Zero or no stock display set to unlimited

  • Posts: 95
  • Thank you received: 6
  • Hikashop Business
8 years 7 months ago #255023

-- HikaShop version -- : 2.6.4

Since there is no option for back orders in Hikashop would it be possible to set a stock count of zero (0) to unlimited (-1) automatically if the stock reaches zero.

We do handle the orders and back orders outside of Hikashop so it would be useful to us in the way that as long as there is stock we can give a stock indication and as soon as all is sold we have a no stock indication but customers can still order.

It would be nice if there is a notification if the stock goes to -1 but that would be optional.

The wait list feature is no option, since we are not able to take any orders.

Any ideas would be welcome.

Last edit: 8 years 7 months ago by EnerW.

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

  • Posts: 95
  • Thank you received: 6
  • Hikashop Business
8 years 7 months ago #255043

Well that was easier than expected, seems that a mass action will do the job, as soon as an items stock reaches zero it is changed to unlimited (-1).

The only small problem left is that if the total stock is say 5 and you would like to order 6 that is not possible and you get the not enough stock warning, but as soon as the order is finished and the stock is updated in Hikashop the mass action will kick in and change the stock to unlimited.

So not a 100% solution but I can live with it for the moment.

Now to get the out of stock email working, I think that is a matter of timing between the cron task and the mass action timer.

The mass action also has an email function, but I do not see any option to insert the product cid or an option to kick the out of stock notification into action.

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

  • Posts: 83995
  • Thank you received: 13605
  • MODERATOR
8 years 7 months ago #255082

Hi,

You should be able to have the notification email with the email action of your mass action. Enter the text "product_listing" in the body of the email and it should send the list of the products to the email address you specified in the mass action.

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

  • Posts: 95
  • Thank you received: 6
  • Hikashop Business
8 years 7 months ago #255125

Morning Nicolas,

thanks, I will try that as well, I did set up an csv export in the same mass action rule, but for some reason the mass action rule did not trigger anymore.

I still have to test this further, but am I correct that the mass action rule is only triggered after you open the item page from the front end again?

There is one big problem I did run into will testing the stock display.

Front end → an item is sold and the stock count is updated.
Back end → you are in working in the back end and the OLD item stock is displayed.
Back end → you hit refresh from the browser.

The stock count is now updated with the OLD displayed information!

Clearing the cache of Joomla and Firefox prior to hitting refresh does not make any difference.

So it appears that you can update/change the stock count and maybe other information as well from the global product back end view since method="POST" is enabled for all product variables

Attachments:
Last edit: 8 years 7 months ago by EnerW.

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

  • Posts: 83995
  • Thank you received: 13605
  • MODERATOR
8 years 7 months ago #255161

Hi,

I can't say when the mass action is triggered.
It depends on how you set it up.
If you used a trigger like "onAfterProductUpdate", it's ihighly possible that it won't work properly as the triggers are not triggered when the stock is changed automatically by the system, for performance reasons. I would rather recommend to use a periodic trigger like every hour, so that evey hour, the out of stock products are put back on the shop with an unlimited stock.

Regarding your issue with the display, I don't understand what you did. The stock displayed in the backend and in the frontend is the stock coming from the database.
If the stock is updated in the database and you refresh the page, you'll see the new stock. You'll only see the old stock if you save the old stock.

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

  • Posts: 95
  • Thank you received: 6
  • Hikashop Business
8 years 7 months ago #255181

Morning Nicolas,

"If the stock is updated in the database and you refresh the page, you'll see the new stock. You'll only see the old stock if you save the old stock."

That is what it is expected to do, but what I find is that if the stock is changed because an item is sold and you will refresh the front page it will display the new stock, so that is as it should be. But if you are in the back end viewing the same articles as been sold and you hit refresh after the stock is updated the stock is updated again with the stock currently displayed in the back end.

So the item in the picture with cid 647 is sold and the stock will be changed to 0 in the database and the correct stock is displayed in the front end.

But you are working in the back end and hit refresh for that screen, so you do not open the items page, and the stock is updated again with the values displayed at that moment.

If you would leave the screen and open it again without using refresh the new stock is displayed as it should.

Just try it and see for yourself what is happening, if you do not see it changing in the database then there is something wrong on my side, otherwise it is not doing what it is expected to do.

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

  • Posts: 83995
  • Thank you received: 13605
  • MODERATOR
8 years 7 months ago #255195

Hi,

This doesn't happen on our end.
It can only happen if you save the information in the backend.
I suppose that it is what you do when you hit refresh.
If you edit the product product and save the data. If you then hit refresh, the browser will save again the data that you had saved with the previous action.
Instead, if you edit the product in the backend and directly hit refresh, without first saving, then the product data won't be saved and you should not have the "problem".

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

  • Posts: 95
  • Thank you received: 6
  • Hikashop Business
8 years 7 months ago #255307

Afternoon Nicolas,

No you do not understand, I am NOT opening the item I just hit refresh in the screen of the attached picture, there is no option in that screen to adjust the stock only to change the order of the items, that is what made me worry.

I will test it again, just to be certain and let you know.

For the other questions, I did add the text "product_listing", once with and once without the quote sign in the body of the mass action email but that only did result in an email with that text, so no cid or product name.

The option with the csv export is working now, so I get the product code, quantity, name and id and I am happy with it as is. I just was a bit inpatient I guess to begin with, but after 15 minutes or so (cron time) the mass action is triggered. If someone does view the item page before the cron time does expire the mass action is triggered as well, so all in all a working solution.

CSV Content:

product_code product_name product_quantity product_id
PLX89433.02 EncorePro HW510 0 646

Come to think of it, you could drop the "HikaShop Out of stock notification Plugin" with the mass action you have more options if something runs out of stock, or goes below a preset level and you would have more options with for instance the use of a specific category id or the custom item fields for that matter.

Last edit: 8 years 7 months ago by EnerW. Reason: Did hit the wrong button ;-)

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

  • Posts: 95
  • Thank you received: 6
  • Hikashop Business
8 years 7 months ago #255316

Evening Nicolas,

I did find my mistake for the page refresh and the stock update, it is more or less in the browser warning: “To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier.”

1- So I open an item and in this case change the stock from 0 to 1
2- I press save and close and return to the global item view as in the picture
3- The item I was working on is sold so the stock goes to zero
4- Still in the global screen as in the picture I refresh the browser page
5- I get the Firefox warning and select Resend
6- Stock is update to 1 again

This does mean that Firefox is repeating my steps, so opening the item and changing the stock in the background.

If I would leave the screen, as in the picture, and open it again (at point 4) and do a refresh the correct is displayed being zero.

I find this behavior a bit confusing, but I will pay more attention to these browser warnings.

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

  • Posts: 95
  • Thank you received: 6
  • Hikashop Business
8 years 7 months ago #255321

For those who are interested to see what Firefox is doing on a page refresh and submitting form data via a (hidden) POST form.

Open the network monitor with CTRL + SHIFT + Q
Select Network form the top toolbar
Refresh the page
Select HTML from the lower toolbar
Click the 200 POST line in the result display
Select Params from the right side display

Under Request payload you will see all the form data being resend.

Normally I do not use the page refresh in the Hikashop back end, but during testing I did and made the foolish assumption that just ignoring the Firefox nag screen would be okay.

The following user(s) said Thank You: nicolas

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

Time to create page: 0.082 seconds
Powered by Kunena Forum