Keyword

How do I make different styles for the price of the modules and for the price on page?

More
13 years 3 months ago #97559 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...

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #97560 by Olivier Karfis
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

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.

More
13 years 3 months ago #97561 by 4ort
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 ...

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #97562 by Olivier Karfis
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

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.

More
13 years 3 months ago #97563 by 4ort
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.

More
13 years 3 months ago #97564 by 4ort
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; ?>

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #97565 by Olivier Karfis
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; ?>

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.

More
13 years 3 months ago #97566 by 4ort
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.


Powered by Kunena Forum