Skayfer Posted August 10, 2015 Share Posted August 10, 2015 Hi, I must in my store display product i block top menu, but i have multistore. my code is: <ul> {assign var="idpro" value=0} {foreach from=$products item=product} {if $product.id_category == $catid && $product.active == 1 && $product.id_product != $idpro} {assign var="idpro" value=$product.id_product} <li> <span class="arrow">></span><a href="{$link->getProductLink($product.id_product, $product.link_rewrite)|escape:'htmlall':'UTF-8'}"> {$product.name|escape:'htmlall':'UTF-8'|truncate:50:'...'} </a> {if isset($product.on_sale) && $product.on_sale == 1}<span class="sale">SALE</span>{/if} <div>{$product_shop->id_shop}</div> </li> {/if} {/foreach} <div class="id_shop" style="color:transparent;">{$cart->id_shop}</div> </ul> , but i dont know how create if condition that check if product is assign for this id_shop. Now menu display all products, too from others store. Link to comment Share on other sites More sharing options...
NemoPS Posted August 10, 2015 Share Posted August 10, 2015 How are you getting that products array? You should do it within php Link to comment Share on other sites More sharing options...
Skayfer Posted August 10, 2015 Author Share Posted August 10, 2015 {if $product.id_category == $catid && $product.active == 1 && $product.id_product != $idpro} It is only presta variables Maybe presta have variables like $product.id_shop ? If yes i only add condition $product.id_shop == {$product_shop->id_shop} can you help Nemo with this ? I find table in database 'ps_product_shop' It have column id_product, id_shop, active and id_category_default that i need to choice products. Can you help display it in template, after i can style it ? Link to comment Share on other sites More sharing options...
NemoPS Posted August 10, 2015 Share Posted August 10, 2015 ?It can't just be smarty variables, where are you using that $products variable, exactly? You need to know where it comes from, say, category, or somewhere else. Otherwise, if you change it there, the product count will be off Link to comment Share on other sites More sharing options...
Skayfer Posted August 10, 2015 Author Share Posted August 10, 2015 Ok, Can me only say how get products from database and display it in template ? I want SELECT all FROM ps_product_shop WHERE id_shop = {$cart->id_shop} ? Link to comment Share on other sites More sharing options...
Skayfer Posted August 10, 2015 Author Share Posted August 10, 2015 Other, Maybe is way to display all, active products from selected multistore ? That is only i want. Link to comment Share on other sites More sharing options...
Skayfer Posted August 10, 2015 Author Share Posted August 10, 2015 (edited) Hey I look one thing. My menu top menu display in bar main 4 categories, after hover display subcategories, and bottom all asigned products from all stores, but when i click only subcategories, display ok, avalible from this shop products. May i only insert in code product query, like from this subcategories ? Edited August 10, 2015 by Skayfer (see edit history) Link to comment Share on other sites More sharing options...
Skayfer Posted August 10, 2015 Author Share Posted August 10, 2015 How i can use there in if $product.quantity > 0 ? Link to comment Share on other sites More sharing options...
Kerm Posted August 10, 2015 Share Posted August 10, 2015 How i can use there in if $product.quantity > 0 ? How this question relates to the current topic? Link to comment Share on other sites More sharing options...
NemoPS Posted August 12, 2015 Share Posted August 12, 2015 I'm honestly having a really hard time understanding what you need, can we stick to a single topic per thread?To get products, use Product::getProducts 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