/**
  * Add price details to xml object
  *
  * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObj
  * @param Mage_Sales_Model_Quote_Address_Rate $rate
  * @return Mage_XmlConnect_Block_Cart_Paypal_Mecl_Shippingmethods
  */
 protected function _addPriceToXmlObj($xmlObj, $rate)
 {
     $price = $this->_getShippingPrice($rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax());
     $incl = $this->_getShippingPrice($rate->getPrice(), true);
     $renderedInclTax = '';
     if ($incl != $price && $this->helper('tax')->displayShippingBothPrices()) {
         $inclTaxFormat = ' (%s %s)';
         $renderedInclTax = sprintf($inclTaxFormat, Mage::helper('tax')->__('Incl. Tax'), $incl);
     }
     $price .= $renderedInclTax;
     $xmlObj->addAttribute('price', $rate->getPrice() * 1);
     $xmlObj->addAttribute('formatted_price', $xmlObj->escapeXml($price));
     return $this;
 }
Esempio n. 2
0
 /**
  * Add weee tax product info to xml object
  *
  * @param Mage_XmlConnect_Model_Simplexml_Element $priceXmlObj
  * @param bool $subtotalFlag use true to get subtotal product info
  * @return Mage_XmlConnect_Model_Simplexml_Element
  */
 protected function _addWeeeToXmlObj(Mage_XmlConnect_Model_Simplexml_Element $priceXmlObj, $subtotalFlag = false)
 {
     $_item = $this->getItem();
     $weeeXmlObj = $priceXmlObj->addCustomChild('weee');
     if ($subtotalFlag) {
         $_incl = $this->helper('checkout')->getSubtotalInclTax($_item);
     } else {
         $_incl = $this->helper('checkout')->getPriceInclTax($_item);
     }
     $typeOfDisplay2 = Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales');
     if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()) {
         foreach (Mage::helper('weee')->getApplied($_item) as $tax) {
             if ($subtotalFlag) {
                 $amount = $tax['row_amount'];
             } else {
                 $amount = $tax['amount'];
             }
             $weeeXmlObj->addCustomChild('item', null, array('name' => $tax['title'], 'amount' => $this->_formatPrice($amount)));
         }
     } elseif ($_item->getWeeeTaxAppliedAmount() && ($typeOfDisplay2 || Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales'))) {
         foreach (Mage::helper('weee')->getApplied($_item) as $tax) {
             if ($subtotalFlag) {
                 $amount = $tax['row_amount_incl_tax'];
             } else {
                 $amount = $tax['amount_incl_tax'];
             }
             $weeeXmlObj->addCustomChild('item', null, array('name' => $tax['title'], 'amount' => $this->_formatPrice($amount)));
         }
     }
     if ($typeOfDisplay2 && $_item->getWeeeTaxAppliedAmount()) {
         if ($subtotalFlag) {
             $totalExcl = $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition();
         } else {
             $totalExcl = $_item->getCalculationPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition();
         }
         $totalExcl = $this->_formatPrice($totalExcl);
         $priceXmlObj->addAttribute('total_excluding_tax', $priceXmlObj->escapeXml($totalExcl));
     }
     if ($typeOfDisplay2 && $_item->getWeeeTaxAppliedAmount()) {
         if ($subtotalFlag) {
             $totalIncl = $_incl + $_item->getWeeeTaxAppliedRowAmount();
         } else {
             $totalIncl = $_incl + $_item->getWeeeTaxAppliedAmount();
         }
         $totalIncl = $this->_formatPrice($totalIncl);
         $priceXmlObj->addAttribute('total_including_tax', $priceXmlObj->escapeXml($totalIncl));
     }
     return $priceXmlObj;
 }
Esempio n. 3
0
 /**
  * Add total to totals XML. Api version 23.
  *
  * @param Varien_Object $total
  * @param Mage_XmlConnect_Model_Simplexml_Element $totalsXml
  * @return null
  */
 protected function _addTotalToXmlApi23($total, Mage_XmlConnect_Model_Simplexml_Element $totalsXml)
 {
     if ($total instanceof Varien_Object && $total->getCode() && $total->getLabel() && $total->hasData('value')) {
         $totalsXml->addCustomChild('item', $this->_formatPrice($total), array('id' => preg_replace('@[\\W]+@', '_', trim($total->getCode())), 'label' => $totalsXml->escapeXml($total->getLabel())));
     }
 }
