Пример #1
0
 /**
  * Adds attribute items to an array.
  *
  * @param \Aimeos\MShop\Common\Item\Iface $item Item containing the properties to be added as attributes
  * @param \Aimeos\MShop\Order\Item\Base\Product\Iface $product Product containing attributes
  * @param Array $properties List of item properties to be converted
  * @return Array List of attributes
  */
 protected function addAttributes(\Aimeos\MShop\Common\Item\Iface $item, \Aimeos\MShop\Order\Item\Base\Product\Iface $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;
 }