Exemple #1
0
 /**
  * Array of SKU to array of super attribute values for all products.
  *
  * @return $this
  */
 protected function _loadSkuSuperData()
 {
     if (!$this->_skuSuperData) {
         $mainTable = $this->_resource->getTableName('catalog_product_super_attribute');
         $priceTable = $this->_resource->getTableName('catalog_product_super_attribute_pricing');
         $select = $this->_connection->select()->from(['m' => $mainTable], ['product_id', 'attribute_id', 'product_super_attribute_id'])->joinLeft(['p' => $priceTable], $this->_connection->quoteIdentifier('p.product_super_attribute_id') . ' = ' . $this->_connection->quoteIdentifier('m.product_super_attribute_id'), ['value_index']);
         foreach ($this->_connection->fetchAll($select) as $row) {
             $attrId = $row['attribute_id'];
             $productId = $row['product_id'];
             if ($row['value_index']) {
                 $this->_skuSuperData[$productId][$attrId][$row['value_index']] = true;
             }
             $this->_productSuperAttrs["{$productId}_{$attrId}"] = $row['product_super_attribute_id'];
         }
     }
     return $this;
 }