helper = $helper; $this->json = $json ?: ObjectManager::getInstance()->get(Json::class); parent::__construct($context, $data); } /** * @return bool */ public function isEnabled() { return $this->helper->isEnabled(); } /** * @return bool|false|string */ public function getConfig() { $config = [ 'mode' => $this->getModuleConfig('type'), 'container' => trim($this->getSelectorProducts()), 'item' => trim($this->getSelectorProduct()), 'loader' => (bool)$this->getModuleConfig('loader_type'), ]; return $this->json->serialize($config); } /** * @param string $path * @param null $storeCode * @return mixed */ public function getModuleConfig($path = '', $storeCode = null) { return $this->helper->getModuleConfig('general/' . $path, $storeCode); } /** * @return string */ public function getSelectorProducts() { $products_container = $this->getModuleConfig('products_container') ?: '.column.main .products.products-grid, .column.main .products.products-list, .column.main .products-grid.grid'; return $products_container; } /** * @return string */ public function getSelectorProduct() { $product_container = $this->getModuleConfig('product_container') ?: '.item.product.product-item'; return $product_container; } }