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.......[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
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: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...
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:
I'll note that the issue remains on the current ZC 1.5.6 repository.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>
That was easy.. (for me)!
Thanks!
Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...
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
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.
One other issue that I'm facing is :
But, this Error only occurs in the online server with 7.1.13Code:Uncaught Error: Cannot use string offset as an array in /home/xxx/public_html/includes/modules/tpl_pb/category_row.php:39
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
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.Code:Uncaught Error: Cannot use string offset as an array in /home/xxx/public_html/includes/modules/tpl_pb/category_row.php:39
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
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...
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
Bookmarks