AleBros Posted June 16, 2020 Share Posted June 16, 2020 Hi everybody, I have a multistore in which I need to show, in the principal shop, a list of some products of all shops I have. Each shop have a virtual path, for create an employee at shop can manage orders of that shop. I created a module and I can take the products from all store. The problem is that I want show the miniatures of this products, but when I use product assembler it ask me to give the context. The context is not the right context because is the context of principal shop. So the miniatures are visible, but the image, the price, and the link are wrong. There is a way for getting the context of a specific shop and passing instanciate productAssembler with this context instead of context of principal shop? Or there is another way to get and show products miniatures of all shops in the right way? Thank you. public function hookdisplayHome($params) { $query = 'SELECT * FROM `'._DB_PREFIX_.'shop`'; $getshops = Db::getInstance()->ExecuteS($query); $shopsID = ""; for ($x = 0; $x<count($getshops); $x++) { $shopsID .= $getshops[$x]["id_shop"] . ","; } $shopsID = substr($shopsID, 0, -1); $discountedProducts = Product::getProductsByAllShop($shopsID,(int)$this->context->language->id, 0, 10, "date_upd", "desc", 2); $assembler = new ProductAssembler($this->context); $presenterFactory = new ProductPresenterFactory($this->context); $presentationSettings = $presenterFactory->getPresentationSettings(); $presenter = new ProductListingPresenter( new ImageRetriever( $this->context->link ), $this->context->link, new PriceFormatter(), new ProductColorsRetriever(), $this->context->getTranslator() ); $products_for_template = []; foreach ($discountedProducts as $productDetail) { $products_for_template[] = $presenter->present( $presentationSettings, $assembler->assembleProduct($productDetail), $this->context->language ); } $this->smarty->assign(array( 'discountedProducts' => $products_for_template, 'shopsids' => $shopsID . " - " . count($getshops) . " - " . count($discountedProducts), 'context' => $this->context )); return $this->display(__FILE__, 'my_featured_products.tpl'); } Link to comment Share on other sites More sharing options...
Rachelle Posted February 5, 2021 Share Posted February 5, 2021 Hello AleBros, I have the same need, could you solve it? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now