2

I'm looking for a way to identify which 'Store' an order came from.

A little context, our client, a restaurant, uses Expresso Store to handle their online ordering. They've just opened a new location, and online orders all go to the same email address, making it impossible for them to determine which location the order refers to.

I'm working around this using a cookie that gets set to a value depending on which page they are ordering from. On submission, I'd like to set the order status depending on the cookie value.

Am I right in assuming I'll need to use the 'store_order_complete_end' hook to change order status on submission? Or is there a way to set status before submitting the order?

Thanks in advance.

Bobby

EDIT: I believe the change, if possible, would have to be made within the {exp:store:payment} tag pair. I noticed that it has access to the {exp:store:order} tags, including the order_status parameter. In the latter, it's used as a filter, but when used in the {exp:store:payment} tag pair, could it be used to set the order status?

FINAL EDIT: Hey guys, just wanted to let you know I've found a workaround for this problem using Michael's advice below. I'm using a custom variable. Basically, there is a page for each location that has an address checker (to see if you're within the delivery zone). On success, both are directed to the same order page, and the custom variable is set. This value is appended to the subject line for the Order / Payment Confirmation emails.

There is a master email address that is BCC'd on all emails. We then use filtering to forward to individual store email addresses depending on the subject line.

All in all, it's not the most elegant solution, but it does work. Thanks again for the help.

2

You could write an extension using the *store_order_submit_end* hook, which runs each time an order is submitted (i.e. runs whether the order "completes" or not).

However, it might be more semantically useful to reserve the "Status" to states like "In Progress", "Submitted to the Kitchen", "Out for Delivery", etc.

Have you considered using Store's custom variables to mark orders as belonging to one location or another?

Orders in Store can have up to 9 custom variables. You can name them whatever you want, set their values using form fields, use them to filter/sort results in your templates, and review them in the CP as part of the Order Details.

That way, you could use statuses to represent the status of the order, and still have values to add a location dimension for use in your business logic.

Check out the Order Fields page in your Store settings, and feel free to post a follow-up question if I can explain anything better.

  • p.s. You can also map Store's custom variables to a member variable field. For example, you could store a user's location in their member profile and load it up for them on repeat orders. – Michael Rog Feb 21 '13 at 22:49
  • Michael, thanks a lot for the help. Your suggestion certainly makes sense, and I think I could leverage custom fields to manage the orders. There may be one hitch in the works though. Basically, when someone places an order, the email templates (Order / Payment Confirmation) are BCC'd to their email address. So the current setup doesn't allow much flexibility. Each store would like an email independently of the other store, so essentially depending on the variable, I'd need to change the BCC. Unless there is a better way of setting it up, of course. Hope this makes sense! Thanks again. – Bobby Burch Feb 22 '13 at 14:49
  • Hey Michael, I've accepted your answer as I used it as a starting point for my solution. Thanks again for your help! – Bobby Burch Feb 22 '13 at 21:27
  • Yes, you'd probably have to extend store_order_complete_end in order to customize the email notification recipients. – Michael Rog Feb 27 '13 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.