News:

Support the VirtueMart project and become a member

Main Menu

Hiding cart table after deleting all of the products

Started by mxf, November 12, 2012, 01:01:06 AM

Previous topic - Next topic

mxf

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?

lanthan

#1
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');
}
?>



jamesl-kemet

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

GJC Web Design

already works perfectly on the standard VM checkout .. so there must be something different about your install...
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

jamesl-kemet

#5
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.

AH

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

Regards
A

Joomla 4.4.5
php 8.1

Jörgen

#7
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
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

jamesl-kemet

Thanks AH, does not work in default.php, but works in default_pricelist.php

Jörgen

Nice to hear it works.
I hope You have overidden the files in the template and not the core files  ;)

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

jamesl-kemet