本文整理汇总了PHP中Mage_XmlConnect_Model_Simplexml_Element::addCustomChild方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_XmlConnect_Model_Simplexml_Element::addCustomChild方法的具体用法?PHP Mage_XmlConnect_Model_Simplexml_Element::addCustomChild怎么用?PHP Mage_XmlConnect_Model_Simplexml_Element::addCustomChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_XmlConnect_Model_Simplexml_Element
的用法示例。
在下文中一共展示了Mage_XmlConnect_Model_Simplexml_Element::addCustomChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addPaymentInfoToXmlObj
/**
* Add Check / Money order info to order XML object
*
* @param Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj
* @return Mage_XmlConnect_Model_Simplexml_Element
*/
public function addPaymentInfoToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
{
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
$orderItemXmlObj->addAttribute('title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle()));
if ($this->getInfo()->getAdditionalData()) {
if ($this->getPayableTo()) {
$orderItemXmlObj->addCustomChild('item', $this->getPayableTo(), array('label' => Mage::helper('sales')->__('Make Check payable to:')));
}
if ($this->getMailingAddress()) {
$orderItemXmlObj->addCustomChild('item', $this->getMailingAddress(), array('label' => Mage::helper('payment')->__('Send Check to:')));
}
}
}
示例2: addToXmlObjectApi23
/**
* Add order total rendered to XML object. Api version 23
*
* @param $totalsXml Mage_XmlConnect_Model_Simplexml_Element
* @return null
*/
public function addToXmlObjectApi23(Mage_XmlConnect_Model_Simplexml_Element $totalsXml)
{
$cards = $this->getGiftCards();
if ($cards) {
foreach ($cards as $card) {
$label = Mage::helper('enterprise_giftcardaccount')->__('Gift Card (%s)', $card->getCode());
$totalsXml->addCustomChild('item', '-' . $this->_formatPrice($card->getAmount()), array('id' => $this->getTotal()->getCode(), 'label' => $label));
}
} else {
$cardsAmount = $this->getSource()->getGiftCardsAmount();
if ($cardsAmount > 0) {
$totalsXml->addCustomChild($this->getTotal()->getCode(), '-' . $this->_formatPrice($cardsAmount), array('label' => Mage::helper('enterprise_giftcardaccount')->__('Gift Card')));
}
}
}
示例3: addLastOrdersToXmlObj
/**
* Add last orders info to xml object
*
* @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
* @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_LastOrders
*/
public function addLastOrdersToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
{
if (!Mage::helper('core')->isModuleEnabled('Mage_Reports')) {
return $this;
}
/** @var $collection Mage_Reports_Model_Resource_Order_Collection */
$collection = Mage::getResourceModel('reports/order_collection')->addItemCountExpr()->joinCustomerName('customer')->orderByCreatedAt()->setPageSize(self::LAST_ORDER_COUNT_LIMIT);
foreach (Mage::helper('xmlconnect/adminApplication')->getSwitcherList() as $storeId) {
if ($storeId) {
$collection->addAttributeToFilter('store_id', $storeId);
$collection->addRevenueToSelect();
} else {
$collection->addRevenueToSelect(true);
}
$this->setCollection($collection);
$orderList = $this->_prepareColumns()->getCollection()->load();
$valuesXmlObj = $xmlObj->addCustomChild('values', null, array('store_id' => $storeId ? $storeId : Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS));
foreach ($orderList as $order) {
$itemXmlObj = $valuesXmlObj->addCustomChild('item');
$itemXmlObj->addCustomChild('customer', $order->getCustomer(), array('label' => $this->__('Customer')));
$itemXmlObj->addCustomChild('items_count', $order->getItemsCount(), array('label' => $this->__('Items')));
$currency_code = Mage::app()->getStore($storeId)->getBaseCurrencyCode();
$itemXmlObj->addCustomChild('currency', Mage::app()->getLocale()->currency($currency_code)->toCurrency($order->getRevenue()), array('label' => $this->__('Grand Total')));
}
$collection->clear();
}
return $this;
}
示例4: _addOldStandardValue
/**
* Get values using old standard
*
* @deprecated old output standard
* @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
* @return Mage_XmlConnect_Model_Simplexml_Form_Element_CountryListSelect
*/
protected function _addOldStandardValue(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
{
$countries = $this->_getCountryOptions();
if (is_array($countries)) {
$valuesXmlObj = $xmlObj->addCustomChild('values');
foreach ($countries as $data) {
$regions = array();
if ($data['value']) {
$regions = $this->_getRegionOptions($data['value']);
}
$relationType = is_array($regions) && !empty($regions) ? 'region_id' : 'region';
$selectedCountry = array();
if ($this->getCountryId() == $data['value']) {
$selectedCountry = array('selected' => 1);
}
$item = $valuesXmlObj->addCustomChild('item', null, array('relation' => $relationType) + $selectedCountry);
$item->addCustomChild('label', (string) $data['label']);
$item->addCustomChild('value', $data['value']);
if ($relationType == 'region_id') {
$regionsXmlObj = $item->addCustomChild('regions');
foreach ($regions as $regionData) {
$selectedRegion = array();
if (!empty($selectedCountry) && $this->getRegionId() == $regionData['value']) {
$selectedRegion = array('selected' => 1);
}
$regionItem = $regionsXmlObj->addCustomChild('region_item', null, $selectedRegion);
$regionItem->addCustomChild('label', (string) $regionData['label']);
$regionItem->addCustomChild('value', (string) $regionData['value']);
}
}
}
}
return $this;
}
示例5: _addLocalization
/**
* Add localization data to xml object
*
* @param Mage_XmlConnect_Model_Simplexml_Element $xml
* @return Mage_XmlConnect_Block_Adminhtml_Connect_Config
*/
protected function _addLocalization(Mage_XmlConnect_Model_Simplexml_Element $xml)
{
/** @var $translateHelper Mage_XmlConnect_Helper_Translate */
$translateHelper = Mage::helper('xmlconnect/translate');
$xml->addCustomChild('localization', $this->getUrl('*/*/localization'), array('hash' => sha1(serialize($translateHelper->getLocalizationArray()))));
return $this;
}
示例6: addToXmlObjectApi23
/**
* Add order total rendered to XML object. Api version 23
*
* @param $totalsXml Mage_XmlConnect_Model_Simplexml_Element
* @return null
*/
public function addToXmlObjectApi23(Mage_XmlConnect_Model_Simplexml_Element $totalsXml)
{
$balance = $this->getSource()->getCustomerBalanceAmount();
if ($balance) {
$totalsXml->addCustomChild('item', '-' . $this->_formatPrice($balance), array('id' => $this->getTotal()->getCode(), 'label' => Mage::helper('enterprise_giftcardaccount')->__('Store Credit')));
}
}
示例7: addGraphInfoToXmlObj
/**
* Add last orders info to xml object
*
* @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
* @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphInfo
*/
public function addGraphInfoToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
{
/** @var $graphInfoXmlObj Mage_XmlConnect_Model_Simplexml_Element */
$graphInfoXmlObj = $xmlObj->addCustomChild('chart');
$this->_addRangeValues($graphInfoXmlObj)->_addDataSelector($graphInfoXmlObj)->_addTotalsBar($graphInfoXmlObj);
$graphInfoXmlObj = $graphInfoXmlObj->addCustomChild('chart_data');
$this->_addChartDataOrders($graphInfoXmlObj)->_addChartDataAmounts($graphInfoXmlObj);
return $this;
}
示例8: addPaymentInfoToXmlObj
/**
* Add CC Save Payment info to order XML object
*
* @param Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj
* @return Mage_XmlConnect_Model_Simplexml_Element
*/
public function addPaymentInfoToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
{
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
$orderItemXmlObj->addAttribute('title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle()));
if ($_specificInfo = $this->getSpecificInformation()) {
foreach ($_specificInfo as $label => $value) {
$orderItemXmlObj->addCustomChild('item', implode($this->getValueAsArray($value, true), '\\n'), array('label' => $label));
}
}
}
示例9: _addValue
/**
* Add value to element
*
* @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
* @return Mage_XmlConnect_Model_Simplexml_Form_Element_Abstract
*/
protected function _addValue(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
{
$values = $this->getEscapedValue();
if (!empty($values)) {
$valuesXmlObj = $xmlObj->addCustomChild('values');
foreach ($values as $element => $config) {
$valuesXmlObj->addCustomChild('item', null, array('id' => $config['id'], 'title' => $config['title'], 'label' => $config['label'], 'type' => $element, 'value' => $config['value']));
}
}
return $this;
}
示例10: _addOptions
/**
* Add options to select
*
* @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
* @return Mage_XmlConnect_Model_Simplexml_Form_Element_Select
*/
protected function _addOptions(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
{
if ($this->getOptions() && is_array($this->getOptions())) {
$valuesXmlObj = $xmlObj->addCustomChild('values');
foreach ($this->getOptions() as $option) {
if (!isset($option['value']) || $option['value'] == '') {
continue;
}
$valuesXmlObj->addCustomChild('item', null, array('label' => $option['label'], 'value' => $option['value']));
}
}
}
示例11: addItemToXmlObject
/**
* Add item to XML object
* (get from template: downloadable/sales/order/items/renderer/downloadable.phtml)
*
* @param Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj
* @return null
*/
public function addItemToXmlObject(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
{
/** @var $item Mage_Sales_Model_Order_Item */
$item = $this->getItem();
/** @var $itemXml Mage_XmlConnect_Model_Simplexml_Element */
$itemXml = $orderItemXmlObj->addCustomChild('item', null, array('product_id' => $item->getProductId()));
$itemXml->addCustomChild('name', $item->getName());
/** @var $weeeHelper Mage_Weee_Helper_Data */
$weeeHelper = $this->helper('weee');
/** @var $taxHelper Mage_Tax_Helper_Data */
$taxHelper = $this->helper('tax');
Mage::helper('xmlconnect/customer_order')->addItemOptionsToXml($this, $itemXml);
$addtInfoBlock = $this->getProductAdditionalInformationBlock();
if ($addtInfoBlock) {
// TODO: find how to set additional info block
// $addtInfoBlock->setItem($item)->toHtml();
}
$links = $this->getLinks();
if ($links) {
$linksXml = $itemXml->addCustomChild('links', null, array('label' => $this->getLinksTitle()));
foreach ($links->getPurchasedItems() as $link) {
$linksXml->addCustomChild('link', $link->getLinkTitle());
}
}
$itemXml->addCustomChild('entity_type', $item->getProductType());
$itemXml->addCustomChild('description', $item->getDescription());
$itemXml->addCustomChild('sku', Mage::helper('core/string')->splitInjection($this->getSku()));
/** @var $priceXml Mage_XmlConnect_Model_Simplexml_Element */
$priceXml = $itemXml->addChild('price');
// Quantity: Ordered, Shipped, Cancelled, Refunded
Mage::helper('xmlconnect/customer_order')->addQuantityToXml($this, $itemXml->addChild('qty'), $item);
/** @var $subtotalXml Mage_XmlConnect_Model_Simplexml_Element */
$subtotalXml = $itemXml->addChild('subtotal');
$this->setWeeeTaxAppliedAmount($item->getWeeeTaxAppliedAmount());
$this->setWeeeTaxDisposition($item->getWeeeTaxDisposition());
$typeOfDisplay1 = $weeeHelper->typeOfDisplay($item, 1, 'sales') && $this->getWeeeTaxAppliedAmount();
$typeOfDisplay2 = $weeeHelper->typeOfDisplay($item, 2, 'sales') && $this->getWeeeTaxAppliedAmount();
$typeOfDisplay4 = $weeeHelper->typeOfDisplay($item, 4, 'sales') && $this->getWeeeTaxAppliedAmount();
$typeOfDisplay014 = $weeeHelper->typeOfDisplay($item, array(0, 1, 4), 'sales') && $this->getWeeeTaxAppliedAmount();
$this->setTypesOfDisplay(array(Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_1 => $typeOfDisplay1, Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_2 => $typeOfDisplay2, Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_4 => $typeOfDisplay4, Mage_XmlConnect_Helper_Customer_Order::PRICE_DISPLAY_TYPE_14 => $typeOfDisplay014));
$this->setWeeeTaxes($weeeHelper->getApplied($item));
// Price & subtotal - excluding tax
if ($taxHelper->displaySalesBothPrices() || $taxHelper->displaySalesPriceExclTax()) {
Mage::helper('xmlconnect/customer_order')->addPriceAndSubtotalToXml($this, $item, $priceXml, $subtotalXml);
}
// Price & subtotal - including tax
if ($taxHelper->displaySalesBothPrices() || $taxHelper->displaySalesPriceInclTax()) {
Mage::helper('xmlconnect/customer_order')->addPriceAndSubtotalToXml($this, $item, $priceXml, $subtotalXml, true);
}
}
示例12: addPaymentInfoToXmlObj
/**
* Add Authorizenet info to order XML object
*
* @param Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj
* @return Mage_XmlConnect_Model_Simplexml_Element
*/
public function addPaymentInfoToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $orderItemXmlObj)
{
$orderItemXmlObj->addAttribute('type', $this->getMethod()->getCode());
if (!$this->getHideTitle()) {
$orderItemXmlObj->addAttribute('title', $orderItemXmlObj->xmlAttribute($this->getMethod()->getTitle()));
}
$cards = $this->getCards();
$showCount = count($cards) > 1;
foreach ($cards as $key => $card) {
$creditCard = $orderItemXmlObj->addCustomChild('item', null, array('label' => $showCount ? $this->__('Credit Card %s', $key + 1) : $this->__('Credit Card')));
foreach ($card as $label => $value) {
$creditCard->addCustomChild('item', implode($this->getValueAsArray($value, true), '\\n'), array('label' => $label));
}
}
}
示例13: collectProductPrices
/**
* Collect product prices to specified item xml object
*
* @param Mage_Catalog_Model_Product $product
* @param Mage_XmlConnect_Model_Simplexml_Element $item
* @return null
*/
public function collectProductPrices(Mage_Catalog_Model_Product $product, Mage_XmlConnect_Model_Simplexml_Element $item)
{
$this->setProduct($product);
if ($product->getCanShowPrice() !== false) {
$priceListXmlObj = $item->addCustomChild('price_list');
$min = $this->getMinAmount();
$max = $this->getMaxAmount();
if ($min && $max && $min == $max) {
$pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
$pricesXmlObj->addCustomChild('price', $min, array('id' => 'regular', 'label' => $this->__('Regular'), 'formatted_value' => Mage::helper('core')->currency($min, true, false)));
} elseif ($min && $min != 0) {
$pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
$pricesXmlObj->addCustomChild('price', $min, array('id' => 'regular', 'label' => $this->__('From'), 'formatted_value' => Mage::helper('core')->currency($min, true, false)));
}
}
}
示例14: addTopSearchTermsToXmlObj
/**
* Add last search terms info to xml object
*
* @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
* @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_TopSearchTerms
*/
public function addTopSearchTermsToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
{
foreach (Mage::helper('xmlconnect/adminApplication')->getSwitcherList() as $storeId) {
$this->_clearCollection()->_initCollection($storeId);
$valuesXml = $xmlObj->addCustomChild('values', null, array('store_id' => $storeId ? $storeId : Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS));
if (!count($this->getCollection()->getItems()) > 0) {
continue;
}
foreach ($this->getCollection()->getItems() as $item) {
$itemListXml = $valuesXml->addCustomChild('item');
$itemListXml->addCustomChild('name', $item->getName(), array('label' => $this->__('Search Term')));
$itemListXml->addCustomChild('num_results', $item->getNumResults(), array('label' => $this->__('Results')));
$itemListXml->addCustomChild('popularity', $item->getPopularity(), array('label' => $this->__('Number of Uses')));
}
}
return $this;
}
示例15: addTotalsDataToXmlObj
/**
* Add cart totals data to xml object
*
* @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
* @return Mage_XmlConnect_Block_Adminhtml_Connect_Dashboard_GraphTotalsData
*/
public function addTotalsDataToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $xmlObj)
{
$dataValuesXml = $xmlObj->addCustomChild('chart_totals');
foreach (Mage::helper('xmlconnect/adminApplication')->getSwitcherList() as $storeFilter) {
$storeId = $storeFilter ? $storeFilter : null;
$totalsXml = $dataValuesXml->addCustomChild('totals', null, array('store_id' => $storeId ? $storeId : Mage_XmlConnect_Helper_AdminApplication::ALL_STORE_VIEWS));
foreach ($this->getRangeOptions() as $rangeFilter) {
$this->_initCollection($storeId, $rangeFilter['value']);
$valuesXml = $totalsXml->addCustomChild('values', null, array('range_id' => $rangeFilter['value']));
foreach ($this->getTotals() as $total) {
$totalValue = $valuesXml->escapeXml($total['value'] . $total['decimals']);
$valuesXml->addCustomChild('item', $totalValue, array('label' => $total['label']));
}
$this->_clearTotals();
}
}
return $this;
}