Closed (fixed)
Project:
Commerce Reporting
Version:
7.x-4.0-beta1
Component:
Stock Reports
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Sep 2014 at 13:24 UTC
Updated:
23 Sep 2014 at 00:30 UTC
Jump to comment: Most recent
Comments
Comment #1
Salif commentedComment #2
mglamanCan you please post error created in the database log?
Comment #3
mglamanIs your error this:
Looks like it might be an issue when there are not products with stock. I also noticed that this may be dependent on Commerce Simple Stock (for the default commerce_stock field.)
Comment #4
Salif commentedHi mglaman
I will reproduce by enabling the stock reports feature and then report to you soon.
Comment #5
Salif commentedThe error is:
EntityFieldQueryException: Unknown field: commerce_stock in EntityFieldQuery->addFieldCondition() (line 779 of .../public_html/includes/entity.inc).Comment #6
Salif commentedCommerce stock was missing (Haven't seen yet a dependancy of Commerce reports on Commerce stock !?)
Enable commerce stock 7.x-2.0 module:
- Enable the Commerce Stock API & Commerce Simple stock modules.
Configured as per instruction:
- Select the “simple stock management” tab,
- - Check the product types for simple stock to manage.
-------------
And now
"The website encountered an unexpected error" gone.
And I can visite all reports tabs: Dasboard, Products, Stock, taxes, Customers, sales & Payment methods
-------------
But now the error you've mentionned above appear in error log messages.
Notice: Undefined variable: products in _commerce_reports_stock_get_stock_enabled_products() (line 173 of /home/savabien/public_html/sites/all/modules/commerce_reports/modules/stock/commerce_reports_stock.module).Warning: Invalid argument supplied for foreach() in _commerce_reports_stock_get_stock_enabled_products() (line 173 of /home/savabien/public_html/sites/all/modules/commerce_reports/modules/stock/commerce_reports_stock.module).Comment #7
mglamanDo you have Commerce Reports Stock enabled without enabling Commerce Stock? The issue is empty values, apparently. Before it was a silent fail because it didn't use EntityMetadataWrappers, so there wasn't an EntityException.
Just disable Commerce Reports Stock for now, I will have fix up later tonight.
Comment #8
Salif commentedThanks much @ mglaman
Yes I will use the other features that are available and disable the Commerce Reports Stock report for now, as you suggested.
... The error came back when I try to put products (quantity) in stock.
Comment #10
mglamanThanks for catching this right away for me, and being patient for the fix!
If there were no products with a stock value, this was still being run, event though $products didn't exist, throwing the first error.
I updated the stock check to use EntityMetadataWrapper's __isset(). The
commerce_stockfield is only created via Commerce Simple Stock (commerce_ss) and may not exist on all product types. This checks first.