当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_XmlConnect_Model_Simplexml_Element::xmlentities方法代码示例

本文整理汇总了PHP中Mage_XmlConnect_Model_Simplexml_Element::xmlentities方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_XmlConnect_Model_Simplexml_Element::xmlentities方法的具体用法?PHP Mage_XmlConnect_Model_Simplexml_Element::xmlentities怎么用?PHP Mage_XmlConnect_Model_Simplexml_Element::xmlentities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_XmlConnect_Model_Simplexml_Element的用法示例。


在下文中一共展示了Mage_XmlConnect_Model_Simplexml_Element::xmlentities方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _toHtml

 /**
  * Render shipping methods xml
  *
  * @return string
  */
 protected function _toHtml()
 {
     $methodsXmlObj = new Mage_XmlConnect_Model_Simplexml_Element('<shipping_methods></shipping_methods>');
     $_shippingRateGroups = $this->getShippingRates();
     if ($_shippingRateGroups) {
         $store = $this->getQuote()->getStore();
         $_sole = count($_shippingRateGroups) == 1;
         foreach ($_shippingRateGroups as $code => $_rates) {
             $methodXmlObj = $methodsXmlObj->addChild('method');
             $methodXmlObj->addAttribute('label', $methodsXmlObj->xmlentities(strip_tags($this->getCarrierName($code))));
             $ratesXmlObj = $methodXmlObj->addChild('rates');
             $_sole = $_sole && count($_rates) == 1;
             foreach ($_rates as $_rate) {
                 $rateXmlObj = $ratesXmlObj->addChild('rate');
                 $rateXmlObj->addAttribute('label', $methodsXmlObj->xmlentities(strip_tags($_rate->getMethodTitle())));
                 $rateXmlObj->addAttribute('code', $_rate->getCode());
                 if ($_rate->getErrorMessage()) {
                     $rateXmlObj->addChild('error_message', $methodsXmlObj->xmlentities(strip_tags($_rate->getErrorMessage())));
                 } else {
                     $price = Mage::helper('tax')->getShippingPrice($_rate->getPrice(), Mage::helper('tax')->displayShippingPriceIncludingTax(), $this->getAddress());
                     $formattedPrice = $store->convertPrice($price, true, false);
                     $rateXmlObj->addAttribute('price', Mage::helper('xmlconnect')->formatPriceForXml($store->convertPrice($price, false, false)));
                     $rateXmlObj->addAttribute('formated_price', $formattedPrice);
                 }
             }
         }
     } else {
         Mage::throwException($this->__('Sorry, no quotes are available for this order at this time.'));
     }
     return $methodsXmlObj->asNiceXml();
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:36,代码来源:Avaliable.php

示例2: reviewToXmlObject

 /**
  * Retrieve review data as xml object
  *
  * @param Mage_Review_Model_Review $review
  * @param string $itemNodeName
  * @return Mage_XmlConnect_Model_Simplexml_Element
  */
 public function reviewToXmlObject(Mage_Review_Model_Review $review, $itemNodeName = 'item')
 {
     $rating = 0;
     $item = new Mage_XmlConnect_Model_Simplexml_Element('<' . $itemNodeName . '></' . $itemNodeName . '>');
     if ($review->getId()) {
         $item->addChild('review_id', $review->getId());
         $item->addChild('created_at', $this->formatDate($review->getCreatedAt()));
         $item->addChild('title', $item->xmlentities(strip_tags($review->getTitle())));
         $item->addChild('nickname', $item->xmlentities(strip_tags($review->getNickname())));
         $detail = $item->xmlentities($review->getDetail());
         if ($itemNodeName == 'item') {
             $remainder = '';
             $deviceType = Mage::helper('xmlconnect')->getDeviceType();
             if ($deviceType != Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD) {
                 $detail = Mage::helper('core/string')->truncate($detail, self::REVIEW_DETAIL_TRUNCATE_LEN, '', $remainder, false);
             }
         }
         $item->addChild('detail', $detail);
         $summary = Mage::getModel('rating/rating')->getReviewSummary($review->getId());
         if ($summary->getCount() > 0) {
             $rating = round($summary->getSum() / $summary->getCount() / 10);
         }
         if ($rating) {
             $item->addChild('rating_votes', $rating);
         }
     }
     return $item;
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:35,代码来源:Review.php

示例3: _toHtml

 /**
  * Render customer wishlist xml
  *
  * @return string
  */
 protected function _toHtml()
 {
     $wishlistXmlObj = new Mage_XmlConnect_Model_Simplexml_Element('<wishlist></wishlist>');
     $hasMoreItems = 0;
     /**
      * Apply offset and count
      */
     $request = $this->getRequest();
     $offset = (int) $request->getParam('offset', 0);
     $count = (int) $request->getParam('count', 0);
     $count = $count <= 0 ? 1 : $count;
     if ($offset + $count < $this->getWishlistItems()->getSize()) {
         $hasMoreItems = 1;
     }
     $this->getWishlistItems()->getSelect()->limit($count, $offset);
     $wishlistXmlObj->addAttribute('items_count', $this->getWishlistItemsCount());
     $wishlistXmlObj->addAttribute('has_more_items', $hasMoreItems);
     if ($this->hasWishlistItems()) {
         /**
          * @var Mage_Wishlist_Model_Mysql4_Product_Collection
          */
         foreach ($this->getWishlistItems() as $item) {
             $itemXmlObj = $wishlistXmlObj->addChild('item');
             $itemXmlObj->addChild('item_id', $item->getWishlistItemId());
             $itemXmlObj->addChild('entity_id', $item->getProductId());
             $itemXmlObj->addChild('entity_type_id', $item->getProduct()->getTypeId());
             $itemXmlObj->addChild('name', $wishlistXmlObj->xmlentities(strip_tags($item->getName())));
             $itemXmlObj->addChild('in_stock', (int) $item->getProduct()->isInStock());
             $itemXmlObj->addChild('is_salable', (int) $item->getProduct()->getIsSalable());
             /**
              * If product type is grouped than it has options as its grouped items
              */
             if ($item->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type_Grouped::TYPE_CODE) {
                 $item->setHasOptions(true);
             }
             $itemXmlObj->addChild('has_options', (int) $item->getHasOptions());
             $icon = $this->helper('catalog/image')->init($item->getProduct(), 'small_image')->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('product_small'));
             $iconXml = $itemXmlObj->addChild('icon', $icon);
             $file = Mage::helper('xmlconnect')->urlToPath($icon);
             $iconXml->addAttribute('modification_time', filemtime($file));
             $description = $wishlistXmlObj->xmlentities(strip_tags($item->getDescription()));
             $itemXmlObj->addChild('description', $description);
             $addedDate = $wishlistXmlObj->xmlentities($this->getFormatedDate($item->getAddedAt()));
             $itemXmlObj->addChild('added_date', $addedDate);
             if ($this->getChild('product_price')) {
                 $this->getChild('product_price')->setProduct($item->getProduct())->setProductXmlObj($itemXmlObj)->collectProductPrices();
             }
             if (!$item->getProduct()->getRatingSummary()) {
                 Mage::getModel('review/review')->getEntitySummary($item->getProduct(), Mage::app()->getStore()->getId());
             }
             $ratingSummary = (int) $item->getProduct()->getRatingSummary()->getRatingSummary();
             $itemXmlObj->addChild('rating_summary', round($ratingSummary / 10));
             $itemXmlObj->addChild('reviews_count', $item->getProduct()->getRatingSummary()->getReviewsCount());
         }
     }
     return $wishlistXmlObj->asNiceXml();
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:62,代码来源:Wishlist.php

示例4: productToXmlObject

 /**
  * Retrieve product attributes as xml object
  *
  * @param Mage_Catalog_Model_Product $product
  * @param string $itemNodeName
  *
  * @return Mage_XmlConnect_Model_Simplexml_Element
  */
 public function productToXmlObject(Mage_Catalog_Model_Product $product, $itemNodeName = 'item')
 {
     $item = new Mage_XmlConnect_Model_Simplexml_Element('<' . $itemNodeName . '></' . $itemNodeName . '>');
     if ($product && $product->getId()) {
         $item->addChild('entity_id', $product->getId());
         $item->addChild('name', $item->xmlentities(strip_tags($product->getName())));
         $item->addChild('entity_type', $product->getTypeId());
         $item->addChild('short_description', $item->xmlentities(strip_tags($product->getShortDescription())));
         $description = Mage::helper('xmlconnect')->htmlize($item->xmlentities($product->getDescription()));
         $item->addChild('description', $description);
         $item->addChild('link', $product->getProductUrl());
         if ($itemNodeName == 'item') {
             $imageToResize = Mage::helper('xmlconnect/image')->getImageSizeForContent('product_small');
             $propertyToResizeName = 'small_image';
         } else {
             $imageToResize = Mage::helper('xmlconnect/image')->getImageSizeForContent('product_big');
             $propertyToResizeName = 'image';
         }
         $icon = clone Mage::helper('catalog/image')->init($product, $propertyToResizeName)->resize($imageToResize);
         $iconXml = $item->addChild('icon', $icon);
         $file = Mage::helper('xmlconnect')->urlToPath($icon);
         $iconXml->addAttribute('modification_time', filemtime($file));
         $item->addChild('in_stock', (int) $product->isInStock());
         $item->addChild('is_salable', (int) $product->isSalable());
         /**
          * By default all products has gallery (because of collection not load gallery attribute)
          */
         $hasGallery = 1;
         if ($product->getMediaGalleryImages()) {
             $hasGallery = sizeof($product->getMediaGalleryImages()) > 0 ? 1 : 0;
         }
         $item->addChild('has_gallery', $hasGallery);
         /**
          * If product type is grouped than it has options as its grouped items
          */
         if ($product->getTypeId() == Mage_Catalog_Model_Product_Type_Grouped::TYPE_CODE) {
             $product->setHasOptions(true);
         }
         $item->addChild('has_options', (int) $product->getHasOptions());
         if ($minSaleQty = $this->_getMinimalQty($product)) {
             $item->addChild('min_sale_qty', (int) $minSaleQty);
         }
         if (!$product->getRatingSummary()) {
             Mage::getModel('review/review')->getEntitySummary($product, Mage::app()->getStore()->getId());
         }
         $item->addChild('rating_summary', round((int) $product->getRatingSummary()->getRatingSummary() / 10));
         $item->addChild('reviews_count', $product->getRatingSummary()->getReviewsCount());
         if ($this->getChild('product_price')) {
             $this->getChild('product_price')->setProduct($product)->setProductXmlObj($item)->collectProductPrices();
         }
         if ($this->getChild('additional_info')) {
             $this->getChild('additional_info')->addAdditionalData($product, $item);
         }
     }
     return $item;
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:64,代码来源:Product.php

示例5: _toHtml

 /**
  * Render cross sell items xml
  *
  * @return string
  */
 protected function _toHtml()
 {
     $crossSellXmlObj = new Mage_XmlConnect_Model_Simplexml_Element('<crosssell></crosssell>');
     if (!$this->getItemCount()) {
         return $crossSellXmlObj->asNiceXml();
     }
     foreach ($this->getItems() as $_item) {
         $itemXmlObj = $crossSellXmlObj->addChild('item');
         $itemXmlObj->addChild('name', $crossSellXmlObj->xmlentities(strip_tags($_item->getName())));
         $icon = $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('product_small'));
         $iconXml = $itemXmlObj->addChild('icon', $icon);
         $file = Mage::helper('xmlconnect')->urlToPath($icon);
         $iconXml->addAttribute('modification_time', filemtime($file));
         $itemXmlObj->addChild('entity_id', $_item->getId());
         $itemXmlObj->addChild('entity_type', $_item->getTypeId());
         $itemXmlObj->addChild('has_options', (int) $_item->getHasOptions());
         if ($this->getChild('product_price')) {
             $this->getChild('product_price')->setProduct($_item)->setProductXmlObj($itemXmlObj)->collectProductPrices();
         }
         if (!$_item->getRatingSummary()) {
             Mage::getModel('review/review')->getEntitySummary($_item, Mage::app()->getStore()->getId());
         }
         $itemXmlObj->addChild('rating_summary', round((int) $_item->getRatingSummary()->getRatingSummary() / 10));
         $itemXmlObj->addChild('reviews_count', $_item->getRatingSummary()->getReviewsCount());
     }
     return $crossSellXmlObj->asNiceXml();
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:32,代码来源:Crosssell.php

示例6: _toHtml

 /**
  * Render agreements xml
  *
  * @return string
  */
 protected function _toHtml()
 {
     $agreementsXmlObj = new Mage_XmlConnect_Model_Simplexml_Element('<agreements></agreements>');
     if ($this->getAgreements()) {
         foreach ($this->getAgreements() as $agreement) {
             $itemXmlObj = $agreementsXmlObj->addChild('item');
             $content = $agreementsXmlObj->xmlentities($agreement->getContent());
             if (!$agreement->getIsHtml()) {
                 $content = nl2br(strip_tags($content));
             }
             $itemXmlObj->addChild('label', $agreementsXmlObj->xmlentities(strip_tags($agreement->getCheckboxText())));
             $itemXmlObj->addChild('content', $content);
             $itemXmlObj->addChild('code', 'agreement[' . $agreement->getId() . ']');
             $itemXmlObj->addChild('agreement_id', $agreement->getId());
         }
     }
     return $agreementsXmlObj->asNiceXml();
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:23,代码来源:Agreements.php

示例7: _toHtml

 /**
  * Render block HTML
  *
  * @return string
  */
 protected function _toHtml()
 {
     $categoryXmlObj = new Mage_XmlConnect_Model_Simplexml_Element('<category></category>');
     $categoryId = $this->getRequest()->getParam('id', null);
     if ($categoryId === null) {
         $categoryId = Mage::app()->getStore()->getRootCategoryId();
     }
     $productsXmlObj = $productListBlock = false;
     $categoryModel = Mage::getModel('catalog/category')->load($categoryId);
     if ($categoryModel->getId()) {
         $hasMoreProductItems = 0;
         $productListBlock = $this->getChild('product_list');
         if ($productListBlock && $categoryModel->getLevel() > 1) {
             $layer = Mage::getSingleton('catalog/layer');
             $productsXmlObj = $productListBlock->setCategory($categoryModel)->setLayer($layer)->getProductsXmlObject();
             $hasMoreProductItems = (int) $productListBlock->getHasProductItems();
         }
         $infoBlock = $this->getChild('category_info');
         if ($infoBlock) {
             $categoryInfoXmlObj = $infoBlock->setCategory($categoryModel)->getCategoryInfoXmlObject();
             $categoryInfoXmlObj->addChild('has_more_items', $hasMoreProductItems);
             $categoryXmlObj->appendChild($categoryInfoXmlObj);
         }
     }
     /** @var $categoryCollection Mage_XmlConnect_Model_Mysql4_Category_Collection */
     $categoryCollection = Mage::getResourceModel('xmlconnect/category_collection');
     $categoryCollection->setStoreId(Mage::app()->getStore()->getId())->setOrder('position', 'ASC')->addParentIdFilter($categoryId);
     // subcategories are exists
     if (sizeof($categoryCollection)) {
         $itemsXmlObj = $categoryXmlObj->addChild('items');
         foreach ($categoryCollection->getItems() as $item) {
             $itemXmlObj = $itemsXmlObj->addChild('item');
             $itemXmlObj->addChild('label', $categoryXmlObj->xmlentities(strip_tags($item->getName())));
             $itemXmlObj->addChild('entity_id', $item->getEntityId());
             $itemXmlObj->addChild('content_type', $item->hasChildren() ? 'categories' : 'products');
             if (!is_null($categoryId)) {
                 $itemXmlObj->addChild('parent_id', $item->getParentId());
             }
             $icon = Mage::helper('xmlconnect/catalog_category_image')->initialize($item, 'thumbnail')->resize(Mage::helper('xmlconnect/image')->getImageSizeForContent('category'));
             $iconXml = $itemXmlObj->addChild('icon', $icon);
             $file = Mage::helper('xmlconnect')->urlToPath($icon);
             $iconXml->addAttribute('modification_time', filemtime($file));
         }
     }
     if ($productListBlock && $productsXmlObj) {
         $categoryXmlObj->appendChild($productsXmlObj);
     }
     return $categoryXmlObj->asNiceXml();
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:54,代码来源:Category.php

示例8: getProductCustomOptionsXmlObject

 /**
  * Create produc custom options Mage_XmlConnect_Model_Simplexml_Element object
  *
  * @param Mage_Catalog_Model_Product $product
  * @return Mage_XmlConnect_Model_Simplexml_Element
  */
 public function getProductCustomOptionsXmlObject(Mage_Catalog_Model_Product $product)
 {
     $xmlModel = new Mage_XmlConnect_Model_Simplexml_Element('<product></product>');
     $optionsNode = $xmlModel->addChild('options');
     if (!$product->getId()) {
         return $xmlModel;
     }
     $xmlModel->addAttribute('id', $product->getId());
     if (!$product->isSaleable() || !sizeof($product->getOptions())) {
         return $xmlModel;
     }
     foreach ($product->getOptions() as $option) {
         $optionNode = $optionsNode->addChild('option');
         $type = $this->_getOptionTypeForXmlByRealType($option->getType());
         $code = 'options[' . $option->getId() . ']';
         if ($type == self::OPTION_TYPE_CHECKBOX) {
             $code .= '[]';
         }
         $optionNode->addAttribute('code', $code);
         $optionNode->addAttribute('type', $type);
         $optionNode->addAttribute('label', $xmlModel->xmlentities(strip_tags($option->getTitle())));
         if ($option->getIsRequire()) {
             $optionNode->addAttribute('is_required', 1);
         }
         /**
          * Process option price
          */
         $price = Mage::helper('xmlconnect')->formatPriceForXml($option->getPrice());
         if ($price > 0.0) {
             $optionNode->addAttribute('price', $price);
             $formatedPrice = Mage::app()->getStore($product->getStoreId())->formatPrice($price, false);
             $optionNode->addAttribute('formated_price', $formatedPrice);
         }
         if ($type == self::OPTION_TYPE_CHECKBOX || $type == self::OPTION_TYPE_SELECT) {
             foreach ($option->getValues() as $value) {
                 $valueNode = $optionNode->addChild('value');
                 $valueNode->addAttribute('code', $value->getId());
                 $valueNode->addAttribute('label', $xmlModel->xmlentities(strip_tags($value->getTitle())));
                 $price = Mage::helper('xmlconnect')->formatPriceForXml($value->getPrice());
                 if ($price > 0.0) {
                     $valueNode->addAttribute('price', $price);
                     $formatedPrice = $this->_formatPriceString($price, $product);
                     $valueNode->addAttribute('formated_price', $formatedPrice);
                 }
             }
         }
     }
     return $xmlModel;
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:55,代码来源:Options.php

示例9: _toHtml

 /**
  * Render filters list xml
  *
  * @return string
  */
 protected function _toHtml()
 {
     $categoryId = $this->getRequest()->getParam('category_id', null);
     $categoryXmlObj = new Mage_XmlConnect_Model_Simplexml_Element('<category></category>');
     $filtersCollection = Mage::getResourceModel('xmlconnect/filter_collection')->setCategoryId($categoryId);
     $filtersXmlObj = $categoryXmlObj->addChild('filters');
     foreach ($filtersCollection->getItems() as $item) {
         if (!sizeof($item->getValues())) {
             continue;
         }
         $itemXmlObj = $filtersXmlObj->addChild('item');
         $itemXmlObj->addChild('name', $categoryXmlObj->xmlentities(strip_tags($item->getName())));
         $itemXmlObj->addChild('code', $categoryXmlObj->xmlentities($item->getCode()));
         $valuesXmlObj = $itemXmlObj->addChild('values');
         foreach ($item->getValues() as $value) {
             $valueXmlObj = $valuesXmlObj->addChild('value');
             $valueXmlObj->addChild('id', $categoryXmlObj->xmlentities($value->getValueString()));
             $valueXmlObj->addChild('label', $categoryXmlObj->xmlentities(strip_tags($value->getLabel())));
             $valueXmlObj->addChild('count', (int) $value->getProductsCount());
         }
     }
     $categoryXmlObj->appendChild($this->getProductSortFeildsXmlObject());
     return $categoryXmlObj->asNiceXml();
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:29,代码来源:Filters.php

示例10: _toHtml

 /**
  * Search suggestions xml renderer
  *
  * @return string
  */
 protected function _toHtml()
 {
     $suggestXmlObj = new Mage_XmlConnect_Model_Simplexml_Element('<suggestions></suggestions>');
     if (!$this->getRequest()->getParam('q', false)) {
         return $suggestXmlObj->asNiceXml();
     }
     $handler = Mage::getSingleton('factfinder_suggest/handler_suggest', array($this->getRequest()->getParam('q')));
     $suggestData = $handler->getSuggestionsAsArray();
     if (!($count = count($suggestData))) {
         return $suggestXmlObj->asNiceXml();
     }
     $items = '';
     foreach ($suggestData as $index => $item) {
         $items .= $suggestXmlObj->xmlentities(strip_tags($item['query'])) . self::SUGGEST_ITEM_SEPARATOR . (int) $item['hitCount'] . self::SUGGEST_ITEM_SEPARATOR;
     }
     $suggestXmlObj = new Mage_XmlConnect_Model_Simplexml_Element('<suggestions>' . $items . '</suggestions>');
     return $suggestXmlObj->asNiceXml();
 }
开发者ID:KaiStapel,项目名称:Magento-FACTFinder,代码行数:23,代码来源:Suggest.php

示例11: getProductSortFeildsXmlObject

 /**
  * Retrieve product sort fields as xml object
  *
  * @return Mage_XmlConnect_Model_Simplexml_Element
  */
 public function getProductSortFeildsXmlObject()
 {
     $ordersXmlObject = new Mage_XmlConnect_Model_Simplexml_Element('<orders></orders>');
     /* @var $category Mage_Catalog_Model_Category */
     $category = Mage::getModel('catalog/category');
     $sortOptions = $category->getAvailableSortByOptions();
     $sortOptions = array_slice($sortOptions, 0, self::PRODUCT_SORT_FIELDS_NUMBER);
     $defaultSort = $category->getDefaultSortBy();
     foreach ($sortOptions as $code => $name) {
         $item = $ordersXmlObject->addChild('item');
         if ($code == $defaultSort) {
             $item->addAttribute('isDefault', 1);
         }
         $item->addChild('code', $code);
         $item->addChild('name', $ordersXmlObject->xmlentities(strip_tags($name)));
     }
     return $ordersXmlObject;
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:23,代码来源:Catalog.php

示例12: _toHtml

 /**
  * Render billing shipping xml
  *
  * @return string
  */
 protected function _toHtml()
 {
     $shippingXmlObj = new Mage_XmlConnect_Model_Simplexml_Element('<shipping></shipping>');
     $addressId = $this->getAddress()->getId();
     $address = $this->getCustomer()->getPrimaryShippingAddress();
     if ($address) {
         $addressId = $address->getId();
     }
     foreach ($this->getCustomer()->getAddresses() as $address) {
         $item = $shippingXmlObj->addChild('item');
         if ($addressId == $address->getId()) {
             $item->addAttribute('selected', 1);
         }
         $this->getChild('address_list')->prepareAddressData($address, $item);
         $item->addChild('address_line', $shippingXmlObj->xmlentities($address->format('oneline')));
     }
     return $shippingXmlObj->asNiceXml();
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:23,代码来源:Shipping.php

示例13: getProductOptionsXml

 /**
  * Generate bundle product options xml
  *
  * @param Mage_Catalog_Model_Product $product
  * @param bool $isObject
  * @return string | Mage_XmlConnect_Model_Simplexml_Element
  */
 public function getProductOptionsXml(Mage_Catalog_Model_Product $product, $isObject = false)
 {
     $xmlModel = new Mage_XmlConnect_Model_Simplexml_Element('<product></product>');
     $optionsNode = $xmlModel->addChild('options');
     if (!$product->getId()) {
         return $isObject ? $xmlModel : $xmlModel->asNiceXml();
     }
     $xmlModel->addAttribute('id', $product->getId());
     if (!$product->isSaleable()) {
         return $isObject ? $xmlModel : $xmlModel->asNiceXml();
     }
     /**
      * Grouped (associated) products
      */
     $_associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
     if (!sizeof($_associatedProducts)) {
         return $isObject ? $xmlModel : $xmlModel->asNiceXml();
     }
     foreach ($_associatedProducts as $_item) {
         if (!$_item->isSaleable()) {
             continue;
         }
         $optionNode = $optionsNode->addChild('option');
         $optionNode->addAttribute('code', 'super_group[' . $_item->getId() . ']');
         $optionNode->addAttribute('type', 'product');
         $optionNode->addAttribute('label', $xmlModel->xmlentities(strip_tags($_item->getName())));
         $optionNode->addAttribute('is_qty_editable', 1);
         $optionNode->addAttribute('qty', $_item->getQty() * 1);
         /**
          * Process product price
          */
         if ($_item->getPrice() != $_item->getFinalPrice()) {
             $productPrice = $_item->getFinalPrice();
         } else {
             $productPrice = $_item->getPrice();
         }
         $productPrice = Mage::helper('xmlconnect')->formatPriceForXml($productPrice);
         if ($productPrice != 0.0) {
             $optionNode->addAttribute('price', Mage::helper('xmlconnect')->formatPriceForXml(Mage::helper('core')->currency($productPrice, false, false)));
             $optionNode->addAttribute('formated_price', $this->_formatPriceString($productPrice, $product));
         }
     }
     return $isObject ? $xmlModel : $xmlModel->asNiceXml();
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:51,代码来源:Grouped.php

示例14: _toHtml

 /**
  * Search suggestions xml renderer
  *
  * @return string
  */
 protected function _toHtml()
 {
     $suggestXmlObj = new Mage_XmlConnect_Model_Simplexml_Element('<suggestions></suggestions>');
     if (!$this->getRequest()->getParam('q', false)) {
         return $suggestXmlObj->asNiceXml();
     }
     $suggestData = $this->getSuggestData();
     if (!($count = count($suggestData))) {
         return $suggestXmlObj->asNiceXml();
     }
     $items = '';
     foreach ($suggestData as $index => $item) {
         $items .= $suggestXmlObj->xmlentities(strip_tags($item['title'])) . self::SUGGEST_ITEM_SEPARATOR . (int) $item['num_of_results'] . self::SUGGEST_ITEM_SEPARATOR;
         //            $itemXmlObj = $suggestXmlObj->addChild('item');
         //            $itemXmlObj->addChild('title', $suggestXmlObj->xmlentities(strip_tags($item['title'])));
         //            $itemXmlObj->addChild('count', (int)$item['num_of_results']);
     }
     $suggestXmlObj = new Mage_XmlConnect_Model_Simplexml_Element('<suggestions>' . $items . '</suggestions>');
     return $suggestXmlObj->asNiceXml();
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:25,代码来源:Suggest.php

示例15: _toHtml

 /**
  * Render customer orders list xml
  *
  * @return string
  */
 protected function _toHtml()
 {
     $ordersXmlObj = new Mage_XmlConnect_Model_Simplexml_Element('<orders></orders>');
     $orders = Mage::getResourceModel('sales/order_collection')->addFieldToSelect('*')->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId())->addFieldToFilter('state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()))->setOrder('created_at', 'desc');
     $orders->getSelect()->limit(self::ORDERS_LIST_LIMIT, 0);
     $orders->load();
     if (sizeof($orders->getItems())) {
         foreach ($orders as $_order) {
             $item = $ordersXmlObj->addChild('item');
             $item->addChild('entity_id', $_order->getId());
             $item->addChild('number', $_order->getRealOrderId());
             $item->addChild('date', $this->formatDate($_order->getCreatedAtStoreDate()));
             if ($_order->getShippingAddress()) {
                 $item->addChild('ship_to', $ordersXmlObj->xmlentities(strip_tags($_order->getShippingAddress()->getName())));
             }
             $item->addChild('total', $_order->getOrderCurrency()->formatPrecision($_order->getGrandTotal(), 2, array(), false, false));
             $item->addChild('status', $_order->getStatusLabel());
         }
     }
     return $ordersXmlObj->asNiceXml();
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:26,代码来源:List.php


注:本文中的Mage_XmlConnect_Model_Simplexml_Element::xmlentities方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。