创建模块prestashop 1.7启动后客户端验证订单

问题描述:

我想知道如何创建模块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

你必须使用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