VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: Rikard on October 31, 2017, 08:15:41 AM

Title: I get an error message when I click on "on featured" in the list view.
Post by: Rikard on October 31, 2017, 08:15:41 AM
Hi
When I try to put a product on featured or remove it from featured I get the following message: 
Too few arguments to function VmController::toggle(), 0 passed in /usr/share/nginx/html/www/libraries/src/MVC/Controller/BaseController.php on line 710 and at least 1 expected

If I open a product and click on "featured" it works as expected. It is however very handy to put stuff on featured from list view so I wonder if there is a way for me to make it work.

My specifics:
VM: 3.2.4
Joomla: 3.8.1
PHP: 7.1.10-1
Title: Re: I get an error message when I click on "on featured" in the list view.
Post by: Milbo on November 01, 2017, 18:48:17 PM
Known php 7.1 error, which I did not understand yet. Please use php 7.0. Or maybe it works with the last php7.1. I think this is the first time that I encounter a php bug myself. There is no reason that it works from php 5.3 -php7.0, but not on php7.1
Title: Re: I get an error message when I click on "on featured" in the list view.
Post by: Studio 42 on November 03, 2017, 03:32:42 AM
In file YOURSITE/administrator/components/com_virtuemart/helpers/vmcontroller.php
class VmController extends JControllerLegacy{
public function toggle($field,$val=null){
argument $field have no default value ?
Try
public function toggle($field=null,$val=null){
I had to change some code for PHP7+ on my extensions too because PHP warnings or error, but accepted in php 5.6
Title: Re: I get an error message when I click on "on featured" in the list view.
Post by: Rikard on November 03, 2017, 09:18:41 AM
Hi
Thank you all for your assistance. I tried the below code change and it works for me.

Quote from: Studio 42 on November 03, 2017, 03:32:42 AM
In file YOURSITE/administrator/components/com_virtuemart/helpers/vmcontroller.php
class VmController extends JControllerLegacy{
public function toggle($field,$val=null){
argument $field have no default value ?
Try
public function toggle($field=null,$val=null){
I had to change some code for PHP7+ on my extensions too because PHP warnings or error, but accepted in php 5.6