Ejemplo n.º 1
0
 /**
  * Set valid attribute set and product type to rows with all scopes
  * to ensure that existing products doesn't changed.
  *
  * @param array $rowData
  * @return array
  */
 protected function _prepareRowForDb(array $rowData)
 {
     $rowData = $this->_customFieldsMapping($rowData);
     $rowData = parent::_prepareRowForDb($rowData);
     static $lastSku = null;
     if (\Magento\ImportExport\Model\Import::BEHAVIOR_DELETE == $this->getBehavior()) {
         return $rowData;
     }
     $lastSku = $rowData[self::COL_SKU];
     if (isset($this->_oldSku[$lastSku])) {
         $newSku = $this->skuProcessor->getNewSku($lastSku);
         $rowData[self::COL_ATTR_SET] = $newSku['attr_set_code'];
         $rowData[self::COL_TYPE] = $newSku['type_id'];
     }
     return $rowData;
 }
Ejemplo n.º 2
0
 /**
  * Set valid attribute set and product type to rows with all scopes
  * to ensure that existing products doesn't changed.
  *
  * @param array $rowData
  * @return array
  */
 protected function _prepareRowForDb(array $rowData)
 {
     $rowData = parent::_prepareRowForDb($rowData);
     static $lastSku = null;
     if (\Magento\ImportExport\Model\Import::BEHAVIOR_DELETE == $this->getBehavior()) {
         return $rowData;
     }
     if (self::SCOPE_DEFAULT == $this->getRowScope($rowData)) {
         $lastSku = $rowData[self::COL_SKU];
     }
     if (isset($this->_oldSku[$lastSku])) {
         $rowData[self::COL_ATTR_SET] = $this->_newSku[$lastSku]['attr_set_code'];
         $rowData[self::COL_TYPE] = $this->_newSku[$lastSku]['type_id'];
     }
     return $rowData;
 }