Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help With Product_Listing.php Code


Teamjr

Recommended Posts

Posted

Hello,

 

I replaced the PRODUCT_LIST_NAME code with the below following, and it works works fine. I just need to add a prefix word, and I just can not seem to get it to work.

 

What is current displays in product_listing is category and then description,

 

Chevy Engine Parts

Complete gasket set for 350 block

 

What I would like it to say is the following

 

Category: Chevy Engine Parts

Complete gasket set for 350 block

 

I can not get the (name category) to show.

 

Current code below,

 

$lc_align = '';

if(isset($HTTP_GET_VARS['language']))

{

$env_language = $HTTP_GET_VARS['language'];

$language_query = tep_db_query("select languages_id from ". TABLE_LANGUAGES . " where code ='" . $env_language . "'");

$language_arr = tep_db_fetch_array($language_query);

$language_id = $language_arr['languages_id'];

}

else

{

$language_id = (int)$languages_id;

}

$products_to_catagories_query = tep_db_query("SELECT categories_name FROM ". TABLE_PRODUCTS_TO_CATEGORIES ." p2c, ". TABLE_CATEGORIES_DESCRIPTION ." cd WHERE p2c.products_id = " . (int)$listing['products_id'] . " and p2c.categories_id = cd.categories_id and language_id ='".(int)$language_id."'");

$category_list = " ";

do

{

if($category_list != " ")

$category_list .=" , ";

else

$products_to_categories_array = tep_db_fetch_array($products_to_catagories_query);

$category_list .= $products_to_categories_array['categories_name'];

}

while($products_to_categories_array = tep_db_fetch_array($products_to_catagories_query));

$category_list .="<br>";

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$lc_text = $category_list . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';

} else {

$lc_text = $category_list . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';

}

break;

 

Thanks JR

Posted

My guess is

 

$category_list .= 'Category: '.$products_to_categories_array['categories_name'];

 

what was yours

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Posted

Hello,

 

Thank you. I did forget the . before the $products. Not getting this far yet, I did not realize I would run into one other issue. I added the line that you suggested and it works, but I have same product in more than one category, so now I get,

 

Category: Chevy Engine Parts, Category: Misc Engine Parts

Complete gasket set for 350 block

 

Is it possible to get,

 

Category: Chevy Engine Parts, Misc Engine Parts

Complete gasket set for 350 block

 

Thanks JR

Posted

I guess you are back to

 

$category_list .= $products_to_categories_array['categories_name'];

 

and move the adding of the word Category out of the while/do loop

 

$category_list .= 'Category: ';

 

I'll leave you to play around till you get it right.

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Archived

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

×
×
  • Create New...