Jump to content
thirty bees forum
  • 0

Issue with Okom VIP module


movieseals

Question

Hello all,

I get an error 500 and the following exception when I click on customers in the customers section with TB 1.1.x

 

Decoded exception

Too few arguments to function okom_vip::printForm(), 2 passed in /home/zbookstore/public_html/modules/okom_vip/okom_vip.php on line 454 and exactly 3 expected

in file modules/okom_vip/okom_vip.php at line 492

Source file: modules/okom_vip/okom_vip.php

473:                $exprired = false;
474:            } else {
475:                $exprired = true;
476:            }
477:        }
478:
479:        $product = new Product((int)Configuration::get('OKOM_VIP_IDPRODUCT'), true, $this->context->language->id);
480:        $link = new Link();
481:        //@TODO Fix Bad Link
482:        $vip_product_url = $link->getProductLink($product);
483:        $this->context->smarty->assign(array(
484:            'customer_vip' => $customer_vip,
485:            'exprired' => $exprired,
486:            'is_vip' => $is_vip,
487:            'vip_product_url' => $vip_product_url
488:        ));
489:        return $this->display(__FILE__, 'shopping-cart.tpl');
490:    }
491:
492:    public function printForm($vip_add, $vip_end, $vip_cards)
493:    {
494:        $option = '';
495:        
496:        if ($vip_cards) {
497:            foreach ($vip_cards as $vip_card) {
498:                $option .= '<option data-add="'.$vip_card['vip_add'].'" data-end="'.$vip_card['vip_end'].'" value="'.$vip_card['id_vip'].'">'.$vip_card['id_vip'].' : '.$vip_card['vip_add'].' to '.$vip_card['vip_end'].'</option>';
499:            }
500:        }
501:
502:        $html = '';
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

The exception says it all - the module contains method printForm that expects 3 input parameters. However, module calls this method with 2 arguments, resulting in php error. Previous versions of php were more lenient, and such call triggered only warnings / notices. But in php7 it's no longer permitted.

You should modify the module, and change signature of printForm method from

public function printForm($vip_add, $vip_end, $vip_cards)
{
...
}

to

public function printForm($vip_add, $vip_end, $vip_cards=null)
{
...
}

This will explicitly mark third parameter as optional, making php happy

   

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...