Esempio n. 4
0
 /**
  * Add payment methods info to xml object
  *
  * @throw Mage_Core_Exception
  * @param Mage_XmlConnect_Model_Simplexml_Element $methodsXmlObj
  * @return Mage_XmlConnect_Block_Checkout_Payment_Method_List
  */
 protected function _buildPaymentMethods(Mage_XmlConnect_Model_Simplexml_Element $methodsXmlObj)
 {
     $methodArray = $this->_getPaymentMethodArray();
     $usedMethods = $sortedAvailableMethodCodes = $usedCodes = array();
     /**
      * Receive available methods for checkout
      */
     $allAvailableMethods = Mage::helper('payment')->getStoreMethods(Mage::app()->getStore(), $this->getQuote());
     $total = $this->getQuote()->getGrandTotal();
     foreach ($allAvailableMethods as $key => $method) {
         if ($this->_canUseMethod($method) && ($total != 0 || $method->getCode() == 'free' || $this->getQuote()->hasRecurringItems() && $method->canManageRecurringProfiles())) {
             $this->_assignMethod($method);
         } else {
             unset($allAvailableMethods[$key]);
         }
     }
     /**
      * Get sorted codes of available methods
      */
     foreach ($allAvailableMethods as $method) {
         $sortedAvailableMethodCodes[] = $method->getCode();
     }
     /**
      * Get blocks for layout to check available renderers
      */
     $methodBlocks = $this->getChild();
     /**
      * Collect directly supported by xmlconnect methods
      */
     if (!empty($methodBlocks) && is_array($methodBlocks)) {
         foreach ($methodBlocks as $block) {
             if (!$block) {
                 continue;
             }
             $method = $block->getMethod();
             if (!$this->_canUseMethod($method) || in_array($method->getCode(), $usedCodes)) {
                 continue;
             }
             $this->_assignMethod($method);
             $usedCodes[] = $method->getCode();
             $usedMethods[$method->getCode()] = array('renderer' => $block, 'method' => $method);
         }
     }
     /**
      * Collect all "Credit Card" / "CheckMo" / "Purchaseorder" method compatible methods
      */
     foreach ($methodArray as $methodName => $methodModelClassName) {
         $methodRenderer = $this->getChild($methodName);
         if (!empty($methodRenderer)) {
             foreach ($sortedAvailableMethodCodes as $methodCode) {
                 /**
                  * Skip used methods
                  */
                 if (in_array($methodCode, $usedCodes)) {
                     continue;
                 }
                 try {
                     $method = Mage::helper('payment')->getMethodInstance($methodCode);
                     if (!is_subclass_of($method, $methodModelClassName)) {
                         continue;
                     }
                     if (!$this->_canUseMethod($method)) {
                         continue;
                     }
                     $this->_assignMethod($method);
                     $usedCodes[] = $method->getCode();
                     $usedMethods[$method->getCode()] = array('renderer' => $methodRenderer, 'method' => $method);
                 } catch (Exception $e) {
                     Mage::logException($e);
                 }
             }
         }
     }
     /**
      * Generate methods XML according to sort order
      */
     foreach ($sortedAvailableMethodCodes as $code) {
         if (!in_array($code, $usedCodes)) {
             continue;
         }
         $method = $usedMethods[$code]['method'];
         $renderer = $usedMethods[$code]['renderer'];
         /**
          * Render all Credit Card method compatible methods
          */
         if ($renderer instanceof Mage_XmlConnect_Block_Checkout_Payment_Method_Ccsave) {
             $renderer->setData('method', $method);
         }
         $options = array('id' => $method->getCode(), 'code' => $method->getCode(), 'post_name' => 'payment[method]', 'label' => $methodsXmlObj->escapeXml($method->getTitle()));
         if ($this->getQuote()->getPayment()->getMethod() == $method->getCode()) {
             $options['selected'] = 1;
         }
         $methodItemXmlObj = $methodsXmlObj->addCustomChild('method', null, $options);
         $renderer->addPaymentFormToXmlObj($methodItemXmlObj);
     }
     if (count($allAvailableMethods) == 1 && isset($sortedAvailableMethodCodes[0]) && $sortedAvailableMethodCodes[0] == 'free') {
         if ($this->_isPaymentRequired()) {
             $this->_addFreePaymentToXmlObj($methodsXmlObj);
         }
     }
     if (!count($allAvailableMethods)) {
         Mage::throwException($this->__('Your order cannot be completed at this time as there is no payment methods available for it.'));
     }
     return $this;
 }
