Jump to content
Sign in to follow this  
Illicious

[Contribution] Description in Product Listing MS2 v.2.3

Recommended Posts

Hi All

 

WARNING: This site os not for the faint hearted, for others who can help, read on....

 

My truncated description is not appearing in

 

http://www.musthavetoys.com/index.php?cPath=2

 

I was having problems with formatting, so i took out

 

// Products Description Hack begins

if (PRODUCT_LIST_DESCRIPTION > 0) {

$lc_params = 'rowspan="2" ';

}

// Products Description Hack ends

 

 

Don't know if it's related? Any ideas?

 

Cheers

 

Andy

Edited by sputnikinternet

Share this post


Link to post
Share on other sites

I see a few people have had this problem...

 

1064 - You have an error in your SQL syntax near ' pd.products_name, , , , pd.products_description, p.products_id, p.manufacturer' at line 1

 

select p.products_image, , pd.products_name, , , , pd.products_description, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '2' order by pd.products_name limit 0, 20

 

...but i've replaced my general.php and index.php files and it's not worked.

 

I know I shouldn't have the extra commas, but they're put in dynamically by the code.

 

Does anyone know the fix?

Is the bug brought in from one of the other includes?

 

A

Share this post


Link to post
Share on other sites

It seems to be something to do with the

 

if (tep_not_null($select_column_list)) {

$select_column_list .= ', ';

}

 

bits

 

if i change it to

 

if (tep_not_null($select_column_list)) {

$select_column_list .= ', 555';

}

 

i get

 

 

1064 - You have an error in your SQL syntax near ' 555pd.products_name, , 555, 555, 555pd.products_description, p.products_id, p.' at line 1

 

select p.products_image, , 555pd.products_name, , 555, 555, 555pd.products_description, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '2' order by pd.products_name limit 0, 20

Share this post


Link to post
Share on other sites

Hmmm

 

I seem to have fixed the SELECT blah blah problem.

 

For those that suffer the same gremlin, i took this code in index.php, and removed the bit in red cos it seemed to be putting too many commas in.

 

Hopefully this won't bring up problems elsewhere.

 

 

 

 

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

if ( ($column_list[$col] == 'PRODUCT_LIST_BUY_NOW') || ($column_list[$col] == 'PRODUCT_LIST_PRICE') ) {

continue;

}

 

if (tep_not_null($select_column_list)) {

$select_column_list .= ', ';

}

 

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$select_column_list .= 'p.products_model';

break;

case 'PRODUCT_LIST_NAME':

$select_column_list .= 'pd.products_name';

break;

// Products Description Hack begins

case 'PRODUCT_LIST_DESCRIPTION':

$select_column_list .= 'pd.products_description';

break;

// Products Description Hack ends

 

case 'PRODUCT_LIST_MANUFACTURER':

$select_column_list .= 'm.manufacturers_name';

break;

case 'PRODUCT_LIST_QUANTITY':

$select_column_list .= 'p.products_quantity';

break;

case 'PRODUCT_LIST_IMAGE':

$select_column_list .= 'p.products_image';

break;

case 'PRODUCT_LIST_WEIGHT':

$select_column_list .= 'p.products_weight';

break;

}

}

 

if (tep_not_null($select_column_list)) {

$select_column_list .= ', ';

}

Share this post


Link to post
Share on other sites
I'm running into the same problem.

 

I added this code to TD.productListing-data in catalog/stylesheet.css:

 

 ?border-bottom: thin solid #ff00cc;
?border-bottom-width: 1px;

 

and I'm now getting a separator between each product, but it's also adding a separator between the title/price and description. For an example, see:

 

http://www.kididdles.com/catalog/index.php?cPath=1_9

 

