VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Templating FAQs => Topic started by: PRO on November 28, 2011, 23:36:43 PM

Title: Specific Category/Product Page CSS Override without new template
Post by: PRO on November 28, 2011, 23:36:43 PM
There is no reason to create a new override template just to change SIMPLE css for specific categories, or product pages.

What you can do is wrap your category with a div class tag thats unique per the category id. Like this.
Place this code above where the html starts in your category default.php , or override file.
<div class="h<?php echo JRequest::getInt('virtuemart_category_id'); ?>">

THEN, make sure to close it at the bottom. </div>

You can also do the same with the product page.
<div class="h<?php echo JRequest::getInt('virtuemart_product_id'); ?>">

then you can just add specific styles like this.
.h11 .spacer{height:237px;}

^ where the 11 is the category id.
Title: Re: Specific Category/Product Page CSS Override without new template
Post by: maxispin on March 04, 2012, 18:24:42 PM
Could you please tell for a php noob, where .h1 .spacer{height:237px;} is inserted?
Title: Re: Specific Category/Product Page CSS Override without new template
Post by: PRO on March 04, 2012, 20:21:18 PM
Quote from: maxispin on March 04, 2012, 18:24:42 PM
Could you please tell for a php noob, where .h1 .spacer{height:237px;} is inserted?

.h11 .spacer{height:237px;}

IS the css. BUT thats what I use to make borders around products , and I want the product borders to be specific sizes for different categories.

What are you wanting to change?

All my code does is make a dynamic class to have the ability to change the category css, without doing a whole new template override
Title: Re: Specific Category/Product Page CSS Override without new template
Post by: maxispin on March 04, 2012, 20:50:11 PM
Basically I just need to fine tune product category font sizes and colors.

I understood that that line should be inside the css-file.   

I am not sure if this file is the "core" css file:  /public_html/components/com_virtuemart/assets/css/vmsite-ltr.css (?)

Overally, I am a bit confused with dozens of different files the system is constructed off. Possibilities are endless but it is a bit complecated if the user as me have no coding experience, and everything has to be done via trial and error.

Css files are something I am going to hack next.
Title: Re: Specific Category/Product Page CSS Override without new template
Post by: PRO on March 04, 2012, 21:10:29 PM
Quote from: maxispin on March 04, 2012, 20:50:11 PM
Basically I just need to fine tune product category font sizes and colors.

I understood that that line should be inside the css-file.   

I am not sure if this file is the "core" css file:  /public_html/components/com_virtuemart/assets/css/vmsite-ltr.css (?)

YES thats the file.

BUT::: my code is if you want to have different fonts per category. Or if you want o change just 1 category font.

http://forum.virtuemart.net/index.php?topic=90935.0
Title: Re: Specific Category/Product Page CSS Override without new template
Post by: maxispin on March 05, 2012, 06:01:57 AM
Grazie!  :)

I continue "exercises" later this week.