protected function addSkuCombinations(array $data)
    {
        if (empty($data['combination'])) {
            return false;
        }

        foreach ($data['combination'] as $combination) {

            if (empty($combination['fields'])) {
                continue;
            }

            if (!empty($combination['price'])) {
                $combination['price'] = $this->price->amount($combination['price'], $data['currency']);
            }

            $this->setCombinationFileId($combination, $data);

            $combination['store_id'] = $data['store_id'];
            $combination['product_id'] = $data['product_id'];
            $combination['combination_id'] = $this->sku->getCombinationId($combination['fields'], $data['product_id']);

            if (empty($combination['sku'])) {
                $combination['sku'] = $this->sku->generate($data['sku'], array('store_id' => $data['store_id']));
            }

            $this->sku->add($combination);
        }

        return true;
    }
protected function addSkuCombinations(array $data)
    {
        if (empty($data['combination'])) {
            return false;
        }

        foreach ($data['combination'] as $combination) {

            if (empty($combination['fields'])) {
                continue;
            }

            if (!empty($combination['price'])) {
                $combination['price'] = $this->price->amount($combination['price'], $data['currency']);
            }

            $this->setCombinationFileId($combination, $data);

            $combination['store_id'] = $data['store_id'];
            $combination['product_id'] = $data['product_id'];
            $combination['combination_id'] = $this->sku->getCombinationId($combination['fields'], $data['product_id']);

            if (empty($combination['sku'])) {
                $combination['sku'] = $this->sku->generate($data['sku'], array('store_id' => $data['store_id']));
            }

            $this->sku->add($combination);
        }

        return true;
    }
protected function addSkuCombinations ( array $ data ) { if ( empty ( $ data [ 'combination' ] ) ) { return false ; } foreach ( $ data [ 'combination' ] as $ combination ) { if ( empty ( $ combination [ 'fields' ] ) ) { continue ; } if ( ! empty ( $ combination [ 'price' ] ) ) { $ combination [ 'price' ] = $ this -> price -> amount ( $ combination [ 'price' ] , $ data [ 'currency' ] ) ; } $ this -> setCombinationFileId ( $ combination , $ data ) ; $ combination [ 'store_id' ] = $ data [ 'store_id' ] ; $ combination [ 'product_id' ] = $ data [ 'product_id' ] ; $ combination [ 'combination_id' ] = $ this -> sku -> getCombinationId ( $ combination [ 'fields' ] , $ data [ 'product_id' ] ) ; if ( empty ( $ combination [ 'sku' ] ) ) { $ combination [ 'sku' ] = $ this -> sku -> generate ( $ data [ 'sku' ] , array ( 'store_id' => $ data [ 'store_id' ] ) ) ; } $ this -> sku -> add ( $ combination ) ; } return true ; }
Add SKUs for an array of product combinations
@param array $data
@return boolean
Add SKUs for an array of product combinations