Error 0 Unsupported operand types: string % string [solved]

Started by Darko F., October 05, 2022, 10:19:38 AM

Previous topic - Next topic

Darko F.

After Update to
com_virtuemart.4.0.7.10716_package_or_extract.zip
Joomla 4 
And still can't enter custom fields from back end.

I get error from front page

0 Unsupported operand types: string % string

Call stack
#   Function   Location
1   ()   JROOT/administrator/components/com_virtuemart/models/product.php:1054
2   VirtueMartModelProduct->setPaginationLimits()   JROOT/administrator/components/com_virtuemart/helpers/vmmodel.php:846
3   VmModel->exeSortSearchListQuery()   JROOT/administrator/components/com_virtuemart/models/product.php:959
4   VirtueMartModelProduct->sortSearchListQuery()   JROOT/components/com_virtuemart/views/category/view.html.php:282
5   VirtuemartViewCategory->display()   JROOT/components/com_virtuemart/controllers/category.php:61
6   VirtueMartControllerCategory->display()   JROOT/libraries/src/MVC/Controller/BaseController.php:672
7   Joomla\CMS\MVC\Controller\BaseController->execute()   JROOT/components/com_virtuemart/virtuemart.php:128
8   require_once()   JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
9   Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}()   JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73
10   Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch()   JROOT/libraries/src/Component/ComponentHelper.php:355
11   Joomla\CMS\Component\ComponentHelper::renderComponent()   JROOT/libraries/src/Application/SiteApplication.php:200
12   Joomla\CMS\Application\SiteApplication->dispatch()   JROOT/libraries/src/Application/SiteApplication.php:241
13   Joomla\CMS\Application\SiteApplication->doExecute()   JROOT/libraries/src/Application/CMSApplication.php:294
14   Joomla\CMS\Application\CMSApplication->execute()   JROOT/includes/app.php:61
15   require_once()   JROOT/index.php:32
There in no problem if you fall. Problem is if you don't get up

Darko F.

I like to add that this  error above happened when I enter configuration after update and save configuration.
Before that everything work. 
There in no problem if you fall. Problem is if you don't get up

Milbo

Ha finally. It looks like you found the reason for the not working pagination. At least it shows for me correct links now. Btw, which php do you use?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Darko F.

There in no problem if you fall. Problem is if you don't get up

Darko F.

I try com_virtuemart.4.0.7.10717.zip
An I can enter custom fields back end in J4 hooray for that

Unfortunately when I go to menu shop - front end with top category

I get error:

0 Unsupported operand types: string - int

Call stack
#   Function   Location
1   ()   JROOT/administrator/components/com_virtuemart/models/product.php:1055
2   VirtueMartModelProduct->setPaginationLimits()   JROOT/administrator/components/com_virtuemart/helpers/vmmodel.php:846
3   VmModel->exeSortSearchListQuery()   JROOT/administrator/components/com_virtuemart/models/product.php:959
4   VirtueMartModelProduct->sortSearchListQuery()   JROOT/components/com_virtuemart/views/category/view.html.php:282
5   VirtuemartViewCategory->display()   JROOT/components/com_virtuemart/controllers/category.php:61
6   VirtueMartControllerCategory->display()   JROOT/libraries/src/MVC/Controller/BaseController.php:672
7   Joomla\CMS\MVC\Controller\BaseController->execute()   JROOT/components/com_virtuemart/virtuemart.php:128
8   require_once()   JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
9   Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}()   JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73
10   Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch()   JROOT/libraries/src/Component/ComponentHelper.php:355
11   Joomla\CMS\Component\ComponentHelper::renderComponent()   JROOT/libraries/src/Application/SiteApplication.php:200
12   Joomla\CMS\Application\SiteApplication->dispatch()   JROOT/libraries/src/Application/SiteApplication.php:241
13   Joomla\CMS\Application\SiteApplication->doExecute()   JROOT/libraries/src/Application/CMSApplication.php:294
14   Joomla\CMS\Application\CMSApplication->execute()   JROOT/includes/app.php:61
15   require_once()
There in no problem if you fall. Problem is if you don't get up

Milbo

Okey, fixed next version, the code at JROOT/administrator/components/com_virtuemart/models/product.php:1055 is just

$suglimit = intval($suglimit);
$rest = $suglimit%intval($category->products_per_row);
$limit = $suglimit - $rest;
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Darko F.

Quote from: Milbo on October 05, 2022, 22:45:51 PM
Okey, fixed next version, the code at JROOT/administrator/components/com_virtuemart/models/product.php:1055 is just

