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


PHP Object::getPrice方法代码示例

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


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

示例1: testGetAllItems

 public function testGetAllItems()
 {
     $totals = $this->_prepareValidModelData();
     $this->assertEquals([new \Magento\Framework\Object(['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:nja78,项目名称:magento2,代码行数:9,代码来源:CartTest.php

示例2: render

 /**
  * Render minimal price for downloadable products
  *
  * @param \Magento\Framework\Object $row
  * @return string
  */
 public function render(\Magento\Framework\Object $row)
 {
     if ($row->getTypeId() == 'downloadable') {
         $row->setPrice($row->getPrice());
     }
     return parent::render($row);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:Price.php

示例3: validate

 /**
  * Validate Product Rule Condition
  *
  * @param \Magento\Framework\Object $object
  * @return bool
  */
 public function validate(\Magento\Framework\Object $object)
 {
     //@todo reimplement this method when is fixed MAGETWO-5713
     /** @var \Magento\Catalog\Model\Product $product */
     $product = $object->getProduct();
     if (!$product instanceof \Magento\Catalog\Model\Product) {
         $product = $this->_productFactory->create()->load($object->getProductId());
     }
     $product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal());
     return parent::validate($product);
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:17,代码来源:Product.php

示例4: testGetPrice

 /**
  * @param \Magento\Framework\Object $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 getPriceDataProvider
  */
 public function testGetPrice($input, $expectOutputPrice, $configs = [], $productClassName = 'DefaultProductClass')
 {
     $this->setUpDefaultRules();
     $fixtureProductId = 1;
     /** @var \Magento\Catalog\Model\Product $product */
     $product = $this->objectManager->create('Magento\\Catalog\\Model\\Product')->load($fixtureProductId);
     $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->getPrice($product, $input->getPrice(), $input->getIncludingTax(), $shippingAddress, $billingAddress, $this->taxClasses['DefaultCustomerClass'], $input->getStore(), $input->getPriceIncludesTax(), $input->getRoundPrice());
     $this->assertEquals($expectOutputPrice, $price);
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:27,代码来源:DataTest.php

示例5: renderShippingRateOption

 /**
  * Get shipping rate code title and its price or error message
  *
  * @param \Magento\Framework\Object $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, __('Incl. Tax'), $incl);
         }
     }
     return sprintf($format, $this->escapeHtml($rate->getMethodTitle()), $price, $renderedInclTax);
 }
开发者ID:zhangjiachao,项目名称:magento2,代码行数:22,代码来源:Review.php

示例6: 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

示例7: _getInitialItem

 /**
  * Create and return new order item based on payment item data and $itemInfo
  * for initial payment
  *
  * @param \Magento\Framework\Object $itemInfo
  * @return \Magento\Sales\Model\Order\Item
  */
 protected function _getInitialItem($itemInfo)
 {
     $price = $itemInfo->getPrice() ? $itemInfo->getPrice() : $this->getInitAmount();
     $shippingAmount = $itemInfo->getShippingAmount() ? $itemInfo->getShippingAmount() : 0;
     $taxAmount = $itemInfo->getTaxAmount() ? $itemInfo->getTaxAmount() : 0;
     $item = $this->_orderItemFactory->create()->setStoreId($this->getStoreId())->setProductType(\Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL)->setIsVirtual(1)->setSku('initial_fee')->setName(__('Recurring Payment Initial Fee'))->setDescription('')->setWeight(0)->setQtyOrdered(1)->setPrice($price)->setOriginalPrice($price)->setBasePrice($price)->setBaseOriginalPrice($price)->setRowTotal($price)->setBaseRowTotal($price)->setTaxAmount($taxAmount)->setShippingAmount($shippingAmount);
     $option = array('label' => __('Payment type'), 'value' => __('Initial period payment'));
     $this->_addAdditionalOptionToItem($item, $option);
     return $item;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:Payment.php


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