2016-10-22 29 views

回答

0

我发现了一个非常简单的解决方案。 我做了一个模块。

你可以在这里找到:GITHUB

是很容易:

  • 生成的基本模块HERE
  • 选择头钩我的新模块
  • 修改了头钩功能modulename.php fi乐根与这一个:
public function hookHeader() 
{ 
    $this->context->controller->addJS($this->_path.'/views/js/front.js'); 
    $this->context->controller->addCSS($this->_path.'/views/css/front.css'); 
    if (Tools::getValue('voucher')){ 
     $cartVoucher = Tools::getValue('voucher'); 
     $idDiscount = Discount::getIdByName($cartVoucher); 
     Context::getContext()->cart->addDiscount($idDiscount); 
    } 
} 

希望能帮助别人。 感谢所有。