$suglimit = intval($suglimit);
$rest = $suglimit%intval($category->products_per_row);
$limit = $suglimit - $rest;


I apply changes and now when I visit shop menu Front page I get:

0 Unsupported operand types: int + string

Call stack
#   Function   Location
1   ()   JROOT/components/com_virtuemart/router.php:474
2   vmrouterHelper::buildRoute()   JROOT/components/com_virtuemart/router.php:143
3   virtuemartBuildRoute()   JROOT/components/com_virtuemart/router.php:129
4   VirtuemartRouter->build()   JROOT/libraries/src/Router/SiteRouter.php:441
5   Joomla\CMS\Router\SiteRouter->buildSefRoute()   JROOT/libraries/src/Router/Router.php:405
6   Joomla\CMS\Router\Router->processBuildRules()   JROOT/libraries/src/Router/Router.php:192
7   Joomla\CMS\Router\Router->build()   JROOT/libraries/src/Router/Route.php:141
8   Joomla\CMS\Router\Route::link()   JROOT/libraries/src/Router/Route.php:93
9   Joomla\CMS\Router\Route::_()   JROOT/administrator/components/com_virtuemart/helpers/vmpagination.php:756
10   VmPagination->_buildDataObject()   JROOT/administrator/components/com_virtuemart/helpers/vmpagination.php:405
11   VmPagination->getPagesLinks()   JROOT/templates/cassiopeia_strugarstvo/html/com_virtuemart/category/strugarstvo.php:158
12   include()   JROOT/libraries/src/MVC/View/HtmlView.php:410
13   Joomla\CMS\MVC\View\HtmlView->loadTemplate()   JROOT/components/com_virtuemart/helpers/vmview.php:81
14   VmView->display()   JROOT/components/com_virtuemart/views/category/view.html.php:530
15   VirtuemartViewCategory->display()   JROOT/components/com_virtuemart/controllers/category.php:61
16   VirtueMartControllerCategory->display()   JROOT/libraries/src/MVC/Controller/BaseController.php:672
17   Joomla\CMS\MVC\Controller\BaseController->execute()   JROOT/components/com_virtuemart/virtuemart.php:128
18   require_once()   JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
19   Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}()   JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73
20   Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch()   JROOT/libraries/src/Component/ComponentHelper.php:355
21   Joomla\CMS\Component\ComponentHelper::renderComponent()   JROOT/libraries/src/Application/SiteApplication.php:200
22   Joomla\CMS\Application\SiteApplication->dispatch()   JROOT/libraries/src/Application/SiteApplication.php:241
23   Joomla\CMS\Application\SiteApplication->doExecute()   JROOT/libraries/src/Application/CMSApplication.php:294
24   Joomla\CMS\Application\CMSApplication->execute()   JROOT/includes/app.php:61
25   require_once()   JROOT/index.php:32
 
There in no problem if you fall. Problem is if you don't get up

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Darko F.

One question when I apply your fix in product.php:1055
Should I also overwrite product.php:1054 line
I feel I should, since you define $rest In line 1056 in any case error I get is the same.
There in no problem if you fall. Problem is if you don't get up

Milbo

The fix in the router, add at line 470 just

$limitstart = intval($limitstart);
$limit = intval($limit);


the other code should look like that


if(empty($category->products_per_row)){
$category->products_per_row = 1;
}
$suglimit = intval($suglimit);
$rest = $suglimit%intval($category->products_per_row);
$limit = $suglimit - $rest;

if(!empty($category->limit_list_step)){
$prod_per_page = explode(",",$category->limit_list_step);
} else {
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Darko F.

Milbo before applying these fix I find in J4 my test site

in Gloobal configuration I have Set the pagination sequence for the List Box
Most of them empty.

Only  Backend default items per list view i have:  150

and all other no number, and when I save configuration page was broken. But I empty these few days ago when I play around pagination so I didn't connect with last update, this is reason why don't work..

Now with your fix when I enter random numbers in Set the pagination sequence in Global configuration

Everything working including pagination

Hooray :)

Thank you
There in no problem if you fall. Problem is if you don't get up

Darko F.

With the last fix in everything work even if in global configuration are no numbers in Set the pagination sequence for the List Box Tab

Great work,
Thank you again.
There in no problem if you fall. Problem is if you don't get up

Milbo

Yes, it is even better to leave them empty, than it creates the numbers, but if you are unhappy with them, you can enter your own. But ... most people forget that the number of article in a row determine the number to get full rows. For example you want 3 products in a row, but list 100 products, 100 is not divideable by 3. And so the automatic fits most time. the new version should have the fix already.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/