Visibility of a product up to date XY

  • Posts: 62
  • Thank you received: 8
  • Hikaserial Subscription Hikashop Business
1 week 2 days ago #373255

Hello,
I’m currently looking for a setting to hide a product from the shop as of a specific date XY. At the moment, I can only do this manually using the ‘Visible/Hidden’ button. However, I’d like to be able to set a date after which the product automatically disappears from the shop. How can I set this up?

P.S. I don’t mean the option to set the start and end dates for when the product can be purchased and added to the cart; rather, I want to control the general visibility of the product in the frontend.

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

  • Posts: 86112
  • Thank you received: 14210
  • MODERATOR
1 week 2 days ago #373257

Hello,

There is no setting on the product itself which hides it on a date, but a mass action does it, and we tested the two ways below before answering you.

The simplest one uses the "End of sale date" you already have on the product. That date alone only stops the product from being added to the cart, which is what you noticed, but you can also add a mass action which unpublishes those products, and unpublishing removes them from the frontend entirely: listings, product page and search. In the System menu, create a mass action on the "Product" table with:

- a trigger "Every days", so that it runs by itself, which requires the cron of HikaShop to be running on your website ;
- a filter "Product column" on product_sale_end, with the operator ">" and the value 0, so that the products with no end date are left alone ;
- a second filter "Product column" on product_sale_end, with the operator "<=" and the value "now" ;
- an action "Update values" on the column product_published, of the type "int", with the value 0.

Set the end of sale date on the products concerned and they will disappear on that date, at the next pass of the cron. You can also run the mass action by hand with the "Process" button of the mass actions listing to see the result immediately. The only difference with what you asked is the window between the moment the date passes and the next pass of the cron: during it the product is still displayed but cannot be bought anymore.

The second way avoids that window and keeps the sale dates free for their own purpose. Download the HikaShop 6.6.0 installation package from our website again and install it, then add a "Date picker" custom field to your products in System > Custom fields, called for example "hide on". The mass action is then exactly the same, with your field in place of product_sale_end in the two filters. Understanding a value such as "now" on a date picker field is a correction we have just made, which is why the package has to be downloaded again for this one.

The following user(s) said Thank You: P.M.

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

  • Posts: 62
  • Thank you received: 8
  • Hikaserial Subscription Hikashop Business
5 days 21 hours ago #373290

Hello Nicolas,
i made this settings and tested it a while and its lookig great. second method seems to work fine for me. Thank you!

The following user(s) said Thank You: nicolas

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

Time to create page: 0.067 seconds
Powered by Kunena Forum