Add CSS Class to Value and another one to currency symbol

  • Posts: 13
  • Thank you received: 2
2 years 6 days ago #346651

-- 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

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 5 days ago #346652

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:

if($column!='currency_symbol'){
to:
if(in_array($column, array('currency_symbol', 'currency_format'))){
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
%n
, you'll want to use something like that:
<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.

  • Posts: 13
  • Thank you received: 2
2 years 5 days ago #346666

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

<span class="symbol">€</span><span class="price">%!n</span>
after saving is only €%!n

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.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 5 days ago #346672

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:

if(!in_array($column, array('currency_symbol', 'currency_format'))){
Then the saving should work properly.

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

  • Posts: 13
  • Thank you received: 2
2 years 5 days ago #346682

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.057 seconds
Powered by Kunena Forum