On a production site I am getting this error with the same steps, so I decided to test it out on my local machine as well. With a fresh install of Commerce Kickstart with the demo store added, I am getting this error on a manual Add an Order page:
Notice: Undefined property: stdClass::$commerce_unit_price in commerce_line_item_manager_validate() (line 1228 of /Users/[me]/Sites/sandbox/comkickdemo-7.x-2.13/profiles/commerce_kickstart/modules/contrib/commerce/modules/line_item/commerce_line_item.module).
Using:
- Drupal 7.26
- Commerce Kickstart 2.13 (this happened in 2.12 as well, same error)
- PHP 5.3.27
- MySQL 5.5.33
- Memory: 192MB
First action on coming to the site was to:
- Create an order at /commerce/orders/add
- Add line item: Product: HAT1-GRY-OS. Added product. (It's fixed priced is $16)
- Add line item: Fixed amount discount: entered
-6
in unit price - Saved Order
When I view this order, the final price is properly discounted $6, for a total of $10 but without knowing what this error means, I can't use the discounting on a production site. I will get this error also if I repeat the steps above on a new order and set the Owned By to a user.
Am I perhaps not using the discount system properly? Any help would be appreciated. Thanks very much.
Comment | File | Size | Author |
---|---|---|---|
#17 | order-view.PNG | 25.08 KB | tasmaniaman |
#17 | fixed-amount-discount.PNG | 45.94 KB | tasmaniaman |
#14 | entity_wrapper_inc.png | 172.34 KB | joelpittet |
#3 | image1.jpg | 33.03 KB | rajmataj |
Comments
Comment #1
lsolesen CreditAttribution: lsolesen commentedComment #2
lsolesen CreditAttribution: lsolesen commentedThe UX is a little strange, but I cannot reproduce the undefined error. Could you try a clean install.
Comment #3
rajmataj CreditAttribution: rajmataj commentedThanks but this was on a fresh install. To check again, I have emptied my database and gone through the following steps in the same server environment as listed in the original post:
Environment:
Steps to Reproduce:
The resulting error reads:
Notice: Undefined property: stdClass::$commerce_unit_price in commerce_line_item_manager_validate() (line 1228 of /Users/[me]/Sites/sandbox/comkickdemo-7.x-2.13/profiles/commerce_kickstart/modules/contrib/commerce/modules/line_item/commerce_line_item.module).
By clicking on the View tab to see this order, the discount has not been applied.
Comment #4
lsolesen CreditAttribution: lsolesen commentedConfirmed.
Working on a test showcasing the problem: https://github.com/lsolesen/commerce_kickstart/blob/manual-order/tests/b...
However need to figure out how to target the line item field consistently.
Comment #5
lsolesen CreditAttribution: lsolesen commentedNow I got a failing Behat test: https://travis-ci.org/lsolesen/commerce_kickstart/builds/23356753 showing the problem.
Comment #6
lsolesen CreditAttribution: lsolesen commentedComment #7
rajmataj CreditAttribution: rajmataj commentedRegarding your status, what additional info are you needing?
Comment #8
lsolesen CreditAttribution: lsolesen commentedThis is set as Active, so it is confirmed.
Comment #9
rajmataj CreditAttribution: rajmataj commentedAh yes, I misread the status. Thanks for looking into this. Much appreciated.
Comment #10
mr.andrey CreditAttribution: mr.andrey commentedI'm experiencing the same error after editing an order and trying to add a "Fixed amount discount".
Thanks.
Comment #11
lsolesen CreditAttribution: lsolesen commented@mr.andrey This is confirmet. What we need is a solution :)
Rebased agains latest dev and run Travis CI tessts again: https://travis-ci.org/lsolesen/commerce_kickstart/builds/52320683
Comment #12
mglamanLooks like this is a bug in the Line Item module and needs to be moved to proper queue.
Comment #13
rszrama CreditAttribution: rszrama commentedSounds to me more like the issue is with the line item callbacks in the Commerce Discount module. I've never seen this error with just core line items.
Comment #14
joelpittet@rszrama I think you may be correct, I've been racking my head against a very similar issue for 3+ hours yesterday.
commerce_product
field was missing from the entity info "bundle properties info". But only sometimes... (assume caching issue but the cache magically cleared after 3 hours and it fixed itself:S, then showed up this morning in logs again for a customer!)Here's a picture while I was debugging:
I hope I can get a scenario where I can reproduce this issue, but it could be related to entitycache, cache_consistent, entity API, or maybe just some missing entity info declarations on this module.
Either way it would be good to get more details on this. @rajmataj, @mr.andrey @lsolesen if this issue going away with cache clear? Or maybe you can try https://www.drupal.org/project/commerce_repair with the patch here #2532598: Permissions changed to see if the fields get rebuilt correctly?
Comment #15
rajmataj CreditAttribution: rajmataj commentedI'm fairly sure clearing the cache didn't make the issue go away with the versions of the modules that were originally listed. When I get time to try commerce_repair, I'll post here what the results were in relation to the original issue.
Thanks for everyone's input.
Comment #16
joelpittetif commerce_repair works, I may just need to rewrite the field install helper. I've done something interesting around this for a custom module that may help here, but I'll wait to see if your mileage on that takes.
Comment #17
tasmaniaman CreditAttribution: tasmaniaman commentedI'm experiencing this issue too.
Fresh install.
Environment:
Drupal 7.41
Install profile Commerce Kickstart (commerce_kickstart-7.x-2.31) - USING THE DEV version of commerce_discount
Database system MySQL, MariaDB, or equivalent
Database system version 5.5.5-10.0.23-MariaDB
PHP 5.5.31 (more information)
PHP memory limit 160M
Web server nginx/1.9.9
Steps to Reproduce:
Install the demo store through the interface: http://yoursite.com/install.php
Go through the checkout process to purchase a product like a real customer would.
Edit the order - e.g. admin/commerce/orders/ORDERNUMBER/edit
With 'fixed amount discount' in the selection window, hit the Add Line Item button, then click 'Add Discount' button
For the Fixed Amount Discount row, enter -10 as the unit price (see attached screenshot - fixed-amount-discount.PNG)
Click the blue 'Save Order' button at the bottom of the screen
The resulting error reads:
Notice: Undefined property: stdClass::$commerce_unit_price in commerce_line_item_manager_validate() (line 1229 of /home/nginx/domains/test01.localdomain/public/profiles/commerce_kickstart/modules/contrib/commerce/modules/line_item/commerce_line_item.module).
By clicking on the View tab to see this order, the discount HAS been applied but does not show up in the order totals.
If you edit an order that has a discount on it and change the discount price the line disappears from the the view screen as well.