58 lines
2.0 KiB
PHP
58 lines
2.0 KiB
PHP
<?php
|
|
|
|
class inpostshipmyPackageModuleFrontController extends ModuleFrontController
|
|
{
|
|
|
|
public function initContent()
|
|
{
|
|
$this->display_column_right = false;
|
|
$this->display_column_left = false;
|
|
|
|
$context = Context::getContext();
|
|
if (empty($context->customer->id)) {
|
|
Tools::redirect('index.php');
|
|
}
|
|
|
|
parent::initContent();
|
|
$this->context->smarty->tpl_vars['page']->value['body_classes']['page-customer-account'] = true;
|
|
|
|
$packageList = InpostPack::getCustomerPackage((int)$context->customer->id);
|
|
if (!empty($packageList)) {
|
|
foreach ($packageList as &$item) {
|
|
$order = new Order((int)$item['id_order']);
|
|
$item['order_reference'] = $order->reference;
|
|
}
|
|
}
|
|
$ssl = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
|
|
$ajaxTrackingLink = $ssl.$this->context->shop->domain.$this->context->shop->physical_uri.'modules/inpostship/ajax/tracking.php';
|
|
$ajaxTrackingHistoryLink = $ssl.$this->context->shop->domain.$this->context->shop->physical_uri.'modules/inpostship/ajax/trackingHistory.php';
|
|
|
|
$this->context->smarty->assign(array(
|
|
'packageList' => $packageList,
|
|
'ajaxTrackingLink' => $ajaxTrackingLink,
|
|
'ajaxTrackingHistoryLink' => $ajaxTrackingHistoryLink
|
|
));
|
|
|
|
if (self::ps17()) {
|
|
$this->setTemplate('module:inpostship/views/templates/front/mypackage.tpl');
|
|
} else {
|
|
$this->setTemplate('mypackage16.tpl');
|
|
}
|
|
}
|
|
|
|
public function setMedia()
|
|
{
|
|
$js_path = $this->module->getPathUri().'views/js/';
|
|
$css_path = $this->module->getPathUri().'views/css/';
|
|
|
|
parent::setMedia();
|
|
$this->context->controller->addJS($js_path.'front.js');
|
|
$this->context->controller->addCSS($css_path.'myaccount.css');
|
|
}
|
|
|
|
private static function ps17()
|
|
{
|
|
return Tools::version_compare(_PS_VERSION_, '1.7.0.0', '>=');
|
|
}
|
|
|
|
} |