Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help with Filter Specials By Category BS v1.0


Guest

Recommended Posts

2.3.4.1 CE and PHP 7.0

I've been using the contribution for some time with no problem.  However, I have been experimenting with linking products to more than one category and that's where I'm running into trouble with specials.php now.

Any sale priced items that are linked to multiple categories are appearing multiple times when viewing the specials page.

The culprit is the replacement of the listing sql in specials.php - looks like this:

// BOF: Filter Specials by Category BSv1.0
  $listing_sql = "select " . $select_column_list . " p.products_id, SUBSTRING_INDEX(pd.products_description, ' ', 20) as products_description, p.manufacturers_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, 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 " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c where p2c.categories_id = c.categories_id and p.products_status = '1' and p.products_quantity > 0 and p.products_id = p2c.products_id 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'";
  
  if ($categories_id > 0) $listing_sql .= " and p2c.categories_id in (" . tep_get_categories_ids($categories_id) . $categories_id . ")";
// EOF: Filter Specials by Category BSv1.0

Any way to modify this code and stop it from displaying the same item more than once?  Currently, my specials page looks like this:

dupes.JPG.8bd184b848b7739d9f6b20deb991ecf5.JPG

The original listing sql in specials.php results in each item appearing only once.  But, then I lose any category filtering the new one offers.

Any help is appreciated!

- Andrea

 

Link to comment
Share on other sites

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...