News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Remove 'Add to Cart Button' for specific items, again.

Started by marvays, November 30, 2016, 11:02:33 AM

Previous topic - Next topic

marvays

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

jenkinhill

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
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

marvays


jenkinhill

Add stock to all products except those where you don't want add to cart?
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Studio 42

Hi,
if you want hide button for negative stock
if($this->product->product_in_stock > -1) {
echo $this->loadTemplate('addtocart');
}


marvays

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 :)