Forums / General Questions / Changing the status of an order by an external link

Changing the status of an order by an external link

Started by alexthibo on 19 Oct 2013, 12:26 AM · Views: 1,419

Results 1 to 7 of 7
19 Oct 2013, 12:26 AM
#1
alexthibo avatar

alexthibo

New Zenner

Join Date:
Jul 2012
Posts:
99
Plugin Contributions:
0

Changing the status of an order by an external link

I would like to give a link to a third party that could change the status of an order to a specific status.

I would like to give this link in an email.

Here's the situation in details:

  • A customer buy a membership on the store. To process his order he must be a member of one of the federated club. In the buying process he have to choose the club he's a member in a dropdown list.
  • When the checkout is done, an email is send to the email address associated with the club that was selected by the customer.

All this is currently working perfectly, thanks to Dr. Byte who guide me in this post: http://www.zen-cart.com/showthread.php?155959-email-order-confirmation-to-third-party&p=1220566#post1220566

So the club will receive an email and I would like to make the receiver to be able to change the order status "Waiting for the club confirmation" to "The club confirmed, your order is being processed." by following a link in the email. In an ideal world this could be done by simply clicking on Yes or No.

Is it possible?

20 Oct 2013, 4:37 AM
#2
alexthibo avatar

alexthibo

New Zenner

Join Date:
Jul 2012
Posts:
99
Plugin Contributions:
0

Re: Changing the status of an order by an external link

No one have have any idea how I could do that?

Maybe by sending a password by email that could give access to a page with "Confirm" and "Refuse" buttons, which could run a database update to change the status respectively to "Order in process" or "Order refused"...?

21 Oct 2013, 7:17 PM
#3
alexthibo avatar

alexthibo

New Zenner

Join Date:
Jul 2012
Posts:
99
Plugin Contributions:
0

Re: Changing the status of an order by an external link

Ok, is it impossible to do or is it just because no one have an idea of how to do it?

21 Oct 2013, 10:16 PM
#4
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Changing the status of an order by an external link

Far as I know, there's nothing that's 'impossible' with open source software, but what you're asking about would be (I think) a fairly complex programming job, and people here who can write something like that are reluctant to do it for free. You might post in the Help Wanted forum if you really need this functionality.

There have been a few posts concerning adding an 'acceptance' link in the Welcome email to complete registration, which would be something like you want, but I don't know if anyone ever achieved it.

Here's one: http://www.zen-cart.com/showthread.php?47727-Registration-amp-Email-Verification

22 Oct 2013, 3:18 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Changing the status of an order by an external link

Yes, it's possible, and stevesh has suggested one good way to look at it: mimic the concept of clicking an email activation link to confirm identity. It's basically the same process.

Your custom coding to make it work would require a number of things:

  • create a database table with order ID number and an authorization hash code (the SHA1 hash of some random value would probably work)
  • in the email you're sending from your existing observer class, provide a URL containing that hash code for them to click (ie: fred.php?authcode=XXXXXXXX)
  • write a script (fred.php) that responds to those clicks --- it'll need to read that authcode, check the hashcode against the hashcodes in your special db table, and if valid, present a link on-screen asking to confirm that they want to update the status. (And leave a message saying that if they want to DOWNgrade the status, they should email the storeowner to make the correction. This prevents them from accidentally downgrading by clicking links that are 6 months old when looking at old emails.)
    (And if the lookup says the hashcode is invalid, say so, and don't provide any buttons. Either the status has already been updated or their link is invalid.)
  • once they click Update, the fred.php script should once again verify the validity of the click, update the order status (see the existing code for updates in the admin/orders.php script), and finally remove the hashcode record from your special db table so it can't be used again. If you really want to email the customer an update at this point, you could do that too. That code is in the same section of admin/orders.php.
  • I suggest you set a metatag in fred.php for robots to get noindex,nofollow instructions so google doesn't index the page needlessly.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

22 Oct 2013, 3:41 AM
#6
alexthibo avatar

alexthibo

New Zenner

Join Date:
Jul 2012
Posts:
99
Plugin Contributions:
0

Re: Changing the status of an order by an external link

That's great! Realy great! But I'll surely not be able to do that in a minute. I know I can do what I want and learn anything, So i'll try to do that for sure. It just seems to be a lot more learning that what I first tought. So I'll concentrate on what is more urgent for now and will just ask to representent to reply to the email they will receive by saying if they confirm or not the identification. I'll keep this as an update that I promise myself to learn and to do.

Thanks for your amazing help guys! I put this in stand by for now.

20 Oct 2015, 3:54 PM
#7
shopville avatar

shopville

Zen Follower

Join Date:
Aug 2012
Posts:
331
Plugin Contributions:
0

Re: Changing the status of an order by an external link

Were you able to implement this?

Your response is much appreciated!
Thanks!