Jump to content

Get id_shop for id_product


Skayfer

Recommended Posts

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

{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

?
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

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 by Skayfer (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...