VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: sorema on April 26, 2017, 22:38:28 PM

Title: remove the add to cart button only if the category i'm browsing is child of virtuemart_category_id 4
Post by: sorema on April 26, 2017, 22:38:28 PM
i'm building an override for category view in my VM3 and want to remove the add to cart button only if the category i'm browsing is child of virtuemart_category_id 46
how can i do this?
i'm trying with no success
<?php if($product->category_parent_id!=46 ) :?>
            <div class="product-add-btn" title="Add to Cart">
                        <?php  echo shopFunctionsF::renderVmSubLayout('addtocart_grid',array('product'=>$product,'rowHeights'=>$rowsHeight[$row])); ?>
                     </div>
            <?php endif; ?>

thank you in advance!
Title: Re: remove the add to cart button only if the category i'm browsing is child of virtuemart_category_
Post by: Kuubs on April 27, 2017, 10:27:31 AM
Hi, don't you need to use $this->product?
Title: Re: remove the add to cart button only if the category i'm browsing is child of virtuemart_category_
Post by: sorema on April 27, 2017, 10:42:19 AM
not in category view! i can achieve this and it works:

<?php if(($product->virtuemart_category_id!=51) && ($product->virtuemart_category_id!=52)&& ($product->virtuemart_category_id!=53) && ($product->virtuemart_category_id!=54)&& ($product->virtuemart_category_id!=55)&& ($product->virtuemart_category_id!=56)) :?>
<div class="product-add-btn" title="Add to Cart">
<?php  echo shopFunctionsF::renderVmSubLayout('addtocart_grid',array('product'=>$product,'rowHeights'=>$rowsHeight[$row])); ?>
</div>
<?php endif; ?>

but i'm looking for a way to simplify all things! all those categories are child of virtuemart_category_id=46 so there must be a way to code that "all the categories, belonging to..."
Title: Re: remove the add to cart button only if the category i'm browsing is child of virtuemart_category_
Post by: sorema on April 28, 2017, 12:27:36 PM
is there no way to achieve this? :'(