/**
  * prepare identifier
  *
  * @param mixed $product
  * @return array
  */
 protected function prepareIdentifiers($product = false)
 {
     $result = array();
     $product = $product ? $product : $this->currentProduct;
     if (property_exists($product, 'reference') && !empty($product->reference)) {
         $identifierItem = new Shopgate_Model_Catalog_Identifier();
         $identifierItem->setType('SKU');
         $identifierItem->setValue($product->reference);
         $result[] = $identifierItem;
     }
     if (property_exists($product, 'upc') && !empty($product->upc)) {
         $identifierItem = new Shopgate_Model_Catalog_Identifier();
         $identifierItem->setType('UPC');
         $identifierItem->setValue($product->upc);
         $result[] = $identifierItem;
     }
     if (property_exists($product, 'ean13') && !empty($product->ean13)) {
         $identifierItem = new Shopgate_Model_Catalog_Identifier();
         $identifierItem->setType('EAN');
         $identifierItem->setValue($product->ean13);
         $result[] = $identifierItem;
     }
     return $result;
 }
Example #2
0
 /**
  * @param $type
  * @param $result
  */
 protected function _getIdentifierByType($type, &$result)
 {
     $typeLabel = '';
     switch ($type) {
         case 'ean':
             $attributeCode = Mage::getStoreConfig(Shopgate_Framework_Model_Config::XML_PATH_SHOPGATE_EAN_ATTR_CODE);
             $typeLabel = 'EAN';
             break;
         case 'upc':
             $attributeCode = Mage::getStoreConfig(Shopgate_Framework_Model_Config::XML_PATH_SHOPGATE_UPC_ATTR_CODE);
             $typeLabel = 'UPC';
             break;
     }
     if (!empty($attributeCode)) {
         $textValue = $this->item->getAttributeText($attributeCode);
         $attributeValue = $this->item->getData($attributeCode);
         if (!empty($value) || !empty($attributeValue)) {
             $identifierItemObject = new Shopgate_Model_Catalog_Identifier();
             $identifierItemObject->setType($typeLabel);
             $identifierItemObject->setValue($textValue ? $textValue : $attributeValue);
             $result[] = $identifierItemObject;
         }
     }
 }