function _buildItemFromProduct($p) { $this->_getParentCategoryNames($categories = array(), $p->categories); $p->categories = array_reverse($categories); $p->link = HTTP_SERVER . DIR_WS_CATALOG . "index.php?main_page=product_info&products_id={$p->zen_id}"; $item = new GoogleBaseItem(); $item->setDraftStatus((bool) $this->getOption('draft')); $item->setTitle($p->title, 'text/html'); $item->setDescription($p->description, 'text/html'); $item->setAuthor($this->getOption('authorname'), $this->getOption('authoremail')); $item->setLink($p->link); $item->addGbaseAttribute('item_type', 'Products'); $item->addGbaseAttribute('quantity', $p->quantity); $item->addGbaseAttribute('price', $p->price); $item->addGbaseAttribute('id', $p->zen_id); $item->addGbaseAttribute('zen_id', $p->zen_id, 'int', true); $item->addGbaseAttribute('condition', 'new'); if (zen_not_null($p->image_link)) { $item->addGbaseAttribute('image_link', DIR_WS_CATALOG_IMAGES . $p->image_link); } if (zen_not_null($p->weight)) { $item->addGbaseAttribute('weight', $p->weight . ' ' . TEXT_PRODUCT_WEIGHT_UNIT, 'numberunit'); } if (zen_not_null($p->upc)) { $item->addGbaseAttribute('upc', $p->upc); } if (zen_not_null($p->isbn)) { $item->addGbaseAttribute('isbn', $p->isbn); } if (defined('MODULE_PAYMENT_GOOGLECHECKOUT_STATUS') && constant('MODULE_PAYMENT_GOOGLECHECKOUT_STATUS') == 'True') { $item->addGbaseAttribute('payment_notes', 'Google Checkout'); } foreach ($p->categories as $cat) { $item->addGbaseAttribute('product_type', $cat); } return $item; }
/** * Adds an item for update. * * @param GoogleBaseItem $item The item to be updated. */ function addItemForUpdate($item) { $this->_update[$item->getId()] = $item; }
/** * */ function _parseEntries() { if ($this->_response->hasErrors()) { return; } $pxml = $this->_response->getParsedXmlResponseBody(); /* $this->_updated = $pxml['xmldata']['feed']['updated']['VALUE']; $this->_title = $pxml['xmldata']['feed']['title']['VALUE']; */ $totalResults = (int) @$pxml['xmldata']['feed']['openSearch:totalResults']['VALUE']; if ($totalResults != 0) { if ($totalResults == 1) { $entries = array($pxml['xmldata']['feed']['entry']); } else { $entries = @$pxml['xmldata']['feed']['entry']; } foreach ($entries as $entry) { $item = new GoogleBaseItem(); $item->takeFromArray($entry); $this->_entries[] = $item; } } }