2017-03-22 11 views

답변

0

내가 내 프로젝트에 이런 짓을 한 방법이다. 그것은 깨끗한 옵션이 아니지만 예상대로 작동하고 있습니다. 나는 상황에서 오류가 사라 졌어요, 리디렉션 사용할 때 내가 모듈 /mdoules/customform/customform.php

<?php 

if (!defined('_PS_VERSION_')) 
    exit; 

class CustomForm extends Module 
{ 
    public function __construct() 
    { 
     $this->name = 'customform'; 
     $this->tab = 'administration'; 
     $this->version = '1.0.0'; 
     $this->author = 'Florian Lemaitre'; 
     $this->need_instance = 0; 

     $this->bootstrap = true; 
     parent::__construct(); 

     $this->displayName = $this->l('Custom Form'); 
     $this->description = $this->l('Custom Form'); 
    } 

    public function install() 
    { 
     return $this->createTable() 
      && parent::install() 
      && $this->registerHook('checkCustomForm'); 
    } 

    public function hookcheckCustomForm($params) 
    { 

     [process your form values here (Tools::getValue('my_value') ...)] 

     if (error) 
     { 
      // We redirect to the Adrress page with a flag 'missing_value' to alert an error 
      Tools::redirect('index.php?controller=order&step=1&missing_value=true'); 
     } 
    } 
} 
+0

을 만들었습니다

{hook h="checkCustomForm"} 

: 나는 후크를 추가 한 order-carrier.tpl의 상단에

. 게다가 내 양식은 새로운 가치로 채워지지 않습니다. 리디렉션을 사용하여 요청에서 오류 및 데이터를 유지 관리하는 방법 아니면 그렇게 할 다른 방법이 있습니까? – santosh