Hi,
Upgraded to Joomla 3.7.0
PHP 5.6
VirtueMart 3.2.1
I am see this error since I upgraded Joomla to 3.7.0:
PHP Warning: Division by zero in /components/com_virtuemart/sublayouts/categories.php on line 33
PHP Warning: Division by zero in /components/com_virtuemart/sublayouts/categories.php on line 57
Probably another J3.7 issue. Was there a warning with J3.6.5? If the front end still looks OK then you can suppress the php warning with php.ini settings or possibly by setting Error Reporting
to none in Joomla global config/server - I have not checked if warning suppression still works after a Joomla update.
Hi,
The error was in the error log.
When I upgrade PHP to 7.0 virtuemart no longer works at all.
I get this error on all pages:
(http://i65.tinypic.com/2s8039j.jpg)
Are You using a custom template ? Because others are using Joomla 3.7.0 without this issue. Not saying that VM doesn´t have issues with 3.7.0, but probably not this for most other users.
regards
Jörgen @ Kreativ Fotografi
I changed the Template to the Joomla default:
Beez3 - Default
Error:
(http://i64.tinypic.com/2vio9bc.jpg)
I removed the lines that where giving errors and virtuemart works with PHP 7.0
PHP Warning: Division by zero in /components/com_virtuemart/sublayouts/categories.php on line 33
PHP Warning: Division by zero in /components/com_virtuemart/sublayouts/categories.php on line 57 (REMOVED LINES 57-61 AS IT WAS AN IF STATEMENT)
Please show the code for the lines that are faulting. You may have some settings in number of columns maybe that is giving trouble.
This should be easy to fix in the template file :)
regards
Jörgen @ Kreativ Fotografi
Both those calculation lines include the number of set categories per row.
I have a J3.7 VM3.2.1 running just fine on PHP7.0.18 using Beez and VM default templates. With full debug turned on there is no division by zero reported.
It looks like it is just this link that is the problem.
index.php?option=com_virtuemart&view=category&virtuemart_category_id=0&virtuemart_manufacturer_id=0&Itemid=557
It is the Menu link to the Shop, created using the Menu Item Type : Category Layout.
Select a Category is set to: Top Level Category.
Select a Manufacturer is set to: "Please Select". ( I am not using Manufacturers, so none to select )
Just curious. Do You have categories per row set to 0 somewhere in Virtuemart under configuration templates?
This would explain the issue. The following code would be nice to include in sublayouts/categories.php
after line 39
$categories_per_row = VmConfig::get ( 'categories_per_row', 3 );
insert a test for categories == 0
// JH 2017-04-28 Prevents division by 0
if ($categories_per_row == 0) {
$categories_per_row = 3:}
regards
Jörgen @ Kreativ Fotografi
I have Default number of categories in a row set to 3
Is there anywhere else this could be set.
Cats per row can be set in three places:
the Joomla menu link to VM category view on the Virtuemart Category View Settings tab
in VM Configuration/Templates
and for each category on the Virtuemart category view settings
or just
if(empty($categories_per_row)) $categories_per_row = 3;