is it possible to integrate deliverycost by distance? I am still using Quickcart 2.1
So far I have managed with php and ajax to get the distance in kilometer after the customer puts in the zipcode. The kilometer appears in a <div>.
Now i am stuck. I dont know how I can get the kilomters * Courier cost from delivery page to orders print and email. I am also using TaxAndDiscount because we have different tax for delivery and products.
Hello, it is possible to integrate it. But you would probably have to integrate it in js and also in php - almost separately (because you can't rely on JS for it being hackable).
Now, the function you're looking for is ordersCouriers() in file js/orders.js. Modify it to get the content of your div and actually check if it has any.. This might not be very simple. Perhaps your plugin taxAndDiscount also includes this function but in a modified form. In such a case, edit that one.
Next you need to edit php code to get the distance and include the distance price calculation in throwCourierPayment() perhaps. But I am not even sure if you have this function in your QC 2.1 code.
Hi beholder, thanks for answering. Well the distance and the new calculated deliveryCost shows up on the delivery page where it is supposed to be as deliveryCost. So far I have accomplised it.
My problem is that this calculated deliveryCost doesn't get carried over to the order print nor the Email. It only shows the static courierCost which I set up in admin.
Do you have an idea how I can accomplish this or where I need to look? I appreciate your help. Thanks.
Yes, that's why you still need to carry out the calculation of distance to the PHP. Look, basically, a customer chooses distance in a form. You take the distance from $_POST in php and then you calculate a new delivery cost, which is of course different than the original delivery cost of the carrier. Then you save this delivery somehow (or save whole order for that matter). I don't remember the QC 2.1 code very well to write you specifically where to edit. But if you understand PHP then it should not be a problem for you.
If it is a problem, I am able to help you out commercially. Lately I've been editing QC 2.x to several customers satisfaction. Do let me know on my email in such a case.