Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 39
  1. #11
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: PHP Warning: A non-numeric value encountered... categories_ul_generator.php

    Quote Originally Posted by carlwhat View Post
    ..... so i would recommend applying them both.
    Yep, did just that.

    Quote Originally Posted by carlwhat View Post
    i find @torvista s work solid and agree with most things he brings up; certainly in this case, it does address your issue....

    best.
    Absolutely, fully agree hence I had no hesitation applying his suggestion.

    Cheers

  2. #12
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    Scenario:
    start to add a new product
    select "Product Priced by Attributes: - Yes"
    Leave price blank/0
    Other fields do not matter.

    Insert product.
    Debug log generated:
    [11-Dec-2017 17:17:48 Europe/Madrid] Request URI: /zc155e_vanilla/admin1/product.php?cPath=1_17&product_type=1&pID=183&action=new_product_preview&page=1, IP address: 127.0.0.1
    #1 currencies->format() called at blah-blah\public_html\zc155e_vanilla\admin1\includes\modules\product\preview_info.php :56]
    #2 require(blah-blah\public_html\zc155e_vanilla\admin1\includes\modules\product\preview_info.php ) called at [blah-blah\public_html\zc155e_vanilla\admin1\product.php:145]


    [11-Dec-2017 17:17:48 Europe/Madrid] PHP Warning: A non-numeric value encountered in blah-blah\public_html\zc155e_vanilla\includes\classes\currencies.php on line 50
    Line 50 is pretty meaty so I'll leave this for those who seem to enjoy these challenges.......
    PHP Code:
    $format_string $this->currencies[$currency_type]['symbol_left'] . number_format(zen_round($number $rate$this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right']; 
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  3. #13
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    Quote Originally Posted by torvista View Post
    Scenario:
    start to add a new product
    select "Product Priced by Attributes: - Yes"
    Leave price blank/0
    Other fields do not matter.

    Insert product.
    Debug log generated:


    Line 50 is pretty meaty so I'll leave this for those who seem to enjoy these challenges.......
    PHP Code:
    $format_string $this->currencies[$currency_type]['symbol_left'] . number_format(zen_round($number $rate$this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right']; 
    The "Product Priced by Attributes" setting is a red-herring and doesn't matter; the root cause of the debug-log is the fact that the product's price is not entered so it's an empty string ('') and thus non-numeric so that PHP 7.0+'s variable-type-checking steps in.

    /admin/includes/modules/product/preview_info.php should ensure that the price value supplied to the currency class is numeric, i.e. an update to line 56 of that file from the ZC 1.5.5e distribution:
    Code:
    <td class="pageHeading" align="right"><?php echo $currencies->format((float)$pInfo->products_price) . ($pInfo->products_virtual == 1 ? '<span class="errorText">' . '<br />' . TEXT_VIRTUAL_PREVIEW . '</span>' : '') . ($pInfo->product_is_always_free_shipping == 1 ? '<span class="errorText">' . '<br />' . TEXT_FREE_SHIPPING_PREVIEW . '</span>' : '') . ($pInfo->products_priced_by_attribute == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_PRICED_BY_ATTRIBUTES_PREVIEW . '</span>' : '') . ($pInfo->product_is_free == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_IS_FREE_PREVIEW . '</span>' : '') . ($pInfo->product_is_call == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_IS_CALL_PREVIEW . '</span>' : '') . ($pInfo->products_qty_box_status == 0 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_QTY_BOX_STATUS_PREVIEW . '</span>' : '') . ($pInfo->products_priced_by_attribute == 1 ? '<br />' . zen_get_products_display_price($_GET['pID']) : ''); ?></td>
    I'll note that the issue remains on the current ZC 1.5.6 repository.

  4. #14
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    That was easy.. (for me)!
    Thanks!
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  5. #15
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    Hi
    I'm getting this warnings with 7.1
    I did fix the categories_ul_generator with (int) .... now I was about to fix the taxes, and I understood I could be here doing this all day, so I search for a solution in the forum.

    But I see the use of (float) also.... plus the github fix for taxes
    Does the zc 1.55f fix this issues , or if not , is it "safer" to use float where ever I get this warnings ?

    Thanks
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

  6. #16
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    PHP 7.2 support is NOT built-in to v1.5.5f.
    But here's a list of the changes required to adapt it: https://github.com/zencart/zencart/pull/1582/files

    All of these ARE built-in to v1.5.6
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #17
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    One other issue that I'm facing is :
    Code:
    Uncaught Error: Cannot use string offset as an array in /home/xxx/public_html/includes/modules/tpl_pb/category_row.php:39
    But, this Error only occurs in the online server with 7.1.13
    On my local xampp 7.1.12 it doesn't

    This is one, another it's driving me crazy, because it works in my local machine and it doesn't on the online server, and I even don't know what to ask...
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

  8. #18
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    Code:
    Uncaught Error: Cannot use string offset as an array in /home/xxx/public_html/includes/modules/tpl_pb/category_row.php:39
    After all it does occur in my local machine, but it's related to breadcrumb. And I've update php to 7, zencart to 155f, Ceon URI to php7, and now I'm lost.
    Big mistake.
    But probably it's related to CEON.... or not.
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

  9. #19
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    Quote Originally Posted by mesnitu View Post
    Code:
    Uncaught Error: Cannot use string offset as an array in /home/xxx/public_html/includes/modules/tpl_pb/category_row.php:39
    After all it does occur in my local machine, but it's related to breadcrumb. And I've update php to 7, zencart to 155f, Ceon URI to php7, and now I'm lost.
    Big mistake.
    But probably it's related to CEON.... or not.
    The Ceon URI Mapping that has been updated to support php 7 addresses the breadcrumb issue and this error has not otherwise been seen. The fact that this file is in a template override directory implies it has been modified in some way to support the template (not a modification made by Ceon URI Mapping), so it would make more sense to provide the code at, around, and before line 39 to try to identify what modification has been made to cause an attempt to use a string offset as an array.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #20
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    Thanks!!!
    Less one problem !
    The issue was on the modify file. It had this
    $list_box_contents ='';

    instead of this
    $list_box_contents = array();

    ... don't know why, probably some update that I miss.
    Now it ok !
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

 

 
Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 15 Dec 2018, 10:54 PM
  2. Replies: 2
    Last Post: 18 Nov 2018, 04:06 AM
  3. Replies: 0
    Last Post: 18 Feb 2018, 06:26 PM
  4. Replies: 20
    Last Post: 7 Dec 2014, 11:29 AM
  5. Replies: 0
    Last Post: 27 Sep 2012, 11:57 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR