Пример #1
0
 public function testAddPrice()
 {
     $this->assertEmpty($this->_model->getPrices());
     $this->_model->addPrice(100);
     $this->assertEquals([100], $this->_model->getPrices());
 }
Пример #2
0
 /**
  * Load prices for configurable attribute
  *
  * @param ConfigurableAttribute $object
  * @return $this
  */
 protected function loadPrices(ConfigurableAttribute $object)
 {
     $websiteId = $this->_catalogData->isPriceGlobal() ? 0 : (int) $this->_storeManager->getStore()->getWebsiteId();
     $select = $this->_getReadAdapter()->select()->from($this->_priceTable)->where('product_super_attribute_id = ?', $object->getId())->where('website_id = ?', $websiteId);
     foreach ($select->query() as $row) {
         $data = ['value_index' => $row['value_index'], 'is_percent' => $row['is_percent'], 'pricing_value' => $row['pricing_value']];
         $object->addPrice($data);
     }
     return $this;
 }