• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Helper\Data类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Weee\Helper\Data的典型用法代码示例。如果您正苦于以下问题:PHP Data类的具体用法?PHP Data怎么用?PHP Data使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: execute

 /**
  * @param Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function execute(Observer $observer)
 {
     if ($this->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && $this->weeeHelper->isEnabled()) {
         /** @var \Magento\Customer\Model\Data\Customer $customer */
         $customer = $observer->getData('customer');
         /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */
         $addresses = $customer->getAddresses();
         if (isset($addresses)) {
             $defaultShippingFound = false;
             $defaultBillingFound = false;
             foreach ($addresses as $address) {
                 if ($address->isDefaultBilling()) {
                     $defaultBillingFound = true;
                     $this->customerSession->setDefaultTaxBillingAddress(['country_id' => $address->getCountryId(), 'region_id' => $address->getRegion() ? $address->getRegion()->getRegionId() : null, 'postcode' => $address->getPostcode()]);
                 }
                 if ($address->isDefaultShipping()) {
                     $defaultShippingFound = true;
                     $this->customerSession->setDefaultTaxShippingAddress(['country_id' => $address->getCountryId(), 'region_id' => $address->getRegion() ? $address->getRegion()->getRegionId() : null, 'postcode' => $address->getPostcode()]);
                 }
                 if ($defaultShippingFound && $defaultBillingFound) {
                     break;
                 }
             }
         }
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:31,代码来源:CustomerLoggedIn.php


