- Posts: 5
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- How do I make different styles for the price of the modules and for the price on page?
How do I make different styles for the price of the modules and for the price on page?
- 4ort
-
Topic Author
- Offline
- New Member
Less
More
13 years 10 months ago #97559
by 4ort
How do I make different styles for the price of the modules and for the price on page? was created by 4ort
Please help to solve this problem - on the product page and in modules to display the prices of goods used one and the same class:
class="productPrice"
How do I assign a different class for the price of goods in item.php?I tried to find a solution to the file \plugins\k2\k2mart\tmpl\module.php and \plugins\k2\k2mart\tmpl\item.php, but nothing could come up because of lack of knowledge of PHP...
class="productPrice"
How do I assign a different class for the price of goods in item.php?I tried to find a solution to the file \plugins\k2\k2mart\tmpl\module.php and \plugins\k2\k2mart\tmpl\item.php, but nothing could come up because of lack of knowledge of PHP...
Please Log in or Create an account to join the conversation.
- Olivier Karfis
-
- Offline
- Elite Member
13 years 10 months ago #97560
by Olivier Karfis
Owner of www.FrenchToday.com - K2 fan and freelancer, runs the Joomla/K2 tip site: www.yanaku.com
Replied by Olivier Karfis on topic How do I make different styles for the price of the modules and for the price on page?
Hi.
(fyi: K2mart support is usually better handled on forum.joomlaworks.gr/k2mart/ since it's a dedicated forum )
You should be able to target the productPrice class based on what div it is contained with without needing to change any php code... Use something like this:
k2ModuleBox span.productPrice vs. itemView span.productPrice
(read up on css inheritance to give you some pointers).
--Olivier
(fyi: K2mart support is usually better handled on forum.joomlaworks.gr/k2mart/ since it's a dedicated forum )
You should be able to target the productPrice class based on what div it is contained with without needing to change any php code... Use something like this:
k2ModuleBox span.productPrice vs. itemView span.productPrice
(read up on css inheritance to give you some pointers).
--Olivier
Owner of www.FrenchToday.com - K2 fan and freelancer, runs the Joomla/K2 tip site: www.yanaku.com
Please Log in or Create an account to join the conversation.
- 4ort
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 5
13 years 10 months ago #97561
by 4ort
Replied by 4ort on topic How do I make different styles for the price of the modules and for the price on page?
I found in the \plugins\k2\k2mart\tmpl\module.php only one mention of ProductPrice:
<?php if($this->params->get('moduleProductPrice') && $product->price && _SHOW_PRICES): ?> <li> <span class="itemVmFieldsLabel"> <?php if($product->unit && VM_PRICE_SHOW_PACKAGING_PRICELABEL): ?> <?php echo JText::_('Price per Unit'); ?> (<?php echo $product->unit; ?>): <?php else: ?> <?php echo JText::_('Price'); ?>: <?php endif; ?> </span> <span class="itemVmFieldsValue itemVmPrice"><?php echo $product->price; ?></span> <div class="clr"></div> </li> <?php endif; ?>
I do not understand how this change styles ...
<?php if($this->params->get('moduleProductPrice') && $product->price && _SHOW_PRICES): ?> <li> <span class="itemVmFieldsLabel"> <?php if($product->unit && VM_PRICE_SHOW_PACKAGING_PRICELABEL): ?> <?php echo JText::_('Price per Unit'); ?> (<?php echo $product->unit; ?>): <?php else: ?> <?php echo JText::_('Price'); ?>: <?php endif; ?> </span> <span class="itemVmFieldsValue itemVmPrice"><?php echo $product->price; ?></span> <div class="clr"></div> </li> <?php endif; ?>
I do not understand how this change styles ...
Please Log in or Create an account to join the conversation.
- Olivier Karfis
-
- Offline
- Elite Member
13 years 10 months ago #97562
by Olivier Karfis
Owner of www.FrenchToday.com - K2 fan and freelancer, runs the Joomla/K2 tip site: www.yanaku.com
Replied by Olivier Karfis on topic How do I make different styles for the price of the modules and for the price on page?
Like I said: "without needing to change any php code".
Don't change anything in these files, it's all done in your template's css. Using CSS, you'll be able to apply a different style to span.productPrice (which I believe is actually inserted by Virtuemart) whether it appears in a k2 module or in the item view.
--Olivier
Don't change anything in these files, it's all done in your template's css. Using CSS, you'll be able to apply a different style to span.productPrice (which I believe is actually inserted by Virtuemart) whether it appears in a k2 module or in the item view.
--Olivier
Owner of www.FrenchToday.com - K2 fan and freelancer, runs the Joomla/K2 tip site: www.yanaku.com
Please Log in or Create an account to join the conversation.
- 4ort
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 5
13 years 10 months ago #97563
by 4ort
Replied by 4ort on topic How do I make different styles for the price of the modules and for the price on page?
Olivier, perhaps I misunderstood, for example - I added a stylespan.productPrice {color: # d0b45a;}However, I see that the color has changed the price per page, and prices for ALL goods in the side module. But I wish that would have changed the color only for product price on the page. But how do I do this?
Please Log in or Create an account to join the conversation.
- 4ort
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 5
13 years 10 months ago #97564
by 4ort
Replied by 4ort on topic How do I make different styles for the price of the modules and for the price on page?
Decided. Just added their own style in item.php:
<?php if($this->params->get('itemProductPrice') && $product->price && _SHOW_PRICES): ?> <li> <span class="itemVmFieldsLabel"> <?php if($product->unit && VM_PRICE_SHOW_PACKAGING_PRICELABEL): ?> <?php echo JText::_('Price per Unit'); ?> (<?php echo $product->unit; ?>): <?php else: ?> <?php echo JText::_('Price'); ?>: <?php endif; ?> </span> <span class="itemVmFieldsValue itemVmPrice"> <span class="my-price"><?php echo $product->price; ?></span> </span> <div class="clr"></div> </li> <?php endif; ?>
<?php if($this->params->get('itemProductPrice') && $product->price && _SHOW_PRICES): ?> <li> <span class="itemVmFieldsLabel"> <?php if($product->unit && VM_PRICE_SHOW_PACKAGING_PRICELABEL): ?> <?php echo JText::_('Price per Unit'); ?> (<?php echo $product->unit; ?>): <?php else: ?> <?php echo JText::_('Price'); ?>: <?php endif; ?> </span> <span class="itemVmFieldsValue itemVmPrice"> <span class="my-price"><?php echo $product->price; ?></span> </span> <div class="clr"></div> </li> <?php endif; ?>
Please Log in or Create an account to join the conversation.
- Olivier Karfis
-
- Offline
- Elite Member
13 years 10 months ago #97565
by Olivier Karfis
Owner of www.FrenchToday.com - K2 fan and freelancer, runs the Joomla/K2 tip site: www.yanaku.com
Replied by Olivier Karfis on topic How do I make different styles for the price of the modules and for the price on page?
Sure, that's one way to do it but it's absolutely unnecessary & bloats your php AND css (you now have 3 spans in a row to define 1 style!).
If you target span.producPrice by itself then yes, all instances of productPrice will change on your site. The solution below will work but I would suggest you read up on css descendants to avoid these types of hacks in the future, it's not hard to grasp...
www.w3.org/TR/CSS2/selector.html#descendant-selectors
Good luck. --Olivier
4ort said:
Decided. Just added their own style in item.php:
<?php if($this->params->get('itemProductPrice') && $product->price && _SHOW_PRICES): ?> <li> <span class="itemVmFieldsLabel"> <?php if($product->unit && VM_PRICE_SHOW_PACKAGING_PRICELABEL): ?> <?php echo JText::_('Price per Unit'); ?> (<?php echo $product->unit; ?>): <?php else: ?> <?php echo JText::_('Price'); ?>: <?php endif; ?> </span> <span class="itemVmFieldsValue itemVmPrice"> <span class="my-price"><?php echo $product->price; ?></span> </span> <div class="clr"></div> </li> <?php endif; ?>
If you target span.producPrice by itself then yes, all instances of productPrice will change on your site. The solution below will work but I would suggest you read up on css descendants to avoid these types of hacks in the future, it's not hard to grasp...
www.w3.org/TR/CSS2/selector.html#descendant-selectors
Good luck. --Olivier
4ort said:
Decided. Just added their own style in item.php:
<?php if($this->params->get('itemProductPrice') && $product->price && _SHOW_PRICES): ?> <li> <span class="itemVmFieldsLabel"> <?php if($product->unit && VM_PRICE_SHOW_PACKAGING_PRICELABEL): ?> <?php echo JText::_('Price per Unit'); ?> (<?php echo $product->unit; ?>): <?php else: ?> <?php echo JText::_('Price'); ?>: <?php endif; ?> </span> <span class="itemVmFieldsValue itemVmPrice"> <span class="my-price"><?php echo $product->price; ?></span> </span> <div class="clr"></div> </li> <?php endif; ?>
Owner of www.FrenchToday.com - K2 fan and freelancer, runs the Joomla/K2 tip site: www.yanaku.com
Please Log in or Create an account to join the conversation.
- 4ort
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 5
13 years 10 months ago #97566
by 4ort
Replied by 4ort on topic How do I make different styles for the price of the modules and for the price on page?
I can not understand how it applied in my case ... Maybe you can show how?
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- How do I make different styles for the price of the modules and for the price on page?