Esempio n. 5
0
 /**
  * Add total data to totals xml object
  *
  * @param Mage_XmlConnect_Model_Simplexml_Element $totalsXmlObj
  * @param string $code
  * @param string $title
  * @param float $value
  */
 protected function _addTotalDataToXmlObj($totalsXmlObj, $code, $title, $value)
 {
     $value = Mage::helper('xmlconnect')->formatPriceForXml($value);
     $totalXmlObj = $totalsXmlObj->addChild($code);
     $totalXmlObj->addChild('title', $totalsXmlObj->escapeXml($title));
     $formattedValue = $this->getQuote()->getStore()->formatPrice($value, false);
     $totalXmlObj->addChild('value', $value);
     $totalXmlObj->addChild('formated_value', $formattedValue);
 }
 /**
  * Add product block to cart
  *
  * @param Mage_XmlConnect_Model_Simplexml_Element $xmlObject
  * @param Mage_Sales_Model_Quote $quote
  * @return null
  */
 public function addCartProductsToXmlObj($xmlObject, $quote)
 {
     $productSmallImageSize = Mage::getModel('xmlconnect/images')->getImageLimitParam('content/product_small');
     $products = $xmlObject->addCustomChild('products');
     /* @var $item Mage_Sales_Model_Quote_Item */
     foreach ($this->getItems() as $item) {
         $type = $item->getProductType();
         $renderer = $this->getItemRenderer($type)->setItem($item);
         /**
          * General information
          */
         $itemXml = $products->addCustomChild('item', null, array('entity_id' => $item->getProduct()->getId()));
         $itemXml->addCustomChild('entity_type', $type);
         $itemXml->addCustomChild('item_id', $item->getId());
         $itemXml->addCustomChild('name', $xmlObject->escapeXml($renderer->getProductName()));
         $itemXml->addCustomChild('code', 'cart[' . $item->getId() . '][qty]');
         $itemXml->addCustomChild('qty', $renderer->getQty());
         $icon = $renderer->getProductThumbnail()->resize($productSmallImageSize);
         $iconXml = $itemXml->addChild('icon', $icon);
         $iconXml->addAttribute('modification_time', filemtime($icon->getNewFile()));
         /**
          * Price
          */
         $pricesXmlObj = $itemXml->addCustomChild('price_list');
         $exclPrice = $inclPrice = 0;
         if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
             if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales') && $item->getWeeeTaxAppliedAmount()) {
                 $exclPrice = $item->getCalculationPrice() + $item->getWeeeTaxAppliedAmount() + $item->getWeeeTaxDisposition();
             } else {
                 $exclPrice = $item->getCalculationPrice();
             }
         }
         if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
             $incl = $this->helper('checkout')->getPriceInclTax($item);
             if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales') && $item->getWeeeTaxAppliedAmount()) {
                 $inclPrice = $incl + $item->getWeeeTaxAppliedAmount();
             } else {
                 $inclPrice = $incl - $item->getWeeeTaxDisposition();
             }
         }
         $exclPrice = Mage::helper('xmlconnect')->formatPriceForXml($exclPrice);
         $paypalPrice = Mage::helper('xmlconnect')->formatPriceForXml($item->getCalculationPrice());
         $formattedExclPrice = $quote->getStore()->formatPrice($exclPrice, false);
         $inclPrice = Mage::helper('xmlconnect')->formatPriceForXml($inclPrice);
         $formattedInclPrice = $quote->getStore()->formatPrice($inclPrice, false);
         $priceXmlObj = $pricesXmlObj->addCustomChild('prices', null, array('id' => 'price'));
         if ($this->helper('tax')->displayCartBothPrices()) {
             $priceXmlObj->addCustomChild('price', $exclPrice, array('id' => 'excluding_tax', 'label' => $this->__('Excl. Tax'), 'formatted_value' => $formattedExclPrice));
             $priceXmlObj->addCustomChild('price', $inclPrice, array('id' => 'including_tax', 'label' => $this->__('Incl. Tax'), 'formatted_value' => $formattedInclPrice));
         } else {
             if ($this->helper('tax')->displayCartPriceExclTax()) {
                 $priceXmlObj->addCustomChild('price', $exclPrice, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $formattedExclPrice));
             }
             if ($this->helper('tax')->displayCartPriceInclTax()) {
                 $priceXmlObj->addCustomChild('price', $inclPrice, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $formattedInclPrice));
             }
         }
         /**
          * Info for paypal MEP if it's enabled
          */
         $appConfig = Mage::helper('xmlconnect')->getApplication()->loadConfiguration()->getRenderConf();
         $isMepActive = $appConfig['paypal']['isActive'];
         $paypalMepIsAvailable = Mage::getModel('xmlconnect/payment_method_paypal_mep')->isAvailable(null);
         if ($paypalMepIsAvailable && $isMepActive) {
             $paypalPriceXmlObj = $pricesXmlObj->addCustomChild('prices', null, array('id' => 'paypal'));
             $paypalPriceXmlObj->addCustomChild('price', $paypalPrice, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $quote->getStore()->formatPrice($paypalPrice, false)));
             $paypalSubtotalPrice = Mage::helper('xmlconnect')->formatPriceForXml($item->getRowTotal());
             $paypalPriceXmlObj->addCustomChild('price', $paypalSubtotalPrice, array('id' => 'subtotal', 'label' => $this->__('Subtotal'), 'formatted_value' => $quote->getStore()->formatPrice($paypalSubtotalPrice, false)));
         }
         /**
          * Subtotal
          */
         $subtotalExclTax = $subtotalInclTax = 0;
         if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) {
             if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales') && $item->getWeeeTaxAppliedAmount()) {
                 $subtotalExclTax = $item->getRowTotal() + $item->getWeeeTaxAppliedRowAmount() + $item->getWeeeTaxRowDisposition();
             } else {
                 $subtotalExclTax = $item->getRowTotal();
             }
         }
         if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) {
             $incl = $this->helper('checkout')->getSubtotalInclTax($item);
             if (Mage::helper('weee')->typeOfDisplay($item, array(0, 1, 4), 'sales') && $item->getWeeeTaxAppliedAmount()) {
                 $subtotalInclTax = $incl + $item->getWeeeTaxAppliedRowAmount();
             } else {
                 $subtotalInclTax = $incl - $item->getWeeeTaxRowDisposition();
             }
         }
         $subtotalExclTax = Mage::helper('xmlconnect')->formatPriceForXml($subtotalExclTax);
         $formattedSubtotalExcl = $quote->getStore()->formatPrice($subtotalExclTax, false);
         $subtotalInclTax = Mage::helper('xmlconnect')->formatPriceForXml($subtotalInclTax);
         $formattedSubtotalIncl = $quote->getStore()->formatPrice($subtotalInclTax, false);
         $priceXmlObj = $pricesXmlObj->addCustomChild('prices', null, array('id' => 'subtotal'));
         if ($this->helper('tax')->displayCartBothPrices()) {
             $priceXmlObj->addCustomChild('price', $subtotalExclTax, array('id' => 'excluding_tax', 'label' => $this->__('Subtotal Excl. Tax'), 'formatted_value' => $formattedSubtotalExcl));
             $priceXmlObj->addCustomChild('price', $subtotalInclTax, array('id' => 'including_tax', 'label' => $this->__('Subtotal Incl. Tax'), 'formatted_value' => $formattedSubtotalIncl));
         } else {
             if ($this->helper('tax')->displayCartPriceExclTax()) {
                 $priceXmlObj->addCustomChild('price', $subtotalExclTax, array('id' => 'regular', 'label' => $this->__('Subtotal'), 'formatted_value' => $formattedSubtotalExcl));
             }
             if ($this->helper('tax')->displayCartPriceInclTax()) {
                 $priceXmlObj->addCustomChild('price', $subtotalInclTax, array('id' => 'regular', 'label' => $this->__('Subtotal'), 'formatted_value' => $formattedSubtotalIncl));
             }
         }
         /**
          * Options list
          */
         $options = $renderer->getOptionList();
         if ($options) {
             $itemOptionsXml = $itemXml->addCustomChild('options');
             foreach ($options as $_option) {
                 $formattedOptionValue = $renderer->getFormatedOptionValue($_option);
                 $itemOptionsXml->addCustomChild('option', null, array('label' => $xmlObject->xmlAttribute($_option['label']), 'text' => $xmlObject->xmlAttribute($formattedOptionValue['value'])));
             }
         }
         /**
          * Downloadable products
          */
         $links = $renderer->getLinks();
         if ($links) {
             $itemOptionsXml = $itemXml->addCustomChild('options', null, array('label' => $renderer->getLinksTitle()));
             foreach ($links as $link) {
                 $itemOptionsXml->addCustomChild('option', null, array('label' => $link->getTitle()));
             }
         }
         /**
          * Item messages
          */
         $messages = $renderer->getMessages();
         if ($messages) {
             $itemMessagesXml = $itemXml->addCustomChild('messages');
             foreach ($messages as $message) {
                 $messageXml = $itemMessagesXml->addCustomChild('option');
                 $messageXml->addCustomChild('type', $message['type']);
                 $messageXml->addCustomChild('text', $xmlObject->escapeXml($message['text']));
             }
         }
     }
 }
