- Posts: 13
- Thank you received: 2
Add CSS Class to Value and another one to currency symbol
3 years 11 months ago #346651
by joki1994
-- HikaShop version -- : 4.6.2
-- Joomla version -- : 4.2.3
-- PHP version -- : 8.0.25
-- Browser(s) name and version -- : Firefox
Hi again,
is there a way to add two different css classes to the price value and the currency symbol, so that I can align the currency symbol on the left and the price value on the right.
I found several very old topics with the same issue but nothing solved my problem.
Hope you can help.
Kind Regards, Nathalie
-- Joomla version -- : 4.2.3
-- PHP version -- : 8.0.25
-- Browser(s) name and version -- : Firefox
Hi again,
is there a way to add two different css classes to the price value and the currency symbol, so that I can align the currency symbol on the left and the price value on the right.
I found several very old topics with the same issue but nothing solved my problem.
Hope you can help.
Kind Regards, Nathalie
Please Log in or Create an account to join the conversation.
3 years 11 months ago #346652
by nicolas
Replied by nicolas on topic Add CSS Class to Value and another one to currency symbol
Hi,
There is no option for that.
However, thinking about it, I see a solution which will only require a slight modification in HikaShop. So we'll do the modification for the next version.
First, you need to change the line:
to:
in the file administrator/components/com_hikashop/classes/currency.php
This will allow you the possibility to add HTML in the "format" setting of the currencies in the System>Currencies menu of HikaShop. We'll add that change.
Second, you need to change the type of the currency_format column of the hikashop_currency table to VARCHAR(255) instead of the CHAR(10) which is there at the moment. You can do that in your PHPMyAdmin. We'll change that so that all new installations of HikaShop will get it automatically.
Third, in the "Format" setting of your currency, instead of
, you'll want to use something like that:
That way, you can then use .symbol{} and .price{} for your CSS.
There is no option for that.
However, thinking about it, I see a solution which will only require a slight modification in HikaShop. So we'll do the modification for the next version.
First, you need to change the line:
Code:
if($column!='currency_symbol'){
Code:
if(in_array($column, array('currency_symbol', 'currency_format'))){
This will allow you the possibility to add HTML in the "format" setting of the currencies in the System>Currencies menu of HikaShop. We'll add that change.
Second, you need to change the type of the currency_format column of the hikashop_currency table to VARCHAR(255) instead of the CHAR(10) which is there at the moment. You can do that in your PHPMyAdmin. We'll change that so that all new installations of HikaShop will get it automatically.
Third, in the "Format" setting of your currency, instead of
Code:
%n
Code:
<span class="symbol">€</span><span class="price">%!n</span>
That way, you can then use .symbol{} and .price{} for your CSS.
Please Log in or Create an account to join the conversation.
3 years 11 months ago #346666
by joki1994
Replied by joki1994 on topic Add CSS Class to Value and another one to currency symbol
Thank you for this very fast support.
I did everything you mentioned, but unfortunately if I enter html in the Format area of currency setting, the html disappear after saving.
This code
after saving is only €%!n
Therefore I don't have the possibility to style the symbol with .symbol in css file.
I did everything you mentioned, but unfortunately if I enter html in the Format area of currency setting, the html disappear after saving.
This code
Code:
<span class="symbol">€</span><span class="price">%!n</span>
Therefore I don't have the possibility to style the symbol with .symbol in css file.
Please Log in or Create an account to join the conversation.
3 years 11 months ago #346672
by nicolas
Replied by nicolas on topic Add CSS Class to Value and another one to currency symbol
Hi,
Sorry, I made a typo when I wrote my message.
The code in the file administrator/components/com_hikashop/classes/currency.php should be:
Then the saving should work properly.
Sorry, I made a typo when I wrote my message.
The code in the file administrator/components/com_hikashop/classes/currency.php should be:
Code:
if(!in_array($column, array('currency_symbol', 'currency_format'))){
Please Log in or Create an account to join the conversation.
3 years 11 months ago #346682
by joki1994
Replied by joki1994 on topic Add CSS Class to Value and another one to currency symbol
Thank you, that works perfect
The following user(s) said Thank You: Philip
Please Log in or Create an account to join the conversation.
Time to create page: 0.059 seconds