Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Showing product info on specials.php


betty

Recommended Posts

Hello!

 

Just a quick question (I hope!)...

 

I've done the contribution which allows me to include a short description of each product on my product listing page. I'd also like this short description to appear on my specials page, but am just not quite sure how to add it...

 

I've put

 

$listing['products_info']

 

where I want it to appear on the page, but think I also need mention it at the start of the page too, perhaps in this line????

 

$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

 

Would be very grateful if anyone could let me know if I'm working on the right lines. And if so, how i might include it?

 

Betty

Link to comment
Share on other sites

Yes, add 'products_info' to the query you posted - you can call the description using $specials['products_info'] in this line:

 

      echo '            <td align="center" width="33%" class="smallText"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $specials['products_image'], $specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . $specials['products_name'] . '</a><br>' . $specials['products_info'] . '<br><s>' . $currencies->display_price($specials['products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($specials['specials_new_products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</span></td>' . "\n";

 

Matti

Link to comment
Share on other sites

Thanks very much Matti - that's worked a treat! I'd actually quite like to do the same thing with my featured products module, but it looks slightly different to specials.php, and I can't get it to work by using the same code.

 

At the moment I have this at the top of the code:

 

    $featured_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by p.products_date_added desc limit " . 6);
 } else {
   $info_box_contents[] = array('align' => '', 'text' => '');
   $featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' and f.status = '1' p.products_date_added desc limit " . 6);
 }

 

 

But putting products_info in that lot (along with $featured_products['products_info'] where I'd like it to appear on the page), doesn't work. Do you know what I'd need to change at all???

Link to comment
Share on other sites

There are two queries in the above code - p.products_info must go in both (eg. after p.products_image) - then it should display using $featured_products['products_info'] (if that is how the other variables are formatted)

 

Matti

Link to comment
Share on other sites

Hi again Matti. Thanks for replying! I'd actually tried that and I get this error message:

 

1054 - Unknown column 'p.products_info' in 'field list'

 

select p.products_id, p.products_image, p.products_info, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from products p left join specials s on p.products_id = s.products_id left join featured f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by p.products_date_added desc limit 6

 

[TEP STOP]

 

Any ideas where I might be going wrong??

 

betty

Link to comment
Share on other sites

Hi again!

 

I tried that and I've now got a different error:

 

1109 - Unknown table 'pd' in field list

 

select p.products_id, p.products_image, pd.products_info, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from products p left join specials s on p.products_id = s.products_id left join featured f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by p.products_date_added desc limit 6

 

[TEP STOP]

 

Do I need to mention the Product Descriptions table anywhere maybe??? Here's the code I've got at the moment:

 

$featured_products_query = tep_db_query("select p.products_id, p.products_image, pd.products_info, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by p.products_date_added desc limit " . 6);
 } else {
   $info_box_contents[] = array('align' => '', 'text' => '');
   $featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_info, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' and f.status = '1' p.products_date_added desc limit " . 6);
 }

 

Sorry for all the questions - I hope there's an easy answer that someone knows!!

 

Betty

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...