VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: marvays on November 30, 2016, 11:02:33 AM

Title: Remove 'Add to Cart Button' for specific items, again.
Post by: marvays on November 30, 2016, 11:02:33 AM
Hi. I see here: http://forum.virtuemart.net/index.php?topic=113527.msg381835

But dont work for me. I have joomla 2.5.8 and VM 2.0.14
And use flexibledesign cleanmart template.

in the my-tempalte/html/com_virtuemart/productdetails/default.php have this code about add-to-cart
<?php

if ($params->get('productdetails_ajax',1) and !empty($this->product->customfieldsCart)) {
foreach ($this->product->customfieldsCart as $field) {   
if ($field->field_type == "A") {
 $doc JFactory::getDocument();
 $doc->addScriptDeclaration('
  jQuery(document).ready(function(){
jQuery.fn.FlexibleChildAjax();
  });  
 '
);
}
}
}


// Add To Cart Button
    echo $this->loadTemplate('addtocart');
 
?>


how i can change this code to hide add-to-cart, if my product will be on stock "-1"? All product have in stock "0" and no mor action in config. In any new product i need have product page with prize, but withou ad-to-cart for any time to grand open and start selling it :)

PS: Sry for my bad english
Title: Re: Remove 'Add to Cart Button' for specific items, again.
Post by: jenkinhill on November 30, 2016, 11:34:20 AM
Those versions are very old and insecure, so I doubt if anyone here will be using them or  that particular commercial template.   http://forum.virtuemart.net/index.php?topic=118683.0

Instead of changing existing overrides I would use "Displays 'Notify Me' instead of 'Add To Cart' button" for Action when a Product is Out of Stock  and hide the 'Notify Me' using css
Title: Re: Remove 'Add to Cart Button' for specific items, again.
Post by: marvays on November 30, 2016, 11:54:21 AM
thx. but all m yproduct have stock 0 :(
Title: Re: Remove 'Add to Cart Button' for specific items, again.
Post by: jenkinhill on November 30, 2016, 14:56:10 PM
Add stock to all products except those where you don't want add to cart?
Title: Re: Remove 'Add to Cart Button' for specific items, again.
Post by: Studio 42 on December 01, 2016, 11:03:23 AM
Hi,
if you want hide button for negative stock
if($this->product->product_in_stock > -1) {
echo $this->loadTemplate('addtocart');
}

Title: Re: Remove 'Add to Cart Button' for specific items, again.
Post by: marvays on December 01, 2016, 11:13:51 AM
Quote from: Studio 42 on December 01, 2016, 11:03:23 AM
Hi,
if you want hide button for negative stock
if($this->product->product_in_stock > -1) {
echo $this->loadTemplate('addtocart');
}


thx. i will try it :)