chafan mustapha
chafan mustapha

Reputation: 58

create module prestashop 1.7 launch after the client validate the order

i want to know how to create module prestashop 1.7 launch after the client validate the order and insert the id_order and the order_state in database this is what i try for now but just for test i try with validation order but the hook validationorder dosn't have any $parms thenak u for ur help and sorry for my bad english

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


}

?>

Upvotes: 1

Views: 1164

Answers (1)

marsaldev
marsaldev

Reputation: 3349

You have to use hookActionValidateOrder, in $params there are all that you need:

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
}

Check the Cart and the Order class to see what you can do with that object.

Hope it helps :)

Upvotes: 4

Related Questions