Process affecting Quantity count of product

  • Posts: 86
  • Thank you received: 3
9 years 4 months ago #183144

-- HikaShop version -- : 2.3.4

Hi. I have an example:

I would like to have the quantity affected on product (in a specific category) based on a specific order status (triggered manually)

Is there a settings somewhere to do so?
Thanks

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

  • Posts: 2143
  • Thank you received: 747
9 years 4 months ago #183155

Well, first there is a parameter in the configuration where you can set if it's order status "created" or "confirmed" which is decreasing the quantity in stock: HikaShop backend -> System -> Configuration -> Main tab -> Product -> "Update the product stock on confirmed status".

However, it's a question which interests me as well: how can a different order status (= other than "created" or "confirmed") be defined to affect product stock?
I imagine it could mean editing a core file, but that'd be okay for me, too.


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
Last edit: 9 years 4 months ago by lousyfool. Reason: flipped -> System -> Configuration
The following user(s) said Thank You: magickarle

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
9 years 4 months ago #183178

Hi,

@lousyfool : If the option "Update the product stock on confirmed status" of the configuration is activated, the product stock will be decremented when the order status changed from the "created" order status to one of the statuses selected in the option "Invoice order statuses" (which by default contains both the "confirmed" and "shipped" order statuses).

The following user(s) said Thank You: magickarle, lousyfool

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

  • Posts: 2143
  • Thank you received: 747
9 years 4 months ago #183242

@nicolas:
Aaah, that's helpful to know - thanks for the info!
Maybe the option should then be named differently, maybe something like "Update the product stock on invoice order status" or so, as now it reads as if on "Yes" it's only the pre-defined "confirmed" status (or on "No" the "created" status - which requires to read documentation or help to find out).

What if I need yet another status to be the one decreasing the product stock? Sure, for all 'immediate' payment methods or the good old "first come, first serve" it's very okay to select "confirmed". But imagine 'pay later' methods such as bank transfer and "first PAY, first serve" strategy, especially with very limited or even unique products (all these factors being what I'm dealing with): I have an extra 'paid' order status - which is following the invoice order status, and not the same - which I'd like to be the one affecting product stock.

So again, how can I put the 'paid' status in place? Or any other non-"created" and non-"confirmed" status?

Makes me thinking that, in an ideal world, it'd be probably coolest if the option were a single dropdown with all order statuses in the system, hehehe, instead of only Yes/No...
Take that as a feature request, maybe? ;)

Anyway, thanks again.


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

  • Posts: 86
  • Thank you received: 3
9 years 4 months ago #183276

You can create a new status in system- order status.
That<s what I did (deposit paied)

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

  • Posts: 2143
  • Thank you received: 747
9 years 4 months ago #183284

Thanks magickarle, I guess that's why you asked your initial question. And since I also added new order statuses as described I thought I'll join you here.

So, with the question raised, let's give Nicolas & team some time for a response... after all it's not a critical issue. ;)


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
9 years 4 months ago #183303

Hi,

@lousyfool: If you want to have the stock updated for a custom order status that you created, you can add it to the "Invoice order statuses" option of the configuration as I said in my previous message. I don't see the problem with that ?

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

  • Posts: 2143
  • Thank you received: 747
9 years 4 months ago #183333

Thanks Nicolas,

This far it's well understood:
if "Update the product stock on invoice order status" = Yes, then it's whatever "Invoice order statuses" are.

Still leaves one - no, meanwhile two - questions open:

  1. Say I have "Invoice order statuses" set to only "confirmed" (because that's when I want the invoice issued), but I want the product stock updated at a 'later' order status named "paid" (because I want the product stock updated only then, not sooner), what do I do to make that happen?
  2. If I add both "confirmed" and "paid" to "Invoice order statuses" as you're suggesting: do I then have (PDF) invoices issued and/or going out twice, and stock updated twice too? :side:

Admittedly, I haven't tried it out. But you see, it's not clear, neither from option field names, nor from documentation... or, unfortunately, even from your posts here... but it would be nice if it were clear, of course.

So, thanks in advance for making it clear - here, and best also in documentation and backend field/option titles.


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
9 years 4 months ago #183376

Hi,

1. There is no way to do that for now. One of our plans in the future is to have some kind of order statuses workflow where you have actions and order statuses to easily say what happens for which status all in one option. A bit like the checkout workflow system which defines the whole checkout experience with a lot of flexibility. Once we do that, you'll be able to do what you want.

2. No, the stock is only updated once, the first time. And if you set both paid and confirmed as "invoice order statuses", it just means that the invoice is available for both order statuses, but it's the same invoice.

The following user(s) said Thank You: lousyfool

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

  • Posts: 2143
  • Thank you received: 747
9 years 4 months ago #183474

Thanks again, Nicolas,

1. Hmm, not even with a little (core) code modification?
Future plans sound good but will sure take a while. Again, it's not "critical", but with little product stock, any "pay later" method and so many abandoned orders it'd be great to have a short-term solution.
Not to mention that the present option/parameter field names are irritating if not even misleading, as mentioned.

2. Understood and appreciated.


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #183513

Hi,

You can maybe create a plugin based on the function "onAfterOrderUpdate(&$order,&$do)" and when order status come from "created" to "confirmed" so re-increase the product stock.
Then still in this function, if the status come from "confirmed" to "paid" so decrease the product stock here.

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

  • Posts: 2143
  • Thank you received: 747
9 years 4 months ago #183599

Thanks Xavier,

This might be a way to go, but somehow I had hoped for a simpler code hack, i.e. wherever the invoice order status variable set in the backend causes the product stock to change, replacing it there with a "hardcoded" different order status as per user's wish.

Could you give me at least a pointer which file and section of it I'd need to look at? That would already save me quite a bit of time, I guess.

Thanks again!


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
9 years 4 months ago #183614

If you want to do it properly, you can have a plugin implementing onAfterOrderUpdate.
As a core hack, you can edit the function "save" in the file administrator/components/com_hikashop/classes/order.php

The following user(s) said Thank You: lousyfool

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

  • Posts: 2143
  • Thank you received: 747
9 years 4 months ago #183654

Thanks to your pointer I found the relevant section in the function. Will play with it some time soon.

Case closed for me now. Many thanks again!


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

Time to create page: 0.096 seconds
Powered by Kunena Forum