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


PHP Mage_Sales_Model_Quote_Item_Abstract::getQty方法代码示例

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


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

示例1: _recalculateParent

 /**
  * Recalculate row information for item based on children calculation
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Tax_Model_Sales_Total_Quote_Subtotal
  */
 protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $price = 0;
     $basePrice = 0;
     $rowTotal = 0;
     $baseRowTotal = 0;
     $priceInclTax = 0;
     $basePriceInclTax = 0;
     $rowTotalInclTax = 0;
     $baseRowTotalInclTax = 0;
     foreach ($item->getChildren() as $child) {
         $price += $child->getPrice() * $child->getQty();
         $basePrice += $child->getBasePrice() * $child->getQty();
         $rowTotal += $child->getRowTotal();
         $baseRowTotal += $child->getBaseRowTotal();
         $priceInclTax += $child->getPriceInclTax() * $child->getQty();
         $basePriceInclTax += $child->getBasePriceInclTax() * $child->getQty();
         $rowTotalInclTax += $child->getRowTotalInclTax();
         $baseRowTotalInclTax += $child->getBaseRowTotalInclTax();
     }
     /**
      *
      * Customisation To make the custom price work with configurable items
      *
      **/
     if ($item->getCustomPrice()) {
         $customPrice = $item->getCustomPrice();
         $price = $customPrice;
         $basePrice = $customPrice;
         $rowTotal = $customPrice * $item->getQty();
         $baseRowTotal = $customPrice * $item->getQty();
         $priceInclTax = $customPrice;
         $basePriceInclTax = $customPrice;
         $rowTotalInclTax = $customPrice * $item->getQty();
         $baseRowTotalInclTax = $customPrice * $item->getQty();
     }
     $item->setConvertedPrice($price);
     $item->setPrice($basePrice);
     $item->setRowTotal($rowTotal);
     $item->setBaseRowTotal($baseRowTotal);
     $item->setPriceInclTax($priceInclTax);
     $item->setBasePriceInclTax($basePriceInclTax);
     $item->setRowTotalInclTax($rowTotalInclTax);
     $item->setBaseRowTotalInclTax($baseRowTotalInclTax);
     return $this;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:52,代码来源:Subtotal.php

