Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
Found that in file 'uc_quote.pages.inc' on line 152 value passed via Shipping method as $quote['format'] is being overridden by reformatting $quote['rate'].
foreach ($data as &$quote) {
if (isset($quote['rate'])) {
$context['subject']['line_item'] = array(
'type' => 'shipping',
'name' => $quote['option_label'],
'amount' => $quote['rate'],
'weight' => 1,
);
$quote['format'] = uc_price($quote['rate'], $context);
}
}
If it is to avoid missing 'format' element, then it should first check if it is actually missing only then assign the value.
Please explain the reason if this bug is found invalid. As this interferes with formatting of Shipping quote.
Thanks & Regards,
Tajinder Singh
Comment | File | Size | Author |
---|---|---|---|
#15 | 1393686-uc_quote-no-reformat.patch | 606 bytes | longwave |
#10 | uc_quote.format.1.patch | 293 bytes | TajinderSingh |
#8 | uc_quote.format.1.patch | 275 bytes | TajinderSingh |
#5 | uc_quote.format.1.patch | 403 bytes | TajinderSingh |
Comments
Comment #1
longwaveWhy do you need to override 'format' but not 'rate'? uc_price() must be called here so price altering modules can change the shipping price if necessary.
There is no bug here, but your change could perhaps be a feature request.
Comment #2
TajinderSingh CreditAttribution: TajinderSingh commentedActually was working on a Ubercart Multi-currency setup.
To show shipping rates in different currency, only alternative is the 'format' value which is not being stored in database. Otherwise if we will modify 'rate' to show shipping charges in other currency, it will get stored in database resulting in different charges paid from what were actually required.
For example:
Comment #3
TajinderSingh CreditAttribution: TajinderSingh commentedComment #4
longwaveHave you made this change in your own copy of Ubercart? If so please post a patch.
Comment #5
TajinderSingh CreditAttribution: TajinderSingh commentedHaven't created a patch ever, but here is a try with Meld.
Comment #6
TajinderSingh CreditAttribution: TajinderSingh commentedComment #8
TajinderSingh CreditAttribution: TajinderSingh commentedComment #10
TajinderSingh CreditAttribution: TajinderSingh commentedComment #11
TajinderSingh CreditAttribution: TajinderSingh commentedPlease check as test cleared.
Comment #12
longwaveYou cannot set your own patch to RTBC.
Comment #13
TR CreditAttribution: TR commentedFeature requests should be made against HEAD.
Comment #14
TR CreditAttribution: TR commented#10: uc_quote.format.1.patch queued for re-testing.
Comment #15
longwaveI think it is safer to allow modules to return $quote['format'], but set it if they don't.
Comment #16
TR CreditAttribution: TR commentedOK with me.
There was a distinction between 'rate' and 'format' in D5 because 'rate' contained the raw float value while 'format' contained a string with currency sign, thousands separators, etc., but when uc_price() was introduced in D6 all this was changed and we ended up storing the same thing in 'format' as we do in 'rate'. I don't see the need to have both passed around anymore, and indeed 'format' is gone in D7.
Comment #17
longwaveCommitted #15.
Comment #19
chriscohen CreditAttribution: chriscohen commentedWith this commit, it's actually broken the display of shipping rates in the uc_vat module.
The OP's feature request was NOT to recalculate the 'format' value if it's already been calculated.
It looks like, when displaying the shipping rates where uc_vat is enabled on shipping rates, it actually relies on recalculating the 'format' value.
I suppose you could say that this is a bug in uc_vat, and that it shouldn't be displaying VAT on shipping rates via this method. Or, you could argue that this is a valid way to do that, and the above patch has broken it.
It hasn't already been filed as an issue in the uc_vat project, which is odd, but I figured that since a limited number of sites use the module, and some of those sites might be older versions of ubercart, and not everyone will want to calculate and display VAT on shipping rates, that it might just have gone unnoticed.
I am not sure what the solution might be here, so I'm unable to propose anything I'm afraid.
Comment #20
longwaveuc_vat doesn't alter shipping rates directly though, as far as I can see? There is apparently no code in uc_vat.module to do this, although it may apply a "tax adjustment" depending on your settings. Can you give an example of what's now broken including some actual figures, along with details of your configuration, especially the "VAT on shipping" setting?
Comment #21
longwaveNo further info provided.
Comment #22
TajinderSingh CreditAttribution: TajinderSingh commentedThanks :)