Order discounts work beautifully with this module, but when I select Total is greater than or equal or Total is greater than the discount doesn't show up.
Order discounts work beautifully with this module, but when I select Total is greater than or equal or Total is greater than the discount doesn't show up.
Comments
Comment #1
jantoine commentedI am unable to reproduce this. I tested using the following settings:
- Trigger: Calculate order discounts
- Condition: Check the order total
- Order total value: 100
- Order total comparison type: I tested both greater than or equal to and great than
- Action: Apply a discount
- Operation: Add
- Amount: -10
- Discount type: Order total
My order had a product costing $199 with a shipping charge of $10.60. A $10 discount was applied to the order testing both conditions. Please provide us with more information on your particular issue.
Cheers,
Antoine
Comment #2
tjjacobsen commentedHi Antoine,
Im seeing the exact same problem as the original poster.
Maybe this will help the diagnosis: For my Products, I have Attributes set to display checkboxes, which allow users to select multiple Attributes, each with a price adjustment. (I am also using the uc_node_checkout module).
All other Discounts seem to work well. It is only the "Check Order Total" which seems to be having trouble.
I'd love to get this working asap, and am willing to help in any way.
Thanks
-Todd
Comment #3
tjjacobsen commentedA few more details:
I am using ubercart-6.x-2.0-rc5, uc_discount-6.x-1.x-dev, and drupal-6.13.
I can confirm discounts on Order Total ARE being calculated for "less than" and "less than or equal".
But, they are NOT being calculated on "equals", "greater than", or "greater than or equal".
In addition, the "NEGATE" does not seem to be working, either.
Checking other Discount types (Number of Products, Orders can be shipped, etc) seem to be working correctly.
Scenario:
I need to apply a 10% discount when an order is between $175 and $315 (inclusive). I should be able to use two conditions:
1. >=$175
2. <=$315.
Since neither > nor >= seem to be working, I tried to use:
1. <=$315 (works as expected)
2. NEGATE <=$175 (should return "TRUE" for a value such as $200, correct?)
Again, Im happy to help in any way I can.
Thanks.
-Todd
Comment #4
scott m. sanders commentedRC6 is out, if that makes any difference.
Comment #5
tjjacobsen commentedThanks, Scott...I'll check.
A bit more info I just discovered:
The problem seems to be in the file ubercart > uc_order > uc_order.ca.inc. Specifically the function:
function uc_order_condition_total($order, $settings) {
switch ($settings['order_total_comparison']) {
case 'less':
return $order->order_total < $settings['order_total_value'];
case 'less_equal':
return $order->order_total <= $settings['order_total_value'];
case 'equal':
return $order->order_total == $settings['order_total_value'];
case 'greater_equal':
return $order->order_total >= $settings['order_total_value'];
case 'greater':
return $order->order_total > $settings['order_total_value'];
}
}
It seems the "==", ">=" and ">" cases are not working. Could it be because certain versions of PHP do not recognize those operators properly? (I am using PHP v5.2.6 on MediaTemple gs)
To test, I changed the 'greater' case to read "<", and it worked as a "is less than".
Any thoughts?
Thanks.
-t
Comment #6
tjjacobsen commentedCode looks the same in RC6.
Comment #7
Terko commentedI have the same problem, and I can't resolve it :(
Comment #8
Terko commentedThe module works fine when I say: If there is more than one product, apply discount. But if I want to apply discount when the price is higher than X, this don't work. Searched everywhere, in the ubercart forum too, but without success. Maybe it's something minor, but I can't find the bug. Or maybe the bug is in the uc_order module?
Comment #9
franklca commentedI was having the same problem as well. With help from The Worx Company, we discovered was that even though conditional actions has the order total available as a condition - the variable is not set. Using a print_r($order) on the checkout page we found that the order object does not has an 'order total' variable.
We resolved this by removing the "check order total" condition and adding a condition of "execute custom php code" with the following snippet.
This loops through each item in the cart, multiplying the qty by the price and tallying the total price. After looping through each item in the cart, it is then compared to our desired values and returns a true or false back to the conditional action which can then apply the appropriate discount. This code snippet was copied and pasted into each required condition - only changing the amount of the total that is required for each.
Comment #10
giorgoskfor the conditions reported in #1
the "check the order total" does not appear to work
using the php snippet above solves the problem
Comment #11
junedkazi commentedthe better way to calculate the total amount would be to use the inbuilt ubercart function uc_order_get_total($order, $products_only = FALSE)