/** * Return item stats array based on Zend Gdata Entry object * * @param Varien_Gdata_Gshopping_Entry $entry * @return array */ protected function _getEntryStats($entry) { $result = array(); $expirationDate = $entry->getContentAttributeByName('expiration_date'); if ($expirationDate instanceof Varien_Gdata_Gshopping_Extension_Attribute) { $result['expires'] = $this->convertContentDateToTimestamp($expirationDate->text); } return $result; }
/** * Insert/update attribute in the entry * * @param Varien_Gdata_Gshopping_Entry $entry * @param string $name * @param string $type * @param string $value * @param string $unit * @return Varien_Gdata_Gshopping_Entry */ protected function _setAttribute($entry, $name, $type = self::ATTRIBUTE_TYPE_TEXT, $value = '', $unit = null) { if (is_object($value) || (string) $value != $value) { Mage::throwException(Mage::helper('googleshopping')->__('The attribute "%s" has incorrect type for Google Shopping. The product with this attribute hasn\'t been updated in Google Content.', $name)); } $attribute = $entry->getContentAttributeByName($name); if ($attribute instanceof Varien_Gdata_Gshopping_Extension_Attribute) { $attribute->text = (string) $value; $attribute->type = $type; if (!is_null($unit)) { $attribute->unit = $unit; } } else { $entry->addContentAttribute($name, $value, $type, $unit); } return $entry; }