Jump to content

show only products with a custom attribute ?


rboyart
 Share

Recommended Posts

Hello,

 

I want to show only the products of a manufacture if it has a custom attribute value.

{foreach from=$products item=product name=products}
// products of a manufacturer
{/foreach}

How can I search in the loop (foreach) if that product has that custom attribute value ?

 

 

I'm trying to get the attribute in this direction :

{$attributes = $product->getAttributeCombinations(self::$cookie->id_lang);
echo 'variable is '.$attributes;
foreach ($attributes as $attribute_key => $attribute) {
if ($attribute['is_color_group'] > 0) {
$colors[$attribute['id_attribute']]['value'] = $attribute['attribute_name'];
}
}
{/foreach}

 

 

Thanks for the help,

 

Rodrigo

Edited by rboyart (see edit history)

Share this post


Link to post
Share on other sites

Well, I don't know if the best way to do it but i changed product-list and I did it like this :

 

 

{if isset($products)}
<ul class="clear">
{foreach from=$products item=product name=products}
{foreach from=$product.features item=feature name=features}         
{if $feature.name =="promo"}
{if $feature.value == "si"}
<li>
<a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}">
<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} /></a>
<h3>{if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if}<a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}</a></h3>
</li>
{/if}
{/if}
{/foreach}
{/foreach}
</ul>
{/if}

hope that helps someone.

Edited by rboyart (see edit history)

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More