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

时间:2017-06-29 14:51:21

标签: database prestashop prestashop-1.7

我想知道在客户端验证订单后如何创建模块prestashop 1.7启动并在数据库中插入id_order和order_state这是我现在尝试但只是为了测试我尝试验证顺序但是钩子验证顺序dosn没有任何$ parms,请你帮忙,抱歉我的英文不好

<?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";
  }


}

?>

1 个答案:

答案 0 :(得分:3)

您必须使用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类,了解您可以对该对象执行的操作。

希望有所帮助:)