2017-06-29 91 views
1

我想知道如何創建模塊prestashop 1.7啓動後,客戶端驗證命令,並在數據庫中插入id_order和order_state這是我現在嘗試,但只是爲了測試中,我嘗試用驗證順序,但掛鉤validationorder不到風度有任何$ PARMS thenakü烏拉圭回合的幫助,對不起我的英文不好創建模塊prestashop 1.7啓動後客戶端驗證訂單

<?php 

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


class VanmieghemFlux extends Module 
{ 

    public function __construct() 
    { 
     $this->name = 'vanmieghemflux'; 
     $this->tab = 'front_office_features'; 
     $this->version = '1.0.0'; 
     $this->author = ' DK group'; 
     $this->need_instance = 0; 
     $this->ps_versions_compliancy = array('min' => '1.7.0.0', 'max' => _PS_VERSION_); 
     $this->bootstrap = true; 

     parent::__construct(); 

     $this->displayName = $this->l('vanmieghemflux'); 
     $this->description = $this->l('Automatisation des flux'); 

     $this->confirmUninstall = $this->l('Êtes-vous sur de vouloir désinstaller?'); 


    } 

    public function install() 
    { 
    if (!parent::install() || !$this->registerHook('displayLeftColumn')) 
     return false; 
    return true; 
    } 

    public function uninstall() 
    { 
    if (!parent::uninstall()) 
     return false; 
    return true; 
    } 

    public function getContent() 
    { 

     return "test return"; 
    } 

    public function hookdisplayLeftColumn($params) 
    { 


    return "test return"; 
    } 


} 

?> 
+0

使用'hookActionValidateOrder($ params)方法',發現使用另一個模塊,掛鉤一個有效的例子 – sarcom

+0

是啊,但actionvalidateorder dosnt HVE任何$ PARMS我需要id_order在我的功能感謝 –

+0

您在'$ params'數組中擁有整個訂單對象,您可以從中獲得訂單ID。 – TheDrot

回答

2

你必須使用hookActionValidateOrder,在$params有你需要的一切:

public function hookActionValidateOrder($params) 
{ 
    $cart = $params['cart']; // The cart object 
    $order_status = $params['orderStatus']; // The order status 
    $order = $params['order']; // And the order object 

    $order->id; // This is the id order 
} 

檢查CartOrder類,看看你可以用這個對象做什麼。

希望它能幫助:)

+0

感謝它的工作 –

+0

我很高興聽到這些;),不客氣;) – sarcom