VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: mxf on November 12, 2012, 01:01:06 AM

Title: Hiding cart table after deleting all of the products
Post by: mxf on November 12, 2012, 01:01:06 AM
Hi
I have a question about cart table (pricelist). If I add something to the cart it is shown in form of a table on the index.php?option=com_virtuemart&view=cart page.
But, if I remove all the products, the table remains. It deletes only quantity and prices.
In the VM 1.1 when products were deleted it shows only information, that cart is empty, but no table.
Is it possible to make that in VM2?
Title: Re: Hiding cart table after deleting all of the products
Post by: lanthan on November 12, 2012, 01:38:31 AM
add to your default.php in your cart folder

at line 58

if (count($this->cart->products) >=1) {
?>


and at the end (line 181)

<?php
}
else {
echo 
JText::('COM_VIRTUEMART_CART_NO_PRODUCT');
}
?>

Title: Re: Hiding cart table after deleting all of the products
Post by: mxf on November 12, 2012, 13:31:39 PM
That's right! Thank you! :)
Title: Re: Hiding cart table after deleting all of the products
Post by: jamesl-kemet on November 23, 2020, 11:28:13 AM
Hi, is this also possible in VM3 please? I have tried but does not work. This does however work if you want to hide the other elements such as the checkout button when the cart is empty.

I am using VirtueMart 3.8.4 and Joomla! 3.9.21
Title: Re: Hiding cart table after deleting all of the products
Post by: GJC Web Design on November 23, 2020, 11:33:13 AM
already works perfectly on the standard VM checkout .. so there must be something different about your install...
Title: Re: Hiding cart table after deleting all of the products
Post by: jamesl-kemet on November 23, 2020, 12:07:04 PM
That is strange then,i have put it back to the default cart layout (which I have not modified) and tried with the Beez template, but still shows the table when the cart is empty? Is there an option in the configuration then as i can't seem to see it.
Title: Re: Hiding cart table after deleting all of the products
Post by: AH on November 23, 2020, 12:18:36 PM
May I suggest you use this

If there are no cart products use this

if (!$this->cart->cartProductsData){


or use this for when there are cart products

if ($this->cart->cartProductsData){

Title: Re: Hiding cart table after deleting all of the products
Post by: Jörgen on November 23, 2020, 12:57:21 PM
I guess you still have some active overrides or plugin in the cart.
This is like AH sais not normal behaviour, You have something still active.

Jörgen @ Kreativ Fotografi
Title: Re: Hiding cart table after deleting all of the products
Post by: jamesl-kemet on November 23, 2020, 13:11:18 PM
Thanks AH, does not work in default.php, but works in default_pricelist.php
Title: Re: Hiding cart table after deleting all of the products
Post by: Jörgen on November 23, 2020, 13:37:47 PM
Nice to hear it works.
I hope You have overidden the files in the template and not the core files  ;)

Jörgen
Title: Re: Hiding cart table after deleting all of the products
Post by: jamesl-kemet on November 23, 2020, 14:24:45 PM
Hi Jörgen, yes indeed  :)

Thanks