Clone of the core Ubercart "Flatrate" shipping quote module, modified to calculate shipping cost as a base rate plus percentage of the order total.
Bug in this module should hook_cart_item() update $item->price
There's a minor bug I've found in this module.
Should hook_cart_item($op, &$item) update $item->price, this module *does not* apply percentages to that price.
To resolve this I am calling $items = uc_cart_get_contents() in uc_percentrate_quote($products,$defaults,$method) and matching my $items up with $products over an ID I have. This ubercart project is rather custom, so this will not be an issue for most people, but I believe the percent should be applied to the adjusted price.
My install is too customized to provide a patch for this, but I wanted to make you aware of the issue.
Re: Bug in this module should hook_cart_item() update $item->pri
Hmm, I think the problem is outside this module. This module, like Flatrate (which it is cloned from), just uses the $products array passed to it by uc_quote, so you're saying in fact uc_quote is wrong, because this array contains the database values for price rather than the cart values?
Re: Re: Bug in this module should hook_cart_item() update $item-
uc_quote gets product information from the cart or the order and then from the database. uc_cart_get_contents() calls hook_cart_item(), so the price field should be as up to date as possible. I don't see anything in quote or cart that would do otherwise.
Re: Re: Re: Bug in this module should hook_cart_item() update $i
I certainly want this module to do things the "right" way, it's just a question of what is right.
Yes, you should expect the uc_percentrate module to quote a shipping cost based on a percent of the cart total. But you should also expect the $products object to hold the correct price.
I think uc_percentrate has to rely on the data passed to it by uc_quote. Otherwise, every single shipping quote module is potentially doing the wrong thing when your module is enabled. From what Lyle is saying, and from my cursory glance at uc_quote.module, it appears uc_quote is calling uc_cart_get_contents() in order to fill the $products array, so hook_cart_item() should be called for each product.
It's not clear to me where the problem lies. Perhaps the hooks aren't being called in the order or when you expect them, or perhaps your module doesn't work the way you think - I just don't know. uc_percentrate is just too simple, I don't see how it could be doing the wrong thing by using the $product->price passed from uc_quote.