/** * @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 $validationNode */ $validationNode = $itemNode->addChildWithCDATA('validation', $this->getValue()); $validationNode->addAttribute('type', $this->getValidationType()); return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $tagNode */ $tagNode = $itemNode->addChildWithCDATA('tag', $this->getValue()); $tagNode->addAttribute('uid', $this->getUid()); return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $attributeNode */ $attributeNode = $itemNode->addChildWithCDATA('attribute_group', $this->getLabel()); $attributeNode->addAttribute('uid', $this->getUid()); return $itemNode; }
/** * @param Shopgate_Model_XmlResultObject $itemNode * * @return Shopgate_Model_XmlResultObject */ public function asXml(Shopgate_Model_XmlResultObject $itemNode) { /** * @var Shopgate_Model_XmlResultObject $stockNode */ $identifierNode = $itemNode->addChildWithCDATA('identifier', $this->getValue()); $identifierNode->addAttribute('uid', $this->getUid()); $identifierNode->addAttribute('type', $this->getType()); 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 $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 $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 $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; }
/** * @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 $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->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; }
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 $childItem * * @return SimpleXMLElement */ public function removeEmptyNodes($childItem) { $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; $doc->loadXML($childItem->asXML()); $xpath = new DOMXPath($doc); $xpQuery = '//*[not(@forceEmpty) and not(descendant::*[@forceEmpty]) and normalize-space() = ""]'; /** @var DOMElement $node */ foreach ($xpath->query($xpQuery) as $node) { $node->parentNode->removeChild($node); } foreach ($xpath->query('//*[@forceEmpty]') as $node) { $node->removeAttribute('forceEmpty'); } return simplexml_import_dom($doc); }
/** * @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; }