示例2: getEddMessage

 /**
  * Get an estimated delivery message for a quote item.
  *
  * @param  Mage_Sales_Model_Quote_Item_Abstract
  * @return string
  */
 public function getEddMessage(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     /** @var string $singularOrPluralItem */
     $singularOrPluralItem = (int) $item->getQty() > 1 ? 's' : '';
     /** @var EbayEnterprise_Inventory_Model_Details_Item | Varien_Object | null $eddItem */
     $eddItem = $this->detailService->getDetailsForItem($item) ?: $this->inventoryHelper->getStreetDateForBackorderableItem($item);
     return $eddItem ? $this->inventoryHelper->__($this->getEddTemplate(), $singularOrPluralItem, $eddItem->getDeliveryWindowFromDate()->format('m/d/y'), $eddItem->getDeliveryWindowToDate()->format('m/d/y')) : '';
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:14,代码来源:Edd.php

示例3: getRequestedItemQuantity

 /**
  * Get the quantity requeted for a single item.
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract
  * @return int
  */
 public function getRequestedItemQuantity(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     // Child item quantity is the static quantity of the child
     // item within a single unit of the parent. E.g. a configurable
     // product's child item's quantity, will always be 1 - one child in
     // the configurable item. Bundle items, however, will be
     // the number of the child items in a single unit of the
     // parent bundle, depending on how the bundle was configured when
     // added to cart - actual quantity of the child is child
     // quantity * parent quantity.
     $parentItem = $item->getParentItem();
     return $item->getQty() * ($parentItem ? $parentItem->getQty() : 1);
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:19,代码来源:Quantity.php

示例4: _getItemQty

 /**
  * Return discount item qty
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @param Mage_SalesRule_Model_Rule $rule
  * @return int
  */
 protected function _getItemQty($item, $rule)
 {
     //@nelkaake: Magento 1.3 and lower doesnt have the item->getTotalQty attribute.
     if (Mage::helper('rewards/version')->isBaseMageVersionAtLeast('1.4')) {
         $qty = $item->getTotalQty();
     } else {
         $qty = $item->getQty();
         if ($item->getParentItem()) {
             $qty *= $item->getParentItem()->getQty();
         }
     }
     return $rule->getDiscountQty() ? min($qty, $rule->getDiscountQty()) : $qty;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:20,代码来源:Abstract.php

示例5: requestShippingRates

 /**
  * Request shipping rates for entire address or specified address item
  * Returns true if current selected shipping method code corresponds to one of the found rates
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @return bool
  */
 public function requestShippingRates(Mage_Sales_Model_Quote_Item_Abstract $item = null)
 {
     //Mage::log("requestShippingRates");
     /** @var $request Mage_Shipping_Model_Rate_Request */
     $request = Mage::getModel('shipping/rate_request');
     $request->setAllItems($item ? array($item) : $this->getAllItems());
     $request->setDestCountryId($this->getCountryId());
     $request->setDestRegionId($this->getRegionId());
     $request->setDestRegionCode($this->getRegionCode());
     /**
      * need to call getStreet with -1
      * to get data in string instead of array
      */
     $request->setDestStreet($this->getStreet(-1));
     $request->setDestCity($this->getCity());
     $request->setDestPostcode($this->getPostcode());
     $request->setPackageValue($item ? $item->getBaseRowTotal() : $this->getBaseSubtotal());
     $packageValueWithDiscount = $item ? $item->getBaseRowTotal() - $item->getBaseDiscountAmount() : $this->getBaseSubtotalWithDiscount();
     $request->setPackageValueWithDiscount($packageValueWithDiscount);
     $request->setPackageWeight($item ? $item->getRowWeight() : $this->getWeight());
     $request->setPackageQty($item ? $item->getQty() : $this->getItemQty());
     /**
      * Need for shipping methods that use insurance based on price of physical products
      */
     $packagePhysicalValue = $item ? $item->getBaseRowTotal() : $this->getBaseSubtotal() - $this->getBaseVirtualAmount();
     $request->setPackagePhysicalValue($packagePhysicalValue);
     $request->setFreeMethodWeight($item ? 0 : $this->getFreeMethodWeight());
     /**
      * Store and website identifiers need specify from quote
      */
     /*$request->setStoreId(Mage::app()->getStore()->getId());
       $request->setWebsiteId(Mage::app()->getStore()->getWebsiteId());*/
     $request->setStoreId($this->getQuote()->getStore()->getId());
     $request->setWebsiteId($this->getQuote()->getStore()->getWebsiteId());
     $request->setFreeShipping($this->getFreeShipping());
     /**
      * Currencies need to convert in free shipping
      */
     $request->setBaseCurrency($this->getQuote()->getStore()->getBaseCurrency());
     $request->setPackageCurrency($this->getQuote()->getStore()->getCurrentCurrency());
     $request->setLimitCarrier($this->getLimitCarrier());
     $result = Mage::getModel('shipping/shipping')->collectRatesWithAddress($request, $this)->getResult();
     $found = false;
     if ($result) {
         $shippingRates = $result->getAllRates();
         foreach ($shippingRates as $shippingRate) {
             $rate = Mage::getModel('sales/quote_address_rate')->importShippingRate($shippingRate);
             if (!$item) {
                 $this->addShippingRate($rate);
             }
             if ($this->getShippingMethod() == $rate->getCode()) {
                 if ($item) {
                     $item->setBaseShippingAmount($rate->getPrice());
                 } else {
                     /**
                      * possible bug: this should be setBaseShippingAmount(),
                      * see Mage_Sales_Model_Quote_Address_Total_Shipping::collect()
                      * where this value is set again from the current specified rate price
                      * (looks like a workaround for this bug)
                      */
                     $this->setShippingAmount($rate->getPrice());
                 }
                 $found = true;
             }
         }
     }
     return $found;
 }
开发者ID:Hospeed,项目名称:Inovarti_PromoFilter,代码行数:75,代码来源:Address.php

示例6: _injectItemData

 /**
  * Inject general item data into the order item payload.
  *
  * @return self
  */
 protected function _injectItemData()
 {
     $this->_orderItem->setLineNumber($this->_item->getId())->setItemId($this->_item->getSku())->setQuantity((int) $this->_item->getQty())->setDescription($this->_item->getName())->setHtsCode($this->_taxHelper->getProductHtsCodeByCountry($this->_itemProduct, $this->_address->getCountryId()))->setManufacturingCountryCode($this->_itemProduct->getCountryOfManufacture());
     return $this;
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:10,代码来源:Item.php

示例7: isItemBackorderable

 /**
  * When an item has no stock in ROM and is set to backorderable in Magento, then return true,
  * otherwise return false as this item is not backorderable it is simply out of stock in ROM.
  *
  * @param  Mage_Sales_Model_Quote_Item_Abstract
  * @param  int
  * @return bool
  */
 protected function isItemBackorderable(Mage_Sales_Model_Quote_Item_Abstract $quoteItem, $romAvailableQuantity)
 {
     return $romAvailableQuantity <= $quoteItem->getQty() && $this->getItemProductStockItem($quoteItem)->getBackorders() > Mage_CatalogInventory_Model_Stock::BACKORDERS_NO;
 }
开发者ID:ryaan-anthony,项目名称:magento-retail-order-management,代码行数:12,代码来源:Service.php

示例8: _recalculateParent

 /**
  * Recalculate row information for item based on children calculation
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  *
  * @return  Mage_Tax_Model_Sales_Total_Quote_Subtotal
  */
 protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $rowTotal = 0;
     $baseRowTotal = 0;
     $rowTotalInclTax = 0;
     $baseRowTotalInclTax = 0;
     $rowTax = 0;
     $baseRowTax = 0;
     $store = $item->getStore();
     $qty = $item->getQty();
     foreach ($item->getChildren() as $child) {
         $rowTotal += $child->getRowTotal();
         $baseRowTotal += $child->getBaseRowTotal();
         $rowTotalInclTax += $child->getRowTotalInclTax();
         $baseRowTotalInclTax += $child->getBaseRowTotalInclTax();
         $rowTax += $child->getRowTax();
         $baseRowTax += $child->getBaseRowTax();
     }
     $item->setConvertedPrice($store->roundPrice($rowTotal) / $qty);
     $item->setPrice($store->roundPrice($baseRowTotal) / $qty);
     $item->setRowTotal($rowTotal);
     $item->setBaseRowTotal($baseRowTotal);
     $item->setPriceInclTax($store->roundPrice($rowTotalInclTax) / $qty);
     $item->setBasePriceInclTax($store->roundPrice($baseRowTotalInclTax) / $qty);
     $item->setRowTotalInclTax($rowTotalInclTax);
     $item->setBaseRowTotalInclTax($baseRowTotalInclTax);
     $item->setRowTax($rowTax);
     $item->setBaseRowTax($baseRowTax);
     return $this;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:37,代码来源:Subtotal.php

示例9: requestShippingRates

 /**
  * Request shipping rates for entire address or specified address item
  * Returns true if current selected shipping method code corresponds to one of the found rates
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @return bool
  */
 public function requestShippingRates(Mage_Sales_Model_Quote_Item_Abstract $item = null)
 {
     /** @var $request Mage_Shipping_Model_Rate_Request */
     $request = Mage::getModel('shipping/rate_request');
     $request->setAllItems($item ? array($item) : $this->getAllItems());
     $request->setDestCountryId($this->getCountryId());
     $request->setDestRegionId($this->getRegionId());
     $request->setDestRegionCode($this->getRegionCode());
     /**
      * need to call getStreet with -1
      * to get data in string instead of array
      */
     $request->setDestStreet($this->getStreet(-1));
     $request->setDestCity($this->getCity());
     $request->setDestPostcode($this->getPostcode());
     $request->setPackageValue($item ? $item->getBaseRowTotal() : $this->getBaseSubtotal());
     $packageValueWithDiscount = $item ? $item->getBaseRowTotal() - $item->getBaseDiscountAmount() : $this->getBaseSubtotalWithDiscount();
     $request->setPackageValueWithDiscount($packageValueWithDiscount);
     $request->setPackageWeight($item ? $item->getRowWeight() : $this->getWeight());
     $request->setPackageQty($item ? $item->getQty() : $this->getItemQty());
     /**
      * Need for shipping methods that use insurance based on price of physical products
      */
     $packagePhysicalValue = $item ? $item->getBaseRowTotal() : $this->getBaseSubtotal() - $this->getBaseVirtualAmount();
     $request->setPackagePhysicalValue($packagePhysicalValue);
     $request->setFreeMethodWeight($item ? 0 : $this->getFreeMethodWeight());
     /**
      * Store and website identifiers need specify from quote
      */
     /*$request->setStoreId(Mage::app()->getStore()->getId());
       $request->setWebsiteId(Mage::app()->getStore()->getWebsiteId());*/
     $request->setStoreId($this->getQuote()->getStore()->getId());
     $request->setWebsiteId($this->getQuote()->getStore()->getWebsiteId());
     $request->setFreeShipping($this->getFreeShipping());
     /**
      * Currencies need to convert in free shipping
      */
     $request->setBaseCurrency($this->getQuote()->getStore()->getBaseCurrency());
     $request->setPackageCurrency($this->getQuote()->getStore()->getCurrentCurrency());
     $request->setLimitCarrier($this->getLimitCarrier());
     $request->setBaseSubtotalInclTax($this->getBaseSubtotalInclTax());
     $result = Mage::getModel('shipping/shipping')->collectRates($request)->getResult();
     $found = false;
     if ($result) {
         $shippingRates = $result->getAllRates();
         // ============ Apply shipping on order minimum value after discount specific to coupon code only =================
         if (!Mage::app()->getStore()->isAdmin()) {
             foreach ($shippingRates as $i => $r) {
                 if ($r->getMethod() == 'freeshipping') {
                     unset($shippingRates[$i]);
                 }
             }
         }
         $isfree = true;
         $minimum_purchange_amount = Mage::getStoreConfig('sales/minimum_order_custom/minimum_purchange_amount');
         $minimum_purchange_amount_status = Mage::getStoreConfig('sales/minimum_order_custom/minimum_purchange_amount_status');
         if ($minimum_purchange_amount_status == '1' && $minimum_purchange_amount > 0) {
             $minPurchaseAmt = Mage::helper('common')->checkMinPurchageAmount($minimum_purchange_amount);
             if ($minPurchaseAmt) {
                 foreach ($shippingRates as $i => $r) {
                     if ($r->getMethod() == 'standard') {
                         $shippingRates[$i]->setPrice(0);
                         $shippingRates[$i]->setCost(0);
                         $isfree = true;
                     }
                 }
             }
         }
         // ==========================================================================================
         foreach ($shippingRates as $shippingRate) {
             $rate = Mage::getModel('sales/quote_address_rate')->importShippingRate($shippingRate);
             if (!$item) {
                 $this->addShippingRate($rate);
             }
             if ($this->getShippingMethod() == $rate->getCode()) {
                 if ($item) {
                     $item->setBaseShippingAmount($rate->getPrice());
                 } else {
                     /**
                      * possible bug: this should be setBaseShippingAmount(),
                      * see Mage_Sales_Model_Quote_Address_Total_Shipping::collect()
                      * where this value is set again from the current specified rate price
                      * (looks like a workaround for this bug)
                      */
                     $this->setShippingAmount($rate->getPrice());
                 }
                 $found = true;
             }
         }
     }
     return $found;
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:99,代码来源:Address.php

示例10: _processItem

 /**
  * Process item fixed taxes
  *
  * @deprecated since 1.3.2.3
  * @param   Mage_Sales_Model_Quote_Address $address
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @param   bool $updateParent
  * @return  Mage_Weee_Model_Total_Quote_Weee
  */
 protected function _processItem(Mage_Sales_Model_Quote_Address $address, $item, $updateParent = false)
 {
     $store = $address->getQuote()->getStore();
     if (!$this->_helper->isEnabled($store)) {
         return $this;
     }
     $custTaxClassId = $address->getQuote()->getCustomerTaxClassId();
     $taxCalculationModel = Mage::getSingleton('tax/calculation');
     /* @var $taxCalculationModel Mage_Tax_Model_Calculation */
     $request = $taxCalculationModel->getRateRequest($address, $address->getQuote()->getBillingAddress(), $custTaxClassId, $store);
     $defaultRateRequest = $taxCalculationModel->getRateRequest(false, false, false, $store);
     $attributes = $this->_helper->getProductWeeeAttributes($item->getProduct(), $address, $address->getQuote()->getBillingAddress(), $store->getWebsiteId());
     $applied = array();
     $productTaxes = array();
     foreach ($attributes as $k => $attribute) {
         $baseValue = $attribute->getAmount();
         $value = $store->convertPrice($baseValue);
         $rowValue = $value * $item->getQty();
         $baseRowValue = $baseValue * $item->getQty();
         $title = $attribute->getName();
         /**
          * Apply discount to fixed tax
          */
         if ($item->getDiscountPercent() && $this->_helper->isDiscounted($store)) {
             $valueDiscount = $value / 100 * $item->getDiscountPercent();
             $baseValueDiscount = $baseValue / 100 * $item->getDiscountPercent();
             $rowValueDiscount = $rowValue / 100 * $item->getDiscountPercent();
             $baseRowValueDiscount = $baseRowValue / 100 * $item->getDiscountPercent();
             $address->setDiscountAmount($address->getDiscountAmount() + $rowValueDiscount);
             $address->setBaseDiscountAmount($address->getBaseDiscountAmount() + $baseRowValueDiscount);
             $address->setGrandTotal($address->getGrandTotal() - $rowValueDiscount);
             $address->setBaseGrandTotal($address->getBaseGrandTotal() - $baseRowValueDiscount);
         }
         $oneDisposition = $baseOneDisposition = $disposition = $baseDisposition = 0;
         /**
          * Apply tax percent to fixed tax
          */
         if ($this->_helper->isTaxable($store)) {
             $currentPercent = $item->getTaxPercent();
             $defaultPercent = $taxCalculationModel->getRate($defaultRateRequest->setProductClassId($item->getProduct()->getTaxClassId()));
             $valueBeforeVAT = $rowValue;
             $baseValueBeforeVAT = $baseRowValue;
             $oneDisposition = $store->roundPrice($value / (100 + $defaultPercent) * $currentPercent);
             $baseOneDisposition = $store->roundPrice($baseValue / (100 + $defaultPercent) * $currentPercent);
             $disposition = $store->roundPrice($rowValue / (100 + $defaultPercent) * $currentPercent);
             $baseDisposition = $store->roundPrice($baseRowValue / (100 + $defaultPercent) * $currentPercent);
             $item->setBaseTaxAmount($item->getBaseTaxAmount() + $baseDisposition);
             $item->setTaxAmount($item->getTaxAmount() + $disposition);
             $value -= $oneDisposition;
             $baseValue -= $baseOneDisposition;
             $rowValue -= $baseDisposition;
             $baseRowValue -= $disposition;
             $item->setWeeeTaxDisposition($item->getWeeeTaxDisposition() + $oneDisposition);
             $item->setBaseWeeeTaxDisposition($item->getBaseWeeeTaxDisposition() + $baseOneDisposition);
             $item->setWeeeTaxRowDisposition($item->getWeeeTaxRowDisposition() + $disposition);
             $item->setBaseWeeeTaxRowDisposition($item->getBaseWeeeTaxRowDisposition() + $baseDisposition);
             //                $item->setTaxBeforeDiscount($item->getTaxBeforeDiscount() + $disposition);
             //                $item->setBaseTaxBeforeDiscount($item->getBaseTaxBeforeDiscount() + $baseDisposition);
             $address->setTaxAmount($address->getTaxAmount() + $disposition);
             $address->setBaseTaxAmount($address->getBaseTaxAmount() + $baseDisposition);
             $rate = $taxCalculationModel->getRate($request->setProductClassId($item->getProduct()->getTaxClassId()));
             $this->_saveAppliedTaxes($address, $taxCalculationModel->getAppliedRates($request), $store->roundPrice($valueBeforeVAT - $rowValue), $store->roundPrice($baseValueBeforeVAT - $baseRowValue), $rate);
             $address->setGrandTotal($address->getGrandTotal() + $store->roundPrice($valueBeforeVAT - $rowValue));
             $address->setBaseGrandTotal($address->getBaseGrandTotal() + $store->roundPrice($baseValueBeforeVAT - $baseRowValue));
         }
         /**
          * Check if need include fixed tax amount to subtotal
          */
         if ($this->_helper->includeInSubtotal($store)) {
             $address->setSubtotal($address->getSubtotal() + $rowValue);
             $address->setBaseSubtotal($address->getBaseSubtotal() + $baseRowValue);
             //                $address->setSubtotalWithDiscount($address->getSubtotalWithDiscount() + $rowValue);
             //                $address->setBaseSubtotalWithDiscount($address->getBaseSubtotalWithDiscount() + $baseRowValue);
         } else {
             $address->setTaxAmount($address->getTaxAmount() + $rowValue);
             $address->setBaseTaxAmount($address->getBaseTaxAmount() + $baseRowValue);
         }
         $productTaxes[] = array('title' => $title, 'base_amount' => $baseValue, 'amount' => $value, 'row_amount' => $rowValue, 'base_row_amount' => $baseRowValue, 'base_amount_incl_tax' => $baseValue + $baseOneDisposition, 'amount_incl_tax' => $value + $oneDisposition, 'row_amount_incl_tax' => $rowValue + $disposition, 'base_row_amount_incl_tax' => $baseRowValue + $baseDisposition);
         $applied[] = array('id' => $attribute->getCode(), 'percent' => null, 'hidden' => $this->_helper->includeInSubtotal($store), 'rates' => array(array('amount' => $rowValue, 'base_amount' => $baseRowValue, 'base_real_amount' => $baseRowValue, 'code' => $attribute->getCode(), 'title' => $title, 'percent' => null, 'position' => 1, 'priority' => -1000 + $k)));
         $item->setBaseWeeeTaxAppliedAmount($item->getBaseWeeeTaxAppliedAmount() + $baseValue);
         $item->setBaseWeeeTaxAppliedRowAmount($item->getBaseWeeeTaxAppliedRowAmount() + $baseRowValue);
         $item->setWeeeTaxAppliedAmount($item->getWeeeTaxAppliedAmount() + $value);
         $item->setWeeeTaxAppliedRowAmount($item->getWeeeTaxAppliedRowAmount() + $rowValue);
     }
     $this->_helper->setApplied($item, array_merge($this->_helper->getApplied($item), $productTaxes));
     if ($updateParent) {
         $parent = $item->getParentItem();
         $parent->setBaseWeeeTaxDisposition($parent->getBaseWeeeTaxDisposition() + $item->getBaseWeeeTaxDisposition());
         $parent->setWeeeTaxDisposition($parent->getWeeeTaxDisposition() + $item->getWeeeTaxDisposition());
         $parent->setBaseWeeeTaxRowDisposition($parent->getBaseWeeeTaxRowDisposition() + $item->getBaseWeeeTaxRowDisposition());
         $parent->setWeeeTaxRowDisposition($parent->getWeeeTaxRowDisposition() + $item->getWeeeTaxRowDisposition());
//.........这里部分代码省略.........
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:101,代码来源:Weee.php

示例11: _notifyCustomerIfItemBackorderable

 /**
  * Notify the customer if the quote item is backorderable with setting to notify customer.
  *
  * @param  Mage_Sales_Model_Quote_Item_Abstract
  * @return self
  */
 protected function _notifyCustomerIfItemBackorderable(Mage_Sales_Model_Quote_Item_Abstract $quoteItem)
 {
     /** @var Mage_CatalogInventory_Model_Stock_Item $stockItem */
     $stockItem = $quoteItem->getProduct()->getStockItem();
     if ((int) $stockItem->getBackorders() === Mage_CatalogInventory_Model_Stock::BACKORDERS_YES_NOTIFY) {
         /** @var float */
         $qty = $quoteItem->getQty();
         /** @var float */
         $rowQty = $this->_calculateTotalQuantityRequested($quoteItem);
         /** @var Varien_Object */
         $result = $stockItem->checkQuoteItemQty($rowQty, $qty);
         if (!is_null($result->getMessage())) {
             $quoteItem->setMessage($result->getMessage());
         }
         if (!is_null($result->getItemBackorders())) {
             $quoteItem->setBackorders($result->getItemBackorders());
         }
     }
     return $this;
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:26,代码来源:Service.php

示例12: requestShippingRates

 /**
  * WE NEEDED TO OVERRIDE THIS METHOD CALL TO UPDATE THE SHIPPING RATES AS
  * SOON AS WE RECEIVED THEM
  * 
  * 
  * 
  * 
  * Request shipping rates for entire address or specified address item
  * Returns true if current selected shipping method code corresponds to one of the found rates
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @return bool
  */
 public function requestShippingRates(Mage_Sales_Model_Quote_Item_Abstract $item = null)
 {
     /**
      * CUSTOMIZED THIS FUNCTION BY ADDING THIS EVENT CALL
      */
     if (!$this->getQuote()->getShippingAddress()->getResidentialIndicator()) {
         Mage::dispatchEvent('widgetized_validate_address', array($this->_eventObject => $this, 'order' => $this->getQuote()));
     }
     /** @var $request Mage_Shipping_Model_Rate_Request */
     $request = Mage::getModel('shipping/rate_request');
     $request->setQuote($this->getQuote());
     $request->setAllItems($item ? array($item) : $this->getAllItems());
     $request->setDestCountryId($this->getCountryId());
     $request->setDestRegionId($this->getRegionId());
     $request->setDestRegionCode($this->getRegionCode());
     /**
      * need to call getStreet with -1
      * to get data in string instead of array
      */
     $request->setDestStreet($this->getStreet(self::DEFAULT_DEST_STREET));
     $request->setDestCity($this->getCity());
     $request->setDestPostcode($this->getPostcode());
     $request->setPackageValue($item ? $item->getBaseRowTotal() : $this->getBaseSubtotal());
     $packageValueWithDiscount = $item ? $item->getBaseRowTotal() - $item->getBaseDiscountAmount() : $this->getBaseSubtotalWithDiscount();
     $request->setPackageValueWithDiscount($packageValueWithDiscount);
     $request->setPackageWeight($item ? $item->getRowWeight() : $this->getWeight());
     $request->setPackageQty($item ? $item->getQty() : $this->getItemQty());
     /**
      * Need for shipping methods that use insurance based on price of physical products
      */
     $packagePhysicalValue = $item ? $item->getBaseRowTotal() : $this->getBaseSubtotal() - $this->getBaseVirtualAmount();
     $request->setPackagePhysicalValue($packagePhysicalValue);
     $request->setFreeMethodWeight($item ? 0 : $this->getFreeMethodWeight());
     /**
      * Store and website identifiers need specify from quote
      */
     /*$request->setStoreId(Mage::app()->getStore()->getId());
       $request->setWebsiteId(Mage::app()->getStore()->getWebsiteId());*/
     $request->setStoreId($this->getQuote()->getStore()->getId());
     $request->setWebsiteId($this->getQuote()->getStore()->getWebsiteId());
     $request->setFreeShipping($this->getFreeShipping());
     /**
      * Currencies need to convert in free shipping
      */
     $request->setBaseCurrency($this->getQuote()->getStore()->getBaseCurrency());
     $request->setPackageCurrency($this->getQuote()->getStore()->getCurrentCurrency());
     $request->setLimitCarrier($this->getLimitCarrier());
     $request->setBaseSubtotalInclTax($this->getBaseSubtotalInclTax() + $this->getBaseExtraTaxAmount());
     $result = Mage::getModel('shipping/shipping')->collectRates($request)->getResult();
     $found = false;
     if ($result) {
         $shippingRates = $result->getAllRates();
         //            var_dump($shippingRates);die;
         /**
          * CUSTOMIZED THIS FUNCTION BY ADDING THIS EVENT CALL
          */
         Mage::dispatchEvent($this->_eventPrefix . '_update_shipping_rates', array($this->_eventObject => $this, 'shipping_rates' => $shippingRates));
         foreach ($shippingRates as $shippingRate) {
             $rate = Mage::getModel('sales/quote_address_rate')->importShippingRate($shippingRate);
             /**
              * COST is Cheaper than the PRICE
              * 
              * We don't want to use the price, we want to give shipping
              * to users at cost.
              */
             if (!$item) {
                 $this->addShippingRate($rate);
             }
             if ($this->getShippingMethod() == $rate->getCode()) {
                 $price = $rate->getCost();
                 if (!$price) {
                     $price = $rate->getPrice();
                 }
                 if ($item) {
                     $item->setBaseShippingAmount($price);
                 } else {
                     /**
                      * possible bug: this should be setBaseShippingAmount(),
                      * see Mage_Sales_Model_Quote_Address_Total_Shipping::collect()
                      * where this value is set again from the current specified rate price
                      * (looks like a workaround for this bug)
                      */
                     $this->setShippingAmount($price);
                 }
                 $found = true;
             }
         }
//.........这里部分代码省略.........
开发者ID:Jonathonbyrd,项目名称:Optimized-Magento-1.9.x,代码行数:101,代码来源:Address.php

示例13: requestShippingRates

 /**
  * Request shipping rates for entire address or specified address item
  * Returns true if current selected shipping method code corresponds to one of the found rates
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @return bool
  */
 public function requestShippingRates(Mage_Sales_Model_Quote_Item_Abstract $item = null)
 {
     /** @var $request Mage_Shipping_Model_Rate_Request */
     $request = Mage::getModel('shipping/rate_request');
     $request->setAllItems($item ? array($item) : $this->getAllItems());
     $request->setDestCountryId($this->getCountryId());
     $request->setDestRegionId($this->getRegionId());
     $request->setDestRegionCode($this->getRegionCode());
     /**
      * need to call getStreet with -1
      * to get data in string instead of array
      */
     $request->setDestStreet($this->getStreet(-1));
     $request->setDestCity($this->getCity());
     $request->setDestPostcode($this->getPostcode());
     $request->setPackageValue($item ? $item->getBaseRowTotal() : $this->getBaseSubtotal());
     $packageValueWithDiscount = $item ? $item->getBaseRowTotal() - $item->getBaseDiscountAmount() : $this->getBaseSubtotalWithDiscount();
     $request->setPackageValueWithDiscount($packageValueWithDiscount);
     $request->setPackageWeight($item ? $item->getRowWeight() : $this->getWeight());
     $request->setPackageQty($item ? $item->getQty() : $this->getItemQty());
     /**
      * Need for shipping methods that use insurance based on price of physical products
      */
     $packagePhysicalValue = $item ? $item->getBaseRowTotal() : $this->getBaseSubtotal() - $this->getBaseVirtualAmount();
     $request->setPackagePhysicalValue($packagePhysicalValue);
     $request->setFreeMethodWeight($item ? 0 : $this->getFreeMethodWeight());
     /**
      * Store and website identifiers need specify from quote
      */
     /*$request->setStoreId(Mage::app()->getStore()->getId());
       $request->setWebsiteId(Mage::app()->getStore()->getWebsiteId());*/
     $request->setStoreId($this->getQuote()->getStore()->getId());
     $request->setWebsiteId($this->getQuote()->getStore()->getWebsiteId());
     $request->setFreeShipping($this->getFreeShipping());
     /**
      * Currencies need to convert in free shipping
      */
     $request->setBaseCurrency($this->getQuote()->getStore()->getBaseCurrency());
     $request->setPackageCurrency($this->getQuote()->getStore()->getCurrentCurrency());
     $request->setLimitCarrier($this->getLimitCarrier());
     $request->setBaseSubtotalInclTax($this->getBaseSubtotalInclTax());
     $result = Mage::getModel('shipping/shipping')->collectRates($request)->getResult();
     $found = true;
     return $found;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:52,代码来源:Address.php

示例14: itemToOrderItem

 /**
  * Convert quote item to order item
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Sales_Model_Order_Item
  */
 public function itemToOrderItem(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $orderItem = Mage::getModel('sales/order_item')->setStoreId($item->getStoreId())->setQuoteItemId($item->getId())->setProductId($item->getProductId())->setSuperProductId($item->getSuperProductId())->setParentProductId($item->getParentProductId())->setSku($item->getSku())->setName($item->getName())->setDescription($item->getDescription())->setWeight($item->getWeight())->setIsQtyDecimal($item->getIsQtyDecimal())->setQtyOrdered($item->getQty())->setOriginalPrice($item->getOriginalPrice())->setAppliedRuleIds($item->getAppliedRuleIds())->setAdditionalData($item->getAdditionalData())->setPrice($item->getCalculationPrice())->setTaxPercent($item->getTaxPercent())->setTaxAmount($item->getTaxAmount())->setRowWeight($item->getRowWeight())->setRowTotal($item->getRowTotal())->setBasePrice($item->getBaseCalculationPrice())->setBaseOriginalPrice($item->getPrice())->setBaseTaxAmount($item->getBaseTaxAmount())->setBaseRowTotal($item->getBaseRowTotal());
     if (!$item->getNoDiscount()) {
         $orderItem->setDiscountPercent($item->getDiscountPercent())->setDiscountAmount($item->getDiscountAmount())->setBaseDiscountAmount($item->getBaseDiscountAmount());
     }
     Mage::dispatchEvent('sales_convert_quote_item_to_order_item', array('order_item' => $orderItem, 'item' => $item));
     return $orderItem;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:15,代码来源:Quote.php


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