Christophe Latour 378aefae75 #10887
Affilnet tagging
2016-09-30 10:48:15 +02:00

51 lines
1.2 KiB
PHP

<?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()
{
return (parent::install() && $this->registerHook('orderConfirmation'));
}
public function hookOrderConfirmation($params)
{
$order = $params['objOrder'];
if (Validate::isLoadedObject($order)) {
$customer = new Customer($order->id_customer);
$discounts = $order->getDiscounts();
$ids_discount = '';
for ($i = 0 ; $i < count($discounts); $i++) {
$ids_discount .= $discounts[$i]['id_cart_rule'];
if ($i < count($discounts) - 1) {
$ids_discount .= ':';
}
}
$this->context->smarty->assign(array(
'order' => $order,
'ids_discount' => $ids_discount,
'customer' => $customer,
));
return $this->display(__FILE__, 'order-confirmation.tpl');
}
}
}