Jump to content

Edit History

andtrx

andtrx

Hello, I need 2 hooks, and no matter which ones I try, they dont seem to work.

1. I need a hook for whenever an order is edited from the backoffice.
When the order changes status and when the admin ads or removes a product  and saves the order.

2. I need another hook for whenever a new product is added / edited from the backoffice.

My module looks as follows:

    public function install()
    {
        if (parent::install() && $this->registerHook('displayHeader') && $this->registerHook('displayOrderConfirmation') && $this->registerHook('updateOrderStatus')  && $this->registerHook('addproduct') ) {
            return true;
        }

        return false;
    }

    public function hookdisplayOrderConfirmation($params)
    {

        $externalIdMobilPay = str_replace('%', '#', Tools::getValue('orderId'));
        $externalIdEuPlatesc = Tools::getValue('ep_id');

        if (isset($externalIdMobilPay)) {
            $externalId = $externalIdMobilPay;
        } else if (isset($externalIdEuPlatesc)) {
            $externalId = $externalIdEuPlatesc;
        } else {
            $externalId = "";
        }

        $cartId = $params['objOrder']->id;
        $order = new SeniorErpSendOrder;
        $order->createOrder($cartId, $externalId);

    }
    public function hookupdateOrderStatus($params)
    {
        die('exit');
    }

    public function hookaddproduct($params)
    {
        die('exit');
    }

The hookdisplayOrderConfirmation works without any problem.
The other two, dont 
I also tried re-installing the module.

I found the hooks here: https://mypresta.eu/en/art/developer/prestashop-hook-list.html




Thanks,

andtrx

andtrx

Hello, I need 2 hooks, and no matter which ones I try they dont seem to work.

1. I need a hook for whenever an order is edited from the backoffice.
When he changes status and when he ads or removes a product  and saves the order.

2. I need a hook for whenever a new product is added / edited from the backoffice.

I tried the following:

 

    public function install()
    {
        if (parent::install() && $this->registerHook('displayHeader') && $this->registerHook('displayOrderConfirmation') && $this->registerHook('updateOrderStatus')  && $this->registerHook('addproduct') ) {
            return true;
        }

        return false;
    }

    public function hookdisplayOrderConfirmation($params)
    {

        $externalIdMobilPay = str_replace('%', '#', Tools::getValue('orderId'));
        $externalIdEuPlatesc = Tools::getValue('ep_id');

        if (isset($externalIdMobilPay)) {
            $externalId = $externalIdMobilPay;
        } else if (isset($externalIdEuPlatesc)) {
            $externalId = $externalIdEuPlatesc;
        } else {
            $externalId = "";
        }

        $cartId = $params['objOrder']->id;
        $order = new SeniorErpSendOrder;
        $order->createOrder($cartId, $externalId);

    }
    public function hookupdateOrderStatus($params)
    {
        die('exit');
    }

    public function hookaddproduct($params)
    {
        die('exit');
    }

None of this seem to work.
I also tried re-installing the module.

I found the hooks here: https://mypresta.eu/en/art/developer/prestashop-hook-list.html

The hookdisplayOrderConfirmation works without any problem.


Thanks,

×
×
  • Create New...