News:

Looking for documentation? Take a look on our wiki

Main Menu

Show Total in Cart, but NOT in Product

Started by MSR_Web_Guy, March 04, 2020, 02:24:18 AM

Previous topic - Next topic

MSR_Web_Guy

Am I correct in my understanding that if I turn off Final salesprice that this will hide it both the Product AND the Cart?

Basically, for a Product, all I want to display is the Base Price (ie. $9.99). So in the Configuration/Pricing tab, I uncheck Show Price for all prices, taxes, totals, etc., then turn on just the Baseprice.
BUT, when I go to the Cart, I do not get any Totals there (ie. $9.99 times the number ordered plus tax, plus any other products also in the cart.)
So I turn on Final salesprice, and it appears in the Cart, but also now in the Product page.

Am I stuck with showing it in both, or am I missing some setting to still show a Total in the Cart, but not on a product page?
(I see the checkbox for "Show Tax in Cart" that nicely shows the tax - was hoping there'd be something similar for totals.)

Am using the plain Protostar template.

Running VirtueMart 3.6.10 10211 in Joomla! 3.9.15. Thanks.

GJC Web Design

for differing displays between views normally you have to over ride the sublayout prices.php to get exactly what you want
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

MSR_Web_Guy

Thanks. Am surprised that VM wouldn't already differentiate settings for a Cart page versus a Product page. And just saw it also affects the other listings too (Featured Products, Latest, Top Ten, etc.). Would benefit from a matrix of all possible displays and all prices/tax/etc.options.

Now, it appears that each price div has a unique class assigned to it - PricesalesPrice, PricesalesPriceTt, etc.

Question: would there be an advantage to customizing the sublayout php, versus just using CSS to hide the various classes where you don't want them? We already have a custom user.css added, that would be easier/safer to maintain than worrying about an upgrade to Vm changing the php pages.
Thoughts? Thanks again.

Jörgen

#3
I am not surprised that all the possibilities are not covered. Make a matrix of all the possibilities and You will se how many settings there would be. If You have special needs, do as GJC suggested and make an override for the view where You want Your customization. This will not be overwritten by updates but could need some maintenance in future VM versions.

Or even better suggest and write the code that would cover all possibilities and donate this to the core :)

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

MSR_Web_Guy

#4
No worries. I am very appreciative of GJC's advice, as well as yours and everyone else who contributes both to VM and to this Forum.
I will say, though, that I don't think that it's a "special needs" for a Cart to always show the totals, regardless of which prices I show/hide on a Products page. And judging by the number of times this question came up in the Google searches, I don't think that I'm alone in that thought. Given that the table on the Cart page itself has multiple "Total" labels and rows, that are blank and not hidden, showing the totals would seem to be expected.
Yes, a cover-everything matrix would be a challenge (and who knows, maybe I will look into it once I'm familiar enough with VM and its data structure!) But in the meantime, I would suggest that the Cart page should always show totals, and if there's a reason why that shouldn't be the default, a setting to override it (one way or the other) would be in order.
Thanks again.

MSR_Web_Guy

Regarding my CSS experiments. Yes, you can hide any total/taxes/etc. you want on the Product page or the Featured, New Products, etc. boxes using a display:hidden; style, and still show them in the Cart page.
Unfortunately, it appears that the surrounding div is retaining the height required as if they were there and not collapsing, and no CSS styling seems to be able to change that. So a Featured Product box, for instance, will have a whack of white space above/below the price.
Not sure where/how the div is getting that height yet - the Developer Tools in Chrome show it as greyed out (versus a solid colour with a link to the style being applied to cause that setting.) And the height changes as you show/not show the pricing items in the VM Configuration/Prices settings, to reflect how many of them you've chosen.
Fun.