Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] New Products Box Mod Ver 1,0


Guest

Recommended Posts

If you do not add new products frequently, the "New products in.." box will look silly after a few mounths, showing the same products all the time.

This Mod solves this problem by adding a time for the new items to be displayed in the box.

You can easily change the number of days new products are be shown in the box.

If there are no new products within the chosen number of days, (default 30) the box will not show up at all.

This applies to the box showing under the subcategories aswell.

 

It is very easy to install and to configure. (Contri only contains one file)

Please give me feedback on this Mod as it is my first Mod ever. :)

Send feedback by PM, mail or by replying to this post, please.

 

The Contribution can be found here:

http://www.oscommerce.com/community/contributions,1382

 

Enjoy!

 

/ Henrik (Zipper)

Link to comment
Share on other sites

I have released a 2,0 of this script with some bugfixes and a major addition.

 

The script now lets you choose if you want to show the box or not when there are no new products within the choosen amount of days.

If you choose to show the box, the box will show a text saying No new products this month.

This can ofcourse be changed to what ever language you are using on your site.

Enjoy!

 

http://www.oscommerce.com/community/contributions,1382

 

/ Henrik (Zipper)

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

Hi,

 

this mod is pretty helpful. But, as always with the many possible varieties of modifications, there is a problem.

 

I use the enable_disable_categories contrib. The modification is made in new_products.php as well.

 

With a lot of comparing code I got it working that far that your mod does it's work properly. But, how else should it be, the categories can't be turned off any more.

 

Here is the code that needs to be changed:

 

That is done

 

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' and products_date_added > SUBDATE( now( ) , INTERVAL " . $days . " DAY ) 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 = '" . $new_products_category_id . "' and p.products_status = '1' and products_date_added > SUBDATE( now( ) , INTERVAL " . $days . " DAY )");

$check_products_query = tep_db_query("select count(p.products_id) as count 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 = '" . $new_products_category_id . "' and p.products_status = '1' and products_date_added > SUBDATE( now( ) , INTERVAL " . $days . " DAY ) limit " . MAX_DISPLAY_NEW_PRODUCTS);

}

 

 

and that follows after it

 

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, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where c.categories_status='1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and 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 c.categories_status='1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $new_products_category_id . "' and p.products_status = '1' order by p.products_date_added DESC limit " . MAX_DISPLAY_NEW_PRODUCTS);

}

 

I am stuck!!!

 

Any advise?

 

Thanks a lot in adevance

 

Michael

Not because it is difficult we don't dare to do it, but because we don't dare to do it, it is difficult. (Seneca)

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...