<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Agence de Développement Informatique du Nord &#187; error</title>
	<atom:link href="http://blog.adin.pro/tag/error/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.adin.pro</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Thu, 26 Dec 2019 08:54:31 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>Magento app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 1180 error</title>
		<link>http://blog.adin.pro/2015-05-21/magento-appcodecoremageeavmodelentityabstract-php-on-line-1180-error/</link>
		<comments>http://blog.adin.pro/2015-05-21/magento-appcodecoremageeavmodelentityabstract-php-on-line-1180-error/#comments</comments>
		<pubDate>Thu, 21 May 2015 14:01:37 +0000</pubDate>
		<dc:creator><![CDATA[blogadmin]]></dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[error]]></category>

		<guid isPermaLink="false">http://blog.adin.pro/?p=470</guid>
		<description><![CDATA[<p>You try to save a product and you get this error : Invalid argument supplied for foreach(). This was unexpected and you don&#8217;t understand why. The problem is, that you are not allowed to save products from the frontend. The &#8230; <a href="http://blog.adin.pro/2015-05-21/magento-appcodecoremageeavmodelentityabstract-php-on-line-1180-error/">Continue reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2015-05-21/magento-appcodecoremageeavmodelentityabstract-php-on-line-1180-error/">Magento app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 1180 error</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>You try to save a product and you get this error : Invalid argument supplied for foreach().<br />
This was unexpected and you don&#8217;t understand why.</p>
<p>The problem is, that you are not allowed to save products from the frontend.<br />
The origData property is not filled</p>
<pre class="brush: php; title: ; notranslate">
public function setOrigData($key=null, $data=null)
{
    if (Mage::app()-&gt;getStore()-&gt;isAdmin()) {
        return parent::setOrigData($key, $data);
    }

    return $this;
}
</pre>
<p>So when you try to save the product, this error is raised.</p>
<p>What to do when you encounter this error ?</p>
<p>A quick fix is to add this before saving, on your controller for example.</p>
<pre class="brush: php; title: ; notranslate">
Mage::app()-&gt;setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
</pre>
<p>A proper solution is to extend Mage_Catalog_Model_Product and replace setOrigData method</p>
<pre class="brush: php; title: ; notranslate">
public function setOrigData($key = null, $data = null)
{
    if (is_null($key)) {
        $this-&gt;_origData = $this-&gt;_data;
    } else {
        $this-&gt;_origData[$key] = $data;
    }
    return $this;
}
</pre>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2015-05-21/magento-appcodecoremageeavmodelentityabstract-php-on-line-1180-error/">Magento app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 1180 error</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.adin.pro/2015-05-21/magento-appcodecoremageeavmodelentityabstract-php-on-line-1180-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
