Ejemplo n.º 1
0
 /**
  * Set current attribute to entry (for specified product)
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Varien_Gdata_Gshopping_Entry $entry
  * @return Varien_Gdata_Gshopping_Entry
  */
 public function convertAttribute($product, $entry)
 {
     $url = $product->getProductUrl(false);
     if ($url) {
         if (!Mage::getStoreConfigFlag('web/url/use_store')) {
             $urlInfo = parse_url($url);
             $store = $product->getStore()->getCode();
             if (isset($urlInfo['query']) && $urlInfo['query'] != '') {
                 $url .= '&___store=' . $store;
             } else {
                 $url .= '?___store=' . $store;
             }
         }
         $links = $entry->getLink();
         if (!is_array($links)) {
             $links = array();
         }
         $link = $entry->getService()->newLink();
         $link->setHref($url);
         $link->setRel('alternate');
         $link->setType('text/html');
         if ($product->getName()) {
             $link->setTitle($product->getName());
         }
         $links[0] = $link;
         $entry->setLink($links);
     }
     return $entry;
 }
Ejemplo n.º 2
0
 /**
  * Set current attribute to entry (for specified product)
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Varien_Gdata_Gshopping_Entry $entry
  * @return Varien_Gdata_Gshopping_Entry
  */
 public function convertAttribute($product, $entry)
 {
     $mapValue = $this->getProductAttributeValue($product);
     $name = $this->getGroupAttributeName();
     if (!is_null($name)) {
         $mapValue = $name->getProductAttributeValue($product);
     }
     if (!is_null($mapValue)) {
         $titleText = $mapValue;
     } elseif ($product->getName()) {
         $titleText = $product->getName();
     } else {
         $titleText = 'no title';
     }
     $titleText = Mage::helper('googleshopping')->cleanAtomAttribute($titleText);
     $entry->setTitle($entry->getService()->newTitle()->setText($titleText));
     return $entry;
 }
Ejemplo n.º 3
0
 /**
  * Set current attribute to entry (for specified product)
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Varien_Gdata_Gshopping_Entry $entry
  * @return Varien_Gdata_Gshopping_Entry
  */
 public function convertAttribute($product, $entry)
 {
     $mapValue = $this->getProductAttributeValue($product);
     $description = $this->getGroupAttributeDescription();
     if (!is_null($description)) {
         $mapValue = $description->getProductAttributeValue($product);
     }
     if (!is_null($mapValue)) {
         $descrText = $mapValue;
     } elseif ($product->getDescription()) {
         $descrText = $product->getDescription();
     } else {
         $descrText = 'no description';
     }
     $descrText = Mage::helper('googleshopping')->cleanAtomAttribute($descrText);
     $entry->setContent($entry->getService()->newContent()->setText($descrText));
     return $entry;
 }