privilegedemarque/modules/affilnet/affilnet.php

51 lines
1.2 KiB
PHP
Raw Normal View History

2016-09-13 15:10:50 +02:00
<?php
if (!defined('_PS_VERSION_'))
exit;
class Affilnet extends Module
{
public function __construct()
{
$this->name = 'affilnet';
$this->tab = 'analytics_stats';
$this->version = '1.0.0';
$this->author = 'Antadis';
$this->displayName = 'Affilnet analytics';
$this->module_key = 'fd2aaefea84ac1bb512e6f1878d990b8';
parent::__construct();
$this->description = $this->l('Affilnet analytics');
$this->confirmUninstall = $this->l('Are you sure you want to delete your details ?');
}
public function install()
{
2016-09-30 10:48:15 +02:00
return (parent::install() && $this->registerHook('orderConfirmation'));
2016-09-13 15:10:50 +02:00
}
public function hookOrderConfirmation($params)
{
2016-09-15 16:28:35 +02:00
$order = $params['objOrder'];
if (Validate::isLoadedObject($order)) {
$customer = new Customer($order->id_customer);
$discounts = $order->getDiscounts();
$ids_discount = '';
2016-09-15 17:10:25 +02:00
for ($i = 0 ; $i < count($discounts); $i++) {
2016-09-15 16:28:35 +02:00
$ids_discount .= $discounts[$i]['id_cart_rule'];
if ($i < count($discounts) - 1) {
$ids_discount .= ':';
}
}
$this->context->smarty->assign(array(
2016-09-30 10:48:15 +02:00
'order' => $order,
'ids_discount' => $ids_discount,
'customer' => $customer,
2016-09-15 16:28:35 +02:00
));
return $this->display(__FILE__, 'order-confirmation.tpl');
}
2016-09-13 15:10:50 +02:00
}
}