Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Strange problem in product listing!


mark27uk3

Recommended Posts

Hi,

 

Please take a look here and scroll down and you will see that the first two products have a 'detail' and an 'add to basket' button but below that there are 3 products that show no buttons and then after the buttons appear again.

 

Is anyone able to shed some light on what could be causing this as it is really bugging me.

 

Monika in Germany has tried to help but has also drawn a blank.

 

Thanks

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

I dont think so as this is whats in the product description.

 

Stylish Leather Clip Holster provides quick and easy access to your handset.<br><br><b>Compatible with these models:</b><ul><li>BlackBerry 7100g</li><li>BlackBerry 7100r</li><li>BlackBerry 7100t</li><li>BlackBerry 7100v</li><li>BlackBerry 7100x</li></ul>

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

as I understand the problem is in the product_listing.php. In there there are 2 loops setting up the columns. The first one deals with the header (I dont see one in your case so ok) now the 2nd is where the products with the short description is placed. Can you post that part of the code? Should be a for loop.

 

In there are cases for 'PRODUCT_LIST_NAME', 'PRODUCT_LIST_MANUFACTURER' etc

Link to comment
Share on other sites

The file has been changed considerably and I hope this is the right piece of code

 

          case 'PRODUCT_LIST_NAME':
           $lc_align = '';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<b>' . $listing['products_name'] . '</b><br>';
           } else {
             $lc_text = '<b>' . $listing['products_name'] . '</b><br>';
           }
           if (tep_not_null($listing['specials_new_products_price'])) {
             $lc_text .= '<br><font color="#ff0000"><b><s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> </b></font> <br>';
           } else {
             $lc_text .= '<br><font color="#ff0000"><b>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' </b></font> <br>';
           }

            $lc_text .= '<br><table border="0" cellpadding="0" cellspacing="0" width="85%"><tr><td class="productDesc">' . tep_flatten_product_description($listing['products_description'],  '<p><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS) . '</a>  <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a></p>') . '</td></tr></table>';
           break;

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

ok I got the tep_flatten_description from another thread and had a look at it

function tep_flatten_product_description($description, $link)
{
$description = ereg_replace('<[^>]*>', '', $description);
if (strlen($description) > PRODUCT_LIST_DESCRIPTION_MAX_LENGTH){

$sub_des = explode('$@$',$sub_description);
$description = $sub_des[0];
$description .= "...".$link;
}
return $description;

 

So if you see the "$link" arg is appended to the description only if the $description is greater than PRODUCT_LIST_DESCRIPTION_MAX_LENGTH. Which shows what happens to your store. Items with long enough description have the buttons cuz the link is appended :D

 

So to fix that just force the function to always append like this:

function tep_flatten_product_description($description, $link)
{
$description = ereg_replace('<[^>]*>', '', $description);
if (strlen($description) > PRODUCT_LIST_DESCRIPTION_MAX_LENGTH){

$sub_des = explode('$@$',$sub_description);
$description = $sub_des[0];
$description .= "...".$link;
} else {
$description .= $link;
}
return $description;

Link to comment
Share on other sites

Hi,

 

Sorry to sound stoopid, but this goes in the general.php file right?

 

If so then it produces this error

 

Parse error: parse error, unexpected $ in /home/mobiled/public_html/includes/functions/general.php on line 1273

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Sorry maybe the last bracket was missing?

function tep_flatten_product_description($description, $link)
{
$description = ereg_replace('<[^>]*>', '', $description);
if (strlen($description) > PRODUCT_LIST_DESCRIPTION_MAX_LENGTH){

$sub_des = explode('$@$',$sub_description);
$description = $sub_des[0];
$description .= "...".$link;
} else {
$description .= $link;
}
return $description;
}

 

this should be ok

man couldnt get this last bracket in :lol:

Link to comment
Share on other sites

have you replaced the entire function? I re-edited my previous post just before you posted yours. Just make sure there are no extra or missing brackets in this function.

Link to comment
Share on other sites

look at this statement make sure there is the dot before the equal sign on the description part

 

$description .= "..." . $link;

 

and its not like

 

$description = "..." . $link;

Link to comment
Share on other sites

Hi Mark,

 

The Motorola product listing page and probably others as well have the tables knocked out due to too much description text. I really need the short description back again.

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

I thought the tep_flatten_descirption was for the short description. I think I am using the same contribution for my site but not sure if with a later version something changed as this function is not part of the version I have.

Link to comment
Share on other sites

the modfied code posted should do it. Just make sure the PRODUCT_LIST_DESCRIPTION_MAX_LENGTH constant is set to something sensible. 100-200 chars max

Link to comment
Share on other sites

ah yes because you made that last change you said with the

$description .= $sub_des[0];

but I think this is incorrect. Ok try this

function tep_flatten_product_description($description, $link)
{
$description = ereg_replace('<[^>]*>', '', $description);
if (strlen($description) > PRODUCT_LIST_DESCRIPTION_MAX_LENGTH){

$sub_des = explode('$@$',$description);
$description = $sub_des[0];
$description .= "...".$link;
}else{
$description .= $link;
}
return $description;
}

cuz the explode statement was doing it on some sub_description that is not part of the function. I think this should do it.

Link to comment
Share on other sites

Ok so the other thing are the separators of the explode statement. So I replaced them see if it works:

 

function tep_flatten_product_description($description, $link)
{
$description = ereg_replace('<[^>]*>', '', $description);
if (strlen($description) > PRODUCT_LIST_DESCRIPTION_MAX_LENGTH){

$description = substr($description, 0, PRODUCT_LIST_DESCRIPTION_MAX_LENGTH);
$description .= "...".$link;
}else {
$description .= $link;
}
return $description;
}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...