Post by Anonymous: » Fri Jan 29, 2021 8:34 am

Please help me how to change the price decimals to be lower. Thank you in advance.

Image
Last edited by Anonymous: on Tue Feb 02, 2021 3:10 am, edited 1 time in total.

Newbie

Posts

Joined
Sat Sep 12, 2020 9:52 pm

Post by pprmkr » Fri Jan 29, 2021 5:18 pm

Edit system/library/cart/currency.php
After:

Code: Select all

$string .= number_format($amount, (int)$decimal_place, $this->language->get('decimal_point'), $this->language->get('thousand_point'));
Add:

Code: Select all

		$dd = '<sup>' . substr($string, (-1 * (int)$decimal_place)) . '</sup>';
		
		$string = substr_replace($string, $dd, (-1 * (int)$decimal_place));
Bootstrap sets sup and sub font-size to 75%. You can add line to stylesheet to adjust the font size:

Code: Select all

sub, sup {
	font-size: 60%;
}

User avatar
Active Member
Online

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by Anonymous: » Sat Jan 30, 2021 2:19 am

Thank you very much. It works perfectly!

Newbie

Posts

Joined
Sat Sep 12, 2020 9:52 pm

Post by paulfeakins » Mon Feb 01, 2021 7:14 pm

Anonymous: wrote:
Sat Jan 30, 2021 2:19 am
Thank you very much. It works perfectly!
Please add [SOLVED] to the start of the post title.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by katalin » Thu Jan 05, 2023 1:24 am

Nice mod, but how can we remove the comma?

Active Member

Posts

Joined
Wed May 05, 2010 2:28 am

Post by pprmkr » Thu Jan 05, 2023 4:08 pm

Code: Select all

    	$dd = '<sup>' . substr($string, (-1 * (int)$decimal_place)) . '</sup>';
		
		$string = substr_replace($string, $dd, (-1 * ((int)$decimal_place)-1));

User avatar
Active Member
Online

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by katalin » Sat Jan 07, 2023 12:54 am

Awesome. Thanks a lot!

Active Member

Posts

Joined
Wed May 05, 2010 2:28 am

Post by katalin » Sun Jan 08, 2023 8:02 pm

It doesn’t work on product option. Please check photo!

LE: it also doesn’t work under drop down select option. Price is 12,00 and it shows 1200.

Attachments

3D652779-A837-4C10-9748-B31A59527027.jpeg

3D652779-A837-4C10-9748-B31A59527027.jpeg (225.34 KiB) Viewed 1656 times

14B85E6A-6605-4B29-83EC-AF07371A4713.jpeg

14B85E6A-6605-4B29-83EC-AF07371A4713.jpeg (1.15 MiB) Viewed 1657 times


Active Member

Posts

Joined
Wed May 05, 2010 2:28 am

Post by thekrotek » Mon Jan 09, 2023 4:54 pm

There's a JS based solution with regex, which will look for any float value, remove comma and add SUP tag on-the-fly for any price on any page. Yet it requires more scripting and tweaking.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by pprmkr » Mon Jan 09, 2023 11:17 pm

@katalin
Modification changes the text shown by library currency. And yes, all of them.

Search for thekrotek's JS based solution. Maybe it fit's your need.

User avatar
Active Member
Online

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands
Who is online

Users browsing this forum: pprmkr, sidclel and 70 guests