I presume it's because both <TD>'s are classed as productListing-data. I've scoured the code tonight trying to find where that's being defined, but have had no luck. Is there some way to define the cells separately? (I'd also like to show my price in a different color that the default text, but would need to find its cell to do that, too.)

 

TIA for any help!

 

Terry

Hi!

 

Looks like you have managed to figure this out. are you able to remember how you did it?

 

Thanks

 

Edwin.

Share this post


Link to post
Share on other sites

Same thing as some other folks

 

Tried some of the idea that where listed here with no luck

 

ANYONE figure this out yet

 

Warning: Division by zero in /home/jstoyand/public_html/catalog/includes/classes/split_page_results.php on line 59

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' p.products_id, p.manufacturers_id, p.products_price, p.produc

 

select p.products_image, pd.products_name, pd.products_description, , p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '41' order by pd.products_name

Share this post


Link to post
Share on other sites

Well i have seem it get rid of the errors, but now i have output problem with where the description shows up.

 

see it here

 

My Webpage

 

getting tired. will work on it another day.

 

any help would be great

Share this post


Link to post
Share on other sites

Simbo,

 

how did you get the dividing line to show up?

 

Also i lost the top bar (ie the one with product name+ in it)... how did you get this working.

 

Thanks for your help!

Share this post


Link to post
Share on other sites

I was just looking int he source code for the index page as shown in html and found an extra

 

<td align="center" class="productListing-heading"> Buy Now </td>

 

If the last col I have shown there is any other then instead of "buy now" it will show a repeated "any other"

 

Where do I go to find the code that brings this html output?

 

 

Thanks

 

JC

Share this post


Link to post
Share on other sites

Finally a solution for the root cause of the SELECT bug and the defective table display on index.php

 

 

DELETE or comment out the following lines from your index.php file:

 

// ############# Added for description to show in catalog

'PRODUCT_LIST_UPC' => PRODUCT_LIST_UPC, /*added 3/17/02 for upc*/

// ####### End Added ##########

 

This extra field ads an emtpy FOR loop which results in the extra "," problem, and it also causes the productListing box to be misaligned.

 

WARNING: If you have the UPC contrib, then don't do this.

 

PS:

Why doesn't anyone on this board actually post how they got their stuff working? Messages like "wow it works now" have really helped me.

Share this post


Link to post
Share on other sites

Thanks for your reply, however I do not have that piece of code for UPC, I deleted it before I posted the question I guess, but the problem persists.

 

JC

Share this post


Link to post
Share on other sites

Quite some time back I installed this Contribution for displaying the product description in the product listing module / page. It has worked perfectly fine for almost a year now, and all of a sudden it is not displaying. The row where it used to be is still there, but it's empty. The products description is still present in the database and all of the configurations are in place correctly.

 

Anyone have an idea of why it would not be loaded into the product listing anymore?

 

 

Thanks,

Aaron

Share this post


Link to post
Share on other sites
Quite some time back I installed this Contribution for displaying the product description in the product listing module / page. It has worked perfectly fine for almost a year now, and all of a sudden it is not displaying. The row where it used to be is still there, but it's empty. The products description is still present in the database and all of the configurations are in place correctly.

 

Anyone have an idea of why it would not be loaded into the product listing anymore?

Thanks,

Aaron

 

 

IM having the same problem if you find a fix please tell me thanks Jordan if you want to aim me at lcshelps

 

THanks

Share this post


Link to post
Share on other sites

I found that what happened in my case was the database table "configuration" had dropped the variable for product descriptions. I added it back in again and all went back to normal.

 

Try checking in to that.

Aaron

Share this post


Link to post
Share on other sites
I found that what happened in my case was the database table "configuration" had dropped the variable for product descriptions. I added it back in again and all went back to normal.

 

Try checking in to that.

Aaron

 

 

Any chance you have aim or msn and i could contact you???

Share this post


Link to post
Share on other sites

Hi,

 

I have installed the Product Listing which works very fine. But I want to add a link "more..." that brings to the product page.

I have changed the general.php file to this:

 

// ################### Products Description Hack begins ##############
//
// grabs a length from a string, but goes back to the last space if it cut into
// the middle of a string.  If the string is longer than that, cut, then add '...'
// to the end of the string, if the $more == 1
function osc_trunc_string($str="",$len=150,$more=1)
{
 if ($str=="") return $str;
 if (is_array($str)) return $str;
 $str = trim($str);
 // if it's les than the size given, then return it
 if (strlen($str) <= $len) return $str;
 // else get that size of text
 $str = substr($str,0,$len);
 // backtrack to the end of a word
 if ($str != "") {
	 // check to see if there are any spaces left
	 if (!substr_count($str," ")) {
   if ($more) $str .= $lien;
$lien= '...  <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_description['products_id']) . '"><b>' . TEXT_PRODUCT_DESCRIPTION_MORE . '</b></a>';

   return $str;    }
	 // backtrack
	 while(strlen($str) && ($str[strlen($str)-1] != " ")) {
   $str = substr($str,0,-1);
	 }
	 $str = substr($str,0,-1);
	 if ($more) $str .= $lien;
$lien= '...  <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_description['products_id']) . '"><b>' . TEXT_PRODUCT_DESCRIPTION_MORE . '</b></a>';
 }
 return $str . ' ' . $lien;
}
// ########### Products Description Hack ends #############

 

The text in every languages shows, the link too, but the ID product doesn't.

How can I have the ID product to show in the URL so that the link may work ?

Any idea ? :'(

Share this post


Link to post
Share on other sites
Hi,

 

I have installed the Product Listing which works very fine. But I want to add a link "more..." that brings to the product page.

I have changed the general.php file to this:

 

// ################### Products Description Hack begins ##############
//
// grabs a length from a string, but goes back to the last space if it cut into
// the middle of a string. ?If the string is longer than that, cut, then add '...'
// to the end of the string, if the $more == 1
function osc_trunc_string($str="",$len=150,$more=1)
{
?if ($str=="") return $str;
?if (is_array($str)) return $str;
?$str = trim($str);
?// if it's les than the size given, then return it
?if (strlen($str) <= $len) return $str;
?// else get that size of text
?$str = substr($str,0,$len);
?// backtrack to the end of a word
?if ($str != "") {
?	// check to see if there are any spaces left
?	if (!substr_count($str," ")) {
? ?if ($more) $str .= $lien;
$lien= '...  <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_description['products_id']) . '"><b>' . TEXT_PRODUCT_DESCRIPTION_MORE . '</b></a>';

? ?return $str; ? ?}
?	// backtrack
?	while(strlen($str) && ($str[strlen($str)-1] != " ")) {
? ?$str = substr($str,0,-1);
?	}
?	$str = substr($str,0,-1);
?	if ($more) $str .= $lien;
$lien= '...  <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_description['products_id']) . '"><b>' . TEXT_PRODUCT_DESCRIPTION_MORE . '</b></a>';
?}
?return $str . ' ' . $lien;
}
// ########### Products Description Hack ends #############

 

The text in every languages shows, the link too, but the ID product doesn't.

How can I have the ID product to show in the URL so that the link may work ?

Any idea ?  :'(

 

I have solved the script and will post it with the contributions here:

http://www.oscommerce.com/community/contributions,1375 ;)

Share this post


Link to post
Share on other sites

I have posted the contribution to add the "read more" link here:

http://www.oscommerce.com/community/contributions,1375

 

If you want to add a read more link to the product_listing.php page, then change

 

// Products Description Hack begins
         case 'PRODUCT_LIST_DESCRIPTION':
           $lc_text = ' ' . osc_trunc_string(strip_tags($listing['products_description'], '<a><b><em><font><i><s><span><strong><sub><sup><u>'), PRODUCT_LIST_DESCRIPTION_LENGTH) . ' ';
           $col_to_span = sizeof($column_list)-1;
           if (PRODUCT_LIST_IMAGE > 0) {
             $col_to_span -= 1;
           }
           $lc_params = 'colspan="' . $col_to_span . '" ';
           break;
         // Products Description Hack ends

 

and replace it with

 

// Products Description Hack begins
//Add a read more link to the products description
         case 'PRODUCT_LIST_DESCRIPTION':
           $lc_text = '<div align=justify>' . osc_trunc_string(strip_tags($listing['products_description'], ''), PRODUCT_LIST_DESCRIPTION_LENGTH) . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '"><b>' . osc_suite_more(strip_tags($listing['products_description'], ''), PRODUCT_LIST_DESCRIPTION_LENGTH) . '</b></a></div>';
           $col_to_span = sizeof($column_list)-1;
           if (PRODUCT_LIST_IMAGE > 0) {
             $col_to_span -= 1;
           }
           $lc_params = 'colspan="' . $col_to_span . '" ';
           break;
// Products Description Hack ends

 

Regards,

 

Amphitryon

Share this post


Link to post
Share on other sites

Hi all !

 

I just tried 2 install this contribution ontop of the Loaded OSc www.phesis.co.uk.

 

So i go all the way through making the changes, everything hunkey dorey. Everything is all saved up I check the listing - as u would expect everything is just as it as before I started, as I havnt run the sql queries yet. However I guess it indicates i havnt made 2 many typos in the hack.

 

Then I run the sql queries and get:

 

1064 - You have an error in your SQL syntax near '.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(' at line 1

 

select p.products_image, pd.products_name, p.products_model, m.manufacturers_name, pd.products_description p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '23' order by p.products_model , pd.products_name limit 0, 10

 

[TEP STOP]

 

Does anyone have any idea what is going wrong here... was it 2 tall an order 2 try and get it 2 work with loaded?

 

Cheers

 

Rich

Share this post


Link to post
Share on other sites

I've added the code from 2.5 and the additional code to add the 'read more...' link. However I don't see the 'read more' text. All I see is '...'

 

What did I miss?

Share this post


Link to post
Share on other sites

Looks like we're missing some data from the instructions... I get errors because I am missing a reference to osc_suite_more

 

I installed the contribution from Amphitryon as well thinking the whole contibution may coorect it... but it doesn't. It just creates the same error on other pages. Anyone know what I need to do to add a osc_suite_more function?

 

Thanks in advance.

 

Let me edit and say that I did have the original 2.4v working fine. I just wanted to add the "read more" link.

Edited by knipper

Steve K AKA - Knipper -

Share this post


Link to post
Share on other sites
Looks like we're missing some data from the instructions... I get errors because I am missing a reference to osc_suite_more

 

I installed the contribution from Amphitryon as well thinking the whole contibution may coorect it... but it doesn't.  It just creates the same error on other pages.  Anyone know what I need to do to add a osc_suite_more function?

 

Thanks in advance.

 

Let me edit and say that I did have the original 2.4v working fine.  I just wanted to add the "read more" link.

 

Okay I got it to work.

1. I already had his contribution installed, version 2.5.

2. Then I added the latest contribution which is supposed to add the read more link. But it doesn't because the missing piece was the code given just above.

Then I added the code from above and Voila!

So you are probably missing step 2.


I have moved on from oscommerce to magento and no longer monitoring this site.

Share this post


Link to post
Share on other sites
I've added the code from 2.5 and the additional code to add the 'read more...' link.  However I don't see the 'read more' text.  All I see is '...'

 

What did I miss?

In your case all you need to do is add the little hack above on product_listings.php

It was missing from the posted code.

Our man is a bit short on instructions. Not a big talker, but the code works.


I have moved on from oscommerce to magento and no longer monitoring this site.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×