Hi, I wonder if I can get help with this issue. I've searched the forum thoroughly and found no solution.
The problem is that I get the Add to Cart buttom everywhere, even in categories for those products which have attributes.
Is is any solution for this? Thanks
add to cart on anything BUT the product page is NOT standard vmart
Sounds like your template has the overrides in it.
are you using a commercial template?
Yes, I'm using a commercial template.
The actual problem is that I get the Add to cart button on the listings, the Add to cart button on the product page is there and is allright.
I just want to get rid of this button on the general listings (when browsing categories) because most of the products have attributes and the customer can put them directly into the cart without selecting any option.
Is it any way to change that? what should I look for?
Thanks
the template is
templates/YOUR_TEMPLATE/html/com_virtuemart/category/default.php
You are going to have to look for the add to cart code, and remove it.
Nobody here knows your template.
Either that, or ask the people that made your template to change it
Thanks for your advice. What I have now is:
// Add the button
$button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO');
$button_cls = 'addtocart-button'; //$button_cls = 'addtocart_button';
$button_name = 'addtocart'; //$button_cls = 'addtocart_button';
// Display the add to cart button
$stockhandle = VmConfig::get('stockhandle', 'none');
if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and ($this->product->product_in_stock - $this->product->product_ordered) < 1) {
$button_lbl = JText::_('COM_VIRTUEMART_CART_NOTIFY');
$button_cls = 'notify-button';
$button_name = 'notifycustomer';
}
//vmdebug('$stockhandle '.$stockhandle.' and stock '.$this->product->product_in_stock.' ordered '.$this->product->product_ordered);
?>
<span class="addtocart-button">
<input type="submit" name="<?php echo $button_name ?>" class="<?php echo $button_cls ?>" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" />
</span>
<div class="clear"></div>
</div>
<?php // Display the add to cart button END ?>
<input type="hidden" class="pname" value="<?php echo $product->product_name ?>" />
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="view" value="cart" />
<noscript><input type="hidden" name="task" value="add" /></noscript>
<input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id ?>" />
<?php /** @todo Handle the manufacturer view */ ?>
<input type="hidden" name="virtuemart_manufacturer_id" value="<?php echo $product->virtuemart_manufacturer_id ?>" />
<input type="hidden" name="virtuemart_category_id[]" value="<?php echo $product->virtuemart_category_id ?>" />
</form>
</div>
<?php // Product Details Button
// echo JHTML::link($product->link, JText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name,'class' => 'catProductDetails'));
?>
</div>
</div>
</div>
<?php
$iBrowseProduct ++;
I have taken out the following part but it seems that there are no visible changes. I will continue trying.
// Display the add to cart button
$stockhandle = VmConfig::get('stockhandle', 'none');
if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and ($this->product->product_in_stock - $this->product->product_ordered) < 1) {
$button_lbl = JText::_('COM_VIRTUEMART_CART_NOTIFY');
$button_cls = 'notify-button';
$button_name = 'notifycustomer';
}
Well I have done it!
If it helps someone else, what I have removed from the code was:
<?php
// Add the button
$button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO');
$button_cls = 'addtocart-button'; //$button_cls = 'addtocart_button';
$button_name = 'addtocart'; //$button_cls = 'addtocart_button';
//vmdebug('$stockhandle '.$stockhandle.' and stock '.$this->product->product_in_stock.' ordered '.$this->product->product_ordered);
?>
<span class="addtocart-button">
<input type="submit" name="<?php echo $button_name ?>" class="<?php echo $button_cls ?>" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" />
</span>
Now the listings don't show the Add to cart button, but if get into a product description the button is there and works perfectly right.
Thanks to PRO for his kind advice! :)