/** * Adds attribute items to an array. * * @param MShop_Common_Item_Interface $item Item containing the properties to be added as attributes * @param MShop_Order_Item_Base_Product_Interface $product Product containing attributes * @param Array $properties List of item properties to be converted * @return Array List of attributes */ protected function _addAttributes(MShop_Common_Item_Interface $item, MShop_Order_Item_Base_Product_Interface $product, array $properties) { $attributeList = $product->getAttributes(); $itemProperties = $item->toArray(); foreach ($properties as $code) { if (array_key_exists($code, $itemProperties) && $product->getAttribute($code, $this->_type) === null) { $new = $this->_orderAttrManager->createItem(); $new->setCode($code); $new->setType($this->_type); $new->setValue($itemProperties[$code]); $attributeList[] = $new; } } return $attributeList; }
/** * Adds attribute items to an array. * * @param MShop_Common_Item_Interface $item Item containing the properties to be added as attributes * @param MShop_Order_Item_Base_Product_Interface $product Product containing attributes * @param Array $properties List of item properties to be converted * @return Array List of attributes */ protected function _addAttributes(MShop_Common_Item_Interface $item, MShop_Order_Item_Base_Product_Interface $product, array $properties) { $attributeList = $product->getAttributes(); $itemProperties = $item->toArray(); foreach ($properties as $current) { if (array_key_exists($current, $itemProperties) && ($new = $this->_createAttribute($product, $current, $itemProperties[$current])) !== null) { $attributeList[] = $new; } } return $attributeList; }