/** * @param Catalog_Model_Products $product * @return array */ public function productToArray(Catalog_Model_Products $product) { $item = array(); //$item['id'] = $product->getId(); $item['sku'] = $product->getSku(); $item['name'] = $product->getName(); $item['image'] = $product->getImage(); $item['uri'] = $product->getFullPath(); $item['description'] = $product->getDescription(); $item['note'] = $product->getNote(); return $item; }
/** * @param SimpleXMLElement $element * @param Catalog_Model_Products $product * @return SimpleXMLElement */ public function addProductXml(SimpleXMLElement $element, Catalog_Model_Products $product) { $element->addAttribute('id', $product->getid()); $element->addChild('title', $product->getName())->addAttribute('sku', $product->getSku()); $element->addChild('image', $product->getImage()); $draftImages = unserialize($product->getAImages()); $draft = !empty($draftImages) ? $draftImages[0] : null; $element->addChild('image', $draft); $element->addChild('description', $product->getDescription()); $element->addChild('note', $product->getNote()); $properties = $element->addChild('properties'); $this->addPropertiesProductXml($properties, $product); $modifications = $element->addChild('modificationsTable'); $this->addModificationTableXml($modifications, $product); return $element; }