By ajsloan on
Warning: in_array(): Wrong datatype for second argument in
..../modules/contribs/ecommerce/product/product.module on line 703
I'm receiving the above error on the home page. I've updated to 4.7.2 and eccomerce 4.7 . I've searched through the forum and on the web for a solution but am stumped. I have checked content type to make sure at least 1 option was checked. I have also deleted the product module and product table in the DB and reinstalled but keep receiving this error. I have also created a product.
Thanks for any assistance.
Comments
Is the location rss.xml or /node/feed?
I'm getting the same thing after an initial installation of 4.7 ecommerce running on 4.7.2 drupal.
I installed the cvs ecommerce and now I get the same message just on a different line number (712 I believe).
- Mark
i think its doing a callback
i think its doing a callback or invoking a member of a productAPI and expecting an array but its not getting it for some reason (maybe becuase its not checking to see if it got an array back? not sure here)
701: function product_get_specials($node, $total_only = false, $txn = null) {
702: $specials = array();
703: if (!(in_array('no_discounts', product_invoke_productapi($node, 'attributes')))) {
im guessing that product_invoke_productapi($node, 'attributes') is returning nothing/null,
and in_array is doing an array operation on it which is causing the error.
is casting that call as an array with (array) a valid fix? seems to fix the notice here.
703: if (!(in_array('no_discounts', (array)product_invoke_productapi($node,
'attributes')))) {
Do any other ecommerce users see this in their logs?
Or is it just me and ajsloan?
- Mark
Also i think you'll find
Also i think you'll find you're running a module that isnt totally compatible with your product.module
check that the _productapi switch case of your enabled product modules atleast has
or
except for the apparel module as gorden says..
A fix
I've been getting the same error, and I don't know why it cropped up. And I still get it after reinstallling Drupal and ecommerce. And I get it even while disabling all the modules except the core ecommerce modules. So ...
I added line 2 and the bracket at line 10
It would seem to be an elementary precaution to check for the precondition that the node has the "attributes" field, though maybe there's a better way to make the check?
Also, am I the only one who's confused that sometimes this code returns a number, and sometimes it returns an integer?
Ecommerce Fix for Warning: in_array(): Wrong datatype for second
This eliminated the error for me. I'm using Drupal 4.7.3 and the latest 4.7 ecommerce as of 9/5/06 and I still got the error until I tried the fix. Thanks !!!
What are the possible attributes?
I'm getting this error, and I'm guessing it's because "attributes" needs something. What are the possible attributes that can go here? I just want to make sure that the product is not shippable.
In tangible_productapi of tangible (example) module:
same
I'm getting this same error after installing today's (July 17) ecommerce 4.7.
It appears to be a bug
I resolved this issue by adding the following lines above the: if (!(in_array(:
+ $nodeattributes = product_invoke_productapi($node, 'attributes');
+ if (sizeof($noteattributes)!=0)
Perhaps someone could submit this as a bug for future releases?
It appears to be a bug
I resolved this issue by adding the following lines above the: if (!(in_array(:
+ $nodeattributes = product_invoke_productapi($node, 'attributes');
+ if (sizeof($noteattributes)!=0)
Perhaps someone could submit this as a bug for future releases?
I dont think its a bug, i
I dont think its a bug, i think its a loose end designed to pull you up if something that is happening isnt exactly what is expected
ie: another module is calling the API without giving it exactly what it is after
This is working... Thank you Carillon
This is working... Thank you Carillon
Dependencies
Make sure all of your dependencies are turned on. For example, if you are using apparel module, you need tangible.