Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

All products - some help needed


fresco

Recommended Posts

Hi I am using all_products contribution that turns one of the cats into all products listing, and it works just fine,

 

the only snag is that I have linked a few products into additional categories (I have fresco plastering tools cat and a also have a cat that "Kits and Sets" so set of plastering tools applies to both)

 

so All_Products lists all them twice,

 

how can I add condition to exclude sertain categories from being listed in this statement (from all_products contribution)

 

       if ($cPath == 64) // all products cpath = 64 no categories apply
        {$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, 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 . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "'";
        }
       else // select on categories

Link to comment
Share on other sites

add the following for instance before "and pd.language_id"

 

and p2c.categories_id not in (1,2,3)

 

This will not list products instances in categories 1,2 and 3

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

you're welcome

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

  • 2 months later...

Going on from this, how can I change the code to ensure it doesn't list items with a zero stock. It's kind of silly switching off the item so it doesn't display in your store, only to find if you display using All Products there it is...click on it, and No Such Product!

 

Any help would be appreciated...

 

$listing_sql = "select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id $where order by pd.products_name";
include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);

Link to comment
Share on other sites

your $where clause should at a minimum contain to show nly products that are active and for which there is stock

 

where p.products_status = '1' and p.products_quantity > 0

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

  • 5 months later...
Hi I am using all_products contribution that turns one of the cats into all products listing, and it works just fine,

 

the only snag is that I have linked a few products into additional categories (I have fresco plastering tools cat and a also have a cat that "Kits and Sets" so set of plastering tools applies to both)

 

so All_Products lists all them twice,

 

how can I add condition to exclude sertain categories from being listed in this statement (from all_products contribution)

 

 ? ? ? if ($cPath == 64) // all products cpath = 64 no categories apply
? ? ? ? {$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, 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 . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "'";
? ? ? ? }
? ? ? ?else // select on categories

 

Trying to do the same.. just list the product - no categories. How'd you do it?

 

Did you upload it as a contribution, as this would work great for stores that don't have a lot of product.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...