Have upgraded 2.1, but unable to get the rules working. Worked brilliantly previously in 1.3 with the original Compare product amount condition. Tested the dev version a few weeks back, but saw that was still buggy with the notices appearing, so reverted back and waited, and this new version isn't working for me still.
I’m trying to create a series of rules for flat rate shipping for orders that contain a particular product type (Order contains products of particular product types) and between total order value ranges of those product types (Total amount of selected products comparison) e.g. under £5, between £5.01 - £20.00 and so on etc to set the shipping rate to the total value amount in order of product type.
Rules are still evaluating to false in debug, and getting ‘no shipping rates found for your order’, and also getting the notice when using Total amount of selected products comparison condition
“Warning: trim() expects parameter 1 to be string, array given in commerce_rules_extra_compare_product() (line 80 of … commerce_rules_extra/includes/conditions/commerce_rules_extra_compare_product_quantity.inc).”
(I did full upgrade as per instructions on upgrade.txt too, and rebuilt all my rule components from scratch that use this module). I’ve tested with adding Term Reference etc in the Total amount of selected products comparison condition and no joy there either (If I add term reference I get the following message above still and also more which mentions line 91 of that file.) but presume that as not using Terms for this condition, I wouldn't need to add those anyhow.
Quantity rule is fine btw as tested with that, no errors appearing, but that’s not the one I need to be using as it’s the value amount not quantity of products; and have looked through some of the issues here re the notices on the earlier dev versions too.
Any ideas or suggestions?
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | 2395421-product-amount-calculation-func-params-21.patch | 1.13 KB | Anonymous (not verified) |
| #19 | 2395421-product-amount-calculation-func-params-19.patch | 989 bytes | Anonymous (not verified) |
Comments
Comment #1
blackroom commentedI've also found that I wasn't getting the predicted result with this same condition – 'Total amount of selected products comparison'. I've just come fresh to this module as I was looking to trigger an action when a product of a certain type had a value amount of more than 1. Uninstalling this and installing 1.3 using 'Total product of type amount value comparison' (which I'm guessing is the equivalent?) with the same operator/amount gave me the result I expected.
Comment #2
perignon commentedI'll review the issue as soon as I can!
Comment #3
Anonymous (not verified) commentedI believe I've fixed the issue. It looks like the parameters got mixed up. Things appear to be working as they should be here (I'm able to use the conditions without error now).
Comment #4
Anonymous (not verified) commentedComment #5
perignon commentedHopefully some other people can get this patch tested that is using that rule. I myself don't have the rule being used in a production site.
Comment #6
lswhitehead commentedI'll be able to test this in the coming week, and will let you know. Thanks!
Comment #7
blackroom commentedI'll check this one too over the next couple of days and report back
Comment #8
perignon commentedThanks everyone!
Comment #9
blackroom commentedI've applied the patch successfully and re-created the rule using the new version of the module. I've created a rule with the condition 'Total amount of selected products comparison' that should be true if the cart contains products of type 'product' with a combined value of zero. However, if I checkout a product of that type that's worth 0.00 it's still returning false in the debug. I've attached an export of the rule incase I'm missing something when creating the comparable rule based on the slightly altered options in the newer version. The total quantity options work fine.
Comment #10
perignon commentedThanks for the feedback. I will take a look at it sometime this weekend.
FYI, when you paste code into the comments it is helpful to use the code text format, makes spacing work right for readability.
Comment #11
blackroom commentedSorry about that (updated above)
Comment #12
lswhitehead commentedI've given it a test, not getting the notice now, but still false in debug and 'no shipping rates found for your order'.
Comment #13
perignon commentedSorry for taking so long to look into this. The patch doesn't actually do anything submitted above, but just rearrange the function calls. No logic is changed.
Comment #14
Anonymous (not verified) commentedRight, this only really affects the trim() error that was occurring due to miss-ordered parameters.
I'll boot up a commerce install and try out each of them to make sure they're working as advertised.
Comment #15
perignon commentedI got to look into this more but at the moment I just started a new project and my dev environment is hosed writing new custom fields and content types...
Comment #16
perignon commented@mhazy, that's the thing. I double checked the order and it was right.
Comment #17
perignon commentedJust did a triple check. The order is correct.
Comment #18
Anonymous (not verified) commentedThe order of parameters is not correct in commerce_rules_extra_compare_product_amount() for the "Total amount of selected product comparison" condition.
Product type and vocabulary are switched. The other methods that I changed in the original patch were superfluous. I'll re-create it with the pertinent bits.
Compared to commerce_rules_extra_compare_product_quantity(), where the product type is the second argument.
Comment #19
Anonymous (not verified) commentedUpdated patch
Comment #20
Anonymous (not verified) commentedJumped the gun a bit, it actually looks like the two groups of parameters are switched.
Based on how the parameters are defined in commerce_rules_extra_compare_product_quantity_condition_info() the order of arguments for commerce_rules_extra_compare_product_amount() should be:
Comment #21
Anonymous (not verified) commentedThis patch sorts out the function arguments.
Comment #23
perignon commentedI just added that patch to the dev branch. Still got to check the logic.
Comment #24
lswhitehead commentedJust to say the dev version is working perfectly, thank you all!
Comment #25
blackroom commentedAlso just retested with dev version and working great. Thanks!
Comment #26
perignon commentedThanks for the feedback!
Comment #27
perignon commented