Jump to content

Invalid argument supplied for foreach()


APerricone

Recommended Posts

Hello,

I see that for product the only value required is price, so theoretically I can do a POST with:

<?xml version="1.0" encoding="windows-1252"?>
<prestashop>
 <product>
  <price>1.20</price>
 </product>
</prestashop>

To do a most complete post, I am trying with:

<?xml version="1.0" encoding="windows-1252"?>
<prestashop>
  <product>
    <id_shop_default>0</id_shop_default>
    <description_short>
      <language id="1">HAMBURGER GRAN GUSTO 130G CA</language>
    </description_short>
    <price>1.20</price>
  </product>
</prestashop>

 

In both case I obtain:

HTTP/1.1 500 Internal Server Error
Date: Fri, 19 Jun 2020 12:20:53 GMT
Server: Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.2.31
Vary: Authorization
X-Powered-By: PrestaShop Webservice
Access-Time: 1592569253
PSWS-Version: 1.7.6.5
Execution-Time: 0.015
Content-Length: 309
Connection: close
Content-Type: text/xml;charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<prestashop 
  xmlns:xlink="http://www.w3.org/1999/xlink">
  <errors>
    <error>
      <code>
        <![CDATA[3]]>
      </code>
      <message>
        <![CDATA[[PHP Warning #2] Invalid argument supplied for foreach() (D:\xampp\htdocs\classes\Product.php, line 6827)]]>
      </message>
    </error>
  </errors>
</prestashop>

I am trying on v. 1.7.6.5

Maybe are there another required value?

 

Link to comment
Share on other sites

  • 1 year later...

I tried post request add product, is not works in prestashop 

 

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">

<product>

<description_short>HAMBURGER GRAN GUSTO 130G CA</description_short>

<price>120.20</price>

<link_rewrite>hummingbird-printed-t-shirtd</link_rewrite>

<name>BnB SOFT </name>

</product>

</prestashop>

Please help me

 

Error

<![CDATA[[PHP Warning #2] Invalid argument supplied for foreach() (/home/u873490575/domains/bnbsoftservice.com/public_html/annaproject/prestashop/classes/Product.php, line 7003)]]>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...