Related products color swatches crush (Magento 2.1.0)

by Wales   Last Updated January 12, 2018 12:09 PM

  1. Want to use color swatches in related products
  2. Using this to display color swatches in related section
  3. Get the page crash end error log. That i think the main part of error

a:4:{i:0;s:178:"Warning: Invalid argument supplied for foreach() in mysite.com/public_html/vendor/magento/module-catalog/Block/Product/ProductList/Related.php on line 129"

code on line 129 of Related.php

public function getIdentities()
    {
        $identities = [];
        foreach ($this->getAllVisibleItems() as $item) {
            $identities = array_merge($identities, $item->getIdentities());
        }
        return $identities;
    }

How i can fix this?



Related Questions


how to get swatches attribute option in magento 2

Updated March 17, 2017 05:09 AM

Magento 2 Visual swatch on simple product?

Updated May 25, 2017 09:09 AM