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


PHP DataObject::getPrice方法代碼示例

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


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

示例1: testGetAllItems

 public function testGetAllItems()
 {
     $totals = $this->_prepareValidModelData();
     $this->assertEquals([new \Magento\Framework\DataObject(['name' => $this->_validItem->getName(), 'qty' => $this->_validItem->getQty(), 'amount' => $this->_validItem->getPrice()])], $this->_model->getAllItems());
     $this->assertEquals($totals['subtotal'], $this->_model->getSubtotal());
     $this->assertEquals($totals['tax'], $this->_model->getTax());
     $this->assertEquals($totals['shipping'], $this->_model->getShipping());
     $this->assertEquals($totals['discount'], $this->_model->getDiscount());
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:9,代碼來源:CartTest.php

示例2: render

 /**
  * Render minimal price for downloadable products
  *
  * @param \Magento\Framework\DataObject $row
  * @return string
  */
 public function render(\Magento\Framework\DataObject $row)
 {
     if ($row->getTypeId() == 'downloadable') {
         $row->setPrice($row->getPrice());
     }
     return parent::render($row);
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:13,代碼來源:Price.php

示例3: renderShippingRateOption

 /**
  * Get shipping rate code title and its price or error message
  *
  * @param \Magento\Framework\DataObject $rate
  * @param string $format
  * @param string $inclTaxFormat
  * @return string
  */
 public function renderShippingRateOption($rate, $format = '%s - %s%s', $inclTaxFormat = ' (%s %s)')
 {
     $renderedInclTax = '';
     if ($rate->getErrorMessage()) {
         $price = $rate->getErrorMessage();
     } else {
         $price = $this->_getShippingPrice($rate->getPrice(), $this->_taxHelper->displayShippingPriceIncludingTax());
         $incl = $this->_getShippingPrice($rate->getPrice(), true);
         if ($incl != $price && $this->_taxHelper->displayShippingBothPrices()) {
             $renderedInclTax = sprintf($inclTaxFormat, $this->escapeHtml(__('Incl. Tax')), $incl);
         }
     }
     return sprintf($format, $this->escapeHtml($rate->getMethodTitle()), $price, $renderedInclTax);
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:22,代碼來源:Review.php

示例4: testGetTaxPrice

 /**
  * @param \Magento\Framework\DataObject $input
  * @param float $expectOutputPrice
  * @param string[] $configs
  * @param string $productClassName
  *
  * @magentoDataFixture Magento/Catalog/_files/products.php
  * @magentoDataFixture Magento/Customer/_files/customer.php
  * @magentoDataFixture Magento/Customer/_files/customer_address.php
  * @magentoDbIsolation enabled
  * @dataProvider getTaxPriceDataProvider
  */
 public function testGetTaxPrice($input, $expectOutputPrice, $configs = [], $productClassName = 'DefaultProductClass')
 {
     $this->setUpDefaultRules();
     /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
     $productRepository = $this->objectManager->get('Magento\\Catalog\\Api\\ProductRepositoryInterface');
     /** @var \Magento\Catalog\Model\Product $product */
     $product = $productRepository->get('simple');
     $product->setTaxClassId($this->taxClasses[$productClassName]);
     $shippingAddress = $this->getCustomerAddress();
     $billingAddress = $shippingAddress;
     foreach ($configs as $config) {
         $this->scopeConfig->setValue($config['path'], $config['value'], ScopeInterface::SCOPE_STORE, 'default');
     }
     $price = $this->helper->getTaxPrice($product, $input->getPrice(), $input->getIncludingTax(), $shippingAddress, $billingAddress, $this->taxClasses['DefaultCustomerClass'], $input->getStore(), $input->getPriceIncludesTax(), $input->getRoundPrice());
     if ($input->getNotEqual()) {
         $this->assertNotEquals($expectOutputPrice, $price);
     } else {
         $this->assertEquals($expectOutputPrice, $price);
     }
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:32,代碼來源:DataTest.php


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