Esempio n. 7
0
 /**
  * Collect address data to xml node
  * Remove objects from data array and escape data values
  *
  * @param Mage_Customer_Model_Address $address
  * @param Mage_XmlConnect_Model_Simplexml_Element $item
  * @return array
  */
 public function prepareAddressData(Mage_Customer_Model_Address $address, Mage_XmlConnect_Model_Simplexml_Element $item)
 {
     if (!$address) {
         return array();
     }
     $attributes = Mage::helper('Mage_Customer_Helper_Address')->getAttributes();
     $data = array('entity_id' => $address->getId());
     foreach ($attributes as $attribute) {
         /* @var $attribute Mage_Customer_Model_Attribute */
         if (!$attribute->getIsVisible()) {
             continue;
         }
         if ($attribute->getAttributeCode() == 'country_id') {
             $data['country'] = $address->getCountryModel()->getName();
             $data['country_id'] = $address->getCountryId();
         } else {
             if ($attribute->getAttributeCode() == 'region') {
                 $data['region'] = $address->getRegion();
             } else {
                 $dataModel = Mage_Customer_Model_Attribute_Data::factory($attribute, $address);
                 $value = $dataModel->outputValue(Mage_Customer_Model_Attribute_Data::OUTPUT_FORMAT_ONELINE);
                 if ($attribute->getFrontendInput() == 'multiline') {
                     $values = $dataModel->outputValue(Mage_Customer_Model_Attribute_Data::OUTPUT_FORMAT_ARRAY);
                     // explode lines
                     foreach ($values as $k => $v) {
                         $key = sprintf('%s%d', $attribute->getAttributeCode(), $k + 1);
                         $data[$key] = $v;
                     }
                 }
                 $data[$attribute->getAttributeCode()] = $value;
             }
         }
     }
     foreach ($data as $key => $value) {
         if (empty($value)) {
             continue;
         }
         $item->addChild($key, $item->escapeXml($value));
     }
 }
