Search

Change Language

Friday, April 8, 2011

Showing Addtocart in Browsepage (Virtuemart)

In administrator/components/com_virtuemart/html/shop.browse.php, look for these lines (400-404):



// Add-to-Cart Button 
  if (USE_AS_CATALOGUE != '1' && $product_price != "" 
   && !stristr( $product_price, $VM_LANG->_('PHPSHOP_PRODUCT_CALL') )
   && !ps_product::product_has_attributes( $db_browse->f('product_id'), true )
   && $tpl->get_cfg( 'showAddtocartButtonOnProductList' ) ) {

1. Change the second parameter of product_has_attributes() to false:



// Add-to-Cart Button 
  if (USE_AS_CATALOGUE != '1' && $product_price != "" 
   && !stristr( $product_price, $VM_LANG->_('PHPSHOP_PRODUCT_CALL') )
   && !ps_product::product_has_attributes( $db_browse->f('product_id'), false )
   && $tpl->get_cfg( 'showAddtocartButtonOnProductList' ) ) {

(this allows the add-to-cart button on products with only simple attributes).
2. Remove the attribute check completely:


// Add-to-Cart Button 
  if (USE_AS_CATALOGUE != '1' && $product_price != "" 
   && !stristr( $product_price, $VM_LANG->_('PHPSHOP_PRODUCT_CALL') )
   && $tpl->get_cfg( 'showAddtocartButtonOnProductList' ) ) {

This allows the add-to-cart button on everything.

1 comments:

Thanks for this post! I had to found out why some products simply can't be added to cart while I had no previous knowledge about "virtuemart". I don't want to think how much time I would need to figure it out by myself.

Post a Comment