lmntscom Posted December 10, 2005 Posted December 10, 2005 is it possible to replace the "new products for december" items with a certain category of products on the main storefront page?
benpower Posted December 12, 2005 Posted December 12, 2005 Does anyone know the soloution to this as we require the same info? Thanks
Guest Posted December 15, 2005 Posted December 15, 2005 this topic is being moved to general support.
Guest Posted December 15, 2005 Posted December 15, 2005 make a duplicate of catalog\includes\modules\new_products.php to a new filename say specific_products.php Then modify this code if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as 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 where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } to this $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on (p2c.products_id=p.products_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' and p2c.categories_id=3 order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); You need to modify the p2c.categories_id=3 with a valid number indicating the category id you want to display with the box. You may also want to modify the strings for the box header. Create a definition for the specific_products.php in the filenames.php and then include the module file in the place of the new_products.php in the catalog\index.php
benpower Posted December 16, 2005 Posted December 16, 2005 nice 1, i'll give that a try, thanks for your help 8o)
benpower Posted January 6, 2006 Posted January 6, 2006 Thanks emigma 1. But still no joy! Kept getting an error, is there an other way? Thanks
skwish Posted January 12, 2006 Posted January 12, 2006 i tried this but theres a couple of bits im not quite sure of: "modify the p2c.categories_id=3 with a valid number indicating the category id you want to display " <------ not sure what the p2c.categories are, and how i go about finding the number of one of my catgories that i want to replace it with, anyone? basicly, im pretty new to php so if anyone can break ENIGMAS post down in to 'simple terms for simple folk' would be appriciated, thanks 8o)
skwish Posted January 19, 2006 Posted January 19, 2006 has anyone else made this change to their sites?
skwish Posted February 24, 2006 Posted February 24, 2006 still not figured this out yet :( im getting this error Parse error: parse error, unexpected '}' in /home/power/public_html/shop/catalog/includes/modules/specific_products.php on line 26 Im doing summit wrong here but ive no idea what, can any one shed any light please? really want to make this change to my site if anyones got the patiance to talk a n00bert throught it :)
Guest Posted February 24, 2006 Posted February 24, 2006 why not posting the php script where you integrated the code I mentioned earlier?
petercascio Posted February 26, 2006 Posted February 26, 2006 Hey, this works great for me! As I'm working on a store with a tiny number of products and there's no prospect of adding categories in the future I simply modded the new_products.php which may be a simpler path for newbies anyway. I also removed order by p.products_date_added desc from the new code because I didn't want the products in date order. Thanks guys!
skwish Posted February 28, 2006 Posted February 28, 2006 why not posting the php script where you integrated the code I mentioned earlier? I think its the part where u have to alter the 'p2c.categories_id=3' , for this part im not sure how to find out what categorie id to replace it with, or where i would find out what the id's are for other categories i have on my site that i would like to use in place of 'new this month' ..... i hope u understand what i mean here, im not the best at explaining stuff 8o/ cheers
Guest Posted February 28, 2006 Posted February 28, 2006 when you go to your osc admin and you click a products category, it displays the id on the address bar of your browser (cID= to a number). That's the number you could replace and see.
skwish Posted March 11, 2006 Posted March 11, 2006 when you go to your osc admin and you click a products category, it displays the id on the address bar of your browser (cID= to a number). That's the number you could replace and see. ahhh k...cheers i'll give that a try :)
SEDef Posted March 14, 2006 Posted March 14, 2006 That works fine. And how can i show on the first page products out of more categories? And can be this selected out of admin, which products or categories show on first page? Thanks
avail1now Posted August 3, 2006 Posted August 3, 2006 make a duplicate of catalog\includes\modules\new_products.php to a new filename say specific_products.php Then modify this code if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as 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 where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } to this $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on (p2c.products_id=p.products_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' and p2c.categories_id=3 order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); You need to modify the p2c.categories_id=3 with a valid number indicating the category id you want to display with the box. You may also want to modify the strings for the box header. Create a definition for the specific_products.php in the filenames.php and then include the module file in the place of the new_products.php in the catalog\index.php Thanks Mark, Just what I was looking for looking for. I simply commented out the code in new_products.php and added the revised code and it worked. Only thing though, I wanted to pull products from a main category which has 6 subcategories. If I specify the main category number, the new products box is empty, when I specify a subcategory, the new products box shows those products. How can I make it work with the main category? cheers, Bridgette & Deano my contributions: tableless CSS template login form for STSresources: effective searching knowledge base how to: sandbox with Paypal IPN
avail1now Posted August 3, 2006 Posted August 3, 2006 also one little trick, thanks to MrMcauber, you can randomize products in new products so you get different products on every refresh using native php function RAND() change: order by p.products_date_added desc limit to order by RAND() limit cheers, Bridgette & Deano my contributions: tableless CSS template login form for STSresources: effective searching knowledge base how to: sandbox with Paypal IPN
Recommended Posts
Archived
This topic is now archived and is closed to further replies.