Display NEW Badge For Number of Days

  • Posts: 962
  • Thank you received: 11
  • Hikashop Business
10 years 6 months ago #128596

Is it possible to add badges to each individual product instead of adding the product to a category with the assigned badge?

For example, the client wants the badge "NEW" to be displayed for 7 days when a new product is added. The issue is the "End Date" is ONLY available for categories but not for individual products. This doesn't really work because products are added at different times so the we don't want them all ending the same time...

So basically, how can I have the "NEW" badge display for 7 days for a product.

Thank you!!

Please Log in or Create an account to join the conversation.

  • Posts: 26014
  • Thank you received: 4004
  • MODERATOR
10 years 6 months ago #128642

Hi,

It is a good idea but I will see it differently.
If you will have to create a new badge each time you have a new product, it will be very difficult to manage.

I think that the "new" badge should be attached to a category without any date limitation.
But using a mass action, you can put products into a category (and remove them from a category).

So you can have a mass action which will put your new products to the special (hidden / unpublished) category if their create date is less than 7 days.
And you can have a mass action which will remove your "old" products from this special (hidden / unpublished) category if their create date is more than 7 days.

The mass action can be processed automatically every day using a cron task. So you won't have to do anything in your store except creating products.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 962
  • Thank you received: 11
  • Hikashop Business
10 years 6 months ago #128670

It is a good idea but I will see it differently.
If you will have to create a new badge each time you have a new product, it will be very difficult to manage.

Good point. I guess I was thinking of it similar to the "manage variants" that you create ONLY once. You would then add the "NEW" button to the NEW items and set the date for it to expire. But you know better how it would work ...

I think that the "new" badge should be attached to a category without any date limitation.
But using a mass action, you can put products into a category (and remove them from a category).

So you can have a mass action which will put your new products to the special (hidden / unpublished) category if their create date is less than 7 days.
And you can have a mass action which will remove your "old" products from this special (hidden / unpublished) category if their create date is more than 7 days.

The mass action can be processed automatically every day using a cron task. So you won't have to do anything in your store except creating products.


Ummm interesting... I will see if I can figure this out . Is there any documentation on this?

Thanks!!

Please Log in or Create an account to join the conversation.

  • Posts: 81566
  • Thank you received: 13075
  • MODERATOR
10 years 6 months ago #128710

You can find the massaction documentation here:
www.hikashop.com/support/documentation/167-massaction-form.html

Please Log in or Create an account to join the conversation.

  • Posts: 962
  • Thank you received: 11
  • Hikashop Business
10 years 5 months ago #130665

Hi there,

I'm trying to display items that are "NEW" for say 7 days but I'm not sure what options to select.

I'm not sure if it's category or product that I should choose as the "Data" to start. I am playing with both but none seem like its the correct one.

Can I get some direction please and thank you. Please see attached pic.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 5 months ago #130876

Hi,

It's actually not possible to set a filter based on the current date.
Thanks to add this additional code:

if(in_array($filter['type'],array('product_published','product_created','product_sale_start','product_sale_end','product_modified','product_last_seen_date')) && preg_match('/time-/',$filter['value'])){
					$filter['value'] = time()-(int)str_replace('time-','',$filter['value']);
				}
Before:
$query->where[] = $this->massaction->getRequest($filter,'hk_product');
In the function onProcessProductMassFilterproductColumn of the file plugins/hikashop/massaction_product/massaction_product.php.

Be careful, this code will be override at the next release. But we will improve that until the next release ;)

Last edit: 10 years 5 months ago by Xavier.

Please Log in or Create an account to join the conversation.

Time to create page: 0.075 seconds
Powered by Kunena Forum