Exemplo n.º 1
0
 /**
  * Copys all data from a given attribute item.
  *
  * @param MShop_Attribute_Item_Interface $item Attribute item to copy from
  */
 public function copyFrom(MShop_Attribute_Item_Interface $item)
 {
     $this->setAttributeId($item->getId());
     $this->setName($item->getName());
     $this->setCode($item->getType());
     $this->setValue($item->getCode());
     $this->setModified();
 }
Exemplo n.º 2
0
 /**
  * Adds all texts belonging to an attribute item.
  *
  * @param MW_Container_Content_Interface $contentItem Content item
  * @param MShop_Attribute_Item_Interface $item product item object
  * @param string $langid Language id
  */
 protected function _addItem(MW_Container_Content_Interface $contentItem, MShop_Attribute_Item_Interface $item, $langid)
 {
     $listTypes = array();
     foreach ($item->getListItems('text') as $listItem) {
         $listTypes[$listItem->getRefId()] = $listItem->getType();
     }
     foreach ($this->_getTextTypes('attribute') as $textTypeItem) {
         $textItems = $item->getRefItems('text', $textTypeItem->getCode());
         if (!empty($textItems)) {
             foreach ($textItems as $textItem) {
                 $listType = isset($listTypes[$textItem->getId()]) ? $listTypes[$textItem->getId()] : '';
                 $items = array($langid, $item->getType(), $item->getCode(), $listType, $textTypeItem->getCode(), '', '');
                 // use language of the text item because it may be null
                 if (($textItem->getLanguageId() == $langid || is_null($textItem->getLanguageId())) && $textItem->getTypeId() == $textTypeItem->getId()) {
                     $items[0] = $textItem->getLanguageId();
                     $items[5] = $textItem->getId();
                     $items[6] = $textItem->getContent();
                 }
                 $contentItem->add($items);
             }
         } else {
             $items = array($langid, $item->getType(), $item->getCode(), 'default', $textTypeItem->getCode(), '', '');
             $contentItem->add($items);
         }
     }
 }