Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function priceFactory($productType)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'priceFactory');
     if (!$pluginInfo) {
         return parent::priceFactory($productType);
     } else {
         return $this->___callPlugins('priceFactory', func_get_args(), $pluginInfo);
     }
 }
 /**
  * Prepare group prices data for website
  *
  * @param array $priceData
  * @param string $productTypeId
  * @param int $websiteId
  * @return array
  */
 public function preparePriceData(array $priceData, $productTypeId, $websiteId)
 {
     $rates = $this->_getWebsiteCurrencyRates();
     $data = [];
     $price = $this->_catalogProductType->priceFactory($productTypeId);
     foreach ($priceData as $v) {
         $key = join('-', array_merge([$v['cust_group']], $this->_getAdditionalUniqueFields($v)));
         if ($v['website_id'] == $websiteId) {
             $data[$key] = $v;
             $data[$key]['website_price'] = $v['price'];
         } elseif ($v['website_id'] == 0 && !isset($data[$key])) {
             $data[$key] = $v;
             $data[$key]['website_id'] = $websiteId;
             if ($this->_isPriceFixed($price)) {
                 $data[$key]['price'] = $v['price'] * $rates[$websiteId]['rate'];
                 $data[$key]['website_price'] = $v['price'] * $rates[$websiteId]['rate'];
             }
         }
     }
     return $data;
 }
Esempio n. 3
0
 /**
  * @param sring|null $typeId
  * @param string $expectedClass
  * @dataProvider priceFactoryDataProvider
  */
 public function testPriceFactory($typeId, $expectedClass)
 {
     $type = $this->_productType->priceFactory($typeId);
     $this->assertInstanceOf($expectedClass, $type);
 }
Esempio n. 4
0
 /**
  * Get product price model
  *
  * @return \Magento\Catalog\Model\Product\Type\Price
  */
 public function getPriceModel()
 {
     return $this->_catalogProductType->priceFactory($this->getTypeId());
 }
Esempio n. 5
0
 public function testPriceFactory()
 {
     $this->assertInstanceOf('\\Magento\\ConfigurableProduct\\Model\\Product\\Type\\Configurable\\Price', $this->_model->priceFactory('type_id_3'));
     $this->assertInstanceOf('\\Magento\\ConfigurableProduct\\Model\\Product\\Type\\Configurable\\Price', $this->_model->priceFactory('type_id_3'));
     $this->assertInstanceOf('\\Magento\\Catalog\\Model\\Product\\Type\\Price', $this->_model->priceFactory('type_id_1'));
 }