Combine orders in PRO
I don't know if anyone would find this useful but someone may. I had a client who supply's performance automotive parts from many manufacturers. To keep life simple I made them use X-Cart and treat every manufacture as a seperate provider. However when it came to the email notifications it produced 1 email for each manufacturer and when a customer ordered 10 products for 10 manufacturers that was a lot of mail!
I struggled with finding a way to combine multiple orders into 1 main order and only send 1 email out for both customer and admin.
I managed to figure it out after many pizzas, gallons of coffee and a few less hairs that I started with!
First of all I placed the code below into /payment/payment_ccend.php
Find the code that starts :
and replace with :
This calls a new function in the /includes/func.php we will create in a moment. you also need to change the line that says:
Now we need to add the function to the bottom of the func.php located in the /includes folder.
Just add this code to the bottom of the page before the last "?>".
I am sure someone can imporve the code, I just thought I would throw it out there.
Basically this takes each of the order id's and creates a primary order id based on the first id in the list. It then assigns all the ordered parts to this primary order ID and takes the totals from the cart and assigns it directly to the primary order ID. the final step is to remove all extra orders.
This has worked fine in version 3.4x and as the cart finishes processing it only sees 1 order and sends out 1 email to the admin and to the customer.
Please let me know if anyone uses this code and finds it useful. 8)
I don't have a use for this but nice work and very, very ingenious.
This is really cool! Thanks for contributing.
Thanks ADP, I have a few other side projects that I will release over the next few weeks. Including a CMS manager with built in HTML editor.
For everyone else there is a small bug in the code. In /payment/paymentccend.php change the section that says
I found out that the shipping costs do not get calculated properly on some versions of xcart when they only have an order for a single provider. This forces all orders to go through the merge processor and figures out all the costs accordingly. Please post any other bugs here if there are any and I will be happy to figure it out for you.
I have just release another mod I was working on, a CMS manager for 3.4x.
Check it out.
|All times are GMT -8. The time now is 08:07 AM.|
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.