VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: chrisnz on August 16, 2013, 00:30:18 AM

Title: Formatting prices on product pages but not the cart page
Post by: chrisnz on August 16, 2013, 00:30:18 AM
When I format the prices using CSS for the product detail page (.PricesalesPrice, .PricediscountAmount etc)  the formatting is also applied to these prices on the cart page but I cannot see where to stop this from happening. On the product detail pages I want the price nice and big, but just standard size on the cart page.
Thanks for your help
Title: Re: Formatting prices on product pages but not the cart page
Post by: jenkinhill on August 16, 2013, 13:07:05 PM
Edit one of the price display templates (or both) to add an additional class or id to more accurately apply your styles. Unless you are already using overrides the templates are
components/com_virtuemart/views/productdetails/tmpl/default_showprices.php
components/com_virtuemart/views/cart/tmpl/default_pricelist.php

Be sure to use the edited files as template overrides so that they are preserved during VM updates.
Title: Re: Formatting prices on product pages but not the cart page
Post by: chrisnz on August 16, 2013, 20:23:45 PM
Thanks - yes I am using template overrides and was expecting to be able to apply a different class in the default_pricelist.php template. I'm pretty comfortable with CSS but not so much with php. The code in question would be around line 210

echo $this->currencyDisplay->createPriceDiv ('salesPrice', '', $this->cart->pricesUnformatted[$pkey], FALSE, FALSE, $prow->quantity) ?>

but I can't see how to apply a different class as the .PricesalesPrice class seems to be dynamically generated
Title: Re: Formatting prices on product pages but not the cart page
Post by: Maxim Pishnyak on August 16, 2013, 20:26:24 PM
I need a link to help you. And you probably still need a Firebug (check FAQs in this forum section) to help yourself.
Title: Re: Formatting prices on product pages but not the cart page
Post by: jenkinhill on August 17, 2013, 11:12:24 AM
You just need to be more specific with your style selectors, work back through the classes within the same div to find a class unique to the template you want to restyle. eg the following works with defaul VM templates to set the price font size on the product details page only:

.spacer-buy-area .PricesalesPrice  {font-size:20px;}
Title: Re: Formatting prices on product pages but not the cart page
Post by: chrisnz on August 17, 2013, 20:24:01 PM
Quote from: jenkinhill on August 17, 2013, 11:12:24 AM
You just need to be more specific with your style selectors, work back through the classes within the same div to find a class unique to the template you want to restyle. eg the following works with defaul VM templates to set the price font size on the product details page only:

.spacer-buy-area .PricesalesPrice  {font-size:20px;}

Fantastic - thanks!