Unpublish a product after expiry

  • Posts: 209
  • Thank you received: 18
11 years 10 months ago #84464

Hi, is there a way to automatically unpublish a product when it has reached its expiry date/time? Instead of having to go into admin and unpublish it manually?

The field "Product available until" only seems to remove the add to cart button from the product page. I want it to stop showing the product altogether.

Thanks.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 10 months ago #84526

Hi,

What you can do is create a cron task plugin which check the expired products and change their status to unpublished.
Here is some documentation:
www.hikashop.com/fr/support/documentatio...r-documentation.html

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

  • Posts: 246
  • Thank you received: 5
8 years 7 months ago #236531

Hi,

Is this still the only way to achieve this ?

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
8 years 7 months ago #236536

Hi,

No, you can now do it with a mass action via the menu System>Mass actions so it doesn't require developing anything:
www.hikashop.com/support/documentation/167-massaction-form.html

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

  • Posts: 246
  • Thank you received: 5
8 years 7 months ago #236736

Perfect. It works very well.

As the action runs every day, I have to set the filter relative to the current day. I found that the keyword "today" was working. But I would have prefered to leave the product published for some days with the "no more availaible for sale" alert before unpublishing it. So I would have set a condition such "WHERE SALE_END < TODAY + 5 DAYS " for example. Is this possible ?

Ideally we should be able to enter a partial SQL Sentence in the field such as "WHERE product_sales_end < CURDATE() + INTERVAL 5 DAY"

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
8 years 7 months ago #236793

Hi,

You can fill the field with this data: {time}-432000
Here, time allow to get the current timestamp and 432000 is 5 days in seconds.

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

Time to create page: 0.055 seconds
Powered by Kunena Forum