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


PHP Mage_Catalog_Model_Product::getTierPrice方法代码示例

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


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

示例1: _applyTierPrice

 /**
  * Return tier price, even it is less than base price
  *
  * @param   Mage_Catalog_Model_Product $product
  * @param   float $qty
  * @param   float $finalPrice
  * @return  float
  */
 protected function _applyTierPrice($product, $qty, $finalPrice)
 {
     if (is_null($qty)) {
         return $finalPrice;
     }
     $tierPrice = $product->getTierPrice($qty);
     if (is_numeric($tierPrice)) {
         $finalPrice = $tierPrice;
     }
     return $finalPrice;
 }
开发者ID:Rodrifer,项目名称:candyclub,代码行数:19,代码来源:Price.php

示例2: getFormatedTierPrice

 /**
  * Get formatted by currency tier price
  *
  * @param   float $qty
  * @param   Mage_Catalog_Model_Product $product
  * @return  array || float
  */
 public function getFormatedTierPrice($qty = null, $product)
 {
     $price = $product->getTierPrice($qty);
     if (is_array($price)) {
         foreach ($price as $index => $value) {
             $price[$index]['formated_price'] = Mage::app()->getStore()->convertPrice($price[$index]['website_price'], true);
         }
     } else {
         $price = Mage::app()->getStore()->formatPrice($price);
     }
     return $price;
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:19,代码来源:Price.php

示例3: _applyTierPrice

 /**
  * Apply tier price for bundle
  *
  * @param   Mage_Catalog_Model_Product $product
  * @param   decimal $qty
  * @param   decimal $finalPrice
  * @return  decimal
  */
 protected function _applyTierPrice($product, $qty, $finalPrice)
 {
     if (is_null($qty)) {
         return $finalPrice;
     }
     $tierPrice = $product->getTierPrice($qty);
     if (is_numeric($tierPrice)) {
         $tierPrice = $finalPrice - $finalPrice * ($tierPrice / 100);
         $tierPrice = $this->_getApp()->getStore()->roundPrice($tierPrice);
         $finalPrice = min($finalPrice, $tierPrice);
     }
     return $finalPrice;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:21,代码来源:Price.php

示例4: getFinalPrice

 /**
  * Get product final price
  *
  * @param double $qty
  * @param Mage_Catalog_Model_Product $product
  * @return double
  */
 public function getFinalPrice($qty = null, $product)
 {
     /**
      * Calculating final price for item of configurable product
      */
     if ($product->getSuperProduct() && $product->getSuperProduct()->isConfigurable()) {
         $finalPrice = $product->getSuperProduct()->getFinalPrice($qty);
         $attributes = $product->getSuperProduct()->getTypeInstance()->getConfigurableAttributes();
         foreach ($attributes as $attribute) {
             $value = $this->getValueByIndex($attribute->getPrices(), $product->getData($attribute->getProductAttribute()->getAttributeCode()));
             if ($value) {
                 if ($value['pricing_value'] != 0) {
                     $finalPrice += $product->getSuperProduct()->getPricingValue($value);
                 }
             }
         }
     } else {
         $finalPrice = $product->getPrice();
         $tierPrice = $product->getTierPrice($qty);
         if (is_numeric($tierPrice)) {
             $finalPrice = min($finalPrice, $tierPrice);
         }
         $specialPrice = $product->getSpecialPrice();
         if (is_numeric($specialPrice)) {
             $today = floor(time() / 86400) * 86400;
             #echo " TEST:"; echo date('Y-m-d H:i:s', $today).' , '.$product->getSpecialToDate();
             if ($product->getSpecialFromDate() && $today < strtotime($product->getSpecialFromDate())) {
                 #echo ' test1: '.$product->getSpecialFromDate();
             } elseif ($product->getSpecialToDate() && $today > strtotime($product->getSpecialToDate())) {
                 #echo ' test2: '.$product->getSpecialToDate();
             } else {
                 $finalPrice = min($finalPrice, $specialPrice);
             }
         }
     }
     $product->setFinalPrice($finalPrice);
     Mage::dispatchEvent('catalog_product_get_final_price', array('product' => $product));
     return $product->getData('final_price');
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:46,代码来源:Price.php

示例5: _applyTierPrice

 /**
  * Apply tier price for bundle
  *
  * @param   Mage_Catalog_Model_Product $product
  * @param   decimal $qty
  * @param   decimal $finalPrice
  * @return  decimal
  */
 protected function _applyTierPrice($product, $qty, $finalPrice)
 {
     if (is_null($qty)) {
         return $finalPrice;
     }
     $tierPrice = $product->getTierPrice($qty);
     if (is_numeric($tierPrice)) {
         $tierPrice = $finalPrice - $finalPrice * $tierPrice / 100;
         $finalPrice = min($finalPrice, $tierPrice);
     }
     return $finalPrice;
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:20,代码来源:Price.php

示例6: testGetTierPrice

 /**
  * See detailed tests at Mage_Catalog_Model_Product_Type*_PriceTest
  */
 public function testGetTierPrice()
 {
     $this->assertEquals(array(), $this->_model->getTierPrice());
 }
开发者ID:relue,项目名称:magento2,代码行数:7,代码来源:ProductPriceTest.php

示例7: _applyOptionsPrice

 /**
  * Apply options price
  *
  * @param Mage_Catalog_Model_Product $product
  * @param int $qty
  * @param double $finalPrice
  * @return double
  */
 protected function _applyOptionsPrice($product, $qty, $finalPrice)
 {
     if ($optionIds = $product->getCustomOption('option_ids')) {
         $basePrice = $finalPrice;
         $finalPrice = 0;
         $options = array();
         $qtyRelatedOption = null;
         foreach (explode(',', $optionIds->getValue()) as $optionId) {
             if ($option = $product->getOptionById($optionId)) {
                 $options[] = $option;
                 if ($option->getOptionCode() == $this->_getQtyOptionCode()) {
                     $qtyRelatedOption = $option;
                 }
             }
         }
         foreach ($options as $option) {
             $optionQty = null;
             $quoteItemOptionInfoBuyRequest = unserialize($product->getCustomOption('info_buyRequest')->getValue());
             switch ($option->getType()) {
                 case 'checkbox':
                     if (isset($quoteItemOptionInfoBuyRequest['options'][$optionId])) {
                         $optionValues = array();
                         $optionQtyArr = array();
                         foreach ($option->getValues() as $key => $itemV) {
                             if (isset($quoteItemOptionInfoBuyRequest['options_' . $optionId . '_' . $itemV->getOptionTypeId() . '_qty'])) {
                                 $optionQty = intval($quoteItemOptionInfoBuyRequest['options_' . $optionId . '_' . $itemV->getOptionTypeId() . '_qty']);
                             } else {
                                 $optionQty = 1;
                             }
                             $optionQtyArr[$itemV->getOptionTypeId()] = $optionQty;
                         }
                         $optionQty = $optionQtyArr;
                         break;
                     }
                     break;
                 case 'drop_down':
                 case 'radio':
                     if (isset($quoteItemOptionInfoBuyRequest['options_' . $optionId . '_qty'])) {
                         $optionQty = intval($quoteItemOptionInfoBuyRequest['options_' . $optionId . '_qty']);
                     } else {
                         $optionQty = 1;
                     }
                 case 'multiple':
                     if (!isset($optionQty)) {
                         $optionQty = 1;
                     }
                     break;
                 case 'field':
                 case 'area':
                 case 'file':
                 case 'date':
                 case 'date_time':
                 case 'time':
                     break;
                 default:
                     //multiple
                     $optionQty = 1;
             }
             $option->setOptionQty($optionQty);
         }
         $customQty = 0;
         if ($qtyRelatedOption) {
             foreach ($qtyRelatedOption->getValues() as $_value) {
                 if (isset($quoteItemOptionInfoBuyRequest['options_' . $qtyRelatedOption->getOptionId() . '_' . $_value->getOptionTypeId() . '_qty'])) {
                     $customQty += intval($quoteItemOptionInfoBuyRequest['options_' . $qtyRelatedOption->getOptionId() . '_' . $_value->getOptionTypeId() . '_qty']);
                 }
             }
             if ($customQty) {
                 $basePrice = $product->getTierPrice($customQty);
             }
         }
         foreach ($options as $option) {
             switch ($option->getType()) {
                 case 'field':
                 case 'area':
                 case 'file':
                 case 'date':
                 case 'date_time':
                 case 'time':
                     $finalPrice += $this->_getCustomOptionsChargableOptionPrice($option->getPrice(), $option->getPriceType() == 'percent', $basePrice, $qty, $option->getCustomoptionsIsOnetime());
                     break;
                 case 'drop_down':
                 case 'radio':
                 case 'checkbox':
                     $quoteItemOption = $product->getCustomOption('option_' . $option->getId());
                     $group = $option->groupFactory($option->getType())->setOption($option)->setQuoteItemOption($quoteItemOption);
                     $optionPrice = $group->getOptionPrice($quoteItemOption->getValue(), $basePrice, $option != $qtyRelatedOption ? $customQty : $qty, $option->getOptionQty());
                     if ($option != $qtyRelatedOption && $customQty) {
                         $optionPrice *= $customQty;
                     }
                     $finalPrice += $optionPrice;
             }
//.........这里部分代码省略.........
开发者ID:parmanandsagar-mobikasa,项目名称:CO,代码行数:101,代码来源:Price.php


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