當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Object::getQtyOrdered方法代碼示例

本文整理匯總了PHP中Magento\Framework\Object::getQtyOrdered方法的典型用法代碼示例。如果您正苦於以下問題:PHP Object::getQtyOrdered方法的具體用法?PHP Object::getQtyOrdered怎麽用?PHP Object::getQtyOrdered使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\Object的用法示例。


在下文中一共展示了Object::getQtyOrdered方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: registerItemSale

 /**
  * Subtract ordered qty for product
  *
  * @param  \Magento\Framework\Object $item
  * @return $this
  * @throws \Magento\Framework\Model\Exception
  */
 public function registerItemSale(\Magento\Framework\Object $item)
 {
     $productId = $item->getProductId();
     if (!$productId) {
         throw new \Magento\Framework\Model\Exception(__('We cannot specify a product identifier for the order item.'));
     }
     /** @var Item $stockItem */
     $stockItem = $this->_stockItemFactory->create()->loadByProduct($productId);
     if ($this->stockItemService->isQty($this->getProductType($productId))) {
         if ($item->getStoreId()) {
             $stockItem->setStoreId($item->getStoreId());
         }
         if ($stockItem->checkQty($item->getQtyOrdered())) {
             $stockItem->subtractQty($item->getQtyOrdered());
             $stockItem->save();
         }
     }
     return $this;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:26,代碼來源:Stock.php

示例2: getPriceInclTax

 /**
  * Get sales item (quote item, order item etc) price including tax based on row total and tax amount
  *
  * @param   \Magento\Framework\Object $item
  * @return  float
  */
 public function getPriceInclTax($item)
 {
     if ($item->getPriceInclTax()) {
         return $item->getPriceInclTax();
     }
     $qty = $item->getQty() ? $item->getQty() : ($item->getQtyOrdered() ? $item->getQtyOrdered() : 1);
     $taxAmount = $item->getTaxAmount() + $item->getDiscountTaxCompensation();
     $price = floatval($qty) ? ($item->getRowTotal() + $taxAmount) / $qty : 0;
     return $this->priceCurrency->round($price);
 }
開發者ID:zhangjiachao,項目名稱:magento2,代碼行數:16,代碼來源:Data.php

示例3: displayPriceInclTax

 /**
  * Retrieve include tax html formatted content
  *
  * @param \Magento\Framework\Object $item
  * @return string
  */
 public function displayPriceInclTax(\Magento\Framework\Object $item)
 {
     $qty = $item->getQtyOrdered() ? $item->getQtyOrdered() : ($item->getQty() ? $item->getQty() : 1);
     $baseTax = $item->getTaxBeforeDiscount() ? $item->getTaxBeforeDiscount() : ($item->getTaxAmount() ? $item->getTaxAmount() : 0);
     $tax = $item->getBaseTaxBeforeDiscount() ? $item->getBaseTaxBeforeDiscount() : ($item->getBaseTaxAmount() ? $item->getBaseTaxAmount() : 0);
     $basePriceTax = 0;
     $priceTax = 0;
     if (floatval($qty)) {
         $basePriceTax = $item->getBasePrice() + $baseTax / $qty;
         $priceTax = $item->getPrice() + $tax / $qty;
     }
     return $this->displayPrices($this->getOrder()->getStore()->roundPrice($basePriceTax), $this->getOrder()->getStore()->roundPrice($priceTax));
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:19,代碼來源:AbstractItems.php


注:本文中的Magento\Framework\Object::getQtyOrdered方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。