yes i write an module to save my data into database and show in backoffice:
<?php
class SaveVariables extends Module
{
public function __construct()
{
$this->name = 'savevariables';
$this->tab = 'Test';
$this->version = 1.0;
$this->author = 'ramin sarmadi';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->l('savevariables');
$this->description = $this->l('Save Variables on database');
}
public function install()
{
if (parent::install() == false OR !$this->registerHook('orderConfirmation') OR !$this->registerHook('adminOrder'))
return false;
return true;
}
public function hookOrderConfirmation( $params )
{
global $cookie;
$id_order = $params['objOrder']->id;
$x = $cookie->x;
$y = $cookie->y;
$w = $cookie->w;
$h = $cookie->h;
$wwr = $cookie->wwr;
$hwr = $cookie->hwr;
if(isset($_COOKIE["imagename"]))
{
$image_name = $_COOKIE["imagename"];
Db::getInstance()->Execute
("
INSERT INTO `variables` (`id_order`, `image_name`, `x`, `y`, `w`, `h`, `wwr`, `hwr`)
VALUES ('$id_order', '$image_name', '$x', '$y', '$w', '$h', '$wwr', '$hwr')
");
}
else
{
Db::getInstance()->Execute
("
INSERT INTO `variables` (`id_order`, `image_name`, `x`, `y`, `w`, `h`, `wwr`, `hwr`)
VALUES ('$id_order', 'imagenotexist', '$x', '$y', '$w', '$h', '$wwr', '$hwr')
");
}
}
public function hookAdminOrder( $params )
{
global $smarty;
global $base_dir;
$id_order = $params['id_order'];
$variabels = Db::getInstance()->ExecuteS("SELECT * FROM `variables` WHERE `id_order` = '$id_order'");
$smarty->assign(array(
'x' => $variabels[0]['x'],
'y' => $variabels[0]['y'],
'h' => $variabels[0]['h'],
'w' => $variabels[0]['w'],
'wwr' => $variabels[0]['wwr'],
'hwr' => $variabels[0]['hwr'],
'imagename' => $variabels[0]['image_name']
));
$filename = $variabels[0]['image_name'];
$uploadaddress = "http://" . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . "upload/php/files/thumbnail/" . $filename;
$smarty->assign('uploadaddress', $uploadaddress);
return $this->display(__FILE__, 'savevariables.tpl');
}
}
?>