Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

remove new products from main store page


lmntscom

Recommended Posts

Posted

is it possible to replace the "new products for december" items with a certain category of products on the main storefront page?

Posted

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

  • 3 weeks later...
Posted

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)

  • 5 weeks later...
Posted

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 :)

Posted

why not posting the php script where you integrated the code I mentioned earlier?

Posted

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!

Posted
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

Posted

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.

  • 2 weeks later...
Posted
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 :)

Posted

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

  • 4 months later...
Posted
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?
Posted

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

Archived

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

×
×
  • Create New...