Beispiel #1
0
 /**
  * Get all prices for bundle option selection
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Mage_Bundle_Model_Option $option
  * @param bool $takeTierPrice
  * @param bool|null $includeTax
  * @return array
  */
 protected function _getSelectionPrices($product, $option, $takeTierPrice, $includeTax)
 {
     $selectionPrices = array();
     $taxHelper = $this->_getHelperData('tax');
     $taxCalcMethod = $taxHelper->getConfig()->getAlgorithm($product->getStore());
     $isPriceFixedType = $product->getPriceType() == self::PRICE_TYPE_FIXED;
     $selections = $option->getSelections();
     if (!$selections) {
         return $selectionPrices;
     }
     foreach ($selections as $selection) {
         /* @var $selection Mage_Bundle_Model_Selection */
         if (!$selection->isSalable()) {
             /**
              * @todo CatalogInventory Show out of stock Products
              */
             continue;
         }
         $item = $isPriceFixedType ? $product : $selection;
         $selectionUnitPrice = $this->getSelectionFinalTotalPrice($product, $selection, 1, null, false, $takeTierPrice);
         $selectionQty = $selection->getSelectionQty();
         if ($isPriceFixedType || $taxCalcMethod == Mage_Tax_Model_Calculation::CALC_TOTAL_BASE) {
             $selectionPrice = $selectionQty * $taxHelper->getPrice($item, $selectionUnitPrice, $includeTax, null, null, null, null, null, false);
             $selectionPrices[] = $selectionPrice;
         } else {
             if ($taxCalcMethod == Mage_Tax_Model_Calculation::CALC_ROW_BASE) {
                 $selectionPrice = $taxHelper->getPrice($item, $selectionUnitPrice * $selectionQty, $includeTax);
                 $selectionPrices[] = $selectionPrice;
             } else {
                 //dynamic price and Mage_Tax_Model_Calculation::CALC_UNIT_BASE
                 $selectionPrice = $taxHelper->getPrice($item, $selectionUnitPrice, $includeTax) * $selectionQty;
                 $selectionPrices[] = $selectionPrice;
             }
         }
     }
     return $selectionPrices;
 }
Beispiel #2
0
 /**
  * Get all prices for bundle option selection
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Mage_Bundle_Model_Option $option
  * @param bool $takeTierPrice
  * @param bool|null $includeTax
  * @return array
  */
 protected function _getSelectionPrices($product, $option, $takeTierPrice, $includeTax)
 {
     $selectionPrices = array();
     $taxHelper = $this->_getHelperData('tax');
     $isPriceFixedType = $product->getPriceType() == self::PRICE_TYPE_FIXED;
     $selections = $option->getSelections();
     if (!$selections) {
         return $selectionPrices;
     }
     foreach ($selections as $selection) {
         /* @var $selection Mage_Bundle_Model_Selection */
         if (!$selection->isSalable()) {
             /**
              * @todo CatalogInventory Show out of stock Products
              */
             continue;
         }
         $item = $isPriceFixedType ? $product : $selection;
         $selectionPrices[] = $taxHelper->getPrice($item, $this->getSelectionFinalTotalPrice($product, $selection, 1, null, true, $takeTierPrice), $includeTax);
     }
     return $selectionPrices;
 }