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.
Coupon gets added to order leads to:
Notice: Undefined property: stdClass::$weight_units funktiossa uc_order_condition_products_weight() (row 446 in file/home/biovasa/biovasa.fi/sites/all/modules/ubercart/uc_order/uc_order.rules.inc).
Comment | File | Size | Author |
---|---|---|---|
#10 | 1416322-weight-units.patch | 663 bytes | wodenx |
Comments
Comment #1
wodenx CreditAttribution: wodenx commentedMoving to uc_coupon queue.
- What version of uc_coupon are you using?
- What page do you get the error on?
- What rule is that condition a part of?
Comment #2
Demoshane CreditAttribution: Demoshane commented- 7.x-2.1-alpha5+3-dev
- When trying to access checkout after adding coupon
- Havent got any specific rules set up. Just initial ones
Have got weight based shipping costs enabled though. And uc global quote.
Comment #3
wodenx CreditAttribution: wodenx commentedDoes this happen if you disable uc_global_quote?
What are the exact conditions you have set up for weight based quotes?
Just to clarify - you're saying this only happens if you enter the coupon on the 'cart' page and then hit "checkout"?
Do you have multiple coupons enabled?
What are the settings for the coupon that causes the problem?
As always, a link to a site that demonstrates the problem would be helpful.
Thanks.
Comment #4
Demoshane CreditAttribution: Demoshane commentedDoesnt happen with UC_global_quote disabled
uc-global quote settings
Min weight 0, max weight 1kg, shipping rate 6,48€
Only checkout. If applied at cart page it goes to checkout but after clicking review it sends back to cart page and after that you cant access checkout anymore.
No
Settings: -20% Total of matching
Can't provide link as webstore side is work in progress and can't be published.
Comment #5
wodenx CreditAttribution: wodenx commentedStill can't reproduce this, but there are a lot of variables.
You must have some weight-based condition executing - can you visit admin/config/workflow/rules/components and see if there are any condition sets that are checking an order's weight?
What checkout panes are enabled and what order are they in?
I still don't have a clear idea of the exact steps needed to reproduce the problem.
Here's what I've done:
1- created a single uc_global_quote as defined above (had to create a single zone).
2- defined a coupon offering a 20% discount
2- defined a shippable product with a weight of 0.5kg
3- added that product to the cart
4- proceeded to checkout
5- applied the coupon
6- proceeded to review
No error message.
Also have tried adding a condition to the quote (total weight > 0kg) and applying the coupon on the cart page.
No error message.
Can you post a similar list of steps that produces the error on your site?
Comment #6
Demoshane CreditAttribution: Demoshane commented1. Enabled global quote
2. Defined coupon -20% total of matching products
2. Created zone Countries "Finland" zone "All"
3. Created global quote with minimum weight 0,00 Maximum weight 2,00, shipping rate 6,49€
4. Logged in as dummy customer account with blank cart
5. Added product with 1kg weight to cart
6. At cart window gave coupon code and applied it
7. Continued to checkout and filled information
8. Selected global quote as delivery method (tried others too to see if they produce error)
9. Proceeded to review which seems to work this time after recreating global quote.
List on panes: Cart contents, Customer information, delivery information, billing information, special discounts, coupon discounts, calculate shipping costs, payment method, extra information.
Can't replicate it anymore either. Recreating rules removed the error even they're identical to original ones.
Comment #7
Dylanotron CreditAttribution: Dylanotron commentedI am getting this error when I do the following:
1. add a product to the cart (any product will do.)
2. View cart and add coupon code
3. Proceed to checkout.
4. Receive the error message in checkout:
Notice: Undefined property: stdClass::$weight_units in uc_order_condition_products_weight() (line 495 of /home/dyoung/public_html/main/sites/all/modules/ubercart/uc_order/uc_order.rules.inc).
I'm using:
Drupal Pressflow 7.12
uc_coupon 7.x-2.1-alpha6+8-dev
ubercart 7.x-3.0-rc4+68-dev
rules 7.x-2.1 (2012-03-16)
I have not enabled uc_global
I have created and activated multiple coupons
Shipping Methods enabled:
UPS (no conditions) [UPS automatically doesn't return quotes for freight weight: 150+ lbs]
"Standard Shipping" condition - $10.00 = if all products total weight is less than 150 lbs AND delivery address = U.S. AND Order Total < $150 (includes 2 data comparisons and then one "check and order's total weight")
"Free Shipping" condition - $0.00 = if all products total weight is less than 150 lbs AND delivery address = U.S. AND Order Total > $150 (includes 2 data comparisons and then one "check and order's total weight")
"Refrigerator Shipping" condition - $125.00 = if all products total weight is more than 150 lbs. (includes one "check and order's total weight")
"Customer Pick-up" condition - $0.00, (no conditions)
Because I get the error twice after moving to the checkout screen, maybe ubercart isn't finding a $weight_units attribute for the coupon code when applying the "Check an Order's Total Weight" shipping condition. In my case, because the item I added was under $150, the "Check an Order's Total Weight" conditional check would have run twice. However, if I add a product more than $150, the error appears twice on the checkout page as well.
#6 says "recreating rules removed the error." Some of my tax rules cannot be reverted (this may be because i tried to delete some of them manually from the database at one point.) I recreated my shipping quotes and conditions (except for UPS) but still receive the error. The only conditions in /admin/config/workflow/rules/components that check an order's weight are mentioned above.
Checkout Panes, in order:
Cart Contents
Customer information
Delivery Information
Billing Information
Calculate shipping cost
Coupon discount
Payment method
Order options (custom pane)
Order comments
Comment #8
ñull CreditAttribution: ñull commentedI have the same issue here. I can send you a drush produced archive of the site to your email address to reproduce the error. The problem is that the error is not triggered consistently.
Comment #9
Allthegearnoidea CreditAttribution: Allthegearnoidea commentedI get the same warning message. I have Weight Quote 7.x-3.2 under Ubercart fulfillment enabled. By disabling this the warning goes away.
I have tried recreating my shipping quotes but that does not solve the problem.
Am using Ubercart 7.x-3.2 and Ubercart Discount Coupons version 7.x-2.1-alpha7
Happy to post any further info you need.
Comment #10
wodenx CreditAttribution: wodenx commentedPlease try attached patch.
Comment #11
Allthegearnoidea CreditAttribution: Allthegearnoidea commentedBearing in mind that I am a complete novice when it comes to applying patches (and that I did it manually)... I think I have successfully applied the patch but I now get the following message:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/rattryde/public_html/sites/all/modules/uc_coupon/uc_coupon.module on line 1678
Of course it could just be that I mucked it up so we might need someone more proficient in the application of patches to post.
Comment #12
wodenx CreditAttribution: wodenx commentedhm. that sounds like you didn't apply the patch properly. If you are on a linux/osx system, you can simply:
cd /path/to/uc_coupon
patch -p1 < path/to/patchfile
Instructions for windows can be found at http://drupal.org/node/60179
Comment #13
Allthegearnoidea CreditAttribution: Allthegearnoidea commentedMust admit I thought as much. Will start again afresh...
Comment #14
Allthegearnoidea CreditAttribution: Allthegearnoidea commentedJust tried to apply the patch using cygwin but get:
Hunk #1 FAILED at 1660.
1 out of 1 hunk FAILED
Comment #15
Allthegearnoidea CreditAttribution: Allthegearnoidea commentedHi
I've got the patch to work!!! And the error message has now disappeared and the discount is applying properly.
All I did was I changed the version of Discount Coupons I'm using to 7.x-3.0-alpha0+3-dev then applied the patch manually. The only thing to note is the patch says to start at line 1660 but actually the piece of code that the changes started at i.e. the first change to implement was at line 1859 in the version of Discount Coupons I am using (7.x-3.0-alpha0+3-dev).
Hope this helps others.
Comment #16
Allthegearnoidea CreditAttribution: Allthegearnoidea commentedForgot to add I used this http://drupal.org/node/534548 for the guide on applying the patch manually
Comment #17
5kot CreditAttribution: 5kot commentedI had the same issue with the patch, so applied it manually and it's worked.
I was on 7.x-2.1-alpha7, so upgraded to 7.x-3.0-alpha0 then applied the patch,
edit: oh, I see. The patch was for 7.x-2.x-dev.
Comment #18
5kot CreditAttribution: 5kot commentedThis seems to be a pretty innocuous patch. It's just adding default attributes for the line item. Any chance of this being rolled into trunk?