I am getting this Warning in my System.log:

Warning: Invalid argument supplied for foreach()  in C:\htdocs\myrep\app\code\community\AvS\FastSimpleImport\Model\Import\Entity\Product.php on line 485

and for line 508.

So, these lines are foreach loops in the functions setDropdownAttributes() and setMultiselectAttributes(). Through debugging I found out that $this->getDropdownAttributes() (and getMultiselectAttributes()) return empty arrays, therefore supplying the set functions with empty arrays. And it returns an empty array because in here (in class Varien_Object):

public function __call($method, $args)
        switch (substr($method, 0, 3)) {
            case 'get' :
                //Varien_Profiler::start('GETTER: '.get_class($this).'::'.$method);
                $key = $this->_underscore(substr($method,3));
                $data = $this->getData($key, isset($args[0]) ? $args[0] : null);
                //Varien_Profiler::stop('GETTER: '.get_class($this).'::'.$method);
                return $data;

the line $data= $this->getData(...); returns 0.

Although I get this warning, all my attributes, that are dropdown or multiselect, in the products that are being imported, are set with the correct values without any problems.

Another funny thing is that this happens only when I import on parts. This means that, f.e., I have 7 products to import in a single XML file - if I construct the importArray for all of them and import it at once - it's all fine, without warning. But if I try importing on every 3rd product, f.e., I get the warning (therefore 2 warnings). If I try doing it on every 2nd product - 3 warnings. And yet - the values are always being imported and set correctly. I really am confused.

  • magento version? – FlorinelChis Dec 18 '13 at 16:00
  • @FlorinelChis - – Syspect Dec 18 '13 at 16:05
  • 1
    Are you using the latest version? This was added recently to fix some PHP5.4 warnings: github.com/avstudnitz/AvS_FastSimpleImport/commit/… – Paul Hachmang Dec 18 '13 at 16:11
  • @PaulHachmang - wow, I am definitely not with the latest version, because I am missing like 50 lines of code from the class. Thanks, I will try updating and will post here whether that solved the problem. :) – Syspect Dec 18 '13 at 16:33
  • You can post it as a self-answer :) – Paul Hachmang Dec 18 '13 at 21:26

As Paul Hachmang suggested, I updated the Import.php in my /app/code/community/AvS/FastSimpleImport/Model/ and I got rid of the annoying warning. Here's a link to the GitHub commit with the last changes.

  • Accept it so it is marked as solved :) – Paul Hachmang Dec 20 '13 at 22:28

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.