/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** @var Shopgate_Model_XmlResultObject $categoryPathNode */ $categoryPathNode = $itemNode->addChild('category'); $categoryPathNode->addAttribute('uid', $this->getUid()); $categoryPathNode->addAttribute('sort_order', (int) $this->getSortOrder()); return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $shippingNode */ $shippingNode = $itemNode->addChild('shipping'); $shippingNode->addChild('costs_per_order', $this->getCostsPerOrder()); $shippingNode->addChild('additional_costs_per_unit', $this->getAdditionalCostsPerUnit()); $shippingNode->addChild('is_free', (int) $this->getIsFree()); return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $manufacturerNode */ $manufacturerNode = $itemNode->addChild('manufacturer'); $manufacturerNode->addAttribute('uid', $this->getUid()); $manufacturerNode->addChildWithCDATA('title', $this->getTitle(), false); $manufacturerNode->addChild('item_number', $this->getItemNumber(), null, false); return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $propertyNode */ $propertyNode = $itemNode->addChild('property'); $propertyNode->addAttribute('uid', $this->getUid()); $propertyNode->addChildWithCDATA('label', $this->getLabel()); $propertyNode->addChildWithCDATA('value', $this->getValue()); return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $optionNode */ $optionNode = $itemNode->addChild('option'); $optionNode->addAttribute('additional_price', $this->getAdditionalPrice()); $optionNode->addAttribute('uid', $this->getUid()); $optionNode->addChildWithCDATA('label', $this->getLabel()); $optionNode->addChildWithCDATA('value', $this->getValue()); return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $tierPriceNode */ $tierPriceNode = $itemNode->addChild('tier_price', $this->getReduction()); $tierPriceNode->addAttribute('aggregate_children', $this->getAggregateChildren()); $tierPriceNode->addAttribute('threshold', $this->getFromQuantity()); $tierPriceNode->addAttribute('max_quantity', $this->getToQuantity()); $tierPriceNode->addAttribute('type', $this->getReductionType()); $tierPriceNode->addAttribute('customer_group_uid', $this->getCustomerGroupUid()); return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $imageNode */ $imageNode = $itemNode->addChild('image'); $imageNode->addAttribute('uid', $this->getUid()); $imageNode->addAttribute('sort_order', $this->getSortOrder()); $imageNode->addAttribute('is_cover', $this->getIsCover()); $imageNode->addChildWithCDATA('url', $this->getUrl()); $imageNode->addChildWithCDATA('title', $this->getTitle()); $imageNode->addChildWithCDATA('alt', $this->getAlt()); return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $attachmentNode */ $attachmentNode = $itemNode->addChild('attachment'); $attachmentNode->addAttribute('number', $this->getNumber()); $attachmentNode->addChildWithCDATA('url', $this->getUrl()); $attachmentNode->addChild('mime_type', $this->getMimeType()); $attachmentNode->addChild('file_name', $this->getFileName()); $attachmentNode->addChildWithCDATA('title', $this->getTitle()); $attachmentNode->addChildWithCDATA('description', $this->getDescription()); return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $reviewNode */ $reviewNode = $itemNode->addChild('review'); $reviewNode->addAttribute('uid', $this->getUid()); $reviewNode->addChild('item_uid', $this->getItemUid()); $reviewNode->addChild('score', $this->getScore()); $reviewNode->addChildWithCDATA('reviewer_name', $this->getReviewerName()); $reviewNode->addChild('date', $this->getDate()); $reviewNode->addChildWithCDATA('title', $this->getTitle()); $reviewNode->addChildWithCDATA('text', $this->getText()); return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $stockNode */ $stockNode = $itemNode->addChild('stock'); $stockNode->addChild('is_saleable', (int) $this->getIsSaleable()); $stockNode->addChild('backorders', (int) $this->getBackorders()); $stockNode->addChild('use_stock', (int) $this->getUseStock()); $stockNode->addChild('stock_quantity', $this->getStockQuantity()); $stockNode->addChild('minimum_order_quantity', $this->getMinimumOrderQuantity(), null, false); $stockNode->addChild('maximum_order_quantity', $this->getMaximumOrderQuantity(), null, false); $stockNode->addChildWithCDATA('availability_text', $this->getAvailabilityText(), false); return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $relationNode */ $relationNode = $itemNode->addChild('relation'); $relationNode->addAttribute('type', $this->getType()); if ($this->getType() == self::DEFAULT_RELATION_TYPE_CUSTOM) { $relationNode->addChildWithCDATA('label', $this->getLabel()); } foreach ($this->getValues() as $value) { $relationNode->addChild('uid', $value); } return $itemNode; }
public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $tierPricesNode * @var Shopgate_Model_Catalog_TierPrice $customerGroupItem */ $pricesNode = $itemNode->addChild('prices'); $pricesNode->addAttribute('type', $this->getType()); $pricesNode->addChild('price', $this->getPrice()); $pricesNode->addChild('cost', $this->getCost()); $pricesNode->addChild('sale_price', $this->getSalePrice()); $pricesNode->addChild('msrp', $this->getMsrp()); $pricesNode->addChild('minimum_order_amount', $this->getMinimumOrderAmount()); $pricesNode->addChildWithCDATA('base_price', $this->getBasePrice()); $tierPricesNode = $pricesNode->addChild('tier_prices'); foreach ($this->getTierPricesGroup() as $customerGroupItem) { $customerGroupItem->asXml($tierPricesNode); } return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $inputNode * @var Shopgate_Model_XmlResultObject $optionsNode * @var Shopgate_Model_Catalog_Validation $validationItem * @var Shopgate_Model_Catalog_Option $optionItem */ $inputNode = $itemNode->addChild('input'); $inputNode->addAttribute('uid', $this->getUid()); $inputNode->addAttribute('type', $this->getType()); $inputNode->addAttribute('required', (int) $this->getRequired()); $inputNode->addAttribute('additional_price', $this->getAdditionalPrice()); $inputNode->addAttribute('sort_order', $this->getSortOrder()); $inputNode->addChildWithCDATA('label', $this->getLabel()); $inputNode->addChildWithCDATA('info_text', $this->getInfoText()); $optionsNode = $inputNode->addChild('options'); /** * options */ foreach ($this->getOptions() as $optionItem) { $optionItem->asXml($optionsNode); } /** * validation */ $this->getValidation()->asXml($inputNode); return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $categoryNode */ $categoryNode = $itemNode->addChild('category'); $categoryNode->addAttribute('uid', $this->getUid()); $categoryNode->addAttribute('sort_order', (int) $this->getSortOrder()); $categoryNode->addAttribute('parent_uid', $this->getParentUid() ? $this->getParentUid() : null); $categoryNode->addAttribute('is_active', (int) $this->getIsActive()); $categoryNode->addAttribute('is_anchor', (int) $this->getIsAnchor()); $categoryNode->addChildWithCDATA('name', $this->getName()); $categoryNode->addChildWithCDATA('deeplink', $this->getDeeplink()); /** * image */ $this->getImage()->asXml($categoryNode); return $itemNode; }
/** * generate xml result object * * @param Shopgate_Model_XmlResultObject $itemsNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemsNode) { /** * global info * * @var $itemNode Shopgate_Model_XmlResultObject */ $itemNode = $itemsNode->addChild(self::DEFAULT_ITEM_IDENTIFIER); $itemNode->addAttribute('uid', $this->getUid()); $itemNode->addAttribute('last_update', $this->getLastUpdate()); $itemNode->addChildWithCDATA('name', $this->getName()); $itemNode->addChild('tax_percent', $this->getTaxPercent(), null, false); $itemNode->addChild('tax_class', $this->getTaxClass(), null, false); $itemNode->addChild('currency', $this->getCurrency()); $itemNode->addChildWithCDATA('description', $this->getDescription()); $itemNode->addChildWithCDATA('deeplink', $this->getDeeplink()); $itemNode->addChild('promotion')->addAttribute('sort_order', $this->getPromotionSortOrder()); $itemNode->addChildWithCDATA('internal_order_info', $this->getInternalOrderInfo()); $itemNode->addChild('age_rating', $this->getAgeRating(), null, false); $itemNode->addChild('weight', $this->getWeight())->addAttribute('unit', $this->getWeightUnit()); /** * is default child */ if ($this->getIsChild()) { $itemNode->addAttribute('default_child', $this->getIsDefaultChild()); } /** * prices / tier prices */ $this->getPrice()->asXml($itemNode); /** * images * * @var Shopgate_Model_XmlResultObject $imagesNode * @var Shopgate_Model_Media_Image $imageItem */ $imagesNode = $itemNode->addChild('images'); foreach ($this->getImages() as $imageItem) { $imageItem->asXml($imagesNode); } /** * categories * * @var Shopgate_Model_XmlResultObject $categoryPathNode * @var Shopgate_Model_Catalog_CategoryPath $categoryPathItem */ $categoryPathNode = $itemNode->addChild('categories'); foreach ($this->getCategoryPaths() as $categoryPathItem) { $categoryPathItem->asXml($categoryPathNode); } /** * shipping */ $this->getShipping()->asXml($itemNode); /** * manufacture */ $this->getManufacturer()->asXml($itemNode); /** * visibility */ $this->getVisibility()->asXml($itemNode); /** * properties * * @var Shopgate_Model_XmlResultObject $propertiesNode * @var Shopgate_Model_Catalog_Property $propertyItem */ $propertiesNode = $itemNode->addChild('properties'); foreach ($this->getProperties() as $propertyItem) { $propertyItem->asXml($propertiesNode); } /** * stock */ $this->getStock()->asXml($itemNode); /** * identifiers * * @var Shopgate_Model_XmlResultObject $identifiersNode * @var Shopgate_Model_Catalog_Identifier $identifierItem */ $identifiersNode = $itemNode->addChild('identifiers'); foreach ($this->getIdentifiers() as $identifierItem) { $identifierItem->asXml($identifiersNode); } /** * tags * * @var Shopgate_Model_XmlResultObject $tagsNode * @var Shopgate_Model_Catalog_Tag $tagItem */ $tagsNode = $itemNode->addChild('tags'); foreach ($this->getTags() as $tagItem) { $tagItem->asXml($tagsNode); } /** * relations * * @var Shopgate_Model_XmlResultObject $relationsNode * @var Shopgate_Model_Catalog_Relation $relationItem */ $relationsNode = $itemNode->addChild('relations'); foreach ($this->getRelations() as $relationItem) { $relationItem->asXml($relationsNode); } /** * attribute / options * * @var Shopgate_Model_XmlResultObject $attributeGroupsNode * @var Shopgate_Model_XmlResultObject $attributesNode * @var Shopgate_Model_Catalog_Attribute $attributeItem * @var Shopgate_Model_Catalog_AttributeGroup $attributeGroupItem */ if ($this->getIsChild()) { $attributesNode = $itemNode->addChild('attributes'); foreach ($this->getAttributes() as $attributeItem) { $attributeItem->asXml($attributesNode); } } else { $attributeGroupsNode = $itemNode->addChild('attribute_groups'); foreach ($this->getAttributeGroups() as $attributeGroupItem) { $attributeGroupItem->asXml($attributeGroupsNode); } } /** * inputs * * @var Shopgate_Model_XmlResultObject $inputsNode * @var Shopgate_Model_Catalog_Input $inputItem */ $inputsNode = $itemNode->addChild('inputs'); foreach ($this->getInputs() as $inputItem) { $inputItem->asXml($inputsNode); } $itemNode->addChild('display_type', $this->getDisplayType()); /** * children * * @var Shopgate_Model_XmlResultObject $childrenNode * @var object $itemNode ->children * @var Shopgate_Model_Catalog_Product $child * @var Shopgate_Model_XmlResultObject $childXml */ if (!$this->getIsChild()) { $childrenNode = $itemNode->addChild('children'); foreach ($this->getChildren() as $child) { $child->asXml($childrenNode); } /** * remove empty nodes */ if (self::DEFAULT_CLEAN_CHILDREN_NODES && count($this->getChildren()) > 0) { foreach ($itemNode->children as $childXml) { $itemNode->replaceChild($this->removeEmptyNodes($childXml), $itemNode->children); } } } return $itemsNode; }