Esempio n. 8
0
 /**
  * Collect product prices to specified item xml object
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Mage_XmlConnect_Model_Simplexml_Element $item
  */
 public function collectProductPrices(Mage_Catalog_Model_Product $product, Mage_XmlConnect_Model_Simplexml_Element $item)
 {
     $this->setProduct($product)->setDisplayMinimalPrice(true)->setUseLinkForAsLowAs(false);
     $priceListXmlObj = $item->addCustomChild('price_list');
     $tierPrices = $this->_getTierPrices($product);
     if (count($tierPrices) > 0) {
         $tierPricesTextArray = $item->escapeXml(implode(PHP_EOL, $this->_getTierPricesTextArray($tierPrices, $product)));
         $item->addCustomChild('price_tier', $tierPricesTextArray);
     }
     /** @var $coreHelper Mage_Core_Helper_Data */
     $coreHelper = $this->helper('core');
     /** @var $weeeHelper Mage_Weee_Helper_Data */
     $weeeHelper = $this->helper('weee');
     /** @var $taxHelper Mage_Tax_Helper_Data */
     $taxHelper = $this->helper('tax');
     $simplePricesTax = $taxHelper->displayPriceIncludingTax() || $taxHelper->displayBothPrices();
     $minimalPriceValue = $product->getMinimalPrice();
     $minimalPrice = $taxHelper->getPrice($product, $minimalPriceValue, $simplePricesTax);
     if (!$product->isGrouped()) {
         $weeeTaxAmount = $weeeHelper->getAmountForDisplay($product);
         if ($weeeHelper->typeOfDisplay($product, array(1, 2, 4))) {
             $weeeTaxAmount = $weeeHelper->getAmount($product);
             $weeeTaxAttributes = $weeeHelper->getProductWeeeAttributesForDisplay($product);
         }
         $price = $taxHelper->getPrice($product, $product->getPrice());
         $regularPrice = $taxHelper->getPrice($product, $product->getPrice(), $simplePricesTax);
         $finalPrice = $taxHelper->getPrice($product, $product->getFinalPrice());
         $finalPriceInclTax = $taxHelper->getPrice($product, $product->getFinalPrice(), true);
         $weeeHelper->getPriceDisplayType();
         if ($finalPrice == $price) {
             if ($taxHelper->displayBothPrices()) {
                 /**
                  * Including
                  */
                 if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 0)) {
                     $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                     $exclTaxValue = $price + $weeeTaxAmount;
                     $pricesXmlObj->addCustomChild('price', $exclTaxValue, array('id' => 'excluding_tax', 'label' => $this->__('Excl. Tax'), 'formatted_value' => $coreHelper->currency($exclTaxValue, true, false)));
                     $inclTaxValue = $finalPriceInclTax + $weeeTaxAmount;
                     $pricesXmlObj->addCustomChild('price', $inclTaxValue, array('id' => 'including_tax', 'label' => $this->__('Incl. Tax'), 'formatted_value' => $coreHelper->currency($inclTaxValue, true, false)));
                 } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 1)) {
                     /**
                      * Including + Weee
                      */
                     $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                     $exclTaxValue = $price + $weeeTaxAmount;
                     $pricesXmlObj->addCustomChild('price', $exclTaxValue, array('id' => 'excluding_tax', 'label' => $this->__('Excl. Tax'), 'formatted_value' => $coreHelper->currency($exclTaxValue, true, false)));
                     $inclTaxValue = $finalPriceInclTax + $weeeTaxAmount;
                     $pricesXmlObj->addCustomChild('price', $inclTaxValue, array('id' => 'including_tax', 'label' => $this->__('Incl. Tax'), 'formatted_value' => $coreHelper->currency($inclTaxValue, true, false)));
                     $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
                     foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
                         $priceWeeeXmlObj->addCustomChild('item', $weeeTaxAttribute->getAmount() * 1, array('id' => 'weee_tax', 'label' => $weeeTaxAttribute->getName(), 'formatted_value' => $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)));
                     }
                 } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 4)) {
                     /**
                      * Including + Weee
                      */
                     $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                     $exclTaxValue = $price + $weeeTaxAmount;
                     $pricesXmlObj->addCustomChild('price', $exclTaxValue, array('id' => 'excluding_tax', 'label' => $this->__('Excl. Tax'), 'formatted_value' => $coreHelper->currency($exclTaxValue, true, false)));
                     $inclTaxValue = $finalPriceInclTax + $weeeTaxAmount;
                     $pricesXmlObj->addCustomChild('price', $inclTaxValue, array('id' => 'including_tax', 'label' => $this->__('Incl. Tax'), 'formatted_value' => $coreHelper->currency($inclTaxValue, true, false)));
                     $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
                     foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
                         $amount = $weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount();
                         $priceWeeeXmlObj->addCustomChild('item', $amount * 1, array('id' => 'weee_tax', 'label' => $weeeTaxAttribute->getName(), 'formatted_value' => $coreHelper->currency($amount, true, false)));
                     }
                 } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 2)) {
                     /**
                      * Excluding + Weee + Final
                      */
                     $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                     $pricesXmlObj->addCustomChild('price', $price, array('id' => 'excluding_tax', 'label' => $this->__('Excl. Tax'), 'formatted_value' => $coreHelper->currency($price, true, false)));
                     $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
                     foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
                         $priceWeeeXmlObj->addCustomChild('item', $weeeTaxAttribute->getAmount() * 1, array('id' => 'weee_tax', 'label' => $weeeTaxAttribute->getName(), 'formatted_value' => $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)));
                     }
                     $inclTaxValue = $finalPriceInclTax + $weeeTaxAmount;
                     $pricesXmlObj->addCustomChild('price', $inclTaxValue, array('id' => 'including_tax', 'label' => $this->__('Incl. Tax'), 'formatted_value' => $coreHelper->currency($inclTaxValue, true, false)));
                 } else {
                     $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                     $pricesXmlObj->addCustomChild('price', $price, array('id' => 'excluding_tax', 'label' => $this->__('Excl. Tax'), 'formatted_value' => $coreHelper->currency($price, true, false)));
                     $pricesXmlObj->addCustomChild('price', $finalPriceInclTax, array('id' => 'including_tax', 'label' => $this->__('Incl. Tax'), 'formatted_value' => $coreHelper->currency($finalPriceInclTax, true, false)));
                 }
                 /**
                  * if ($taxHelper->displayBothPrices()) {
                  */
             } else {
                 /**
                  * Including
                  */
                 if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 0)) {
                     $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                     $pricesXmlObj->addCustomChild('price', $price + $weeeTaxAmount, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $coreHelper->currency($price + $weeeTaxAmount, true, false)));
                 } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 1)) {
                     /**
                      * Including + Weee
                      */
                     $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                     $pricesXmlObj->addCustomChild('price', $price + $weeeTaxAmount, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $coreHelper->currency($price + $weeeTaxAmount, true, false)));
                     $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
                     foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
                         $priceWeeeXmlObj->addCustomChild('item', $weeeTaxAttribute->getAmount() * 1, array('id' => 'weee_tax', 'label' => $weeeTaxAttribute->getName(), 'formatted_value' => $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)));
                     }
                 } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 4)) {
                     /**
                      * Including + Weee
                      */
                     $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                     $pricesXmlObj->addCustomChild('price', $price + $weeeTaxAmount, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $coreHelper->currency($price + $weeeTaxAmount, true, false)));
                     $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
                     foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
                         $amount = $weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount();
                         $priceWeeeXmlObj->addCustomChild('item', $amount * 1, array('id' => 'weee_tax', 'label' => $weeeTaxAttribute->getName(), 'formatted_value' => $coreHelper->currency($amount, true, false)));
                     }
                 } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 2)) {
                     /**
                      * Excluding + Weee + Final
                      */
                     $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                     $pricesXmlObj->addCustomChild('price', $price, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $coreHelper->currency($price, true, false)));
                     $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
                     foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
                         $priceWeeeXmlObj->addCustomChild('item', $weeeTaxAttribute->getAmount() * 1, array('id' => 'weee_tax', 'label' => $weeeTaxAttribute->getName(), 'formatted_value' => $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)));
                     }
                     $pricesXmlObj->addCustomChild('price', $price + $weeeTaxAmount, array('id' => 'including_tax', 'label' => $this->__('Incl. Tax'), 'formatted_value' => $coreHelper->currency($price + $weeeTaxAmount, true, false)));
                 } else {
                     $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                     $pricesXmlObj->addCustomChild('price', $price, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $coreHelper->currency($price, true, false)));
                 }
             }
             /**
              * if ($finalPrice == $price) {
              */
         } else {
             $originalWeeeTaxAmount = $weeeHelper->getOriginalAmount($product);
             /**
              * Including
              */
             if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 0)) {
                 $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                 $unitPrice = $regularPrice + $originalWeeeTaxAmount;
                 $pricesXmlObj->addCustomChild('price', $unitPrice, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $coreHelper->currency($unitPrice, true, false)));
                 if ($taxHelper->displayBothPrices()) {
                     $pricesXmlObj->addCustomChild('price', $finalPrice + $weeeTaxAmount, array('id' => 'special_excluding_tax', 'label' => $this->__('Special Excl. Tax'), 'formatted_value' => $coreHelper->currency($finalPrice + $weeeTaxAmount, true, false)));
                     $specialIncludingTax = $finalPriceInclTax + $weeeTaxAmount;
                     $pricesXmlObj->addCustomChild('price', $specialIncludingTax, array('id' => 'special_including_tax', 'label' => $this->__('Special Incl. Tax'), 'formatted_value' => $coreHelper->currency($specialIncludingTax, true, false)));
                 } else {
                     $pricesXmlObj->addCustomChild('price', $finalPrice + $weeeTaxAmount, array('id' => 'special', 'label' => $this->__('Special'), 'formatted_value' => $coreHelper->currency($finalPrice + $weeeTaxAmount, true, false)));
                 }
             } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 1)) {
                 /**
                  * Including + Weee
                  */
                 $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                 $unitPrice = $regularPrice + $originalWeeeTaxAmount;
                 $pricesXmlObj->addCustomChild('price', $unitPrice, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $coreHelper->currency($unitPrice, true, false)));
                 $pricesXmlObj->addCustomChild('price', $finalPrice + $weeeTaxAmount, array('id' => 'special_excluding_tax', 'label' => $this->__('Special Excl. Tax'), 'formatted_value' => $coreHelper->currency($finalPrice + $weeeTaxAmount, true, false)));
                 $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('prices', null, array('id' => 'weee'));
                 foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
                     $priceWeeeXmlObj->addCustomChild('item', $weeeTaxAttribute->getAmount() * 1, array('id' => 'weee_tax', 'label' => $weeeTaxAttribute->getName(), 'formatted_value' => $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)));
                 }
                 $pricesXmlObj->addCustomChild('price', $finalPriceInclTax + $weeeTaxAmount, array('id' => 'special_including_tax', 'label' => $this->__('Special Incl. Tax'), 'formatted_value' => $coreHelper->currency($finalPriceInclTax + $weeeTaxAmount, true, false)));
             } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 4)) {
                 /**
                  * Including + Weee
                  */
                 $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                 $unitPrice = $regularPrice + $originalWeeeTaxAmount;
                 $pricesXmlObj->addCustomChild('price', $unitPrice, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $coreHelper->currency($unitPrice, true, false)));
                 $pricesXmlObj->addCustomChild('price', $finalPrice + $weeeTaxAmount, array('id' => 'special_excluding_tax', 'label' => $this->__('Special Excl. Tax'), 'formatted_value' => $coreHelper->currency($finalPrice + $weeeTaxAmount, true, false)));
                 $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
                 foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
                     $amount = $weeeTaxAttribute->getAmount() + $weeeTaxAttribute->getTaxAmount();
                     $priceWeeeXmlObj->addCustomChild('item', $amount * 1, array('id' => 'weee_tax', 'label' => $weeeTaxAttribute->getName(), 'formatted_value' => $coreHelper->currency($amount, true, false)));
                 }
                 $pricesXmlObj->addCustomChild('price', $finalPriceInclTax + $weeeTaxAmount, array('id' => 'special_including_tax', 'label' => $this->__('Special Incl. Tax'), 'formatted_value' => $coreHelper->currency($finalPriceInclTax + $weeeTaxAmount, true, false)));
             } elseif ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, 2)) {
                 /**
                  * Excluding + Weee + Final
                  */
                 $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                 $pricesXmlObj->addCustomChild('price', $regularPrice, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $coreHelper->currency($regularPrice, true, false)));
                 $pricesXmlObj->addCustomChild('price', $finalPrice, array('id' => 'special_excluding_tax', 'label' => $this->__('Special Excl. Tax'), 'formatted_value' => $coreHelper->currency($finalPrice, true, false)));
                 $priceWeeeXmlObj = $pricesXmlObj->addCustomChild('price', null, array('id' => 'weee'));
                 foreach ($weeeTaxAttributes as $weeeTaxAttribute) {
                     $priceWeeeXmlObj->addCustomChild('item', $weeeTaxAttribute->getAmount() * 1, array('id' => 'weee_tax', 'label' => $weeeTaxAttribute->getName(), 'formatted_value' => $coreHelper->currency($weeeTaxAttribute->getAmount(), true, false)));
                 }
                 $pricesXmlObj->addCustomChild('price', $finalPriceInclTax + $weeeTaxAmount, array('id' => 'special_including_tax', 'label' => $this->__('Special Incl. Tax'), 'formatted_value' => $coreHelper->currency($finalPriceInclTax + $weeeTaxAmount, true, false)));
             } else {
                 /**
                  * Excluding
                  */
                 $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                 $pricesXmlObj->addCustomChild('price', $regularPrice, array('id' => 'regular', 'label' => $this->__('Unit Price'), 'formatted_value' => $coreHelper->currency($regularPrice, true, false)));
                 if ($taxHelper->displayBothPrices()) {
                     $pricesXmlObj->addCustomChild('price', $finalPrice, array('id' => 'special_excluding_tax', 'label' => $this->__('Special Excl. Tax'), 'formatted_value' => $coreHelper->currency($finalPrice, true, false)));
                     $pricesXmlObj->addCustomChild('price', $finalPriceInclTax, array('id' => 'special_including_tax', 'label' => $this->__('Special Incl. Tax'), 'formatted_value' => $coreHelper->currency($finalPriceInclTax, true, false)));
                 } else {
                     $pricesXmlObj->addCustomChild('price', $finalPrice, array('id' => 'special', 'label' => $this->__('Special'), 'formatted_value' => $coreHelper->currency($finalPrice, true, false)));
                 }
             }
         }
         if ($this->getDisplayMinimalPrice() && $minimalPriceValue && $minimalPriceValue < $product->getFinalPrice()) {
             $minimalPriceDisplayValue = $minimalPrice;
             if ($weeeTaxAmount && $weeeHelper->typeOfDisplay($product, array(0, 1, 4))) {
                 $minimalPriceDisplayValue = $minimalPrice + $weeeTaxAmount;
             }
             if (!$this->getUseLinkForAsLowAs()) {
                 $pricesXmlObj->addCustomChild('price', $minimalPriceDisplayValue, array('id' => 'as_low_as', 'label' => $this->__('As Low As'), 'formatted_value' => $coreHelper->currency($minimalPriceDisplayValue, true, false)));
             }
         }
         /**
          * if (!$product->isGrouped()) {
          */
     } else {
         $exclTax = $taxHelper->getPrice($product, $minimalPriceValue, null);
         $inclTax = $taxHelper->getPrice($product, $minimalPriceValue, true);
         if ($this->getDisplayMinimalPrice() && $minimalPriceValue) {
             if ($taxHelper->displayBothPrices()) {
                 $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                 $pricesXmlObj->addCustomChild('price', $exclTax, array('id' => 'starting_at_excluding_tax', 'label' => $this->__('Starting At Excl. Tax'), 'formatted_value' => $coreHelper->currency($exclTax, true, false)));
                 $pricesXmlObj->addCustomChild('price', $inclTax, array('id' => 'starting_at_including_tax', 'label' => $this->__('Starting At Incl. Tax'), 'formatted_value' => $coreHelper->currency($inclTax, true, false)));
             } else {
                 $showPrice = $inclTax;
                 if (!$taxHelper->displayPriceIncludingTax()) {
                     $showPrice = $exclTax;
                 }
                 $pricesXmlObj = $priceListXmlObj->addCustomChild('prices', null, array('id' => 'price'));
                 $pricesXmlObj->addCustomChild('price', $showPrice, array('id' => 'starting_at', 'label' => $this->__('Starting At'), 'formatted_value' => $coreHelper->currency($showPrice, true, false)));
             }
         }
     }
 }