Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

want to display special icon


dirthawker

Recommended Posts

I've added a field to product_description, called xitem, that will contain either 0 or 1. If that field has a 1, I want an icon to display in the product listing. Ideally, I'd also like to put it in the new product listing as well, but that's less important for now. (and there's more to be done with that field later, but that's for another post.)

 

I wasn't able to figure out how to create a new column for it in the product listing, so I decided to try to plug it next to the product name.

 

Now I am still new to PHP and osC, so I could easily be barking up the wrong tree.

 

I've added that field to the 4 $listing_sql selects in index.php starting (around line 188) before FROM

, pd.products_xitem as products_xitem

 

I'm assuming this SELECT is what gets sent to product_listing.php to do the display.

 

Then in product_listing.php (around line 95) I changed the case to read:

         case 'PRODUCT_LIST_NAME':
           $lc_align = '';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
               if (products_xitem == 0) {
                   $lc_text = '<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 = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ' . tep_image(DIR_WS_IMAGES . XITEM_DISCOUNT_ICON , XITEM_DISCOUNT_TEXT, 16, 16);
               }
           } else {
               if (products_xitem == 0) {
                   $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';
                 } else {
                   $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ' . tep_image(DIR_WS_IMAGES . XITEM_DISCOUNT_ICON , XITEM_DISCOUNT_TEXT, 16, 16);
               }
           }

basically slapping the image onto the end of the product name if products_xitem is nonzero.

 

My problem is, it doesn't seem to work. The select is selecting the field. I'm sure I'm missing something obvious or am going about it wrong, so if someone would please straighten me out. Thanks.

Link to comment
Share on other sites

I've added a field to product_description, called xitem, that will contain either 0 or 1.  If that field has a 1, I want an icon to display in the product listing. Ideally, I'd also like to put it in the new product listing as well, but that's less important for now.  (and there's more to be done with that field later, but that's for another post.)

 

 

In case anyone cares, I did manage to get my additional column into the product listing by adding a record to the configuration table.

 

http://www.oscommerce.com/forums/index.php?showtopic=115984&hl=

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...