/** * {@inheritDoc} * @see \Owebia\AdvancedSettingCore\Model\Wrapper\AbstractWrapper::loadData() */ protected function loadData($key) { switch ($key) { case 'name': case 'address': case 'phone': return $this->getSource()->getConfig('general/store_information/' . $key); } return parent::loadData($key); }
/** * {@inheritDoc} * @see \Owebia\ShippingCore\Model\Wrapper\AbstractWrapper::loadData() */ protected function loadData($key) { switch ($key) { case 'options': $options = array(); $helper = $this->objectManager->get('Magento\\Catalog\\Helper\\Product\\Configuration'); $customOptions = $helper->getCustomOptions($this->getSource()); if ($customOptions) { foreach ($customOptions as $option) { $options[$option['label']] = $option; } } return $options; } return parent::loadData($key); }
/** * {@inheritDoc} * @see \Owebia\ShippingCore\Model\Wrapper\AbstractWrapper::loadData() */ protected function loadData($key) { switch ($key) { case 'attribute_set': return $this->createWrapper(['id' => (int) $this->{'attribute_set_id'}], 'ProductAttributeSet'); case 'stock_item': return $this->createWrapper(['product_id' => (int) $this->{'entity_id'}], 'ProductStockItem'); case 'category_id': /** @var \Magento\Catalog\Api\Data\ProductInterface $product */ $product = $this->getSource(); return $product->getCategoryId(); case 'category': /** @var \Magento\Catalog\Api\Data\ProductInterface $product */ $product = $this->getSource(); return $product->getCategory(); case 'category_ids': /** @var \Magento\Catalog\Api\Data\ProductInterface $product */ $product = $this->getSource(); return $this->getSource()->getCategoryIds(); case 'categories': /** @var \Magento\Catalog\Api\Data\ProductInterface $product */ $product = $this->getSource(); $categories = []; foreach ($product->getCategoryCollection() as $category) { $categories[] = $category; } return $categories; default: $this->loadIfRequired($key); return parent::loadData($key); } }