2

I've got a project involving Expresso Store, where I'm attempting to simplify the process of updating store products and stock (for the owners of the website) by going outside the ExpressionEngine publish forms and setting up the product entry and stock update process in Channel Forms.

However, though the Store field looks like it's compatible with Channel Forms, on editing an entry, I get this error:

A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()

Filename: Service/ProductsService.php
Line Number: 137
A PHP Error was encountered

Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/tcisite5/public_html/tci/codeigniter/system/core/Exceptions.php:170)

Filename: libraries/Functions.php
Line Number: 446

In spite of the error, other fields are updated when I submit the Channel Form. But Store fields are not updated.

I'm running ExpressionEngine v2.9.2 - Build Date: 20141004. Also, Store has been updated the new version: 2.5.0. I've also done an optimize/repair on all of my EE database tables through the EE utility.

  • Any more info on this? I too am experiencing this issue. – Joseph Marikle Sep 4 '15 at 22:42
0

I got the same error when submitting a form to update a product entry without actually including/updating the store field(s) (i.e. just updating the title / other custom fields).

I found that the stock_level field is required. Adding the following to my form fixed the PHP error:

{exp:store:product entry_id='{segment:offer_entry_id}' disable_form='yes' disable_javascript='yes'}
    <input type="hidden" name="store_product_field[stock][0][stock_level]" value="{if track_stock}{total_stock}{/if}">
{/exp:store:product}

Note that I'm getting the entry_id for the {exp:store:product} tag from a URL segment; you'll probably want to get it from somewhere else.

Also, my products don't have modifiers. This may not work for products that do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.