Post by pm-netti » Wed Oct 05, 2022 7:27 pm

Error in front:

Code: Select all

TypeError: Cart\Currency::format(): Argument #1 ($number) must be of type float, array given, called in ..... system/library/cart/currency.php on line 24
What this is?

Ps. Line 24: Is this attribute type OK?

public function format( float $number,

This $number is price, it can be e.g. '20.07'.

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by pm-netti » Wed Oct 05, 2022 9:12 pm

xxvirusxx wrote:
Wed Oct 05, 2022 9:06 pm
Move text_items line from cart

https://github.com/opencart/opencart-3/pull/104/files
This is many errors module files, product.php, categories and cart-files

Code: Select all

this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
It need be:

Code: Select all

this->currency->format((float)$this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
Last edited by pm-netti on Wed Oct 05, 2022 10:19 pm, edited 1 time in total.

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by xxvirusxx » Wed Oct 05, 2022 9:22 pm

Better report on Github or create pull requests

My Converted Modules | Opencart Upgrade Service | Free Dashboard Maps | Buy me a beer | My Custom OC 3.0.3.8


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by pm-netti » Wed Oct 05, 2022 10:26 pm

xxvirusxx wrote:
Wed Oct 05, 2022 9:22 pm
Better report on Github or create pull requests
In order for that Opencart script to work, shouldn't there be changes like this:

Code: Select all

$unit_price = (float)$this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax'));

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by straightlight » Wed Oct 05, 2022 10:39 pm

Please create pull requests at: https://www.github.com/opencart/opencart-3 in regard to code changes / bug-fixes.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by straightlight » Wed Oct 05, 2022 10:49 pm

pm-netti wrote:
Wed Oct 05, 2022 10:26 pm
xxvirusxx wrote:
Wed Oct 05, 2022 9:22 pm
Better report on Github or create pull requests
In order for that Opencart script to work, shouldn't there be changes like this:

Code: Select all

$unit_price = (float)$this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax'));
There are only 4 results where 3 files contain (float) in the $this->currency->format library object as opposed to 436 matches in 145 files that don't use (float) with this library object. Which PHP version are you using?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by pm-netti » Wed Oct 05, 2022 10:51 pm

xxvirusxx wrote:
Wed Oct 05, 2022 10:41 pm
After that line is moved to begin....error disappear
https://github.com/opencart/opencart/bl ... rt.php#L17

https://github.com/opencart/opencart/bl ... rt.php#L27
You added float to line 27? :P
Line 17: Does this work without the float type:

Code: Select all

$this->currency->format($total, $this->session->data['currency'])

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by xxvirusxx » Wed Oct 05, 2022 10:56 pm

If line $data['text_items'] is on line 160 you will get that warning, if you move the line to line 50, no error/warning.

line 27 is from 4.0.x.x

My Converted Modules | Opencart Upgrade Service | Free Dashboard Maps | Buy me a beer | My Custom OC 3.0.3.8


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by straightlight » Wed Oct 05, 2022 11:08 pm

It's been moved now.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by OSWorX » Thu Oct 06, 2022 12:24 pm

As already written before: discuss such at GitHub (or make there your PRs).
Thanks.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by pm-netti » Thu Oct 06, 2022 2:13 pm

The checkout doesn't work.

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by OSWorX » Thu Oct 06, 2022 3:43 pm

pm-netti wrote:
Thu Oct 06, 2022 2:13 pm
The checkout doesn't work.
Sorry, but you are a "developer" - or not?
A line like that "the checkout doesn't work" is something like "my car does not run" - means what?

1. be more specific - what, when, which action, etc.
2. discuss that at GitHub, report a bug, submit a PM - or do something there

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by pm-netti » Thu Oct 06, 2022 4:55 pm

You can see the problem when you test this program yourself. The error is apparently in some javascript code.
Can't get to the next step from the front page of the checkout.

Ps. I made a program like this for that initial problem, so that I can test this Oc version:
https://www.opencart.com/index.php?rout ... n_id=44272

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by pm-netti » Thu Oct 06, 2022 5:29 pm

xxvirusxx wrote:
Thu Oct 06, 2022 5:11 pm
Make this change
https://github.com/opencart/opencart-3/pull/105/files
Thank you!
I added this change to that ocmod file I made. Now this point works.

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by JNeuhoff » Thu Oct 06, 2022 6:36 pm

xxvirusxx wrote:
Thu Oct 06, 2022 5:11 pm
Make this change
https://github.com/opencart/opencart-3/pull/105/files
Or change the common/header.twig, using this:

Code: Select all

{% for script in scripts %}
<script src="{{ script }}" type="text/javascript"></script>
{% endfor %}
 
Seriously, why this unnecessary change in the library/document.php file? It would potentially cause some unneeded issues with regards to backward compatibilty with OC 3.0.3.8, including for some 3rd party extensions and themes.

Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Rich Snippets * Google Tag Manager * Export/Import Tool * SpamBot Buster * Survey Plus


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by straightlight » Thu Oct 06, 2022 11:50 pm

JNeuhoff wrote:
Thu Oct 06, 2022 6:36 pm
xxvirusxx wrote:
Thu Oct 06, 2022 5:11 pm
Make this change
https://github.com/opencart/opencart-3/pull/105/files
Or change the common/header.twig, using this:

Code: Select all

{% for script in scripts %}
<script src="{{ script }}" type="text/javascript"></script>
{% endfor %}
 
Seriously, why this unnecessary change in the library/document.php file? It would potentially cause some unneeded issues with regards to backward compatibilty with OC 3.0.3.8, including for some 3rd party extensions and themes.
While saying this between the same OC series, imagine what will be like in OC 4 in regard to 'unnecessary changes'. If those changes were made, regardless the direction a user will take to either upgrade to the opencart-3 release or to the OC 4 release, the ways to import JS files will still differ on that end. At least, this time, users have the time to be prepared.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by pm-netti » Sat Oct 08, 2022 1:04 pm

JNeuhoff wrote:
Thu Oct 06, 2022 6:36 pm
Seriously, why this unnecessary change in the library/document.php file? It would potentially cause some unneeded issues with regards to backward compatibilty with OC 3.0.3.8, including for some 3rd party extensions and themes.
Please note that this does not apply to version 3.0.3.8 or other OC versions with a PHP requirement lower than 8.

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland
Who is online

Users browsing this forum: No registered users and 5 guests