Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

  • 0
RabbitZzZ

Edit order, update shipping

Question

Hi,

I noticed that when you edit an order in the backoffice and add products there, the shipping cost isn't updated according to the new weight.
Is that how it's supposed to be? I would guess no. Is there any way to fix that?

Thanks in advance!

  • Like 1

Share this post


Link to post
Share on other sites

11 answers to this question

Recommended Posts

  • 0

I would also be interested in such option, or workaround how to apply new shipping if it crosses weight range.

Edited by toplakd

Share this post


Link to post
Share on other sites
  • 0

Yeah there is no update for shipping cost, when editing an order. It's a feature that a lot of merchants want...

  • Like 1

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)

Is there any way to accomplish that? In my mind it doesn't seem so hard to trigger the shipping calculation again and update that in the order. Am I right?

Edited by RabbitZzZ
  • Like 1

Share this post


Link to post
Share on other sites
  • 0

Well I just looked at it for about an hour. But this looks more complex to me than expected.

- There are shipping costs saved ps_orders and ps_order_carrier. Why is this needed?
- There is total_shipping and total_shipping_tax_incl in ps_orders. What is the difference?

In orders class there is a method "updateShippingCost($amount)", but this doesn't look finished. The core doesn't seem to use this method at all. A question is also: should the core calculate the shipping cost newly or should there be an input field, which allows flexible input? A lot of tquestions :classic_rolleyes:

  • Thanks 1

Share this post


Link to post
Share on other sites
  • 0

Hmm, seems quite tricky, yes. Looks like the database could be designed less redundant in that matter.

In my opinion it would be good to have both options you mentioned. If there are products added to the order at least the total weight should be updated and the shipping cost should be calculated newly according to the configurated shipping table. The possibility to change the cost manually would be nice anyway. That would add flexibility in offering discounts in customer contact etc.

Is that something that could be added as a goal for an upcoming version?

Share this post


Link to post
Share on other sites
  • 0
15 minutes ago, RabbitZzZ said:

Looks like the database could be designed less redundant in that matter.

Quite the opposite, actually. When we make a sale, we always have to make a snapshot of the base information (product price, name, tax settings, shipping settings, etc...) so we could work with the order/invoice later, even when these changed already. In other word -- when you change the product price or shipping settings, your current orders and invoices can't change.

15 minutes ago, RabbitZzZ said:

In my opinion it would be good to have both options you mentioned. If there are products added to the order at least the total weight should be updated and the shipping cost should be calculated newly according to the configurated shipping table. The possibility to change the cost manually would be nice anyway. That would add flexibility in offering discounts in customer contact etc.

Is that something that could be added as a goal for an upcoming version?

The big problem is that the bulk of the calculation is performed in Cart class, and then cart is just converted to Order. That works good for front-office, but it's a terrible situation for back-office. There are few things we can do:

- duplicate the code from cart to order and adjust it. This is recipe for disaster, as we would end up with two similar implementations tackling the same problem

- create new / temporary cart when modifying the order - this is how it's done now, at least for adding new products to order. While it may sound like a good idea, it's really not. Cart work against current state of the database, but that's not what we want when updating order. We want to use historical data (product price valid at the time when product was originally ordered), we don't want cart to check available quantities for some products, but we would like to check quantities for products newly added to order,... It became real messy very soon. 

The proper solution would be to extract the business logic from cart, and make it reusable by both cart and order. But that's very hard and dangerous refactoring. I don't think this will be tackled anytime soon

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)

Ok, tried the module. Installs alright, but when you try to change the shipping cost the update button does not work (console says: "Failed to load resource: the server responded with a status of 503 (temporarily overloaded)").
Also it's supposed to just allow you to manually edit the cost and does not recalculate it based on new articles/weight.

Edited by RabbitZzZ
other post in between

Share this post


Link to post
Share on other sites
  • 0

Yeah I also came to the conclusion that the shipping costs are calculated in the Cart Class. But actually I am not even sure, which method is for what purpose. There are multiple;

  • getTotalShippingCost
  • getPackageShippingCost
  • getCarrierCost

Deprecated:

  • getOrderShippingCost (it says use static::getPackageShippingCost) but this is not even a static method...

I believe that getPackageShippingCost is the interesting method. There it's also possible to use an array $productList. But I agree with @datakick. This can't be cleaned up so easily. That's a huge project. Probably similair as the rounding process, which is being under review by traumflug right now.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×