示例2: getWhichCalcPriceToUse

 /**
  * Returns which product price to use as a basis for the Weee's final price
  *
  * @param  int|null $storeId
  * @return string
  */
 protected function getWhichCalcPriceToUse($storeId = null)
 {
     $calcPrice = 'finalPrice';
     if ($this->weeeData->geDisplayExcl($storeId) || $this->weeeData->geDisplayExlDescIncl($storeId) || $this->taxData->priceIncludesTax() && $this->taxData->displayPriceExcludingTax()) {
         $calcPrice = 'basePrice';
     }
     return $calcPrice;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:14,代码来源:UpdateProductOptionsObserver.php


示例3: getTotalsForDisplay

 /**
  * Check if weee total amount should be included
  * array(
  *  $index => array(
  *      'amount'   => $amount,
  *      'label'    => $label,
  *      'font_size'=> $font_size
  *  )
  * )
  * @return array
  */
 public function getTotalsForDisplay()
 {
     /** @var $items \Magento\Sales\Model\Order\Item[] */
     $items = $this->getSource()->getAllItems();
     $store = $this->getSource()->getStore();
     $weeeTotal = $this->_weeeData->getTotalAmounts($items, $store);
     // If we have no Weee, check if we still need to display it
     if (!$weeeTotal && !filter_var($this->getDisplayZero(), FILTER_VALIDATE_BOOLEAN)) {
         return [];
     }
     // Display the Weee total amount
     $fontSize = $this->getFontSize() ? $this->getFontSize() : 7;
     $totals = [['amount' => $this->getOrder()->formatPriceTxt($weeeTotal), 'label' => __($this->getTitle()) . ':', 'font_size' => $fontSize]];
     return $totals;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:26,代码来源:Weee.php


示例4: getPriceConfiguration

 /**
  * Modify the options config for the front end to resemble the weee final price
  *
  * @param   \Magento\Framework\Event\Observer $observer
  * @return  $this
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function getPriceConfiguration(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_weeeData->isEnabled()) {
         $priceConfigObj = $observer->getData('configObj');
         $priceConfig = $priceConfigObj->getConfig();
         try {
             if (is_array($priceConfig)) {
                 foreach ($priceConfig as $keyConfigs => $configs) {
                     if (is_array($configs)) {
                         foreach ($configs as $keyConfig => $config) {
                             $calcPrice = 'finalPrice';
                             if ($this->_taxData->priceIncludesTax() && $this->_taxData->displayPriceExcludingTax()) {
                                 $calcPrice = 'basePrice';
                             }
                             if (array_key_exists('prices', $configs)) {
                                 $priceConfig[$keyConfigs]['prices']['weeePrice'] = ['amount' => $configs['prices'][$calcPrice]['amount']];
                             } else {
                                 foreach ($configs as $keyConfig => $config) {
                                     $priceConfig[$keyConfigs][$keyConfig]['prices']['weeePrice'] = ['amount' => $config['prices'][$calcPrice]['amount']];
                                 }
                             }
                         }
                     }
                 }
             }
             $priceConfigObj->setConfig($priceConfig);
         } catch (Exception $e) {
             return $this;
         }
     }
     return $this;
 }
开发者ID:nja78,项目名称:magento2,代码行数:39,代码来源:Observer.php


示例5: updateProductOptions

 /**
  * Change default JavaScript templates for options rendering
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return $this
  */
 public function updateProductOptions(\Magento\Framework\Event\Observer $observer)
 {
     $response = $observer->getEvent()->getResponseObject();
     $options = $response->getAdditionalOptions();
     /** @var \Magento\Catalog\Model\Product $product */
     $product = $this->_registry->registry('current_product');
     if (!$product) {
         return $this;
     }
     if ($this->_weeeData->isEnabled() && !$this->_weeeData->geDisplayIncl($product->getStoreId()) && !$this->_weeeData->geDisplayExcl($product->getStoreId())) {
         // only do processing on bundle product
         if ($product->getTypeId() == \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
             if (!array_key_exists('optionTemplate', $options)) {
                 $options['optionTemplate'] = '<%- data.label %>' . '<% if (data.finalPrice.value) { %>' . ' +<%- data.finalPrice.formatted %>' . '<% } %>';
             }
             foreach ($this->_weeeData->getWeeAttributesForBundle($product) as $weeAttribute) {
                 $options['optionTemplate'] .= sprintf(' <%% if (data.weeePrice' . $weeAttribute->getCode() . ') { %%>' . '  (' . $weeAttribute->getName() . ':<%%= data.weeePrice' . $weeAttribute->getCode() . '.formatted %%>)' . '<%% } %%>');
             }
             if ($this->_weeeData->geDisplayExlDescIncl($product->getStoreId())) {
                 $options['optionTemplate'] .= sprintf(' <%% if (data.weeePrice) { %%>' . '<%%= data.weeePrice.formatted %%>' . '<%% } %%>');
             }
         }
     }
     $response->setAdditionalOptions($options);
     return $this;
 }
开发者ID:Coplex,项目名称:magento2,代码行数:32,代码来源:Observer.php


示例6: updateBundleProductOptions

 /**
  * Process bundle options selection for prepare view json
  *
  * @param   \Magento\Framework\Event\Observer $observer
  * @return  $this
  */
 public function updateBundleProductOptions(\Magento\Framework\Event\Observer $observer)
 {
     if (!$this->_weeeData->isEnabled()) {
         return $this;
     }
     $response = $observer->getEvent()->getResponseObject();
     $selection = $observer->getEvent()->getSelection();
     $options = $response->getAdditionalOptions();
     $_product = $this->_registry->registry('current_product');
     $typeDynamic = \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Attributes\Extend::DYNAMIC;
     if (!$_product || $_product->getPriceType() != $typeDynamic) {
         return $this;
     }
     $amount = $this->_weeeData->getAmount($selection);
     $attributes = $this->_weeeData->getProductWeeeAttributes($_product, null, null, null, $this->_weeeData->isTaxable());
     $amountInclTaxes = $this->_weeeData->getAmountInclTaxes($attributes);
     $taxes = $amountInclTaxes - $amount;
     $options['plusDisposition'] = $amount;
     $options['plusDispositionTax'] = $taxes < 0 ? 0 : $taxes;
     // Exclude Weee amount from excluding tax amount
     if (!$this->_weeeData->typeOfDisplay(array(0, 1, 4))) {
         $options['exclDisposition'] = true;
     }
     $response->setAdditionalOptions($options);
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:32,代码来源:Observer.php


示例7: testAfterAddressSave

 public function testAfterAddressSave()
 {
     $this->moduleManagerMock->expects($this->once())->method('isEnabled')->with('Magento_PageCache')->willReturn(true);
     $this->cacheConfigMock->expects($this->once())->method('isEnabled')->willReturn(true);
     $this->weeeHelperMock->expects($this->any())->method('isEnabled')->willReturn(true);
     $address = $this->objectManager->getObject('Magento\\Customer\\Model\\Address');
     $address->setIsDefaultShipping(true);
     $address->setIsDefaultBilling(true);
     $address->setIsPrimaryBilling(true);
     $address->setIsPrimaryShipping(true);
     $address->setCountryId(1);
     $address->setData('postcode', 11111);
     $this->customerSessionMock->expects($this->once())->method('setDefaultTaxBillingAddress')->with(['country_id' => 1, 'region_id' => null, 'postcode' => 11111]);
     $this->customerSessionMock->expects($this->once())->method('setDefaultTaxShippingAddress')->with(['country_id' => 1, 'region_id' => null, 'postcode' => 11111]);
     $this->observerMock->expects($this->once())->method('getCustomerAddress')->willReturn($address);
     $this->session->afterAddressSave($this->observerMock);
 }
开发者ID:nja78,项目名称:magento2,代码行数:17,代码来源:SessionTest.php


示例8: initTotals

 /**
  * Create the weee ("FPT") totals summary
  *
  * @return $this
  */
 public function initTotals()
 {
     /** @var $items \Magento\Sales\Model\Order\Item[] */
     $items = $this->getSource()->getAllItems();
     $store = $this->getSource()->getStore();
     $weeeTotal = $this->weeeData->getTotalAmounts($items, $store);
     if ($weeeTotal) {
         // Add our total information to the set of other totals
         $total = new \Magento\Framework\DataObject(['code' => $this->getNameInLayout(), 'label' => __('FPT'), 'value' => $weeeTotal]);
         if ($this->getBeforeCondition()) {
             $this->getParentBlock()->addTotalBefore($total, $this->getBeforeCondition());
         } else {
             $this->getParentBlock()->addTotal($total, $this->getAfterCondition());
         }
     }
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:22,代码来源:Totals.php


示例9: testExecute

 public function testExecute()
 {
     $this->moduleManagerMock->expects($this->once())->method('isEnabled')->with('Magento_PageCache')->willReturn(true);
     $this->cacheConfigMock->expects($this->once())->method('isEnabled')->willReturn(true);
     $this->weeeHelperMock->expects($this->any())->method('isEnabled')->willReturn(true);
     $customerMock = $this->getMockBuilder('Magento\\Customer\\Model\\Data\\Customer')->disableOriginalConstructor()->getMock();
     $this->observerMock->expects($this->once())->method('getData')->with('customer')->willReturn($customerMock);
     $address = $this->objectManager->getObject('Magento\\Customer\\Model\\Data\\Address');
     $address->setIsDefaultShipping(true);
     $address->setIsDefaultBilling(true);
     $address->setCountryId(1);
     $address->setPostCode(11111);
     $addresses = [$address];
     $customerMock->expects($this->once())->method('getAddresses')->willReturn($addresses);
     $this->customerSessionMock->expects($this->once())->method('setDefaultTaxBillingAddress')->with(['country_id' => 1, 'region_id' => null, 'postcode' => 11111]);
     $this->customerSessionMock->expects($this->once())->method('setDefaultTaxShippingAddress')->with(['country_id' => 1, 'region_id' => null, 'postcode' => 11111]);
     $this->session->execute($this->observerMock);
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:18,代码来源:CustomerLoggedInTest.php


示例10: getWhichCalcPriceToUse

 /**
  * Returns which product price to use as a basis for the Weee's final price
  *
  * @param  int|null $storeId
  * @param  array|null $weeeAttributesForBundle
  * @return string
  */
 protected function getWhichCalcPriceToUse($storeId = null, $weeeAttributesForBundle = null)
 {
     $calcPrice = 'finalPrice';
     if (!empty($weeeAttributesForBundle)) {
         if ($this->weeeData->isDisplayExcl($storeId) || $this->weeeData->isDisplayExclDescIncl($storeId) || $this->taxData->priceIncludesTax() && $this->taxData->displayPriceExcludingTax()) {
             $calcPrice = 'basePrice';
         }
     }
     return $calcPrice;
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:17,代码来源:GetPriceConfigurationObserver.php


示例11: fetch

 /**
  * Fetch the Weee total amount for display in totals block when building the initial quote
  *
  * @param   \Magento\Sales\Model\Quote\Address $address
  * @return  $this
  */
 public function fetch(\Magento\Sales\Model\Quote\Address $address)
 {
     /** @var $items \Magento\Sales\Model\Order\Item[] */
     $items = $this->_getAddressItems($address);
     $store = $address->getQuote()->getStore();
     $weeeTotal = $this->_weeeData->getTotalAmounts($items, $store);
     if ($weeeTotal) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => __('FPT'), 'value' => $weeeTotal, 'area' => null));
     }
     return $this;
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:17,代码来源:Weee.php


示例12: getAmount

 /**
  * Obtain amount
  *
  * @param SaleableInterface $saleableItem
  * @return float
  */
 protected function getAmount(SaleableInterface $saleableItem)
 {
     $weeeTaxAmount = 0;
     $attributes = $this->weeeHelper->getProductWeeeAttributes($saleableItem, null, null, null, true, false);
     if ($attributes != null) {
         foreach ($attributes as $attribute) {
             $weeeTaxAmount += $attribute->getData('tax_amount');
         }
     }
     $weeeTaxAmount = $this->priceCurrency->convert($weeeTaxAmount);
     return $weeeTaxAmount;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:TaxAdjustment.php


示例13: _resetItemData

 /**
  * Reset information about FPT for shopping cart item
  *
  * @param   \Magento\Sales\Model\Quote\Item\AbstractItem $item
  * @return  void
  */
 protected function _resetItemData($item)
 {
     $this->weeeData->setApplied($item, array());
     $item->setBaseWeeeTaxDisposition(0);
     $item->setWeeeTaxDisposition(0);
     $item->setBaseWeeeTaxRowDisposition(0);
     $item->setWeeeTaxRowDisposition(0);
     $item->setBaseWeeeTaxAppliedAmount(0);
     $item->setBaseWeeeTaxAppliedRowAmnt(0);
     $item->setWeeeTaxAppliedAmount(0);
     $item->setWeeeTaxAppliedRowAmount(0);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:18,代码来源:Weee.php


示例14: testGetBaseTotalAmounts

 public function testGetBaseTotalAmounts()
 {
     $item1BaseWeee = 4;
     $item2BaseWeee = 3;
     $expected = $item1BaseWeee + $item2BaseWeee;
     $itemProductSimple1 = $this->getMock('\\Magento\\Quote\\Model\\Quote\\Item', ['getBaseWeeeTaxAppliedRowAmount'], [], '', false);
     $itemProductSimple2 = $this->getMock('\\Magento\\Quote\\Model\\Quote\\Item', ['getBaseWeeeTaxAppliedRowAmount'], [], '', false);
     $items = [$itemProductSimple1, $itemProductSimple2];
     $itemProductSimple1->expects($this->any())->method('getBaseWeeeTaxAppliedRowAmount')->willReturn($item1BaseWeee);
     $itemProductSimple2->expects($this->any())->method('getBaseWeeeTaxAppliedRowAmount')->willReturn($item2BaseWeee);
     $this->assertEquals($expected, $this->helperData->getBaseTotalAmounts($items));
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:12,代码来源:DataTest.php


示例15: resetItemData

 /**
  * Reset information about Tax and Wee on FPT for shopping cart item
  *
  * @param   \Magento\Quote\Model\Quote\Item\AbstractItem $item
  * @return  void
  */
 protected function resetItemData($item)
 {
     $this->weeeData->setApplied($item, []);
     $item->setAssociatedTaxables([]);
     $item->setBaseWeeeTaxDisposition(0);
     $item->setWeeeTaxDisposition(0);
     $item->setBaseWeeeTaxRowDisposition(0);
     $item->setWeeeTaxRowDisposition(0);
     $item->setBaseWeeeTaxAppliedAmount(0);
     $item->setBaseWeeeTaxAppliedRowAmnt(0);
     $item->setWeeeTaxAppliedAmount(0);
     $item->setWeeeTaxAppliedRowAmount(0);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:19,代码来源:Weee.php


示例16: collect

 /**
  * Collect Weee amounts for the credit memo
  *
  * @param Creditmemo $creditmemo
  * @return $this
  */
 public function collect(Creditmemo $creditmemo)
 {
     $store = $creditmemo->getStore();
     $totalTax = 0;
     $baseTotalTax = 0;
     $weeeTaxAmount = 0;
     $baseWeeeTaxAmount = 0;
     foreach ($creditmemo->getAllItems() as $item) {
         if ($item->getOrderItem()->isDummy()) {
             continue;
         }
         $weeeAmountExclTax = ($this->_weeeData->getWeeeTaxInclTax($item) - $this->_weeeData->getTotalTaxAppliedForWeeeTax($item)) * $item->getQty();
         $totalTax += $weeeAmountExclTax;
         $baseWeeeAmountExclTax = ($this->_weeeData->getBaseWeeeTaxInclTax($item) - $this->_weeeData->getBaseTotalTaxAppliedForWeeeTax($item)) * $item->getQty();
         $baseTotalTax += $baseWeeeAmountExclTax;
         $item->setWeeeTaxAppliedRowAmount($weeeAmountExclTax);
         $item->setBaseWeeeTaxAppliedRowAmount($baseWeeeAmountExclTax);
         $weeeTaxAmount += $this->_weeeData->getWeeeTaxInclTax($item) * $item->getQty();
         $baseWeeeTaxAmount += $this->_weeeData->getBaseWeeeTaxInclTax($item) * $item->getQty();
         $newApplied = array();
         $applied = $this->_weeeData->getApplied($item);
         foreach ($applied as $one) {
             $one['base_row_amount'] = $one['base_amount'] * $item->getQty();
             $one['row_amount'] = $one['amount'] * $item->getQty();
             $one['base_row_amount_incl_tax'] = $one['base_amount_incl_tax'] * $item->getQty();
             $one['row_amount_incl_tax'] = $one['amount_incl_tax'] * $item->getQty();
             $newApplied[] = $one;
         }
         $this->_weeeData->setApplied($item, $newApplied);
         $item->setWeeeTaxRowDisposition($item->getWeeeTaxDisposition() * $item->getQty());
         $item->setBaseWeeeTaxRowDisposition($item->getBaseWeeeTaxDisposition() * $item->getQty());
     }
     if ($this->_weeeData->includeInSubtotal($store)) {
         $creditmemo->setSubtotal($creditmemo->getSubtotal() + $totalTax);
         $creditmemo->setBaseSubtotal($creditmemo->getBaseSubtotal() + $baseTotalTax);
     }
     $creditmemo->setSubtotalInclTax($creditmemo->getSubtotalInclTax() + $weeeTaxAmount);
     $creditmemo->setBaseSubtotalInclTax($creditmemo->getBaseSubtotalInclTax() + $baseWeeeTaxAmount);
     $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $totalTax);
     $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseTotalTax);
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:48,代码来源:Weee.php


示例17: testGetWeeAttributesForBundle

 public function testGetWeeAttributesForBundle()
 {
     $weeObject = new \Magento\Framework\Object(['code' => 'fpt', 'amount' => '15.0000']);
     $testArray = ['fpt' => $weeObject];
     $this->weeeTax->expects($this->any())->method('getProductWeeeAttributes')->will($this->returnValue([$weeObject]));
     $productSimple = $this->getMock('\\Magento\\Catalog\\Model\\Product\\Type\\Simple', [], [], '', false);
     $productInstance = $this->getMock('\\Magento\\Bundle\\Model\\Product\\Type', [], [], '', false);
     $productInstance->expects($this->any())->method('getSelectionsCollection')->will($this->returnValue([$productSimple]));
     $store = $this->getMock('\\Magento\\Store\\Model\\Store', [], [], '', false);
     $product = $this->getMock('\\Magento\\Bundle\\Model\\Product', ['getTypeInstance', 'getStoreId', 'getStore', 'getTypeId'], [], '', false);
     $product->expects($this->any())->method('getTypeInstance')->will($this->returnValue($productInstance));
     $product->expects($this->any())->method('getStoreId')->will($this->returnValue(1));
     $product->expects($this->any())->method('getStore')->will($this->returnValue($store));
     $product->expects($this->any())->method('getTypeId')->will($this->returnValue('bundle'));
     $registry = $this->getMock('Magento\\Framework\\Registry', [], [], '', false);
     $registry->expects($this->any())->method('registry')->with('current_product')->will($this->returnValue($product));
     $this->assertEquals($testArray, $this->_helperData->getWeeAttributesForBundle($product));
 }
开发者ID:Coplex,项目名称:magento2,代码行数:18,代码来源:DataTest.php


示例18: testGetRecursiveAmountBundle

 public function testGetRecursiveAmountBundle()
 {
     $testAmountUnit1 = 1;
     $testAmountUnit2 = 2;
     $testTotalUnit = $testAmountUnit1 + $testAmountUnit2;
     $testAmountRow1 = 33;
     $testAmountRow2 = 444;
     $testTotalRow = $testAmountRow1 + $testAmountRow2;
     $itemProductSimple1 = $this->getMock('\\Magento\\Quote\\Model\\Quote\\Item', ['getWeeeTaxAppliedAmount', 'getWeeeTaxAppliedRowAmount'], [], '', false);
     $itemProductSimple2 = $this->getMock('\\Magento\\Quote\\Model\\Quote\\Item', ['getWeeeTaxAppliedAmount', 'getWeeeTaxAppliedRowAmount'], [], '', false);
     $itemProductSimple1->expects($this->any())->method('getWeeeTaxAppliedAmount')->will($this->returnValue($testAmountUnit1));
     $itemProductSimple1->expects($this->any())->method('getWeeeTaxAppliedRowAmount')->will($this->returnValue($testAmountRow1));
     $itemProductSimple2->expects($this->any())->method('getWeeeTaxAppliedAmount')->will($this->returnValue($testAmountUnit2));
     $itemProductSimple2->expects($this->any())->method('getWeeeTaxAppliedRowAmount')->will($this->returnValue($testAmountRow2));
     $itemProductBundle = $this->getMock('\\Magento\\Quote\\Model\\Quote\\Item', ['getHasChildren', 'isChildrenCalculated', 'getChildren'], [], '', false);
     $itemProductBundle->expects($this->any())->method('getHasChildren')->will($this->returnValue(true));
     $itemProductBundle->expects($this->any())->method('isChildrenCalculated')->will($this->returnValue(true));
     $itemProductBundle->expects($this->any())->method('getChildren')->will($this->returnValue([$itemProductSimple1, $itemProductSimple2]));
     $this->assertEquals($testTotalUnit, $this->helperData->getWeeeTaxAppliedAmount($itemProductBundle));
     $this->assertEquals($testTotalRow, $this->helperData->getWeeeTaxAppliedRowAmount($itemProductBundle));
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:21,代码来源:DataTest.php


示例19: getPriceConfiguration

 /**
  * Modify the options config for the front end to resemble the weee final price
  *
  * @param   \Magento\Framework\Event\Observer $observer
  * @return  $this
  */
 public function getPriceConfiguration(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_weeeData->isEnabled()) {
         $priceConfigObj = $observer->getData('configObj');
         $priceConfig = $priceConfigObj->getConfig();
         if (is_array($priceConfig)) {
             foreach ($priceConfig as $keyConfigs => $configs) {
                 if (is_array($configs)) {
                     if (array_key_exists('prices', $configs)) {
                         $priceConfig[$keyConfigs]['prices']['weeePrice'] = ['amount' => $configs['prices']['finalPrice']['amount']];
                     } else {
                         foreach ($configs as $keyConfig => $config) {
                             $priceConfig[$keyConfigs][$keyConfig]['prices']['weeePrice'] = ['amount' => $config['prices']['finalPrice']['amount']];
                         }
                     }
                 }
             }
         }
         $priceConfigObj->setConfig($priceConfig);
     }
     return $this;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:28,代码来源:Observer.php


示例20: testGetWeeeTaxAttributes

 /**
  * Test for method getWeeeTaxAttributes
  *
  * @param int $typeOfDisplay
  * @param array $attributes
  * @param array $expectedResult
  * @dataProvider getWeeeTaxAttributesDataProvider
  */
 public function testGetWeeeTaxAttributes($typeOfDisplay, $attributes, $expectedResult)
 {
     /** @var \Magento\Framework\Pricing\Render\Amount $amountRender */
     $amountRender = $this->getMockBuilder('Magento\\Framework\\Pricing\\Render\\Amount')->disableOriginalConstructor()->setMethods(['getSaleableItem', 'getDisplayValue', 'getAmount'])->getMock();
     /** @var \Magento\Catalog\Model\Product $saleable */
     $saleable = $this->getMockBuilder('Magento\\Catalog\\Model\\Product')->disableOriginalConstructor()->setMethods(['__wakeup'])->getMock();
     /** @var \Magento\Framework\Pricing\Amount\Base $baseAmount */
     $baseAmount = $this->getMockBuilder('Magento\\Framework\\Pricing\\Amount\\Base')->disableOriginalConstructor()->setMethods(['getValue'])->getMock();
     $amountRender->expects($this->any())->method('getAmount')->will($this->returnValue($baseAmount));
     $callback = function ($argument) use($typeOfDisplay) {
         if (is_array($argument)) {
             return in_array($typeOfDisplay, $argument);
         } else {
             return $argument == $typeOfDisplay;
         }
     };
     $this->weeeHelperMock->expects($this->any())->method('typeOfDisplay')->will($this->returnCallback($callback));
     $this->weeeHelperMock->expects($this->any())->method('getProductWeeeAttributesForDisplay')->will($this->returnValue($attributes));
     $amountRender->expects($this->any())->method('getSaleableItem')->will($this->returnValue($saleable));
     $this->model->render($amountRender);
     $result = $this->model->getWeeeTaxAttributes();
     $this->assertEquals($expectedResult, $result);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:31,代码来源:AdjustmentTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Controller\WishlistProviderInterface类代码示例发布时间:2022-05-23
下一篇:
PHP MassAction\Filter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap