/**
  * calculates the reduction and decides if the tier price is added
  *
  * @param float $reducedAmount
  * @param Shopgate_Model_Catalog_Price $priceItem
  * @param Shopgate_Model_Catalog_TierPrice $tierPriceItem
  * @param array $tierPriceRules
  * @post $tierPriceRules contains the new tier price if the reductionAmount is not zero
  */
 protected function addTierPriceRule($reducedAmount, $tierPriceItem, &$tierPriceRules)
 {
     if ($reducedAmount != 0) {
         /*
          * In case a specific price rule (e.g. for Visitors) is automatic calculated as a general discount - the specific price rule will have an amount 0.
          * We need to prevent the export of such price rule by use of this condition
          */
         $tierPriceItem->setReduction($reducedAmount);
         $tierPriceRules[] = $tierPriceItem;
     }
 }
Example #2
0
 /**
  * @param $price Shopgate_Model_Catalog_Price
  */
 protected function _createGroupPriceNode(&$price)
 {
     foreach ($this->item->getData('group_price') as $group) {
         if (($group['website_id'] == Mage::app()->getStore()->getWebsiteId() || $group['website_id'] == 0) && $price->getSalePrice() > $group['website_price']) {
             $tierPrice = new Shopgate_Model_Catalog_TierPrice();
             $tierPrice->setFromQuantity(1);
             $tierPrice->setReduction($price->getSalePrice() - $group['website_price']);
             $tierPrice->setReductionType(Shopgate_Model_Catalog_TierPrice::DEFAULT_TIER_PRICE_TYPE_FIXED);
             $tierPrice->setCustomerGroupUid($group['cust_group']);
             if ($this->item->isSuper() && Mage::getStoreConfig(Shopgate_Framework_Model_Config::XML_PATH_SHOPGATE_EXPORT_USE_ROOT_PRICES)) {
                 $tierPrice->setAggregateChildren(true);
             }
             $price->addTierPriceGroup($tierPrice);
         }
     }
 }