// Context part 9
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7637 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -35,9 +35,7 @@ class AdminCMSCategories extends AdminTab
|
||||
private $_CMSCategory;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
{
|
||||
$this->table = 'cms_category';
|
||||
$this->className = 'CMSCategory';
|
||||
$this->lang = true;
|
||||
@@ -62,7 +60,6 @@ class AdminCMSCategories extends AdminTab
|
||||
|
||||
public function displayList($token = NULL)
|
||||
{
|
||||
global $currentIndex;
|
||||
/* Display list header (filtering, pagination and column names) */
|
||||
$this->displayListHeader($token);
|
||||
if (!sizeof($this->_list))
|
||||
@@ -77,10 +74,9 @@ class AdminCMSCategories extends AdminTab
|
||||
|
||||
public function display($token = NULL)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$id_cms_category = (int)(Tools::getValue('id_cms_category', 1));
|
||||
|
||||
$this->getList((int)($cookie->id_lang), !$cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$cookie->__get($this->table.'Orderway') ? 'ASC' : NULL);
|
||||
$this->getList((int)($cookie->id_lang), !$context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL);
|
||||
|
||||
echo '<h3>'.(!$this->_listTotal ? ($this->l('There are no subcategories')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('subcategories') : $this->l('subCMS Category')))).' '.$this->l('in CMS Category').' "'.stripslashes(CMSCategory::hideCMSCategoryPosition($this->_CMSCategory->getName())).'"</h3>';
|
||||
echo '<a href="'.__PS_BASE_URI__.substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)).'?tab=AdminCMSContent&add'.$this->table.'&id_parent='.Tools::getValue('id_cms_category').'&token='.($token!=NULL ? $token : $this->token).'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new sub CMS Category').'</a>
|
||||
@@ -90,11 +86,9 @@ class AdminCMSCategories extends AdminTab
|
||||
}
|
||||
|
||||
public function postProcess($token = NULL)
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
|
||||
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$this->tabAccess = Profile::getProfileAccess($context->employee->id_profile, $this->id);
|
||||
|
||||
if (Tools::isSubmit('submitAdd'.$this->table))
|
||||
{
|
||||
@@ -196,7 +190,7 @@ class AdminCMSCategories extends AdminTab
|
||||
|
||||
public function displayForm($token=NULL)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -227,7 +221,7 @@ class AdminCMSCategories extends AdminTab
|
||||
<label>'.$this->l('Parent CMS Category:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_parent">';
|
||||
$categories = CMSCategory::getCategories((int)($cookie->id_lang), false);
|
||||
$categories = CMSCategory::getCategories($context->language->id, false);
|
||||
CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($obj, 'id_parent'));
|
||||
echo '
|
||||
</select>
|
||||
|
||||
@@ -91,8 +91,6 @@ class AdminCMSContent extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (((Tools::isSubmit('submitAddcms_category') OR Tools::isSubmit('submitAddcms_categoryAndStay')) AND sizeof($this->adminCMSCategories->_errors)) OR isset($_GET['updatecms_category']) OR isset($_GET['addcms_category']))
|
||||
{
|
||||
$this->adminCMSCategories->displayForm($this->token);
|
||||
|
||||
@@ -135,7 +135,7 @@ class AdminCarriers extends AdminTab
|
||||
</div>
|
||||
<label>'.$this->l('Group access').'</label>
|
||||
<div class="margin-form">';
|
||||
$groups = Group::getGroups(Context::getContext()->language->id));
|
||||
$groups = Group::getGroups(Context::getContext()->language->id);
|
||||
if (sizeof($groups))
|
||||
{
|
||||
echo '
|
||||
|
||||
@@ -44,15 +44,14 @@ class AdminContact extends AdminPreferences
|
||||
|
||||
private function _getDefaultFieldsContent()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$countryList = array();
|
||||
$countryList[] = array('id' => '0', 'name' => $this->l('Choose your country'));
|
||||
foreach (Country::getCountries(intval($cookie->id_lang)) AS $country)
|
||||
foreach (Country::getCountries($context->language->id) AS $country)
|
||||
$countryList[] = array('id' => $country['id_country'], 'name' => $country['name']);
|
||||
$stateList = array();
|
||||
$stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)'));
|
||||
foreach (State::getStates(intval($cookie->id_lang)) AS $state)
|
||||
foreach (State::getStates($context->language->id) AS $state)
|
||||
$stateList[] = array('id' => $state['id_state'], 'name' => $state['name']);
|
||||
|
||||
$formFields = array(
|
||||
@@ -109,10 +108,10 @@ class AdminContact extends AdminPreferences
|
||||
|
||||
protected function _postConfig($fields)
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
if (!$this->_errors && isset($_POST['PS_SHOP_COUNTRY_ID']))
|
||||
{
|
||||
$country = new Country((int)($_POST['PS_SHOP_COUNTRY_ID']), intval($cookie->id_lang));
|
||||
$country = new Country($_POST['PS_SHOP_COUNTRY_ID'], $context->language->id);
|
||||
Configuration::updateValue('PS_SHOP_COUNTRY', pSQL($country->name));
|
||||
}
|
||||
if (!$this->_errors && isset($_POST['PS_SHOP_STATE_ID']))
|
||||
|
||||
@@ -29,8 +29,6 @@ class AdminCounty extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'county';
|
||||
$this->className = 'County';
|
||||
$this->edit = true;
|
||||
@@ -108,7 +106,7 @@ class AdminCounty extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -134,7 +132,7 @@ class AdminCounty extends AdminTab
|
||||
if (!isset($obj->id))
|
||||
echo '<div class="hint clear" style="display:block;">'.$this->l('Save this county then you will be able to associate zipcodes').'</div><br />';
|
||||
|
||||
$countries = Country::getCountries($cookie->id_lang, true, true);
|
||||
$countries = Country::getCountries($context->language->id, true, true);
|
||||
echo '<label>'.$this->l('Country:').' </label>
|
||||
<div class="margin-form"><select id="id_country" onchange="populateStates($(this).val(), '.(int)($this->getFieldValue($obj, 'id_state')).');">';
|
||||
|
||||
|
||||
@@ -29,8 +29,7 @@ class AdminCustomerThreads extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$this->table = 'customer_thread';
|
||||
$this->lang = false;
|
||||
$this->className = 'CustomerThread';
|
||||
@@ -48,10 +47,10 @@ class AdminCustomerThreads extends AdminTab
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON c.`id_customer` = a.`id_customer`
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer_message` cm ON cm.`id_customer_thread` = a.`id_customer_thread`
|
||||
LEFT JOIN `'._DB_PREFIX_.'lang` l ON l.`id_lang` = a.`id_lang`
|
||||
LEFT JOIN `'._DB_PREFIX_.'contact_lang` cl ON (cl.`id_contact` = a.`id_contact` AND cl.`id_lang` = '.(int)$cookie->id_lang.')';
|
||||
LEFT JOIN `'._DB_PREFIX_.'contact_lang` cl ON (cl.`id_contact` = a.`id_contact` AND cl.`id_lang` = '.(int)$context->language->id.')';
|
||||
|
||||
$contactArray = array();
|
||||
$contacts = Contact::getContacts($cookie->id_lang);
|
||||
$contacts = Contact::getContacts($context->language->id);
|
||||
foreach ($contacts AS $contact)
|
||||
$contactArray[$contact['id_contact']] = $contact['name'];
|
||||
|
||||
@@ -92,7 +91,7 @@ class AdminCustomerThreads extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex, $cookie, $link;
|
||||
$context = Context::getContext();
|
||||
|
||||
if ($id_customer_thread = (int)Tools::getValue('id_customer_thread'))
|
||||
{
|
||||
@@ -110,7 +109,7 @@ class AdminCustomerThreads extends AdminTab
|
||||
SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name, CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
|
||||
FROM '._DB_PREFIX_.'customer_thread ct
|
||||
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON (ct.id_customer_thread = cm.id_customer_thread)
|
||||
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$cookie->id_lang.')
|
||||
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$context->language->id.')
|
||||
LEFT OUTER JOIN '._DB_PREFIX_.'employee e ON e.id_employee = cm.id_employee
|
||||
LEFT OUTER JOIN '._DB_PREFIX_.'customer c ON (c.email = ct.email)
|
||||
WHERE ct.id_customer_thread = '.(int)Tools::getValue('id_customer_thread').'
|
||||
@@ -120,17 +119,17 @@ class AdminCustomerThreads extends AdminTab
|
||||
$output .= $this->displayMsg($message, true, (int)Tools::getValue('id_employee_forward'));
|
||||
|
||||
$cm = new CustomerMessage();
|
||||
$cm->id_employee = (int)$cookie->id_employee;
|
||||
$cm->id_employee = (int)$context->employee->id;
|
||||
$cm->id_customer_thread = (int)Tools::getValue('id_customer_thread');
|
||||
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
|
||||
$currentEmployee = new Employee($cookie->id_employee);
|
||||
$currentEmployee = $context->employee;
|
||||
if (($id_employee = (int)Tools::getValue('id_employee_forward')) AND ($employee = new Employee($id_employee)) AND Validate::isLoadedObject($employee))
|
||||
{
|
||||
$params = array(
|
||||
'{messages}' => $output,
|
||||
'{employee}' => $currentEmployee->firstname.' '.$currentEmployee->lastname,
|
||||
'{comment}' => stripslashes($_POST['message_forward']));
|
||||
Mail::Send((int)($cookie->id_lang), 'forward_msg', Mail::l('Fwd: Customer message'), $params,
|
||||
Mail::Send($context->language->id, 'forward_msg', Mail::l('Fwd: Customer message'), $params,
|
||||
$employee->email, $employee->firstname.' '.$employee->lastname,
|
||||
$currentEmployee->email, $currentEmployee->firstname.' '.$currentEmployee->lastname);
|
||||
$cm->message = $this->l('Message forwarded to').' '.$employee->firstname.' '.$employee->lastname."\n".$this->l('Comment:').' '.$_POST['message_forward'];
|
||||
@@ -142,7 +141,7 @@ class AdminCustomerThreads extends AdminTab
|
||||
'{messages}' => $output,
|
||||
'{employee}' => $currentEmployee->firstname.' '.$currentEmployee->lastname,
|
||||
'{comment}' => stripslashes($_POST['message_forward']));
|
||||
Mail::Send((int)($cookie->id_lang), 'forward_msg', Mail::l('Fwd: Customer message'), $params,
|
||||
Mail::Send($context->language->id, 'forward_msg', Mail::l('Fwd: Customer message'), $params,
|
||||
$email, NULL,
|
||||
$currentEmployee->email, $currentEmployee->firstname.' '.$currentEmployee->lastname);
|
||||
$cm->message = $this->l('Message forwarded to').' '.$email."\n".$this->l('Comment:').' '.$_POST['message_forward'];
|
||||
@@ -155,7 +154,7 @@ class AdminCustomerThreads extends AdminTab
|
||||
{
|
||||
$ct = new CustomerThread($id_customer_thread);
|
||||
$cm = new CustomerMessage();
|
||||
$cm->id_employee = (int)$cookie->id_employee;
|
||||
$cm->id_employee = (int)$context->employee->id;
|
||||
$cm->id_customer_thread = $ct->id;
|
||||
$cm->message = Tools::htmlentitiesutf8(nl2br2(Tools::getValue('reply_message')));
|
||||
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
|
||||
@@ -172,7 +171,7 @@ class AdminCustomerThreads extends AdminTab
|
||||
}
|
||||
$params = array(
|
||||
'{reply}' => nl2br2(Tools::getValue('reply_message')),
|
||||
'{link}' => Tools::url($link->getPageLink('contact', true), 'id_customer_thread='.(int)($ct->id).'&token='.$ct->token),
|
||||
'{link}' => Tools::url($context->link->getPageLink('contact', true), 'id_customer_thread='.(int)($ct->id).'&token='.$ct->token),
|
||||
);
|
||||
Mail::Send($ct->id_lang, 'reply_msg', Mail::l('An answer to your message is available'), $params, Tools::getValue('msg_email'), NULL, NULL, NULL, $fileAttachment);
|
||||
$ct->status = 'closed';
|
||||
@@ -189,7 +188,7 @@ class AdminCustomerThreads extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
if (isset($_GET['filename']) AND file_exists(_PS_UPLOAD_DIR_.$_GET['filename']))
|
||||
self::openUploadedFile();
|
||||
@@ -197,15 +196,14 @@ class AdminCustomerThreads extends AdminTab
|
||||
$this->viewcustomer_thread();
|
||||
else
|
||||
{
|
||||
$this->getList((int)$cookie->id_lang, !Tools::getValue($this->table.'Orderby') ? 'date_upd' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
$this->getList($context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_upd' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
$this->displayList();
|
||||
}
|
||||
}
|
||||
|
||||
public function displayListHeader($token = NULL)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$contacts = Db::getInstance()->ExecuteS('
|
||||
SELECT cl.*, COUNT(*) as total, (
|
||||
SELECT id_customer_thread
|
||||
@@ -215,13 +213,13 @@ class AdminCustomerThreads extends AdminTab
|
||||
LIMIT 1
|
||||
) as id_customer_thread
|
||||
FROM '._DB_PREFIX_.'customer_thread ct
|
||||
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.$cookie->id_lang.')
|
||||
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$context->language->id.')
|
||||
WHERE ct.status = "open"
|
||||
GROUP BY ct.id_contact HAVING COUNT(*) > 0');
|
||||
$categories = Db::getInstance()->ExecuteS('
|
||||
SELECT cl.*
|
||||
FROM '._DB_PREFIX_.'contact ct
|
||||
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.$cookie->id_lang.')
|
||||
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$context->language->id.')
|
||||
WHERE ct.customer_service = 1');
|
||||
$dim = count($categories);
|
||||
|
||||
@@ -288,10 +286,9 @@ class AdminCustomerThreads extends AdminTab
|
||||
}
|
||||
private function displayMsg($message, $email = false, $id_employee = null)
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$customersToken = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee));
|
||||
$contacts = Contact::getContacts($cookie->id_lang);
|
||||
$context = Context::getContext();
|
||||
$customersToken = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id);
|
||||
$contacts = Contact::getContacts($context->language->id);
|
||||
|
||||
if (!$email)
|
||||
{
|
||||
@@ -320,21 +317,21 @@ class AdminCustomerThreads extends AdminTab
|
||||
? '<b>'.$this->l('Customer ID:').'</b> <a href="index.php?tab=AdminCustomers&id_customer='.(int)($message['id_customer']).'&viewcustomer&token='.$customersToken.'" title="'.$this->l('View customer').'">'.(int)($message['id_customer']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
|
||||
: ''
|
||||
).'
|
||||
<b>'.$this->l('Sent on:').'</b> '.Tools::displayDate($message['date_add'], (int)($cookie->id_lang), true).'<br />'.(
|
||||
<b>'.$this->l('Sent on:').'</b> '.Tools::displayDate($message['date_add'], $context->language->id, true).'<br />'.(
|
||||
empty($message['employee_name'])
|
||||
? '<b>'.$this->l('Browser:').'</b> '.strip_tags($message['user_agent']).'<br />'
|
||||
: ''
|
||||
).(
|
||||
(!empty($message['file_name']) AND file_exists(_PS_UPLOAD_DIR_.$message['file_name']))
|
||||
? '<b>'.$this->l('File attachment').'</b> <a href="index.php?tab=AdminCustomerThreads&id_customer_thread='.$message['id_customer_thread'].'&viewcustomer_thread&token='.Tools::getAdminToken('AdminCustomerThreads'.(int)(Tab::getIdFromClassName('AdminCustomerThreads')).(int)($cookie->id_employee)).'&filename='.$message['file_name'].'" title="'.$this->l('View file').'"><img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
|
||||
? '<b>'.$this->l('File attachment').'</b> <a href="index.php?tab=AdminCustomerThreads&id_customer_thread='.$message['id_customer_thread'].'&viewcustomer_thread&token='.Tools::getAdminToken('AdminCustomerThreads'.(int)(Tab::getIdFromClassName('AdminCustomerThreads')).(int)$context->employee->id).'&filename='.$message['file_name'].'" title="'.$this->l('View file').'"><img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
|
||||
: ''
|
||||
).(
|
||||
(!empty($message['id_order']) AND empty($message['employee_name']))
|
||||
? '<b>'.$this->l('Order #').'</b> <a href="index.php?tab=AdminOrders&id_order='.(int)($message['id_order']).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'" title="'.$this->l('View order').'">'.(int)($message['id_order']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
|
||||
? '<b>'.$this->l('Order #').'</b> <a href="index.php?tab=AdminOrders&id_order='.(int)($message['id_order']).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id).'" title="'.$this->l('View order').'">'.(int)($message['id_order']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
|
||||
: ''
|
||||
).(
|
||||
(!empty($message['id_product']) AND empty($message['employee_name']))
|
||||
? '<b>'.$this->l('Product #').'</b> <a href="index.php?tab=AdminOrders&id_order='.(int)($id_order_product).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'" title="'.$this->l('View order').'">'.(int)($message['id_product']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
|
||||
? '<b>'.$this->l('Product #').'</b> <a href="index.php?tab=AdminOrders&id_order='.(int)($id_order_product).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id).'" title="'.$this->l('View order').'">'.(int)($message['id_product']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
|
||||
: ''
|
||||
).'<br />
|
||||
<form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post">
|
||||
@@ -400,11 +397,10 @@ class AdminCustomerThreads extends AdminTab
|
||||
|
||||
public function viewcustomer_thread()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$context = Context::getContext();
|
||||
if (!($thread = $this->loadObject()))
|
||||
return;
|
||||
$cookie->{'customer_threadFilter_cl!id_contact'} = $thread->id_contact;
|
||||
$context->cookie->{'customer_threadFilter_cl!id_contact'} = $thread->id_contact;
|
||||
|
||||
$employees = Db::getInstance()->ExecuteS('
|
||||
SELECT e.id_employee, e.firstname, e.lastname FROM '._DB_PREFIX_.'employee e
|
||||
@@ -445,7 +441,7 @@ class AdminCustomerThreads extends AdminTab
|
||||
SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name, CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
|
||||
FROM '._DB_PREFIX_.'customer_thread ct
|
||||
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON (ct.id_customer_thread = cm.id_customer_thread)
|
||||
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$cookie->id_lang.')
|
||||
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$context->language->id.')
|
||||
LEFT JOIN '._DB_PREFIX_.'employee e ON e.id_employee = cm.id_employee
|
||||
LEFT JOIN '._DB_PREFIX_.'customer c ON (IFNULL(ct.id_customer, ct.email) = IFNULL(c.id_customer, c.email))
|
||||
WHERE ct.id_customer_thread = '.(int)Tools::getValue('id_customer_thread').'
|
||||
@@ -460,8 +456,8 @@ class AdminCustomerThreads extends AdminTab
|
||||
WHERE (id_employee IS NULL OR id_employee = 0) AND id_customer_thread = '.(int)$thread->id.'
|
||||
ORDER BY date_add DESC LIMIT 1
|
||||
)
|
||||
'.($cookie->{'customer_threadFilter_cl!id_contact'} ? 'AND ct.id_contact = '.(int)$cookie->{'customer_threadFilter_cl!id_contact'} : '').'
|
||||
'.($cookie->{'customer_threadFilter_l!id_lang'} ? 'AND ct.id_lang = '.(int)$cookie->{'customer_threadFilter_l!id_lang'} : '').
|
||||
'.($context->cookie->{'customer_threadFilter_cl!id_contact'} ? 'AND ct.id_contact = '.(int)$context->cookie->{'customer_threadFilter_cl!id_contact'} : '').'
|
||||
'.($context->cookie->{'customer_threadFilter_l!id_lang'} ? 'AND ct.id_lang = '.(int)$context->cookie->{'customer_threadFilter_l!id_lang'} : '').
|
||||
' ORDER BY ct.date_upd ASC');
|
||||
|
||||
if ($nextThread)
|
||||
@@ -521,7 +517,7 @@ class AdminCustomerThreads extends AdminTab
|
||||
{
|
||||
$totalOK = 0;
|
||||
$ordersOK = array();
|
||||
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee));
|
||||
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id);
|
||||
foreach ($orders as $order)
|
||||
if ($order['valid'])
|
||||
{
|
||||
@@ -546,7 +542,7 @@ class AdminCustomerThreads extends AdminTab
|
||||
foreach ($ordersOK AS $order)
|
||||
echo '<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.$tokenOrders.'\'">
|
||||
<td class="center">'.$order['id_order'].'</td>
|
||||
<td>'.Tools::displayDate($order['date_add'], (int)($cookie->id_lang)).'</td>
|
||||
<td>'.Tools::displayDate($order['date_add'], $context->language->id).'</td>
|
||||
<td align="right">'.$order['nb_products'].'</td>
|
||||
<td align="right">'.Tools::displayPrice($order['total_paid_real'], new Currency((int)($order['id_currency']))).'</td>
|
||||
<td>'.$order['payment'].'</td>
|
||||
@@ -571,11 +567,11 @@ class AdminCustomerThreads extends AdminTab
|
||||
<th class="center">'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$irow = 0;
|
||||
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee));
|
||||
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id);
|
||||
foreach ($products AS $product)
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminOrders&id_order='.$product['id_order'].'&vieworder&token='.$tokenOrders.'\'">
|
||||
<td>'.Tools::displayDate($product['date_add'], (int)($cookie->id_lang), true).'</td>
|
||||
<td>'.Tools::displayDate($product['date_add'], $context->language->id, true).'</td>
|
||||
<td>'.$product['product_id'].'</td>
|
||||
<td>'.$product['product_name'].'</td>
|
||||
<td align="right">'.$product['product_quantity'].'</td>
|
||||
|
||||
@@ -71,8 +71,6 @@ class AdminCustomers extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (Tools::isSubmit('submitDel'.$this->table) OR Tools::isSubmit('delete'.$this->table))
|
||||
{
|
||||
$deleteForm = '
|
||||
@@ -263,26 +261,24 @@ class AdminCustomers extends AdminTab
|
||||
|
||||
public function viewcustomer()
|
||||
{
|
||||
global $currentIndex, $cookie, $link;
|
||||
|
||||
$context = Context::getContext();
|
||||
$irow = 0;
|
||||
$configurations = Configuration::getMultiple(array('PS_LANG_DEFAULT', 'PS_CURRENCY_DEFAULT'));
|
||||
$defaultLanguage = (int)($configurations['PS_LANG_DEFAULT']);
|
||||
$defaultCurrency = (int)($configurations['PS_CURRENCY_DEFAULT']);
|
||||
$defaultLanguage = $context->language->id;
|
||||
$defaultCurrency = $context->currency->id;
|
||||
if (!($customer = $this->loadObject()))
|
||||
return;
|
||||
$customerStats = $customer->getStats();
|
||||
$addresses = $customer->getAddresses($defaultLanguage);
|
||||
$products = $customer->getBoughtProducts();
|
||||
$discounts = Discount::getCustomerDiscounts($defaultLanguage, (int)$customer->id, false, false);
|
||||
$orders = Order::getCustomerOrders((int)$customer->id, true);
|
||||
$carts = Cart::getCustomerCarts((int)$customer->id);
|
||||
$discounts = Discount::getCustomerDiscounts($defaultLanguage, $customer->id, false, false);
|
||||
$orders = Order::getCustomerOrders($customer->id, true);
|
||||
$carts = Cart::getCustomerCarts($customer->id);
|
||||
$groups = $customer->getGroups();
|
||||
$messages = CustomerThread::getCustomerMessages((int)$customer->id);
|
||||
$referrers = Referrer::getReferrers((int)$customer->id);
|
||||
if ($totalCustomer = Db::getInstance()->getValue('SELECT SUM(total_paid_real) FROM '._DB_PREFIX_.'orders WHERE id_customer = '.$customer->id.' AND valid = 1'))
|
||||
$referrers = Referrer::getReferrers($customer->id);
|
||||
if ($totalCustomer = Db::getInstance()->getValue('SELECT SUM(total_paid_real) FROM '._DB_PREFIX_.'orders WHERE id_customer = '.(int)$customer->id.' AND valid = 1'))
|
||||
{
|
||||
Db::getInstance()->getValue('SELECT SQL_CALC_FOUND_ROWS COUNT(*) FROM '._DB_PREFIX_.'orders WHERE valid = 1 GROUP BY id_customer HAVING SUM(total_paid_real) > '.$totalCustomer);
|
||||
Db::getInstance()->getValue('SELECT SQL_CALC_FOUND_ROWS COUNT(*) FROM '._DB_PREFIX_.'orders WHERE valid = 1 GROUP BY id_customer HAVING SUM(total_paid_real) > '.(int)$totalCustomer);
|
||||
$countBetterCustomers = (int)Db::getInstance()->getValue('SELECT FOUND_ROWS()') + 1;
|
||||
}
|
||||
else
|
||||
@@ -294,8 +290,8 @@ class AdminCustomers extends AdminTab
|
||||
<img src="../img/admin/'.($customer->id_gender == 2 ? 'female' : ($customer->id_gender == 1 ? 'male' : 'unknown')).'.gif" style="margin-bottom: 5px" /><br />
|
||||
<a href="mailto:'.$customer->email.'" style="text-decoration: underline; color: blue">'.$customer->email.'</a><br /><br />
|
||||
'.$this->l('ID:').' '.sprintf('%06d', $customer->id).'<br />
|
||||
'.$this->l('Registration date:').' '.Tools::displayDate($customer->date_add, (int)($cookie->id_lang), true).'<br />
|
||||
'.$this->l('Last visit:').' '.($customerStats['last_visit'] ? Tools::displayDate($customerStats['last_visit'], (int)($cookie->id_lang), true) : $this->l('never')).'<br />
|
||||
'.$this->l('Registration date:').' '.Tools::displayDate($customer->date_add, $context->language->id, true).'<br />
|
||||
'.$this->l('Last visit:').' '.($customerStats['last_visit'] ? Tools::displayDate($customerStats['last_visit'], $context->language->id, true) : $this->l('never')).'<br />
|
||||
'.($countBetterCustomers != '-' ? $this->l('Rank: #').' '.(int)$countBetterCustomers.'<br />' : '')
|
||||
.(Tools::isMultiShopActivated() ? '<br />'.$this->l('Shop:').' '.Shop::getInstance($customer->id_shop)->name : '').'
|
||||
</fieldset>
|
||||
@@ -305,8 +301,8 @@ class AdminCustomers extends AdminTab
|
||||
</div>
|
||||
'.$this->l('Newsletter:').' '.($customer->newsletter ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />').'<br />
|
||||
'.$this->l('Opt-in:').' '.($customer->optin ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />').'<br />
|
||||
'.$this->l('Age:').' '.$customerStats['age'].' '.((!empty($customer->birthday['age'])) ? '('.Tools::displayDate($customer->birthday, (int)($cookie->id_lang)).')' : $this->l('unknown')).'<br /><br />
|
||||
'.$this->l('Last update:').' '.Tools::displayDate($customer->date_upd, (int)($cookie->id_lang), true).'<br />
|
||||
'.$this->l('Age:').' '.$customerStats['age'].' '.((!empty($customer->birthday['age'])) ? '('.Tools::displayDate($customer->birthday, $context->language->id).')' : $this->l('unknown')).'<br /><br />
|
||||
'.$this->l('Last update:').' '.Tools::displayDate($customer->date_upd, $context->language->id, true).'<br />
|
||||
'.$this->l('Status:').' '.($customer->active ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />');
|
||||
if ($customer->isGuest())
|
||||
{
|
||||
@@ -377,7 +373,7 @@ class AdminCustomers extends AdminTab
|
||||
echo '<tr>
|
||||
<td>'.$message['status'].'</td>
|
||||
<td><a href="index.php?tab=AdminCustomerThreads&id_customer_thread='.(int)($message['id_customer_thread']).'&viewcustomer_thread&token='.Tools::getAdminTokenLite('AdminCustomerThreads').'">'.substr(strip_tags(html_entity_decode($message['message'], ENT_NOQUOTES, 'UTF-8')), 0, 75).'...</a></td>
|
||||
<td>'.Tools::displayDate($message['date_add'], (int)($cookie->id_lang), true).'</td>
|
||||
<td>'.Tools::displayDate($message['date_add'], $context->language->id, true).'</td>
|
||||
</tr>';
|
||||
echo '</table>
|
||||
<div class="clear"> </div>';
|
||||
@@ -400,7 +396,7 @@ class AdminCustomers extends AdminTab
|
||||
<th class="center">'.$this->l('Name').'</th>
|
||||
<th class="center">'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$tokenGroups = Tools::getAdminToken('AdminGroups'.(int)(Tab::getIdFromClassName('AdminGroups')).(int)($cookie->id_employee));
|
||||
$tokenGroups = Tools::getAdminToken('AdminGroups'.(int)(Tab::getIdFromClassName('AdminGroups')).(int)$context->employee->id);
|
||||
foreach ($groups AS $group)
|
||||
{
|
||||
$objGroup = new Group($group);
|
||||
@@ -421,7 +417,7 @@ class AdminCustomers extends AdminTab
|
||||
$totalOK = 0;
|
||||
$ordersOK = array();
|
||||
$ordersKO = array();
|
||||
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)Tab::getIdFromClassName('AdminOrders').(int)$cookie->id_employee);
|
||||
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)Tab::getIdFromClassName('AdminOrders').(int)$context->employee->id);
|
||||
foreach ($orders AS $order)
|
||||
if ($order['valid'])
|
||||
{
|
||||
@@ -448,7 +444,7 @@ class AdminCustomers extends AdminTab
|
||||
foreach ($ordersOK AS $order)
|
||||
echo '<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.$tokenOrders.'\'">
|
||||
<td class="center">'.$order['id_order'].'</td>
|
||||
<td>'.Tools::displayDate($order['date_add'], (int)($cookie->id_lang)).'</td>
|
||||
<td>'.Tools::displayDate($order['date_add'], $context->language->id).'</td>
|
||||
<td align="right">'.$order['nb_products'].'</td>
|
||||
<td align="right">'.Tools::displayPrice($order['total_paid_real'], new Currency((int)($order['id_currency']))).'</td>
|
||||
<td>'.$order['payment'].'</td>
|
||||
@@ -464,7 +460,7 @@ class AdminCustomers extends AdminTab
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.$tokenOrders.'\'">
|
||||
<td class="center">'.$order['id_order'].'</td>
|
||||
<td>'.Tools::displayDate($order['date_add'], (int)($cookie->id_lang)).'</td>
|
||||
<td>'.Tools::displayDate($order['date_add'], $context->language->id).'</td>
|
||||
<td align="right">'.$order['nb_products'].'</td>
|
||||
<td align="right">'.Tools::displayPrice($order['total_paid_real'], new Currency((int)($order['id_currency']))).'</td>
|
||||
<td>'.$order['payment'].'</td>
|
||||
@@ -488,11 +484,11 @@ class AdminCustomers extends AdminTab
|
||||
<th class="center">'.$this->l('Quantity').'</th>
|
||||
<th class="center">'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee));
|
||||
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id);
|
||||
foreach ($products AS $product)
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminOrders&id_order='.$product['id_order'].'&vieworder&token='.$tokenOrders.'\'">
|
||||
<td>'.Tools::displayDate($product['date_add'], (int)($cookie->id_lang), true).'</td>
|
||||
<td>'.Tools::displayDate($product['date_add'], $context->language->id, true).'</td>
|
||||
<td>'.$product['product_name'].'</td>
|
||||
<td align="right">'.$product['product_quantity'].'</td>
|
||||
<td align="center"><a href="?tab=AdminOrders&id_order='.$product['id_order'].'&vieworder&token='.$tokenOrders.'"><img src="../img/admin/details.gif" /></a></td>
|
||||
@@ -514,7 +510,7 @@ class AdminCustomers extends AdminTab
|
||||
<th>'.$this->l('Phone number(s)').'</th>
|
||||
<th>'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$tokenAddresses = Tools::getAdminToken('AdminAddresses'.(int)(Tab::getIdFromClassName('AdminAddresses')).(int)($cookie->id_employee));
|
||||
$tokenAddresses = Tools::getAdminToken('AdminAddresses'.(int)(Tab::getIdFromClassName('AdminAddresses')).(int)$context->employee->id);
|
||||
foreach ($addresses AS $address)
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').'>
|
||||
@@ -548,7 +544,7 @@ class AdminCustomers extends AdminTab
|
||||
<th>'.$this->l('Status').'</th>
|
||||
<th>'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$tokenDiscounts = Tools::getAdminToken('AdminDiscounts'.(int)(Tab::getIdFromClassName('AdminDiscounts')).(int)($cookie->id_employee));
|
||||
$tokenDiscounts = Tools::getAdminToken('AdminDiscounts'.(int)(Tab::getIdFromClassName('AdminDiscounts')).(int)$context->employee->id);
|
||||
foreach ($discounts AS $discount)
|
||||
{
|
||||
echo '
|
||||
@@ -586,7 +582,7 @@ class AdminCustomers extends AdminTab
|
||||
<th class="center">'.$this->l('Carrier').'</th>
|
||||
<th class="center">'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$tokenCarts = Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)($cookie->id_employee));
|
||||
$tokenCarts = Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)$context->employee->id);
|
||||
foreach ($carts AS $cart)
|
||||
{
|
||||
$cartI = new Cart((int)($cart['id_cart']));
|
||||
@@ -596,7 +592,7 @@ class AdminCustomers extends AdminTab
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminCarts&id_cart='.$cart['id_cart'].'&viewcart&token='.$tokenCarts.'\'">
|
||||
<td class="center">'.sprintf('%06d', $cart['id_cart']).'</td>
|
||||
<td>'.Tools::displayDate($cart['date_add'], (int)($cookie->id_lang), true).'</td>
|
||||
<td>'.Tools::displayDate($cart['date_add'], $context->language->id, true).'</td>
|
||||
<td align="right">'.Tools::displayPrice($summary['total_price'], $currency).'</td>
|
||||
<td>'.$carrier->name.'</td>
|
||||
<td align="center"><a href="index.php?tab=AdminCarts&id_cart='.$cart['id_cart'].'&viewcart&token='.$tokenCarts.'"><img src="../img/admin/details.gif" /></a></td>
|
||||
@@ -624,12 +620,12 @@ class AdminCustomers extends AdminTab
|
||||
<table cellspacing="0" cellpadding="0" class="table">';
|
||||
foreach ($interested as $p)
|
||||
{
|
||||
$product = new Product((int)$p['id_product'], false, $cookie->id_lang, (int)$p['id_shop']);
|
||||
$product = new Product($p['id_product'], false, $context->language->id, $p['id_shop']);
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \''.$link->getProductLink((int)$product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, (int)($cookie->id_lang))).'\'">
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \''.$context->link->getProductLink($product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, $context->language->id)).'\'">
|
||||
<td>'.(int)$product->id.'</td>
|
||||
<td>'.Tools::htmlentitiesUTF8($product->name).'</td>
|
||||
<td align="center"><a href="'.$link->getProductLink((int)$product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, (int)($cookie->id_lang))).'"><img src="../img/admin/details.gif" /></a></td>
|
||||
<td align="center"><a href="'.$context->link->getProductLink($product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, $context->language->id)).'"><img src="../img/admin/details.gif" /></a></td>
|
||||
</tr>';
|
||||
}
|
||||
echo '</table></div>';
|
||||
@@ -652,7 +648,7 @@ class AdminCustomers extends AdminTab
|
||||
</tr>';
|
||||
foreach ($connections as $connection)
|
||||
echo '<tr>
|
||||
<td>'.Tools::displayDate($connection['date_add'], (int)($cookie->id_lang), true).'</td>
|
||||
<td>'.Tools::displayDate($connection['date_add'], $context->language->id, true).'</td>
|
||||
<td>'.(int)($connection['pages']).'</td>
|
||||
<td>'.$connection['time'].'</td>
|
||||
<td>'.($connection['http_referer'] ? preg_replace('/^www./', '', parse_url($connection['http_referer'], PHP_URL_HOST)) : $this->l('Direct link')).'</td>
|
||||
@@ -672,7 +668,7 @@ class AdminCustomers extends AdminTab
|
||||
</tr>';
|
||||
foreach ($referrers as $referrer)
|
||||
echo '<tr>
|
||||
<td>'.Tools::displayDate($referrer['date_add'], (int)($cookie->id_lang), true).'</td>
|
||||
<td>'.Tools::displayDate($referrer['date_add'], $context->language->id, true).'</td>
|
||||
<td>'.$referrer['name'].'</td>
|
||||
'.((Tools::isMultiShopActivated())? '<td>'.$referrer['shop_name'].'</td>' : '').'
|
||||
</tr>';
|
||||
@@ -683,7 +679,6 @@ class AdminCustomers extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -849,8 +844,7 @@ class AdminCustomers extends AdminTab
|
||||
|
||||
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL, $id_lang_shop = NULL)
|
||||
{
|
||||
global $cookie;
|
||||
return parent::getList((int)($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
return parent::getList(Context::getContext()->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
}
|
||||
|
||||
public function beforeDelete($object)
|
||||
|
||||
@@ -29,8 +29,6 @@ class AdminDeliverySlip extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'delivery';
|
||||
|
||||
$this->optionTitle = $this->l('Delivery slips options');
|
||||
@@ -44,7 +42,6 @@ class AdminDeliverySlip extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
$output = '
|
||||
@@ -79,8 +76,6 @@ class AdminDeliverySlip extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (Tools::getValue('submitPrint'))
|
||||
{
|
||||
if (!Validate::isDate($_POST['date_from']))
|
||||
|
||||
@@ -29,8 +29,7 @@ class AdminDiscounts extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$this->table = 'discount';
|
||||
$this->className = 'Discount';
|
||||
$this->lang = true;
|
||||
@@ -43,10 +42,10 @@ class AdminDiscounts extends AdminTab
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'currency` c ON (c.`id_currency` = a.`id_currency`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'discount_type` dt ON (dt.`id_discount_type` = a.`id_discount_type`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'shop` s ON (s.`id_shop` = a.`id_shop`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'discount_type_lang` dtl ON (dt.`id_discount_type` = dtl.`id_discount_type` AND dtl.`id_lang` = '.(int)($cookie->id_lang).')';
|
||||
LEFT JOIN `'._DB_PREFIX_.'discount_type_lang` dtl ON (dt.`id_discount_type` = dtl.`id_discount_type` AND dtl.`id_lang` = '.(int)$context->language->id.')';
|
||||
|
||||
$typesArray = array();
|
||||
$types = Discount::getDiscountTypes((int)($cookie->id_lang));
|
||||
$types = Discount::getDiscountTypes($context->language->id);
|
||||
foreach ($types AS $type)
|
||||
$typesArray[$type['id_discount_type']] = $type['name'];
|
||||
|
||||
@@ -78,7 +77,6 @@ class AdminDiscounts extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
|
||||
|
||||
if ($discountName = Tools::getValue('name') AND Validate::isDiscountName($discountName) AND Discount::discountExists($discountName, Tools::getValue('id_discount')))
|
||||
@@ -180,7 +178,7 @@ class AdminDiscounts extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -232,7 +230,7 @@ class AdminDiscounts extends AdminTab
|
||||
<div class="margin-form">
|
||||
<select name="id_discount_type" id="id_discount_type" onchange="free_shipping()">
|
||||
<option value="0">'.$this->l('-- Choose --').'</option>';
|
||||
$discountTypes = Discount::getDiscountTypes((int)($cookie->id_lang));
|
||||
$discountTypes = Discount::getDiscountTypes($context->language->id);
|
||||
foreach ($discountTypes AS $discountType)
|
||||
echo '<option value="'.(int)($discountType['id_discount_type']).'"'.
|
||||
(($this->getFieldValue($obj, 'id_discount_type') == $discountType['id_discount_type']) ? ' selected="selected"' : '').'>'.$discountType['name'].'</option>';
|
||||
@@ -284,7 +282,7 @@ class AdminDiscounts extends AdminTab
|
||||
$done = array();
|
||||
$index = array();
|
||||
$indexedCategories = isset($_POST['categoryBox']) ? $_POST['categoryBox'] : ($obj->id ? Discount::getCategories($obj->id) : array());
|
||||
$categories = Category::getCategories((int)($cookie->id_lang), false);
|
||||
$categories = Category::getCategories($context->language->id, false);
|
||||
foreach ($indexedCategories AS $k => $row)
|
||||
$index[] = $row['id_category'];
|
||||
$this->recurseCategoryForInclude((int)(Tools::getValue($this->identifier)), $index, $categories, $categories[0][1], 1, $obj->id);
|
||||
|
||||
@@ -31,12 +31,11 @@ class AdminEmails extends AdminPreferences
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$this->className = 'Configuration';
|
||||
$this->table = 'configuration';
|
||||
|
||||
foreach (Contact::getContacts((int)$cookie->id_lang) AS $contact)
|
||||
foreach (Contact::getContacts($context->language->id) AS $contact)
|
||||
$arr[] = array('email_message' => $contact['id_contact'], 'name' => $contact['name']);
|
||||
|
||||
$this->_fieldsEmail = array(
|
||||
|
||||
@@ -32,8 +32,7 @@ class AdminEmployees extends AdminTab
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$this->table = 'employee';
|
||||
$this->className = 'Employee';
|
||||
$this->lang = false;
|
||||
@@ -41,9 +40,9 @@ class AdminEmployees extends AdminTab
|
||||
$this->delete = true;
|
||||
$this->_select = 'pl.`name` AS profile';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'profile` p ON a.`id_profile` = p.`id_profile`
|
||||
LEFT JOIN `'._DB_PREFIX_.'profile_lang` pl ON (pl.`id_profile` = p.`id_profile` AND pl.`id_lang` = '.(int)($cookie->id_lang).')';
|
||||
LEFT JOIN `'._DB_PREFIX_.'profile_lang` pl ON (pl.`id_profile` = p.`id_profile` AND pl.`id_lang` = '.(int)$context->language->id.')';
|
||||
|
||||
$profiles = Profile::getProfiles((int)($cookie->id_lang));
|
||||
$profiles = Profile::getProfiles($context->language->id);
|
||||
if (!$profiles)
|
||||
$this->_errors[] = Tools::displayError('No profile');
|
||||
else
|
||||
@@ -83,12 +82,12 @@ class AdminEmployees extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
$profiles = Profile::getProfiles((int)($cookie->id_lang));
|
||||
$profiles = Profile::getProfiles($context->language->id);
|
||||
|
||||
echo '<script type="text/javascript" src="'._PS_JS_DIR_.'/jquery/jquery-colorpicker.js"></script>
|
||||
<script type="text/javascript">
|
||||
@@ -177,11 +176,10 @@ class AdminEmployees extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
if (Tools::isSubmit('deleteemployee') OR Tools::isSubmit('status') OR Tools::isSubmit('statusemployee'))
|
||||
{
|
||||
if ($cookie->id_employee == Tools::getValue('id_employee'))
|
||||
if ($context->employee->id == Tools::getValue('id_employee'))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('You cannot disable or delete your own account.');
|
||||
return false;
|
||||
|
||||
@@ -47,8 +47,6 @@ class AdminFeatures extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if ((isset($_POST['submitAddfeature_value']) AND sizeof($this->adminFeaturesValues->_errors))
|
||||
OR isset($_GET['updatefeature_value']) OR isset($_GET['addfeature_value']))
|
||||
{
|
||||
@@ -65,8 +63,6 @@ class AdminFeatures extends AdminTab
|
||||
/* Report to AdminTab::displayList() for more details */
|
||||
public function displayList()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
echo '<br />
|
||||
<a href="'.self::$currentIndex.'&add'.$this->table.'&token='.$this->token.'"><img src="../img/admin/add.gif" border="0" /> <b>'.$this->l('Add a new feature').'</b></a><br />
|
||||
<a href="'.self::$currentIndex.'&addfeature_value&token='.$this->token.'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new feature value').'</a><br /><br />
|
||||
@@ -136,7 +132,6 @@ class AdminFeatures extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -183,8 +178,8 @@ class AdminFeatures extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
$this->adminFeaturesValues->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
|
||||
$context = Context::getContext();
|
||||
$this->adminFeaturesValues->tabAccess = Profile::getProfileAccess($context->employee->id_profile, $this->id);
|
||||
$this->adminFeaturesValues->postProcess($this->token);
|
||||
|
||||
if(Tools::getValue('submitDel'.$this->table))
|
||||
|
||||
@@ -40,12 +40,9 @@ class AdminFeaturesValues extends AdminTab
|
||||
|
||||
/**
|
||||
* Display form
|
||||
*
|
||||
* @global string $currentIndex Current URL in order to keep current Tab
|
||||
*/
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -88,13 +85,9 @@ class AdminFeaturesValues extends AdminTab
|
||||
|
||||
/**
|
||||
* Manage page processing
|
||||
*
|
||||
* @global string $currentIndex Current URL in order to keep current Tab
|
||||
*/
|
||||
public function postProcess($token = NULL)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if(Tools::getValue('submitDel'.$this->table))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
|
||||
@@ -38,8 +38,6 @@ class AdminGenerator extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$languages = Language::getLanguages(false);
|
||||
|
||||
// Htaccess
|
||||
@@ -108,8 +106,6 @@ class AdminGenerator extends AdminTab
|
||||
|
||||
function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (Tools::isSubmit('submitHtaccess'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
|
||||
@@ -29,8 +29,7 @@ class AdminGeolocation extends AdminTab
|
||||
{
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
echo '
|
||||
<h2>'.$this->l('Geolocation').'</h2>
|
||||
';
|
||||
@@ -98,7 +97,7 @@ class AdminGeolocation extends AdminTab
|
||||
</thead>
|
||||
<tbody>
|
||||
';
|
||||
foreach (Country::getCountries(intval($cookie->id_lang)) AS $country)
|
||||
foreach (Country::getCountries($context->language->id) AS $country)
|
||||
echo '
|
||||
<tr>
|
||||
<td><input type="checkbox" name="countries[]" value="'.strtoupper(Tools::htmlentitiesUTF8($country['iso_code'])).'" '.(in_array(strtoupper($country['iso_code']), $allowedCountries) ? 'checked="checked"' : '').' /></td>
|
||||
@@ -139,8 +138,6 @@ class AdminGeolocation extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (Tools::isSubmit('submitGeolocationConfiguration'))
|
||||
{
|
||||
if ($this->_isGeoLiteCityAvailable())
|
||||
|
||||
@@ -63,7 +63,6 @@ class AdminGroupShop extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm($isMainTab);
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
|
||||
@@ -58,13 +58,13 @@ class AdminGroups extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
$groupReductions = $obj->id ? GroupReduction::getGroupReductions($obj->id, (int)($cookie->id_lang)) : array();
|
||||
$categories = Category::getSimpleCategories((int)($cookie->id_lang));
|
||||
$groupReductions = $obj->id ? GroupReduction::getGroupReductions($obj->id, $context->language->id) : array();
|
||||
$categories = Category::getSimpleCategories($context->language->id);
|
||||
|
||||
echo '
|
||||
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
|
||||
@@ -167,17 +167,15 @@ class AdminGroups extends AdminTab
|
||||
|
||||
public function viewgroup()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$currentIndex = 'index.php?tab=AdminGroups';
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
|
||||
|
||||
echo '
|
||||
<fieldset style="width: 400px">
|
||||
<div style="float: right"><a href="'.self::$currentIndex.'&updategroup&id_group='.$obj->id.'&token='.$this->token.'"><img src="../img/admin/edit.gif" /></a></div>
|
||||
<span style="font-weight: bold; font-size: 14px;">'.strval($obj->name[(int)($cookie->id_lang)]).'</span>
|
||||
<div style="float: right"><a href="'.$currentIndex.'&updategroup&id_group='.$obj->id.'&token='.$this->token.'"><img src="../img/admin/edit.gif" /></a></div>
|
||||
<span style="font-weight: bold; font-size: 14px;">'.strval($obj->name[(int)$context->language->id]).'</span>
|
||||
<div class="clear"> </div>
|
||||
'.$this->l('Discount:').' '.(float)($obj->reduction).$this->l('%').'
|
||||
</fieldset>
|
||||
@@ -257,16 +255,16 @@ class AdminGroups extends AdminTab
|
||||
<td class="center">'.$imgGender.'</td>
|
||||
<td>'.stripslashes($customer['lastname']).' '.stripslashes($customer['firstname']).'</td>
|
||||
<td>'.stripslashes($customer['email']).'<a href="mailto:'.stripslashes($customer['email']).'"> <img src="../img/admin/email_edit.gif" alt="'.$this->l('Write to this customer').'" /></a></td>
|
||||
<td>'.Tools::displayDate($customer['birthday'], (int)($cookie->id_lang)).'</td>
|
||||
<td>'.Tools::displayDate($customer['date_add'], (int)($cookie->id_lang)).'</td>
|
||||
<td>'.Tools::displayDate($customer['birthday'], $context->language->id).'</td>
|
||||
<td>'.Tools::displayDate($customer['date_add'], $context->language->id).'</td>
|
||||
<td>'.Order::getCustomerNbOrders($customer['id_customer']).'</td>
|
||||
<td class="center"><img src="../img/admin/'.($customer['active'] ? 'enabled.gif' : 'forbbiden.gif').'" alt="" /></td>
|
||||
<td class="center" width="60px">
|
||||
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'">
|
||||
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'">
|
||||
<img src="../img/admin/details.gif" alt="'.$this->l('View orders').'" /></a>
|
||||
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&addcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'">
|
||||
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&addcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'">
|
||||
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this customer').'" /></a>
|
||||
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&deletecustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');">
|
||||
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&deletecustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');">
|
||||
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this customer').'" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
@@ -279,8 +277,6 @@ class AdminGroups extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
|
||||
|
||||
if (Tools::isSubmit('deleteGroupReduction'))
|
||||
|
||||
@@ -29,8 +29,7 @@ class AdminImageResize extends AdminTab
|
||||
{
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
if (isset($_POST['resize']))
|
||||
{
|
||||
$imagesTypes = ImageType::getImagesTypes('products');
|
||||
@@ -47,16 +46,16 @@ class AdminImageResize extends AdminTab
|
||||
$this->_errors = Tools::displayError('An error occurred while copying image.').' '.stripslashes($imageType['name']);
|
||||
// Save and stay on same form
|
||||
if (Tools::getValue('saveandstay') == 'on')
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_product='.Tools::getValue('id_product').'&id_category='.(int)(Tools::getValue('id_category')).'&addproduct&conf=4&tabs=1&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_product='.Tools::getValue('id_product').'&id_category='.(int)(Tools::getValue('id_category')).'&addproduct&conf=4&tabs=1&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id));
|
||||
// Default behavior (save and back)
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_category='.(int)(Tools::getValue('id_category')).'&conf='.(int)(Tools::getValue('conf')).'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_category='.(int)(Tools::getValue('id_category')).'&conf='.(int)(Tools::getValue('conf')).'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id));
|
||||
} else
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
$imagesTypes = ImageType::getImagesTypes();
|
||||
@@ -68,7 +67,7 @@ class AdminImageResize extends AdminTab
|
||||
<script type="text/javascript" src="../js/cropper/dragdrop.js"></script>
|
||||
<script type="text/javascript" src="../js/cropper/cropper.js"></script>
|
||||
<script type="text/javascript" src="../js/cropper/loader.js"></script>
|
||||
<form enctype="multipart/form-data" method="post" action="'.self::$currentIndex.'&imageresize&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'">
|
||||
<form enctype="multipart/form-data" method="post" action="'.self::$currentIndex.'&imageresize&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">
|
||||
<input type="hidden" name="id_product" value="'.Tools::getValue('id_product').'" />
|
||||
<input type="hidden" name="id_category" value="'.Tools::getValue('id_category').'" />
|
||||
<input type="hidden" name="saveandstay" value="'.Tools::getValue('submitAddAndStay').'" />
|
||||
|
||||
@@ -56,7 +56,6 @@ class AdminImages extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
if (Tools::getValue('submitRegenerate'.$this->table))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
@@ -80,7 +79,6 @@ class AdminImages extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -166,13 +164,9 @@ class AdminImages extends AdminTab
|
||||
|
||||
/**
|
||||
* Display form for thumbnails regeneration
|
||||
*
|
||||
* @global string $currentIndex Current URL in order to keep current Tab
|
||||
*/
|
||||
public function displayRegenerate()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$types = array(
|
||||
'categories' => $this->l('Categories'),
|
||||
'manufacturers' => $this->l('Manufacturers'),
|
||||
@@ -407,8 +401,6 @@ class AdminImages extends AdminTab
|
||||
*/
|
||||
public function displayMoveImages()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
echo '
|
||||
<br /><h2 class="space">'.$this->l('Move images').'</h2>'.
|
||||
$this->l('A new storage system for product images is now used by PrestaShop. It offers better performance if your shop has a very large number of products.').'<br />'.
|
||||
@@ -433,7 +425,6 @@ class AdminImages extends AdminTab
|
||||
*/
|
||||
private function _moveImagesToNewFileSystem()
|
||||
{
|
||||
global $currentIndex;
|
||||
ini_set('max_execution_time', $this->max_execution_time); // ini_set may be disabled, we need the real value
|
||||
$this->max_execution_time = (int)ini_get('max_execution_time');
|
||||
$result = Image::moveToNewFileSystem($this->max_execution_time);
|
||||
|
||||
@@ -127,8 +127,6 @@ class AdminInformation extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
echo '
|
||||
<h2>'.$this->l('Information').'</h2>
|
||||
<fieldset>
|
||||
|
||||
@@ -29,8 +29,6 @@ class AdminInvoices extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'invoice';
|
||||
|
||||
$this->optionTitle = $this->l('Invoice options');
|
||||
@@ -45,9 +43,8 @@ class AdminInvoices extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$statuses = OrderState::getOrderStates($cookie->id_lang);
|
||||
$context = Context::getContext();
|
||||
$statuses = OrderState::getOrderStates($context->language->id);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT COUNT(*) as nbOrders, (
|
||||
SELECT oh.id_order_state
|
||||
@@ -117,8 +114,6 @@ class AdminInvoices extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (Tools::isSubmit('submitPrint'))
|
||||
{
|
||||
if (!Validate::isDate(Tools::getValue('date_from')))
|
||||
|
||||
@@ -120,8 +120,7 @@ class AdminLanguages extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
if (isset($_GET['delete'.$this->table]))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
@@ -133,7 +132,7 @@ class AdminLanguages extends AdminTab
|
||||
$this->_errors[] = $this->l('You cannot delete the English language as it is a system requirement, you can only deactivate it.');
|
||||
if ($object->id == Configuration::get('PS_LANG_DEFAULT'))
|
||||
$this->_errors[] = $this->l('you cannot delete the default language');
|
||||
elseif ($object->id == $cookie->id_lang)
|
||||
elseif ($object->id == clan)
|
||||
$this->_errors[] = $this->l('You cannot delete the language currently in use. Please change languages before deleting.');
|
||||
elseif ($this->deleteNoPictureImages((int)(Tools::getValue('id_lang'))) AND $object->delete())
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=1'.'&token='.$this->token);
|
||||
@@ -150,7 +149,7 @@ class AdminLanguages extends AdminTab
|
||||
{
|
||||
if (in_array(Configuration::get('PS_LANG_DEFAULT'), $_POST[$this->table.'Box']))
|
||||
$this->_errors[] = $this->l('you cannot delete the default language');
|
||||
elseif (in_array($cookie->id_lang, $_POST[$this->table.'Box']))
|
||||
elseif (in_array($context->language->id, $_POST[$this->table.'Box']))
|
||||
$this->_errors[] = $this->l('you cannot delete the language currently in use, please change languages before deleting');
|
||||
else
|
||||
{
|
||||
@@ -244,8 +243,6 @@ class AdminLanguages extends AdminTab
|
||||
|
||||
public function displayList()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$this->displayWarning($this->l('When you delete a language, all related translations in the database will be deleted.'));
|
||||
parent::displayList();
|
||||
$languages = Language::getLanguages(false);
|
||||
@@ -253,8 +250,6 @@ class AdminLanguages extends AdminTab
|
||||
|
||||
public function displayListContent($token=NULL)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$irow = 0;
|
||||
if ($this->_list)
|
||||
|
||||
@@ -313,7 +308,6 @@ class AdminLanguages extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
|
||||
@@ -31,9 +31,6 @@ class AdminLocalization extends AdminPreferences
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$lang = strtoupper(Language::getIsoById($cookie->id_lang));
|
||||
$this->className = 'Configuration';
|
||||
$this->table = 'configuration';
|
||||
|
||||
@@ -52,8 +49,6 @@ class AdminLocalization extends AdminPreferences
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (isset($_POST['submitLocalization'.$this->table]))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
@@ -89,8 +84,6 @@ class AdminLocalization extends AdminPreferences
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$this->_displayForm('localization', $this->_fieldsLocalization, $this->l('Localization'), 'width2', 'localization');
|
||||
echo '<br />
|
||||
<form method="post" action="'.self::$currentIndex.'&token='.$this->token.'" class="width2" enctype="multipart/form-data">
|
||||
|
||||
@@ -34,7 +34,7 @@ class AdminManufacturers extends AdminTab
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
$this->table = 'manufacturer';
|
||||
$this->className = 'Manufacturer';
|
||||
@@ -43,7 +43,7 @@ class AdminManufacturers extends AdminTab
|
||||
$this->delete = true;
|
||||
|
||||
// Sub tab addresses
|
||||
$countries = Country::getCountries((int)($cookie->id_lang));
|
||||
$countries = Country::getCountries($context->language->id);
|
||||
foreach ($countries AS $country)
|
||||
$this->countriesArray[$country['id_country']] = $country['name'];
|
||||
$this->fieldsDisplayAddresses = array(
|
||||
@@ -56,7 +56,7 @@ class AdminManufacturers extends AdminTab
|
||||
'country' => array('title' => $this->l('Country'), 'width' => 100, 'type' => 'select', 'select' => $this->countriesArray, 'filter_key' => 'cl!id_country'));
|
||||
$this->_includeTabTitle = array($this->l('Manufacturers addresses'));
|
||||
$this->_joinAddresses = 'LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON
|
||||
(cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)($cookie->id_lang).') ';
|
||||
(cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$context->language->id.') ';
|
||||
$this->_joinAddresses .= 'LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (a.`id_manufacturer` = m.`id_manufacturer`)';
|
||||
$this->_selectAddresses = 'cl.`name` as country, m.`name` AS manufacturer_name';
|
||||
$this->_includeTab = array('Addresses' => array('addressType' => 'manufacturer', 'fieldsDisplay' => $this->fieldsDisplayAddresses, '_join' => $this->_joinAddresses, '_select' => $this->_selectAddresses));
|
||||
@@ -77,10 +77,6 @@ class AdminManufacturers extends AdminTab
|
||||
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
|
||||
);
|
||||
|
||||
$countries = Country::getCountries((int)($cookie->id_lang));
|
||||
foreach ($countries AS $country)
|
||||
$this->countriesArray[$country['id_country']] = $country['name'];
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
@@ -97,7 +93,7 @@ class AdminManufacturers extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
if (!($manufacturer = $this->loadObject(true)))
|
||||
@@ -136,8 +132,7 @@ class AdminManufacturers extends AdminTab
|
||||
echo '</div>';
|
||||
|
||||
// TinyMCE
|
||||
global $cookie;
|
||||
$iso = Language::getIsoById((int)($cookie->id_lang));
|
||||
$iso = $context->language->iso_code;
|
||||
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
|
||||
$ad = dirname($_SERVER["PHP_SELF"]);
|
||||
echo '
|
||||
@@ -210,13 +205,13 @@ class AdminManufacturers extends AdminTab
|
||||
|
||||
public function viewmanufacturer()
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
if (!($manufacturer = $this->loadObject()))
|
||||
return;
|
||||
echo '<h2>'.$manufacturer->name.'</h2>';
|
||||
|
||||
$products = $manufacturer->getProductsLite((int)($cookie->id_lang));
|
||||
$addresses = $manufacturer->getAddresses((int)($cookie->id_lang));
|
||||
$products = $manufacturer->getProductsLite($context->language->id);
|
||||
$addresses = $manufacturer->getAddresses($context->language->id);
|
||||
|
||||
echo '<h3>'.$this->l('Total addresses:').' '.sizeof($addresses).'</h3>';
|
||||
echo '<hr />';
|
||||
@@ -250,14 +245,14 @@ class AdminManufacturers extends AdminTab
|
||||
echo '<h3>'.$this->l('Total products:').' '.sizeof($products).'</h3>';
|
||||
foreach ($products AS $product)
|
||||
{
|
||||
$product = new Product($product['id_product'], false, (int)($cookie->id_lang));
|
||||
$product = new Product($product['id_product'], false, $context->language->id);
|
||||
echo '<hr />';
|
||||
if (!$product->hasAttributes())
|
||||
{
|
||||
echo '
|
||||
<div style="float:right;">
|
||||
<a href="?tab=AdminCatalog&id_product='.$product->id.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" class="button">'.$this->l('Edit').'</a>
|
||||
<a href="?tab=AdminCatalog&id_product='.$product->id.'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" class="button" onclick="return confirm(\''.$this->l('Delete item #', __CLASS__, TRUE).$product->id.' ?\');">'.$this->l('Delete').'</a>
|
||||
<a href="?tab=AdminCatalog&id_product='.$product->id.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" class="button">'.$this->l('Edit').'</a>
|
||||
<a href="?tab=AdminCatalog&id_product='.$product->id.'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" class="button" onclick="return confirm(\''.$this->l('Delete item #', __CLASS__, TRUE).$product->id.' ?\');">'.$this->l('Delete').'</a>
|
||||
</div>
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table width3">
|
||||
<tr>
|
||||
@@ -273,10 +268,10 @@ class AdminManufacturers extends AdminTab
|
||||
{
|
||||
echo '
|
||||
<div style="float:right;">
|
||||
<a href="?tab=AdminCatalog&id_product='.$product->id.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" class="button">'.$this->l('Edit').'</a>
|
||||
<a href="?tab=AdminCatalog&id_product='.$product->id.'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" class="button" onclick="return confirm(\''.$this->l('Delete item #', __CLASS__, TRUE).$product->id.' ?\');">'.$this->l('Delete').'</a>
|
||||
<a href="?tab=AdminCatalog&id_product='.$product->id.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" class="button">'.$this->l('Edit').'</a>
|
||||
<a href="?tab=AdminCatalog&id_product='.$product->id.'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" class="button" onclick="return confirm(\''.$this->l('Delete item #', __CLASS__, TRUE).$product->id.' ?\');">'.$this->l('Delete').'</a>
|
||||
</div>
|
||||
<h3><a href="?tab=AdminCatalog&id_product='.$product->id.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'">'.$product->name.'</a></h3>
|
||||
<h3><a href="?tab=AdminCatalog&id_product='.$product->id.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">'.$product->name.'</a></h3>
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width: 600px;">
|
||||
<tr>
|
||||
<th>'.$this->l('Attribute name').'</th>
|
||||
@@ -286,7 +281,7 @@ class AdminManufacturers extends AdminTab
|
||||
'.(Configuration::get('PS_STOCK_MANAGEMENT') ? '<th class="right" width="40">'.$this->l('Quantity').'</th>' : '').'
|
||||
</tr>';
|
||||
/* Build attributes combinaisons */
|
||||
$combinaisons = $product->getAttributeCombinaisons((int)($cookie->id_lang));
|
||||
$combinaisons = $product->getAttributeCombinaisons($context->language->id);
|
||||
foreach ($combinaisons AS $k => $combinaison)
|
||||
{
|
||||
$combArray[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
|
||||
|
||||
@@ -29,8 +29,8 @@ class AdminMessages extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
$this->table = 'order';
|
||||
$context = Context::getContext();
|
||||
$this->table = 'order';
|
||||
$this->className = 'Order';
|
||||
$this->view = 'noActionColumn';
|
||||
$this->colorOnBackground = true;
|
||||
@@ -40,7 +40,7 @@ class AdminMessages extends AdminTab
|
||||
|
||||
/* Manage default params values */
|
||||
if (empty($limit))
|
||||
$limit = ((!isset($cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $cookie->{$this->table.'_pagination'});
|
||||
$limit = ((!isset($context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $context->cookie->{$this->table.'_pagination'});
|
||||
|
||||
if (!Validate::isTableOrIdentifier($this->table))
|
||||
die (Tools::displayError('Table name is invalid:').' "'.$this->table.'"');
|
||||
@@ -54,7 +54,7 @@ class AdminMessages extends AdminTab
|
||||
$orderWay = Tools::getValue($this->table.'Orderway', 'ASC');
|
||||
|
||||
$limit = (int)(Tools::getValue('pagination', $limit));
|
||||
$cookie->{$this->table.'_pagination'} = $limit;
|
||||
$context->cookie->{$this->table.'_pagination'} = $limit;
|
||||
|
||||
/* Check params validity */
|
||||
if (!Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay)
|
||||
@@ -76,7 +76,7 @@ class AdminMessages extends AdminTab
|
||||
SELECT SQL_CALC_FOUND_ROWS m.id_message, m.id_cart, m.id_employee, IF(m.id_order > 0, m.id_order, \'--\') id_order, m.message, m.private, m.date_add, CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS customer,
|
||||
c.id_customer, count(m.id_message) nb_messages, (SELECT message FROM '._DB_PREFIX_.'message WHERE id_order = m.id_order ORDER BY date_add DESC LIMIT 1) last_message,
|
||||
(SELECT COUNT(m2.id_message) FROM '._DB_PREFIX_.'message m2 WHERE 1 AND m2.id_customer != 0 AND m2.id_order = m.id_order AND m2.id_message NOT IN
|
||||
(SELECT mr2.id_message FROM '._DB_PREFIX_.'message_readed mr2 WHERE mr2.id_employee = '.(int)($cookie->id_employee).') GROUP BY m2.id_order) nb_messages_not_read_by_me
|
||||
(SELECT mr2.id_message FROM '._DB_PREFIX_.'message_readed mr2 WHERE mr2.id_employee = '.(int)$context->employee->id.') GROUP BY m2.id_order) nb_messages_not_read_by_me
|
||||
FROM '._DB_PREFIX_.'message m
|
||||
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.id_order = m.id_order)
|
||||
LEFT JOIN '._DB_PREFIX_.'customer c ON (c.id_customer = m.id_customer)
|
||||
@@ -98,8 +98,7 @@ class AdminMessages extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$context = Context::getContext();
|
||||
if (isset($_GET['ajax']) && !empty($_GET['id_cart']))
|
||||
{
|
||||
ob_clean();
|
||||
@@ -129,7 +128,7 @@ class AdminMessages extends AdminTab
|
||||
</tr>
|
||||
<tr>
|
||||
<td>'.$this->l('Date:').'</td>
|
||||
<td>'.Tools::displayDate($message['date_add'], (int)$cookie->id_lang, true).'</td>
|
||||
<td>'.Tools::displayDate($message['date_add'], $context->language->id, true).'</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>'.$this->l('Message:').' '.Tools::htmlentitiesUTF8($message['message']).'</p>
|
||||
@@ -139,7 +138,7 @@ class AdminMessages extends AdminTab
|
||||
die;
|
||||
}
|
||||
elseif (isset($_GET['view'.$this->table]) AND !empty($_GET['id_order']) AND $_GET['id_order'] != '--')
|
||||
Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($_GET['id_order']).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($_GET['id_order']).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id));
|
||||
else
|
||||
{
|
||||
if (isset($_GET['id_order']) AND (empty($_GET['id_order']) OR $_GET['id_order'] == '--'))
|
||||
@@ -154,7 +153,7 @@ class AdminMessages extends AdminTab
|
||||
|
||||
foreach ($this->_list AS $k => &$item)
|
||||
if ($item['id_order'] == '--')
|
||||
$this->_list[$k]['last_message'] .= ' <a class="iframe" onclick="$(this).parent().attr(\'onclick\', \'return false\');" href="'.self::$currentIndex.'&token='.Tools::getAdminToken('AdminMessages'.(int)(Tab::getIdFromClassName('AdminMessages')).(int)($cookie->id_employee)).'&ajax=1&id_cart='.(int)$this->_list[$k]['id_cart'].'" title="'.$this->l('View details').'"><img src="../img/admin/details.gif" alt="'.$this->l('View details').'" /></a>';
|
||||
$this->_list[$k]['last_message'] .= ' <a class="iframe" onclick="$(this).parent().attr(\'onclick\', \'return false\');" href="'.self::$currentIndex.'&token='.Tools::getAdminToken('AdminMessages'.(int)(Tab::getIdFromClassName('AdminMessages')).(int)$context->employee->id).'&ajax=1&id_cart='.(int)$this->_list[$k]['id_cart'].'" title="'.$this->l('View details').'"><img src="../img/admin/details.gif" alt="'.$this->l('View details').'" /></a>';
|
||||
|
||||
echo '
|
||||
<link href="'._PS_CSS_DIR_.'jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css" media="screen" />
|
||||
|
||||
@@ -29,6 +29,7 @@ class AdminMeta extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$this->table = 'meta';
|
||||
$this->className = 'Meta';
|
||||
$this->lang = true;
|
||||
@@ -42,11 +43,10 @@ class AdminMeta extends AdminTab
|
||||
'url_rewrite' => array('title' => $this->l('Friendly URL'), 'width' => 120)
|
||||
);
|
||||
|
||||
global $cookie;
|
||||
$this->optionTitle = $this->l('URLs Setup');
|
||||
$this->_fieldsOptions = array(
|
||||
'PS_HOMEPAGE_PHP_SELF' => array('title' => $this->l('Homepage file'), 'desc' => $this->l('Usually "index.php", but may be different for a few hosts.'), 'type' => 'string', 'size' => 50),
|
||||
'PS_REWRITING_SETTINGS' => array('title' => $this->l('Friendly URL'), 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)').'<p class="hint clear" style="display: block;">'.$this->l('If you turn on this feature, you must').' <a href="?tab=AdminGenerator&token='.Tools::getAdminToken('AdminGenerator'.(int)(Tab::getIdFromClassName('AdminGenerator')).(int)$cookie->id_employee).'">'.$this->l('generate a .htaccess file').'</a></p><div class="clear"></div>', 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
|
||||
'PS_REWRITING_SETTINGS' => array('title' => $this->l('Friendly URL'), 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)').'<p class="hint clear" style="display: block;">'.$this->l('If you turn on this feature, you must').' <a href="?tab=AdminGenerator&token='.Tools::getAdminToken('AdminGenerator'.(int)(Tab::getIdFromClassName('AdminGenerator')).(int)$context->employee->id).'">'.$this->l('generate a .htaccess file').'</a></p><div class="clear"></div>', 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
|
||||
'PS_CANONICAL_REDIRECT' => array('title' => $this->l('Automatically redirect to Canonical url'), 'desc' => $this->l('Recommended but your theme must be compliant'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
|
||||
);
|
||||
if (!Tools::getValue('__PS_BASE_URI__'))
|
||||
@@ -62,7 +62,6 @@ class AdminMeta extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($meta = $this->loadObject(true)))
|
||||
|
||||
@@ -79,9 +79,8 @@ class AdminModules extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$id_employee = (int)($cookie->id_employee);
|
||||
$context = Context::getContext();
|
||||
$id_employee = (int)$context->employee->id;
|
||||
$filter_conf = Configuration::getMultiple(array(
|
||||
'PS_SHOW_TYPE_MODULES_'.$id_employee,
|
||||
'PS_SHOW_COUNTRY_MODULES_'.$id_employee,
|
||||
@@ -310,7 +309,7 @@ class AdminModules extends AdminTab
|
||||
$module_errors[] = $name;
|
||||
}
|
||||
if ($key != 'configure' AND isset($_GET['bpay']))
|
||||
Tools::redirectAdmin('index.php?tab=AdminPayment&token='.Tools::getAdminToken('AdminPayment'.(int)(Tab::getIdFromClassName('AdminPayment')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin('index.php?tab=AdminPayment&token='.Tools::getAdminToken('AdminPayment'.(int)(Tab::getIdFromClassName('AdminPayment')).(int)$context->employee->id));
|
||||
}
|
||||
if (sizeof($module_errors))
|
||||
{
|
||||
@@ -329,7 +328,6 @@ class AdminModules extends AdminTab
|
||||
|
||||
function extractArchive($file)
|
||||
{
|
||||
global $currentIndex;
|
||||
$success = false;
|
||||
if (substr($file, -4) == '.zip')
|
||||
{
|
||||
@@ -358,13 +356,11 @@ class AdminModules extends AdminTab
|
||||
|
||||
public function displayJavascript()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
echo '<script type="text/javascript" src="'._PS_JS_DIR_.'jquery/jquery.autocomplete.js"></script>
|
||||
<script type="text/javascript" src="'._PS_JS_DIR_.'jquery/jquery.fancybox-1.3.4.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function getPrestaStore(){if (getE("prestastore").style.display!=\'block\')return;$.post("'.dirname($currentIndex).'/ajax.php",{page:"prestastore"},function(a){getE("prestastore-content").innerHTML=a;})}
|
||||
function getPrestaStore(){if (getE("prestastore").style.display!=\'block\')return;$.post("'.dirname(self::$currentIndex).'/ajax.php",{page:"prestastore"},function(a){getE("prestastore-content").innerHTML=a;})}
|
||||
function truncate_author(author)
|
||||
{
|
||||
return ((author.length > '.self::$MAX_DISP_AUTHOR.') ? author.substring(0, '.self::$MAX_DISP_AUTHOR.')+"..." : author);
|
||||
@@ -466,17 +462,16 @@ class AdminModules extends AdminTab
|
||||
|
||||
public function displayList()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$modulesAuthors = array();
|
||||
$autocompleteList = 'var moduleList = [';
|
||||
|
||||
$showTypeModules = Configuration::get('PS_SHOW_TYPE_MODULES_'.(int)($cookie->id_employee));
|
||||
$showInstalledModules = Configuration::get('PS_SHOW_INSTALLED_MODULES_'.(int)($cookie->id_employee));
|
||||
$showEnabledModules = Configuration::get('PS_SHOW_ENABLED_MODULES_'.(int)($cookie->id_employee));
|
||||
$showCountryModules = Configuration::get('PS_SHOW_COUNTRY_MODULES_'.(int)($cookie->id_employee));
|
||||
$showTypeModules = Configuration::get('PS_SHOW_TYPE_MODULES_'.(int)$context->employee->id);
|
||||
$showInstalledModules = Configuration::get('PS_SHOW_INSTALLED_MODULES_'.(int)$context->employee->id);
|
||||
$showEnabledModules = Configuration::get('PS_SHOW_ENABLED_MODULES_'.(int)$context->employee->id);
|
||||
$showCountryModules = Configuration::get('PS_SHOW_COUNTRY_MODULES_'.(int)$context->employee->id);
|
||||
|
||||
$nameCountryDefault = Country::getNameById($cookie->id_lang, Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
$nameCountryDefault = Country::getNameById($context->language->id, Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
$isoCountryDefault = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
|
||||
$serialModules = '';
|
||||
@@ -877,8 +872,6 @@ class AdminModules extends AdminTab
|
||||
|
||||
public function displayOptions($module)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$return = '';
|
||||
$href = self::$currentIndex.'&token='.$this->token.'&module_name='.
|
||||
urlencode($module->name).'&tab_module='.$module->tab;
|
||||
@@ -912,14 +905,14 @@ class AdminModules extends AdminTab
|
||||
|
||||
public function displaySelectedFilter()
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
$selected_filter = '';
|
||||
$id_employee = (int)($cookie->id_employee);
|
||||
$id_employee = (int)$context->employee->id;
|
||||
|
||||
$showTypeModules = Configuration::get('PS_SHOW_TYPE_MODULES_'.(int)($cookie->id_employee));
|
||||
$showInstalledModules = Configuration::get('PS_SHOW_INSTALLED_MODULES_'.(int)($cookie->id_employee));
|
||||
$showEnabledModules = Configuration::get('PS_SHOW_ENABLED_MODULES_'.(int)($cookie->id_employee));
|
||||
$showCountryModules = Configuration::get('PS_SHOW_COUNTRY_MODULES_'.(int)($cookie->id_employee));
|
||||
$showTypeModules = Configuration::get('PS_SHOW_TYPE_MODULES_'.(int)$context->employee->id);
|
||||
$showInstalledModules = Configuration::get('PS_SHOW_INSTALLED_MODULES_'.(int)$context->employee->id);
|
||||
$showEnabledModules = Configuration::get('PS_SHOW_ENABLED_MODULES_'.(int)$context->employee->id);
|
||||
$showCountryModules = Configuration::get('PS_SHOW_COUNTRY_MODULES_'.(int)$context->employee->id);
|
||||
$selected_filter .= ($showTypeModules == 'allModules' ? $this->l('All Modules').' - ' : '').
|
||||
($showTypeModules == 'nativeModules' ? $this->l('Native Modules').' - ' : '').
|
||||
($showTypeModules == 'partnerModules' ? $this->l('Partners Modules').' - ' : '').
|
||||
@@ -940,22 +933,20 @@ class AdminModules extends AdminTab
|
||||
|
||||
private function setFilterModules($module_type, $country_module_value, $module_install, $module_status)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
Configuration::updateValue('PS_SHOW_TYPE_MODULES_'.(int)($cookie->id_employee), $module_type);
|
||||
Configuration::updateValue('PS_SHOW_COUNTRY_MODULES_'.(int)($cookie->id_employee), $country_module_value);
|
||||
Configuration::updateValue('PS_SHOW_INSTALLED_MODULES_'.(int)($cookie->id_employee), $module_install);
|
||||
Configuration::updateValue('PS_SHOW_ENABLED_MODULES_'.(int)($cookie->id_employee), $module_status);
|
||||
$context = Context::getContext();
|
||||
Configuration::updateValue('PS_SHOW_TYPE_MODULES_'.(int)$context->employee->id, $module_type);
|
||||
Configuration::updateValue('PS_SHOW_COUNTRY_MODULES_'.(int)$context->employee->id, $country_module_value);
|
||||
Configuration::updateValue('PS_SHOW_INSTALLED_MODULES_'.(int)$context->employee->id, $module_install);
|
||||
Configuration::updateValue('PS_SHOW_ENABLED_MODULES_'.(int)$context->employee->id, $module_status);
|
||||
}
|
||||
|
||||
private function resetFilterModules()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
Configuration::updateValue('PS_SHOW_TYPE_MODULES_'.(int)($cookie->id_employee), 'allModules');
|
||||
Configuration::updateValue('PS_SHOW_COUNTRY_MODULES_'.(int)($cookie->id_employee), 0);
|
||||
Configuration::updateValue('PS_SHOW_INSTALLED_MODULES_'.(int)($cookie->id_employee), 'installedUninstalled');
|
||||
Configuration::updateValue('PS_SHOW_ENABLED_MODULES_'.(int)($cookie->id_employee), 'enabledDisabled');
|
||||
$context = Context::getContext();
|
||||
Configuration::updateValue('PS_SHOW_TYPE_MODULES_'.(int)$context->employee->id, 'allModules');
|
||||
Configuration::updateValue('PS_SHOW_COUNTRY_MODULES_'.(int)$context->employee->id, 0);
|
||||
Configuration::updateValue('PS_SHOW_INSTALLED_MODULES_'.(int)$context->employee->id, 'installedUninstalled');
|
||||
Configuration::updateValue('PS_SHOW_ENABLED_MODULES_'.(int)$context->employee->id, 'enabledDisabled');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ class AdminOrderMessage extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
|
||||
@@ -29,7 +29,7 @@ class AdminOrders extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
$this->table = 'order';
|
||||
$this->className = 'Order';
|
||||
@@ -45,11 +45,11 @@ class AdminOrders extends AdminTab
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON (oh.`id_order` = a.`id_order`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = oh.`id_order_state`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)($cookie->id_lang).')';
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$context->language->id.')';
|
||||
$this->_where = 'AND oh.`id_order_history` = (SELECT MAX(`id_order_history`) FROM `'._DB_PREFIX_.'order_history` moh WHERE moh.`id_order` = a.`id_order` GROUP BY moh.`id_order`)';
|
||||
|
||||
$statesArray = array();
|
||||
$states = OrderState::getOrderStates((int)($cookie->id_lang));
|
||||
$states = OrderState::getOrderStates((int)$context->language->id);
|
||||
|
||||
foreach ($states AS $state)
|
||||
$statesArray[$state['id_order_state']] = $state['name'];
|
||||
@@ -67,12 +67,9 @@ class AdminOrders extends AdminTab
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @global object $cookie Employee cookie necessary to keep trace of his/her actions
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
/* Update shipping number */
|
||||
if (Tools::isSubmit('submitShippingNumber') AND ($id_order = (int)(Tools::getValue('id_order'))) AND Validate::isLoadedObject($order = new Order($id_order)))
|
||||
@@ -118,7 +115,7 @@ class AdminOrders extends AdminTab
|
||||
{
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = (int)$id_order;
|
||||
$history->id_employee = (int)($cookie->id_employee);
|
||||
$history->id_employee = (int)$context->employee->id;
|
||||
$history->changeIdOrderState((int)($newOrderStatusId), (int)($id_order));
|
||||
$order = new Order((int)$order->id);
|
||||
$carrier = new Carrier((int)($order->id_carrier), (int)($order->id_lang));
|
||||
@@ -171,7 +168,7 @@ class AdminOrders extends AdminTab
|
||||
if (!sizeof($this->_errors))
|
||||
{
|
||||
$message = new Message();
|
||||
$message->id_employee = (int)($cookie->id_employee);
|
||||
$message->id_employee = (int)$context->employee->id;
|
||||
$message->message = htmlentities(Tools::getValue('message'), ENT_COMPAT, 'UTF-8');
|
||||
$message->id_order = $id_order;
|
||||
$message->private = Tools::getValue('visibility');
|
||||
@@ -276,8 +273,8 @@ class AdminOrders extends AdminTab
|
||||
else
|
||||
{
|
||||
$updProductAttributeID = !empty($orderDetail->product_attribute_id) ? (int)($orderDetail->product_attribute_id) : NULL;
|
||||
$newProductQty = Product::getQuantity((int)($orderDetail->product_id), $updProductAttributeID);
|
||||
$product = get_object_vars(new Product((int)($orderDetail->product_id), false, (int)$cookie->id_lang, (int)$order->id_shop));
|
||||
$newProductQty = Product::getQuantity($orderDetail->product_id, $updProductAttributeID);
|
||||
$product = get_object_vars(new Product($orderDetail->product_id, false, $context->language->id, $order->id_shop));
|
||||
if (!empty($orderDetail->product_attribute_id))
|
||||
{
|
||||
$updProduct['quantity_attribute'] = (int)($newProductQty);
|
||||
@@ -352,7 +349,7 @@ class AdminOrders extends AdminTab
|
||||
}
|
||||
elseif (isset($_GET['messageReaded']))
|
||||
{
|
||||
Message::markAsReaded((int)($_GET['messageReaded']), (int)($cookie->id_employee));
|
||||
Message::markAsReaded($_GET['messageReaded'], $context->employee->id);
|
||||
}
|
||||
parent::postProcess();
|
||||
}
|
||||
@@ -453,29 +450,29 @@ class AdminOrders extends AdminTab
|
||||
|
||||
public function viewDetails()
|
||||
{
|
||||
global $currentIndex, $cookie, $link;
|
||||
$context = Context::getContext();
|
||||
$irow = 0;
|
||||
if (!($order = $this->loadObject()))
|
||||
return;
|
||||
|
||||
$customer = new Customer($order->id_customer);
|
||||
$customerStats = $customer->getStats();
|
||||
$addressInvoice = new Address($order->id_address_invoice, (int)($cookie->id_lang));
|
||||
$addressInvoice = new Address($order->id_address_invoice, $context->language->id);
|
||||
if (Validate::isLoadedObject($addressInvoice) AND $addressInvoice->id_state)
|
||||
$invoiceState = new State((int)($addressInvoice->id_state));
|
||||
$addressDelivery = new Address($order->id_address_delivery, (int)($cookie->id_lang));
|
||||
$addressDelivery = new Address($order->id_address_delivery, $context->language->id);
|
||||
if (Validate::isLoadedObject($addressDelivery) AND $addressDelivery->id_state)
|
||||
$deliveryState = new State((int)($addressDelivery->id_state));
|
||||
$carrier = new Carrier($order->id_carrier);
|
||||
$history = $order->getHistory($cookie->id_lang);
|
||||
$history = $order->getHistory($context->language->id);
|
||||
$products = $order->getProducts();
|
||||
$customizedDatas = Product::getAllCustomizedDatas((int)($order->id_cart));
|
||||
Product::addCustomizationPrice($products, $customizedDatas);
|
||||
$discounts = $order->getDiscounts();
|
||||
$messages = Message::getMessagesByOrderId($order->id, true);
|
||||
$states = OrderState::getOrderStates((int)($cookie->id_lang));
|
||||
$states = OrderState::getOrderStates($context->language->id);
|
||||
$currency = new Currency($order->id_currency);
|
||||
$currentLanguage = new Language((int)($cookie->id_lang));
|
||||
$currentLanguage = new Language($context->language->id);
|
||||
$currentState = OrderHistory::getLastOrderState($order->id);
|
||||
$sources = ConnectionsSource::getOrderSources($order->id);
|
||||
$cart = Cart::getCartByOrderId($order->id);
|
||||
@@ -523,7 +520,7 @@ class AdminOrders extends AdminTab
|
||||
echo '
|
||||
<table cellspacing="0" cellpadding="0" class="table" style="width: 429px">
|
||||
<tr>
|
||||
<th>'.Tools::displayDate($row['date_add'], (int)($cookie->id_lang), true).'</th>
|
||||
<th>'.Tools::displayDate($row['date_add'], $context->language->id, true).'</th>
|
||||
<th><img src="../img/os/'.$row['id_order_state'].'.gif" /></th>
|
||||
<th>'.stripslashes($row['ostate_name']).'</th>
|
||||
<th>'.((!empty($row['employee_lastname'])) ? '('.stripslashes(Tools::substr($row['employee_firstname'], 0, 1)).'. '.stripslashes($row['employee_lastname']).')' : '').'</th>
|
||||
@@ -533,7 +530,7 @@ class AdminOrders extends AdminTab
|
||||
{
|
||||
echo '
|
||||
<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
|
||||
<td>'.Tools::displayDate($row['date_add'], (int)($cookie->id_lang), true).'</td>
|
||||
<td>'.Tools::displayDate($row['date_add'], $context->language->id, true).'</td>
|
||||
<td><img src="../img/os/'.$row['id_order_state'].'.gif" /></td>
|
||||
<td>'.stripslashes($row['ostate_name']).'</td>
|
||||
<td>'.((!empty($row['employee_lastname'])) ? '('.stripslashes(Tools::substr($row['employee_firstname'], 0, 1)).'. '.stripslashes($row['employee_lastname']).')' : '').'</td>
|
||||
@@ -547,7 +544,7 @@ class AdminOrders extends AdminTab
|
||||
echo '
|
||||
<form action="'.self::$currentIndex.'&view'.$this->table.'&token='.$this->token.'" method="post" style="text-align:center;">
|
||||
<select name="id_order_state">';
|
||||
$currentStateTab = $order->getCurrentStateFull($cookie->id_lang);
|
||||
$currentStateTab = $order->getCurrentStateFull($context->language->id);
|
||||
foreach ($states AS $state)
|
||||
echo '<option value="'.$state['id_order_state'].'"'.(($state['id_order_state'] == $currentStateTab['id_order_state']) ? ' selected="selected"' : '').'>'.stripslashes($state['name']).'</option>';
|
||||
echo '
|
||||
@@ -562,7 +559,7 @@ class AdminOrders extends AdminTab
|
||||
echo '<br />
|
||||
<fieldset style="width: 400px">
|
||||
<legend><img src="../img/admin/tab-customers.gif" /> '.$this->l('Customer information').'</legend>
|
||||
<span style="font-weight: bold; font-size: 14px;"><a href="?tab=AdminCustomers&id_customer='.$customer->id.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'"> '.$customer->firstname.' '.$customer->lastname.'</a></span> ('.$this->l('#').$customer->id.')<br />
|
||||
<span style="font-weight: bold; font-size: 14px;"><a href="?tab=AdminCustomers&id_customer='.$customer->id.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'"> '.$customer->firstname.' '.$customer->lastname.'</a></span> ('.$this->l('#').$customer->id.')<br />
|
||||
(<a href="mailto:'.$customer->email.'">'.$customer->email.'</a>)<br /><br />';
|
||||
if ($customer->isGuest())
|
||||
{
|
||||
@@ -581,7 +578,7 @@ class AdminOrders extends AdminTab
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $this->l('Account registered:').' '.Tools::displayDate($customer->date_add, (int)($cookie->id_lang), true).'<br />
|
||||
echo $this->l('Account registered:').' '.Tools::displayDate($customer->date_add, $context->language->id, true).'<br />
|
||||
'.$this->l('Valid orders placed:').' <b>'.$customerStats['nb_orders'].'</b><br />
|
||||
'.$this->l('Total paid since registration:').' <b>'.Tools::displayPrice(Tools::ps_round(Tools::convertPrice($customerStats['total_orders'], $currency), 2), $currency, false).'</b><br />';
|
||||
}
|
||||
@@ -595,7 +592,7 @@ class AdminOrders extends AdminTab
|
||||
<fieldset style="width: 400px;"><legend><img src="../img/admin/tab-stats.gif" /> '.$this->l('Sources').'</legend><ul '.(sizeof($sources) > 3 ? 'style="overflow-y: scroll; height: 200px"' : '').'>';
|
||||
foreach ($sources as $source)
|
||||
echo '<li>
|
||||
'.Tools::displayDate($source['date_add'], (int)($cookie->id_lang), true).'<br />
|
||||
'.Tools::displayDate($source['date_add'], $context->language->id, true).'<br />
|
||||
<b>'.$this->l('From:').'</b> <a href="'.$source['http_referer'].'">'.preg_replace('/^www./', '', parse_url($source['http_referer'], PHP_URL_HOST)).'</a><br />
|
||||
<b>'.$this->l('To:').'</b> '.$source['request_uri'].'<br />
|
||||
'.($source['keywords'] ? '<b>'.$this->l('Keywords:').'</b> '.$source['keywords'].'<br />' : '').'<br />
|
||||
@@ -614,8 +611,8 @@ class AdminOrders extends AdminTab
|
||||
echo '<fieldset style="width: 400px">';
|
||||
if (($currentState->invoice OR $order->invoice_number) AND count($products))
|
||||
echo '<legend><a href="pdf.php?id_order='.$order->id.'&pdf"><img src="../img/admin/charged_ok.gif" /> '.$this->l('Invoice').'</a></legend>
|
||||
<a href="pdf.php?id_order='.$order->id.'&pdf">'.$this->l('Invoice #').'<b>'.Configuration::get('PS_INVOICE_PREFIX', (int)($cookie->id_lang)).sprintf('%06d', $order->invoice_number).'</b></a>
|
||||
<br />'.$this->l('Created on:').' '.Tools::displayDate($order->invoice_date, (int)$cookie->id_lang, true);
|
||||
<a href="pdf.php?id_order='.$order->id.'&pdf">'.$this->l('Invoice #').'<b>'.Configuration::get('PS_INVOICE_PREFIX', $context->language->id).sprintf('%06d', $order->invoice_number).'</b></a>
|
||||
<br />'.$this->l('Created on:').' '.Tools::displayDate($order->invoice_date, $context->language->id, true);
|
||||
else
|
||||
echo '<legend><img src="../img/admin/charged_ko.gif" />'.$this->l('Invoice').'</legend>
|
||||
'.$this->l('No invoice yet.');
|
||||
@@ -627,7 +624,7 @@ class AdminOrders extends AdminTab
|
||||
<legend><img src="../img/admin/delivery.gif" /> '.$this->l('Shipping information').'</legend>
|
||||
'.$this->l('Total weight:').' <b>'.number_format($order->getTotalWeight(), 3).' '.Configuration::get('PS_WEIGHT_UNIT').'</b><br />
|
||||
'.$this->l('Carrier:').' <b>'.($carrier->name == '0' ? Configuration::get('PS_SHOP_NAME') : $carrier->name).'</b><br />
|
||||
'.(($currentState->delivery OR $order->delivery_number) ? '<br /><a href="pdf.php?id_delivery='.$order->delivery_number.'">'.$this->l('Delivery slip #').'<b>'.Configuration::get('PS_DELIVERY_PREFIX', (int)($cookie->id_lang)).sprintf('%06d', $order->delivery_number).'</b></a><br />' : '');
|
||||
'.(($currentState->delivery OR $order->delivery_number) ? '<br /><a href="pdf.php?id_delivery='.$order->delivery_number.'">'.$this->l('Delivery slip #').'<b>'.Configuration::get('PS_DELIVERY_PREFIX', $context->language->id).sprintf('%06d', $order->delivery_number).'</b></a><br />' : '');
|
||||
if ($order->shipping_number)
|
||||
echo $this->l('Tracking number:').' <b>'.$order->shipping_number.'</b> '.(!empty($carrier->url) ? '(<a href="'.str_replace('@', $order->shipping_number, $carrier->url).'" target="_blank">'.$this->l('Track the shipment').'</a>)' : '');
|
||||
|
||||
@@ -664,7 +661,7 @@ class AdminOrders extends AdminTab
|
||||
}
|
||||
echo '
|
||||
<label>'.$this->l('Original cart:').' </label>
|
||||
<div style="margin: 2px 0 1em 190px;"><a href="?tab=AdminCarts&id_cart='.$cart->id.'&viewcart&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)($cookie->id_employee)).'">'.$this->l('Cart #').sprintf('%06d', $cart->id).'</a></div>
|
||||
<div style="margin: 2px 0 1em 190px;"><a href="?tab=AdminCarts&id_cart='.$cart->id.'&viewcart&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)$context->employee->id).'">'.$this->l('Cart #').sprintf('%06d', $cart->id).'</a></div>
|
||||
<label>'.$this->l('Payment mode:').' </label>
|
||||
<div style="margin: 2px 0 1em 190px;">'.Tools::substr($order->payment, 0, 32).' '.($order->module ? '('.$order->module.')' : '').'</div>
|
||||
<div style="margin: 2px 0 1em 50px;">
|
||||
@@ -698,7 +695,7 @@ class AdminOrders extends AdminTab
|
||||
<fieldset style="width: 400px;">
|
||||
<legend><img src="../img/admin/delivery.gif" alt="'.$this->l('Shipping address').'" />'.$this->l('Shipping address').'</legend>
|
||||
<div style="float: right">
|
||||
<a href="?tab=AdminAddresses&id_address='.$addressDelivery->id.'&addaddress&realedit=1&id_order='.$order->id.($addressDelivery->id == $addressInvoice->id ? '&address_type=1' : '').'&token='.Tools::getAdminToken('AdminAddresses'.(int)(Tab::getIdFromClassName('AdminAddresses')).(int)($cookie->id_employee)).'&back='.urlencode($_SERVER['REQUEST_URI']).'"><img src="../img/admin/edit.gif" /></a>
|
||||
<a href="?tab=AdminAddresses&id_address='.$addressDelivery->id.'&addaddress&realedit=1&id_order='.$order->id.($addressDelivery->id == $addressInvoice->id ? '&address_type=1' : '').'&token='.Tools::getAdminToken('AdminAddresses'.(int)(Tab::getIdFromClassName('AdminAddresses')).(int)$context->employee->id).'&back='.urlencode($_SERVER['REQUEST_URI']).'"><img src="../img/admin/edit.gif" /></a>
|
||||
<a href="http://maps.google.com/maps?f=q&hl='.$currentLanguage->iso_code.'&geocode=&q='.$addressDelivery->address1.' '.$addressDelivery->postcode.' '.$addressDelivery->city.($addressDelivery->id_state ? ' '.$deliveryState->name: '').'" target="_blank"><img src="../img/admin/google.gif" alt="" class="middle" /></a>
|
||||
</div>
|
||||
'.$this->displayAddressDetail($addressDelivery)
|
||||
@@ -708,7 +705,7 @@ class AdminOrders extends AdminTab
|
||||
<div style="float: left; margin-left: 40px">
|
||||
<fieldset style="width: 400px;">
|
||||
<legend><img src="../img/admin/invoice.gif" alt="'.$this->l('Invoice address').'" />'.$this->l('Invoice address').'</legend>
|
||||
<div style="float: right"><a href="?tab=AdminAddresses&id_address='.$addressInvoice->id.'&addaddress&realedit=1&id_order='.$order->id.($addressDelivery->id == $addressInvoice->id ? '&address_type=2' : '').'&back='.urlencode($_SERVER['REQUEST_URI']).'&token='.Tools::getAdminToken('AdminAddresses'.(int)(Tab::getIdFromClassName('AdminAddresses')).(int)($cookie->id_employee)).'"><img src="../img/admin/edit.gif" /></a></div>
|
||||
<div style="float: right"><a href="?tab=AdminAddresses&id_address='.$addressInvoice->id.'&addaddress&realedit=1&id_order='.$order->id.($addressDelivery->id == $addressInvoice->id ? '&address_type=2' : '').'&back='.urlencode($_SERVER['REQUEST_URI']).'&token='.Tools::getAdminToken('AdminAddresses'.(int)(Tab::getIdFromClassName('AdminAddresses')).(int)$context->employee->id).'"><img src="../img/admin/edit.gif" /></a></div>
|
||||
'.$this->displayAddressDetail($addressInvoice)
|
||||
.(!empty($addressInvoice->other) ? '<hr />'.$addressInvoice->other.'<br />' : '')
|
||||
|
||||
@@ -737,7 +734,7 @@ class AdminOrders extends AdminTab
|
||||
<th colspan="2" style="width: 120px;"><img src="../img/admin/delete.gif" alt="'.$this->l('Products').'" /> '.($order->hasBeenDelivered() ? $this->l('Return') : ($order->hasBeenPaid() ? $this->l('Refund') : $this->l('Cancel'))).'</th>';
|
||||
echo '
|
||||
</tr>';
|
||||
$tokenCatalog = Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee));
|
||||
$tokenCatalog = Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id);
|
||||
foreach ($products as $k => $product)
|
||||
{
|
||||
if ($order->getTaxCalculationMethod() == PS_TAX_EXC)
|
||||
@@ -901,7 +898,7 @@ class AdminOrders extends AdminTab
|
||||
echo '<div style="overflow:auto; width:400px;" '.($message['is_new_for_me'] ?'class="new_message"':'').'>';
|
||||
if ($message['is_new_for_me'])
|
||||
echo '<a class="new_message" title="'.$this->l('Mark this message as \'viewed\'').'" href="'.$_SERVER['REQUEST_URI'].'&token='.$this->token.'&messageReaded='.(int)($message['id_message']).'"><img src="../img/admin/enabled.gif" alt="" /></a>';
|
||||
echo $this->l('At').' <i>'.Tools::displayDate($message['date_add'], (int)($cookie->id_lang), true);
|
||||
echo $this->l('At').' <i>'.Tools::displayDate($message['date_add'], $context->language->id, true);
|
||||
echo '</i> '.$this->l('from').' <b>'.(($message['elastname']) ? ($message['efirstname'].' '.$message['elastname']) : ($message['cfirstname'].' '.$message['clastname'])).'</b>';
|
||||
echo ((int)($message['private']) == 1 ? '<span style="color:red; font-weight:bold;">'.$this->l('Private:').'</span>' : '');
|
||||
echo '<p>'.nl2br2($message['message']).'</p>';
|
||||
@@ -923,9 +920,9 @@ class AdminOrders extends AdminTab
|
||||
foreach ($returns as $return)
|
||||
{
|
||||
$state = new OrderReturnState($return['state']);
|
||||
echo '('.Tools::displayDate($return['date_upd'], $cookie->id_lang).') :
|
||||
<b><a href="index.php?tab=AdminReturn&id_order_return='.$return['id_order_return'].'&updateorder_return&token='.Tools::getAdminToken('AdminReturn'.(int)(Tab::getIdFromClassName('AdminReturn')).(int)($cookie->id_employee)).'">'.$this->l('#').sprintf('%06d', $return['id_order_return']).'</a></b> -
|
||||
'.$state->name[$cookie->id_lang].'<br />';
|
||||
echo '('.Tools::displayDate($return['date_upd'], $context->language->id).') :
|
||||
<b><a href="index.php?tab=AdminReturn&id_order_return='.$return['id_order_return'].'&updateorder_return&token='.Tools::getAdminToken('AdminReturn'.(int)(Tab::getIdFromClassName('AdminReturn')).(int)$context->employee->id).'">'.$this->l('#').sprintf('%06d', $return['id_order_return']).'</a></b> -
|
||||
'.$state->name[$context->language->id].'<br />';
|
||||
}
|
||||
echo '</fieldset>';
|
||||
|
||||
@@ -938,7 +935,7 @@ class AdminOrders extends AdminTab
|
||||
echo $this->l('No slip for this order.');
|
||||
else
|
||||
foreach ($slips as $slip)
|
||||
echo '('.Tools::displayDate($slip['date_upd'], $cookie->id_lang).') : <b><a href="pdf.php?id_order_slip='.$slip['id_order_slip'].'">'.$this->l('#').sprintf('%06d', $slip['id_order_slip']).'</a></b><br />';
|
||||
echo '('.Tools::displayDate($slip['date_upd'], $context->language->id).') : <b><a href="pdf.php?id_order_slip='.$slip['id_order_slip'].'">'.$this->l('#').sprintf('%06d', $slip['id_order_slip']).'</a></b><br />';
|
||||
echo '</fieldset>
|
||||
</div>';
|
||||
echo '<div class="clear"> </div>';
|
||||
@@ -958,16 +955,14 @@ class AdminOrders extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
if (isset($_GET['view'.$this->table]))
|
||||
$this->viewDetails();
|
||||
else
|
||||
{
|
||||
$this->getList((int)($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
$currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT')));
|
||||
$this->getList($context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
$this->displayList();
|
||||
echo '<h2 class="space" style="text-align:right; margin-right:44px;">'.$this->l('Total:').' '.Tools::displayPrice($this->getTotal(), $currency).'</h2>';
|
||||
echo '<h2 class="space" style="text-align:right; margin-right:44px;">'.$this->l('Total:').' '.Tools::displayPrice($this->getTotal(), $context->currency).'</h2>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,7 @@ class AdminOrdersStates extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
if (Tools::isSubmit('submitAdd'.$this->table))
|
||||
{
|
||||
$_POST['invoice'] = Tools::getValue('invoice');
|
||||
@@ -70,7 +69,7 @@ class AdminOrdersStates extends AdminTab
|
||||
}
|
||||
elseif (isset($_GET['delete'.$this->table]))
|
||||
{
|
||||
$orderState = new OrderState((int)($_GET['id_order_state']), $cookie->id_lang);
|
||||
$orderState = new OrderState($_GET['id_order_state'], $context->language->id);
|
||||
if (!$orderState->isRemovable())
|
||||
$this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
|
||||
else
|
||||
@@ -80,7 +79,7 @@ class AdminOrdersStates extends AdminTab
|
||||
{
|
||||
foreach ($_POST[$this->table.'Box'] AS $selection)
|
||||
{
|
||||
$orderState = new OrderState((int)($selection), $cookie->id_lang);
|
||||
$orderState = new OrderState($selection, $context->language->id);
|
||||
if (!$orderState->isRemovable())
|
||||
{
|
||||
$this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
|
||||
@@ -108,7 +107,6 @@ class AdminOrdersStates extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
|
||||
@@ -31,9 +31,6 @@ class AdminPDF extends AdminPreferences
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$lang = strtoupper(Language::getIsoById($cookie->id_lang));
|
||||
$this->className = 'Configuration';
|
||||
$this->table = 'configuration';
|
||||
|
||||
@@ -82,8 +79,6 @@ class AdminPDF extends AdminPreferences
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (isset($_POST['submitPDF'.$this->table]))
|
||||
@@ -104,11 +99,9 @@ class AdminPDF extends AdminPreferences
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$language = new Language((int)($cookie->id_lang));
|
||||
if (!Validate::isLoadedObject($language))
|
||||
$context = Context::getContext();
|
||||
if (!Validate::isLoadedObject($context->language))
|
||||
die(Tools::displayError());
|
||||
$this->_displayForm('PDF', $this->_fieldsPDF, $this->l('PDF settings for the current language:').' '.$language->name, 'width2', 'pdf');
|
||||
$this->_displayForm('PDF', $this->_fieldsPDF, $this->l('PDF settings for the current language:').' '.$context->language->name, 'width2', 'pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,8 +84,6 @@ class AdminPayment extends AdminTab
|
||||
|
||||
private function saveRestrictions($type)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'module_'.$type.' WHERE id_shop='.Context::getContext()->shop->getID());
|
||||
foreach ($this->paymentModules as $module)
|
||||
if ($module->active AND isset($_POST[$module->name.'_'.$type.'']))
|
||||
@@ -98,15 +96,14 @@ class AdminPayment extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$displayRestrictions = false;
|
||||
|
||||
$currencies = Currency::getCurrencies();
|
||||
$countries = Country::getCountries((int)($cookie->id_lang));
|
||||
$groups = Group::getGroups((int)($cookie->id_lang));
|
||||
$countries = Country::getCountries($context->language->id);
|
||||
$groups = Group::getGroups($context->language->id);
|
||||
|
||||
$tokenModules = Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)($cookie->id_employee));
|
||||
$tokenModules = Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)$context->employee->id);
|
||||
echo '<h2 class="space">'.$this->l('Payment modules list').'</h2>';
|
||||
if (isset($this->paymentModules[0]))
|
||||
echo '<input type="button" class="button" onclick="document.location=\'index.php?tab=AdminModules&token='.$tokenModules.'&module_name='.$this->paymentModules[0]->name.'&tab_module=payments_gateways\'" value="'.$this->l('Click to see the list of payment modules.').'" /><br>';
|
||||
@@ -137,7 +134,6 @@ class AdminPayment extends AdminTab
|
||||
|
||||
public function displayModuleRestrictions($items, $title, $nameId, $desc, $icon)
|
||||
{
|
||||
global $currentIndex;
|
||||
$irow = 0;
|
||||
|
||||
echo '
|
||||
|
||||
@@ -29,8 +29,6 @@ class AdminPerformance extends AdminTab
|
||||
{
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (Tools::isSubmit('submitCaching'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
@@ -207,8 +205,6 @@ class AdminPerformance extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$warnings = array();
|
||||
if (!extension_loaded('memcache'))
|
||||
$warnings[] = $this->l('To use Memcached, you must install the Memcache PECL extension on your server.').' <a href="http://www.php.net/manual/en/memcache.installation.php">http://www.php.net/manual/en/memcache.installation.php</a>';
|
||||
|
||||
@@ -35,7 +35,6 @@ class AdminProducts extends AdminTab
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $currentIndex;
|
||||
$context = Context::getContext();
|
||||
|
||||
$this->table = 'product';
|
||||
@@ -120,10 +119,9 @@ class AdminProducts extends AdminTab
|
||||
|
||||
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL, $id_lang_shop = NULL)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$orderByPriceFinal = (empty($orderBy) ? ($cookie->__get($this->table.'Orderby') ? $cookie->__get($this->table.'Orderby') : 'id_'.$this->table) : $orderBy);
|
||||
$orderWayPriceFinal = (empty($orderWay) ? ($cookie->__get($this->table.'Orderway') ? $cookie->__get($this->table.'Orderby') : 'ASC') : $orderWay);
|
||||
$context = Context::getContext();
|
||||
$orderByPriceFinal = (empty($orderBy) ? ($context->cookie->__get($this->table.'Orderby') ? $context->cookie->__get($this->table.'Orderby') : 'id_'.$this->table) : $orderBy);
|
||||
$orderWayPriceFinal = (empty($orderWay) ? ($context->cookie->__get($this->table.'Orderway') ? $context->cookie->__get($this->table.'Orderby') : 'ASC') : $orderWay);
|
||||
if ($orderByPriceFinal == 'price_final')
|
||||
{
|
||||
$orderBy = 'id_'.$this->table;
|
||||
@@ -172,7 +170,7 @@ class AdminProducts extends AdminTab
|
||||
*/
|
||||
public function postProcess($token = NULL)
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
$context = Context::getContext();
|
||||
/* Add a new product */
|
||||
if (Tools::isSubmit('submitAddproduct') OR Tools::isSubmit('submitAddproductAndStay') OR Tools::isSubmit('submitAddProductAndPreview'))
|
||||
{
|
||||
@@ -525,7 +523,7 @@ class AdminProducts extends AdminTab
|
||||
Tools::getValue('minimal_quantity'));
|
||||
if ($id_reason = (int)Tools::getValue('id_mvt_reason') AND (int)Tools::getValue('attribute_mvt_quantity') > 0 AND $id_reason > 0)
|
||||
{
|
||||
if (!$product->addStockMvt(Tools::getValue('attribute_mvt_quantity'), $id_reason, $id_product_attribute, NULL, $cookie->id_employee))
|
||||
if (!$product->addStockMvt(Tools::getValue('attribute_mvt_quantity'), $id_reason, $id_product_attribute, NULL, $context->employee->id))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating qty.');
|
||||
}
|
||||
Hook::updateProductAttribute((int)$id_product_attribute);
|
||||
@@ -1083,16 +1081,13 @@ class AdminProducts extends AdminTab
|
||||
|
||||
/**
|
||||
* Add or update a product
|
||||
*
|
||||
* @global string $currentIndex Current URL in order to keep current Tab
|
||||
*/
|
||||
public function submitAddProduct($token = NULL)
|
||||
{
|
||||
global $cookie, $currentIndex, $link;
|
||||
|
||||
$context = Context::getContext();
|
||||
$className = 'Product';
|
||||
$rules = call_user_func(array($this->className, 'getValidationRules'), $this->className);
|
||||
$defaultLanguage = new Language((int)(Configuration::get('PS_LANG_DEFAULT')));
|
||||
$defaultLanguage = $context->language;
|
||||
$languages = Language::getLanguages(false);
|
||||
|
||||
/* Check required fields */
|
||||
@@ -1177,7 +1172,7 @@ class AdminProducts extends AdminTab
|
||||
{
|
||||
if ($id_reason = (int)Tools::getValue('id_mvt_reason') AND Tools::getValue('mvt_quantity') > 0 AND $id_reason > 0)
|
||||
{
|
||||
if (!$object->addStockMvt(Tools::getValue('mvt_quantity'), $id_reason, NULL, NULL, (int)$cookie->id_employee))
|
||||
if (!$object->addStockMvt(Tools::getValue('mvt_quantity'), $id_reason, NULL, NULL, $context->employee->id))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating qty.');
|
||||
}
|
||||
$this->updateAccessories($object);
|
||||
@@ -1201,7 +1196,7 @@ class AdminProducts extends AdminTab
|
||||
// Save and preview
|
||||
if (Tools::isSubmit('submitAddProductAndPreview'))
|
||||
{
|
||||
$preview_url = ($link->getProductLink($this->getFieldValue($object, 'id'), $this->getFieldValue($object, 'link_rewrite', (int)($cookie->id_lang)), Category::getLinkRewrite($this->getFieldValue($object, 'id_category_default'), (int)($cookie->id_lang))));
|
||||
$preview_url = ($context->link->getProductLink($this->getFieldValue($object, 'id'), $this->getFieldValue($object, 'link_rewrite', $context->language->id), Category::getLinkRewrite($this->getFieldValue($object, 'id_category_default'), $context->language->id)));
|
||||
if (!$object->active)
|
||||
{
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
@@ -1253,7 +1248,7 @@ class AdminProducts extends AdminTab
|
||||
// Save and preview
|
||||
if (Tools::isSubmit('submitAddProductAndPreview'))
|
||||
{
|
||||
$preview_url = ($link->getProductLink($this->getFieldValue($object, 'id'), $this->getFieldValue($object, 'link_rewrite', (int)($cookie->id_lang)), Category::getLinkRewrite($this->getFieldValue($object, 'id_category_default'), (int)($cookie->id_lang))));
|
||||
$preview_url = ($context->link->getProductLink($this->getFieldValue($object, 'id'), $this->getFieldValue($object, 'link_rewrite', $context->language->id), Category::getLinkRewrite($this->getFieldValue($object, 'id_category_default'), $context->language->id)));
|
||||
if (!$obj->active)
|
||||
{
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
@@ -1399,12 +1394,11 @@ class AdminProducts extends AdminTab
|
||||
|
||||
public function display($token = NULL)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$id_shop = Context::getContext()->shop->getID();
|
||||
$context = Context::getContext();
|
||||
$id_shop = $context->shop->getID();
|
||||
if (($id_category = (int)Tools::getValue('id_category')))
|
||||
$currentIndex .= '&id_category='.$id_category;
|
||||
$this->getList((int)($cookie->id_lang), !$cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$cookie->__get($this->table.'Orderway') ? 'ASC' : NULL, 0, NULL, $id_shop);
|
||||
$this->getList($context->language->id, !$context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL, 0, NULL, $id_shop);
|
||||
$id_category = (Tools::getValue('id_category',1));
|
||||
if (!$id_category)
|
||||
$id_category = 1;
|
||||
@@ -1426,8 +1420,6 @@ class AdminProducts extends AdminTab
|
||||
*/
|
||||
public function displayList($token = NULL)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
/* Display list header (filtering, pagination and column names) */
|
||||
$this->displayListHeader($token);
|
||||
if (!sizeof($this->_list))
|
||||
@@ -1520,11 +1512,11 @@ class AdminProducts extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $link, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
if ($id_category_back = (int)(Tools::getValue('id_category')))
|
||||
$currentIndex .= '&id_category='.$id_category_back;
|
||||
self::$currentIndex .= '&id_category='.$id_category_back;
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
@@ -1532,7 +1524,7 @@ class AdminProducts extends AdminTab
|
||||
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
|
||||
if ($obj->id)
|
||||
$currentIndex .= '&id_product='.$obj->id;
|
||||
self::$currentIndex .= '&id_product='.$obj->id;
|
||||
|
||||
echo '
|
||||
<h3>'.$this->l('Current product:').' <span id="current_product" style="font-weight: normal;">'.$this->l('no name').'</span></h3>
|
||||
@@ -1589,7 +1581,7 @@ class AdminProducts extends AdminTab
|
||||
echo ' if (toload[id]) {
|
||||
toload[id] = false;
|
||||
$.post(
|
||||
"'.dirname($currentIndex).'/ajax.php", {
|
||||
"'.dirname(self::$currentIndex).'/ajax.php", {
|
||||
ajaxProductTab: id, id_product: '.$obj->id.',
|
||||
token: \''.Tools::getValue('token').'\',
|
||||
id_category: '.(int)(Tools::getValue('id_category')).'},
|
||||
@@ -1625,9 +1617,9 @@ class AdminProducts extends AdminTab
|
||||
|
||||
if (Tools::getValue('id_category') > 1)
|
||||
{
|
||||
$productIndex = preg_replace('/(&id_product=[0-9]*)/', '', $currentIndex);
|
||||
$productIndex = preg_replace('/(&id_product=[0-9]*)/', '', self::$currentIndex);
|
||||
echo '<br /><br />
|
||||
<a href="'.$productIndex.($this->token ? '&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)) : '').'">
|
||||
<a href="'.$productIndex.($this->token ? '&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id) : '').'">
|
||||
<img src="../img/admin/arrow2.gif" /> '.$this->l('Back to the category').'
|
||||
</a><br />';
|
||||
}
|
||||
@@ -1635,17 +1627,15 @@ class AdminProducts extends AdminTab
|
||||
|
||||
function displayFormPrices($obj, $languages, $defaultLanguage)
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$context = Context::getContext();
|
||||
if ($obj->id)
|
||||
{
|
||||
$shops = Shop::getShops();
|
||||
$currencies = Currency::getCurrencies();
|
||||
$countries = Country::getCountries((int)($cookie->id_lang));
|
||||
$groups = Group::getGroups((int)($cookie->id_lang));
|
||||
$defaultCurrency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT')));
|
||||
$this->_displaySpecificPriceAdditionForm($defaultCurrency, $shops, $currencies, $countries, $groups);
|
||||
$this->_displaySpecificPriceModificationForm($defaultCurrency, $shops, $currencies, $countries, $groups);
|
||||
$countries = Country::getCountries($context->language->id);
|
||||
$groups = Group::getGroups($context->language->id);
|
||||
$this->_displaySpecificPriceAdditionForm( $context->currency, $shops, $currencies, $countries, $groups);
|
||||
$this->_displaySpecificPriceModificationForm( $context->currency, $shops, $currencies, $countries, $groups);
|
||||
}
|
||||
else
|
||||
echo '<b>'.$this->l('You must save this product before adding specific prices').'.</b>';
|
||||
@@ -1661,7 +1651,6 @@ class AdminProducts extends AdminTab
|
||||
|
||||
protected function _displaySpecificPriceModificationForm($defaultCurrency, $shops, $currencies, $countries, $groups)
|
||||
{
|
||||
global $currentIndex;
|
||||
$context = Context::getContext();
|
||||
if (!($obj = $this->loadObject()))
|
||||
return;
|
||||
@@ -2028,12 +2017,12 @@ class AdminProducts extends AdminTab
|
||||
|
||||
function displayFormAttachments($obj, $languages, $defaultLanguage)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
$languages = Language::getLanguages(false);
|
||||
$attach1 = Attachment::getAttachments($cookie->id_lang, $obj->id, true);
|
||||
$attach2 = Attachment::getAttachments($cookie->id_lang, $obj->id, false);
|
||||
$attach1 = Attachment::getAttachments($context->language->id, $obj->id, true);
|
||||
$attach2 = Attachment::getAttachments($context->language->id, $obj->id, false);
|
||||
|
||||
echo '
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
@@ -2100,10 +2089,8 @@ class AdminProducts extends AdminTab
|
||||
function displayFormInformations($obj, $currency)
|
||||
{
|
||||
parent::displayForm(false);
|
||||
global $currentIndex, $cookie, $link;
|
||||
$context = Context::getContext();
|
||||
|
||||
$context->country->getIsoById((int)($cookie->id_lang));
|
||||
$has_attribute = $obj->hasAttributes();
|
||||
$qty = $obj->getStock();
|
||||
$cover = Product::getCover($obj->id);
|
||||
@@ -2117,7 +2104,7 @@ class AdminProducts extends AdminTab
|
||||
updateCurrentText();
|
||||
updateFriendlyURL();
|
||||
$.ajax({
|
||||
url: "'.dirname($currentIndex).'/ajax.php",
|
||||
url: "'.dirname(self::$currentIndex).'/ajax.php",
|
||||
dataType: "json",
|
||||
data: "ajaxProductManufacturers=1",
|
||||
success: function(j) {
|
||||
@@ -2134,7 +2121,7 @@ class AdminProducts extends AdminTab
|
||||
|
||||
});
|
||||
$.ajax({
|
||||
url: "'.dirname($currentIndex).'/ajax.php",
|
||||
url: "'.dirname(self::$currentIndex).'/ajax.php",
|
||||
dataType: "json",
|
||||
data: "ajaxProductSuppliers=1",
|
||||
success: function(j) {
|
||||
@@ -2163,7 +2150,7 @@ class AdminProducts extends AdminTab
|
||||
$preview_url = '';
|
||||
if (isset($obj->id))
|
||||
{
|
||||
$preview_url = ($link->getProductLink($this->getFieldValue($obj, 'id'), $this->getFieldValue($obj, 'link_rewrite', $this->_defaultFormLanguage), Category::getLinkRewrite($this->getFieldValue($obj, 'id_category_default'), (int)($cookie->id_lang))));
|
||||
$preview_url = ($link->getProductLink($this->getFieldValue($obj, 'id'), $this->getFieldValue($obj, 'link_rewrite', $this->_defaultFormLanguage), Category::getLinkRewrite($this->getFieldValue($obj, 'id_category_default'), $context->language->id)));
|
||||
if (!$obj->active)
|
||||
{
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
@@ -2180,7 +2167,7 @@ class AdminProducts extends AdminTab
|
||||
<a href="'.$preview_url.'" target="_blank"><img src="../img/admin/details.gif" alt="'.$this->l('View product in shop').'" title="'.$this->l('View product in shop').'" /> '.$this->l('View product in shop').'</a>';
|
||||
|
||||
if (file_exists(_PS_MODULE_DIR_.'statsproduct/statsproduct.php'))
|
||||
echo ' - <a href="index.php?tab=AdminStats&module=statsproduct&id_product='.$obj->id.'&token='.Tools::getAdminToken('AdminStats'.(int)(Tab::getIdFromClassName('AdminStats')).(int)($cookie->id_employee)).'"><img src="../modules/statsproduct/logo.gif" alt="'.$this->l('View product sales').'" title="'.$this->l('View product sales').'" /> '.$this->l('View product sales').'</a>';
|
||||
echo ' - <a href="index.php?tab=AdminStats&module=statsproduct&id_product='.$obj->id.'&token='.Tools::getAdminToken('AdminStats'.(int)(Tab::getIdFromClassName('AdminStats')).(int)$context->employee->id).'"><img src="../modules/statsproduct/logo.gif" alt="'.$this->l('View product sales').'" title="'.$this->l('View product sales').'" /> '.$this->l('View product sales').'</a>';
|
||||
}
|
||||
echo '
|
||||
<hr class="clear"/>
|
||||
@@ -2302,7 +2289,7 @@ class AdminProducts extends AdminTab
|
||||
echo ' <option value="'.$id_manufacturer.'" selected="selected">'.Manufacturer::getNameById($id_manufacturer).'</option>
|
||||
<option disabled="disabled">----------</option>';
|
||||
echo '
|
||||
</select> <a href="?tab=AdminManufacturers&addmanufacturer&token='.Tools::getAdminToken('AdminManufacturers'.(int)(Tab::getIdFromClassName('AdminManufacturers')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.$this->l('Are you sure you want to delete product information entered?', __CLASS__, true, false).'\');"><img src="../img/admin/add.gif" alt="'.$this->l('Create').'" title="'.$this->l('Create').'" /> <b>'.$this->l('Create').'</b></a>
|
||||
</select> <a href="?tab=AdminManufacturers&addmanufacturer&token='.Tools::getAdminToken('AdminManufacturers'.(int)(Tab::getIdFromClassName('AdminManufacturers')).(int)$context->employee->id).'" onclick="return confirm(\''.$this->l('Are you sure you want to delete product information entered?', __CLASS__, true, false).'\');"><img src="../img/admin/add.gif" alt="'.$this->l('Create').'" title="'.$this->l('Create').'" /> <b>'.$this->l('Create').'</b></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -2314,7 +2301,7 @@ class AdminProducts extends AdminTab
|
||||
echo ' <option value="'.$id_supplier.'" selected="selected">'.Supplier::getNameById($id_supplier).'</option>
|
||||
<option disabled="disabled">----------</option>';
|
||||
echo '
|
||||
</select> <a href="?tab=AdminSuppliers&addsupplier&token='.Tools::getAdminToken('AdminSuppliers'.(int)(Tab::getIdFromClassName('AdminSuppliers')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.$this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false).'\');"><img src="../img/admin/add.gif" alt="'.$this->l('Create').'" title="'.$this->l('Create').'" /> <b>'.$this->l('Create').'</b></a>
|
||||
</select> <a href="?tab=AdminSuppliers&addsupplier&token='.Tools::getAdminToken('AdminSuppliers'.(int)(Tab::getIdFromClassName('AdminSuppliers')).(int)$context->employee->id).'" onclick="return confirm(\''.$this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false).'\');"><img src="../img/admin/add.gif" alt="'.$this->l('Create').'" title="'.$this->l('Create').'" /> <b>'.$this->l('Create').'</b></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -2552,11 +2539,11 @@ class AdminProducts extends AdminTab
|
||||
|
||||
echo '</select>
|
||||
|
||||
<a href="?tab=AdminTaxRulesGroup&addtax_rules_group&token='.Tools::getAdminToken('AdminTaxRulesGroup'.(int)(Tab::getIdFromClassName('AdminTaxRulesGroup')).(int)($cookie->id_employee)).'&id_product='.(int)$obj->id.'" onclick="return confirm(\''.$this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false).'\');"><img src="../img/admin/add.gif" alt="'.$this->l('Create').'" title="'.$this->l('Create').'" /> <b>'.$this->l('Create').'</b></a></span>
|
||||
<a href="?tab=AdminTaxRulesGroup&addtax_rules_group&token='.Tools::getAdminToken('AdminTaxRulesGroup'.(int)(Tab::getIdFromClassName('AdminTaxRulesGroup')).(int)$context->employee->id).'&id_product='.(int)$obj->id.'" onclick="return confirm(\''.$this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false).'\');"><img src="../img/admin/add.gif" alt="'.$this->l('Create').'" title="'.$this->l('Create').'" /> <b>'.$this->l('Create').'</b></a></span>
|
||||
';
|
||||
if (Tax::excludeTaxeOption())
|
||||
{
|
||||
echo '<span style="margin-left:10px; color:red;">'.$this->l('Taxes are currently disabled').'</span> (<b><a href="index.php?tab=AdminTaxes&token='.Tools::getAdminToken('AdminTaxes'.(int)(Tab::getIdFromClassName('AdminTaxes')).(int)($cookie->id_employee)).'">'.$this->l('Tax options').'</a></b>)';
|
||||
echo '<span style="margin-left:10px; color:red;">'.$this->l('Taxes are currently disabled').'</span> (<b><a href="index.php?tab=AdminTaxes&token='.Tools::getAdminToken('AdminTaxes'.(int)(Tab::getIdFromClassName('AdminTaxes')).(int)$context->employee->id).'">'.$this->l('Tax options').'</a></b>)';
|
||||
echo '<input type="hidden" value="'.(int)($this->getFieldValue($obj, 'id_tax_rules_group')).'" name="id_tax_rules_group" />';
|
||||
}
|
||||
|
||||
@@ -2631,7 +2618,7 @@ class AdminProducts extends AdminTab
|
||||
<td style="padding-bottom:5px;">
|
||||
<select id="id_mvt_reason" name="id_mvt_reason">
|
||||
<option value="-1">--</option>';
|
||||
$reasons = StockMvtReason::getStockMvtReasons((int)$cookie->id_lang);
|
||||
$reasons = StockMvtReason::getStockMvtReasons($context->language->id);
|
||||
|
||||
foreach ($reasons AS $reason)
|
||||
echo '<option rel="'.$reason['sign'].'" value="'.$reason['id_stock_mvt_reason'].'" '.(Configuration::get('PS_STOCK_MVT_REASON_DEFAULT') == $reason['id_stock_mvt_reason'] ? 'selected="selected"' : '').'>'.$reason['name'].'</option>';
|
||||
@@ -2718,7 +2705,7 @@ class AdminProducts extends AdminTab
|
||||
<td style="padding-bottom:5px;">
|
||||
<input type="radio" name="out_of_stock" id="out_of_stock_1" value="0" '.((int)($this->getFieldValue($obj, 'out_of_stock')) == 0 ? 'checked="checked"' : '').'/> <label for="out_of_stock_1" class="t" id="label_out_of_stock_1">'.$this->l('Deny orders').'</label>
|
||||
<br /><input type="radio" name="out_of_stock" id="out_of_stock_2" value="1" '.($this->getFieldValue($obj, 'out_of_stock') == 1 ? 'checked="checked"' : '').'/> <label for="out_of_stock_2" class="t" id="label_out_of_stock_2">'.$this->l('Allow orders').'</label>
|
||||
<br /><input type="radio" name="out_of_stock" id="out_of_stock_3" value="2" '.($this->getFieldValue($obj, 'out_of_stock') == 2 ? 'checked="checked"' : '').'/> <label for="out_of_stock_3" class="t" id="label_out_of_stock_3">'.$this->l('Default:').' <i>'.$this->l(((int)(Configuration::get('PS_ORDER_OUT_OF_STOCK')) ? 'Allow orders' : 'Deny orders')).'</i> ('.$this->l('as set in').' <a href="index.php?tab=AdminPPreferences&token='.Tools::getAdminToken('AdminPPreferences'.(int)(Tab::getIdFromClassName('AdminPPreferences')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.$this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false).'\');">'.$this->l('Preferences').'</a>)</label>
|
||||
<br /><input type="radio" name="out_of_stock" id="out_of_stock_3" value="2" '.($this->getFieldValue($obj, 'out_of_stock') == 2 ? 'checked="checked"' : '').'/> <label for="out_of_stock_3" class="t" id="label_out_of_stock_3">'.$this->l('Default:').' <i>'.$this->l(((int)(Configuration::get('PS_ORDER_OUT_OF_STOCK')) ? 'Allow orders' : 'Deny orders')).'</i> ('.$this->l('as set in').' <a href="index.php?tab=AdminPPreferences&token='.Tools::getAdminToken('AdminPPreferences'.(int)(Tab::getIdFromClassName('AdminPPreferences')).(int)$context->employee->id).'" onclick="return confirm(\''.$this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false).'\');">'.$this->l('Preferences').'</a>)</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
|
||||
@@ -2820,7 +2807,7 @@ class AdminProducts extends AdminTab
|
||||
echo ' <p class="clear">'.$this->l('Tags separated by commas (e.g., dvd, dvd player, hifi)').'</p>
|
||||
</td>
|
||||
</tr>';
|
||||
$accessories = Product::getAccessoriesLight((int)($cookie->id_lang), $obj->id);
|
||||
$accessories = Product::getAccessoriesLight($context->language->id, $obj->id);
|
||||
|
||||
if ($postAccessories = Tools::getValue('inputAccessories'))
|
||||
{
|
||||
@@ -2893,8 +2880,7 @@ class AdminProducts extends AdminTab
|
||||
<br />
|
||||
</div>';
|
||||
// TinyMCE
|
||||
global $cookie;
|
||||
$iso = Language::getIsoById((int)($cookie->id_lang));
|
||||
$iso = $context->language->iso_code;
|
||||
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
|
||||
$ad = dirname($_SERVER["PHP_SELF"]);
|
||||
echo '
|
||||
@@ -2923,7 +2909,7 @@ class AdminProducts extends AdminTab
|
||||
|
||||
function displayFormImages($obj, $token = NULL)
|
||||
{
|
||||
global $cookie, $currentIndex, $attributeJs, $images;
|
||||
global $attributeJs, $images;
|
||||
|
||||
$countImages = (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'image WHERE id_product = '.(int)$obj->id);
|
||||
echo '
|
||||
@@ -2988,7 +2974,7 @@ class AdminProducts extends AdminTab
|
||||
<tr>
|
||||
<td colspan="2" style="text-align:center;">';
|
||||
echo '<input type="hidden" name="resizer" value="auto" />';
|
||||
$images = Image::getImages((int)($cookie->id_lang), $obj->id);
|
||||
$images = Image::getImages($context->language->id, $obj->id);
|
||||
$imagesTotal = Image::getImagesTotal($obj->id);
|
||||
|
||||
if (isset($obj->id) AND sizeof($images))
|
||||
@@ -3023,7 +3009,7 @@ class AdminProducts extends AdminTab
|
||||
echo '<script type="text/javascript">
|
||||
$(window).ready(function() {
|
||||
$(\'.image_shop\').change(function() {
|
||||
$.post("'.dirname($currentIndex).'/ajax.php",
|
||||
$.post("'.dirname(self::$currentIndex).'/ajax.php",
|
||||
{updateProductImageShopAsso: 1, id_image:$(this).attr("name"), id_shop: $(this).val(), active:$(this).attr("checked")});
|
||||
});
|
||||
});
|
||||
@@ -3094,7 +3080,7 @@ class AdminProducts extends AdminTab
|
||||
var modifyattributegroup = \''.addslashes(html_entity_decode($this->l('Modify this attribute combination'), ENT_COMPAT, 'UTF-8')).'\';
|
||||
attrs[0] = new Array(0, \'---\');';
|
||||
|
||||
$attributes = Attribute::getAttributes((int)($cookie->id_lang), true);
|
||||
$attributes = Attribute::getAttributes($context->language->id, true);
|
||||
$attributeJs = array();
|
||||
|
||||
foreach ($attributes AS $k => $attribute)
|
||||
@@ -3114,13 +3100,12 @@ class AdminProducts extends AdminTab
|
||||
|
||||
public function initCombinationImagesJS()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$content = 'var combination_images = new Array();';
|
||||
if (!$allCombinationImages = $obj->getCombinationImages((int)($cookie->id_lang)))
|
||||
if (!$allCombinationImages = $obj->getCombinationImages($context->language->id))
|
||||
return $content;
|
||||
foreach ($allCombinationImages AS $id_product_attribute => $combinationImages)
|
||||
{
|
||||
@@ -3134,18 +3119,17 @@ class AdminProducts extends AdminTab
|
||||
|
||||
function displayFormAttributes($obj, $languages, $defaultLanguage)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
$attributeJs = array();
|
||||
$attributes = Attribute::getAttributes((int)($cookie->id_lang), true);
|
||||
$attributes = Attribute::getAttributes($context->language->id, true);
|
||||
foreach ($attributes AS $k => $attribute)
|
||||
$attributeJs[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
|
||||
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$attributes_groups = AttributeGroup::getAttributesGroups((int)($cookie->id_lang));
|
||||
$attributes_groups = AttributeGroup::getAttributesGroups($context->language->id);
|
||||
|
||||
|
||||
$images = Image::getImages((int)($cookie->id_lang), $obj->id);
|
||||
$images = Image::getImages($context->language->id, $obj->id);
|
||||
if ($obj->id)
|
||||
{
|
||||
echo '
|
||||
@@ -3160,7 +3144,7 @@ class AdminProducts extends AdminTab
|
||||
<table cellpadding="5">
|
||||
<tr>
|
||||
<td colspan="2"><b>'.$this->l('Add or modify combinations for this product').'</b> -
|
||||
<a href="index.php?tab=AdminCatalog&id_product='.$obj->id.'&id_category='.(int)(Tools::getValue('id_category')).'&attributegenerator&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.$this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false).'\');"><img src="../img/admin/appearance.gif" alt="combinations_generator" class="middle" title="'.$this->l('Product combinations generator').'" /> '.$this->l('Product combinations generator').'</a>
|
||||
<a href="index.php?tab=AdminCatalog&id_product='.$obj->id.'&id_category='.(int)(Tools::getValue('id_category')).'&attributegenerator&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" onclick="return confirm(\''.$this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false).'\');"><img src="../img/admin/appearance.gif" alt="combinations_generator" class="middle" title="'.$this->l('Product combinations generator').'" /> '.$this->l('Product combinations generator').'</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -3275,7 +3259,7 @@ class AdminProducts extends AdminTab
|
||||
<td style="padding-bottom:5px;">
|
||||
<select id="id_mvt_reason" name="id_mvt_reason">
|
||||
<option value="-1">--</option>';
|
||||
$reasons = StockMvtReason::getStockMvtReasons((int)$cookie->id_lang);
|
||||
$reasons = StockMvtReason::getStockMvtReasons($context->language->id);
|
||||
foreach ($reasons AS $reason)
|
||||
echo '<option rel="'.$reason['sign'].'" value="'.$reason['id_stock_mvt_reason'].'" '.(Configuration::get('PS_STOCK_MVT_REASON_DEFAULT') == $reason['id_stock_mvt_reason'] ? 'selected="selected"' : '').'>'.$reason['name'].'</option>';
|
||||
echo '</select>
|
||||
@@ -3348,11 +3332,11 @@ class AdminProducts extends AdminTab
|
||||
if ($obj->id)
|
||||
{
|
||||
/* Build attributes combinaisons */
|
||||
$combinaisons = $obj->getAttributeCombinaisons((int)($cookie->id_lang));
|
||||
$combinaisons = $obj->getAttributeCombinaisons($context->language->id);
|
||||
$groups = array();
|
||||
if (is_array($combinaisons))
|
||||
{
|
||||
$combinationImages = $obj->getCombinationImages((int)($cookie->id_lang));
|
||||
$combinationImages = $obj->getCombinationImages($context->language->id);
|
||||
foreach ($combinaisons AS $k => $combinaison)
|
||||
{
|
||||
$combArray[$combinaison['id_product_attribute']]['wholesale_price'] = $combinaison['wholesale_price'];
|
||||
@@ -3407,13 +3391,13 @@ class AdminProducts extends AdminTab
|
||||
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this combination').'"
|
||||
onclick="javascript:fillCombinaison(\''.$product_attribute['wholesale_price'].'\', \''.$product_attribute['price'].'\', \''.$product_attribute['weight'].'\', \''.$product_attribute['unit_impact'].'\', \''.$product_attribute['reference'].'\', \''.$product_attribute['supplier_reference'].'\', \''.$product_attribute['ean13'].'\',
|
||||
\''.$product_attribute['quantity'].'\', \''.($attrImage ? $attrImage->id : 0).'\', Array('.$jsList.'), \''.$id_product_attribute.'\', \''.$product_attribute['default_on'].'\', \''.$product_attribute['ecotax'].'\', \''.$product_attribute['location'].'\', \''.$product_attribute['upc'].'\', \''.$product_attribute['minimal_quantity'].'\'); calcImpactPriceTI();" /></a>
|
||||
'.(!$product_attribute['default_on'] ? '<a href="'.self::$currentIndex.'&defaultProductAttribute&id_product_attribute='.$id_product_attribute.'&id_product='.$obj->id.'&'.(Tools::isSubmit('id_category') ? 'id_category='.(int)(Tools::getValue('id_category')).'&' : '&').'token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'">
|
||||
'.(!$product_attribute['default_on'] ? '<a href="'.self::$currentIndex.'&defaultProductAttribute&id_product_attribute='.$id_product_attribute.'&id_product='.$obj->id.'&'.(Tools::isSubmit('id_category') ? 'id_category='.(int)(Tools::getValue('id_category')).'&' : '&').'token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).$context->employee->id).'">
|
||||
<img src="../img/admin/asterisk.gif" alt="'.$this->l('Make this the default combination').'" title="'.$this->l('Make this combination the default one').'"></a>' : '').'
|
||||
<a href="'.self::$currentIndex.'&deleteProductAttribute&id_product_attribute='.$id_product_attribute.'&id_product='.$obj->id.'&'.(Tools::isSubmit('id_category') ? 'id_category='.(int)(Tools::getValue('id_category')).'&' : '&').'token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');">
|
||||
<a href="'.self::$currentIndex.'&deleteProductAttribute&id_product_attribute='.$id_product_attribute.'&id_product='.$obj->id.'&'.(Tools::isSubmit('id_category') ? 'id_category='.(int)(Tools::getValue('id_category')).'&' : '&').'token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');">
|
||||
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this combination').'" /></a></td>
|
||||
</tr>';
|
||||
}
|
||||
echo '<tr><td colspan="7" align="center"><a href="'.self::$currentIndex.'&deleteAllProductAttributes&id_product='.$obj->id.'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');"><img src="../img/admin/delete.gif" alt="'.$this->l('Delete this combination').'" /> '.$this->l('Delete all combinations').'</a></td></tr>';
|
||||
echo '<tr><td colspan="7" align="center"><a href="'.self::$currentIndex.'&deleteAllProductAttributes&id_product='.$obj->id.'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');"><img src="../img/admin/delete.gif" alt="'.$this->l('Delete this combination').'" /> '.$this->l('Delete all combinations').'</a></td></tr>';
|
||||
}
|
||||
else
|
||||
echo '<tr><td colspan="7" align="center"><i>'.$this->l('No combination yet').'.</i></td></tr>';
|
||||
@@ -3453,7 +3437,7 @@ class AdminProducts extends AdminTab
|
||||
echo '
|
||||
</select>
|
||||
<input type="submit" value="'.$this->l('OK').'" name="submitAdd'.$this->table.'AndStay" class="button" />
|
||||
<a href="index.php?tab=AdminAttributesGroups&token='.Tools::getAdminToken('AdminAttributesGroups'.(int)(Tab::getIdFromClassName('AdminAttributesGroups')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.$this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false).'\');"><img src="../img/admin/asterisk.gif" alt="" /> '.$this->l('Color attribute management').'</a>
|
||||
<a href="index.php?tab=AdminAttributesGroups&token='.Tools::getAdminToken('AdminAttributesGroups'.(int)(Tab::getIdFromClassName('AdminAttributesGroups')).(int)$context->employee->id).'" onclick="return confirm(\''.$this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false).'\');"><img src="../img/admin/asterisk.gif" alt="" /> '.$this->l('Color attribute management').'</a>
|
||||
<p >'.$this->l('Activate the color choice by selecting a color attribute group.').'</p>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -3465,12 +3449,12 @@ class AdminProducts extends AdminTab
|
||||
|
||||
function displayFormFeatures($obj)
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
if ($obj->id)
|
||||
{
|
||||
$feature = Feature::getFeatures((int)($cookie->id_lang));
|
||||
$feature = Feature::getFeatures($context->language->id);
|
||||
$ctab = '';
|
||||
foreach ($feature AS $tab)
|
||||
$ctab .= 'ccustom_'.$tab['id_feature'].'¤';
|
||||
@@ -3490,7 +3474,7 @@ class AdminProducts extends AdminTab
|
||||
</table>
|
||||
<hr style="width:100%;" /><br />';
|
||||
// Header
|
||||
$nb_feature = Feature::nbFeatures((int)($cookie->id_lang));
|
||||
$nb_feature = Feature::nbFeatures($context->language->id);
|
||||
echo '
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:900px;">
|
||||
<tr>
|
||||
@@ -3516,7 +3500,7 @@ class AdminProducts extends AdminTab
|
||||
if ($tab_products['id_feature'] == $tab_features['id_feature'])
|
||||
$current_item = $tab_products['id_feature_value'];
|
||||
|
||||
$featureValues = FeatureValue::getFeatureValuesWithLang((int)$cookie->id_lang, (int)$tab_features['id_feature']);
|
||||
$featureValues = FeatureValue::getFeatureValuesWithLang($context->language->id, (int)$tab_features['id_feature']);
|
||||
|
||||
echo '
|
||||
<tr>
|
||||
@@ -3540,7 +3524,7 @@ class AdminProducts extends AdminTab
|
||||
echo '</select>';
|
||||
}
|
||||
else
|
||||
echo '<input type="hidden" name="feature_'.$tab_features['id_feature'].'_value" value="0" /><span style="font-size: 10px; color: #666;">'.$this->l('N/A').' - <a href="index.php?tab=AdminFeatures&addfeature_value&id_feature='.(int)$tab_features['id_feature'].'&token='.Tools::getAdminToken('AdminFeatures'.(int)(Tab::getIdFromClassName('AdminFeatures')).(int)($cookie->id_employee)).'" style="color: #666; text-decoration: underline;">'.$this->l('Add pre-defined values first').'</a></span>';
|
||||
echo '<input type="hidden" name="feature_'.$tab_features['id_feature'].'_value" value="0" /><span style="font-size: 10px; color: #666;">'.$this->l('N/A').' - <a href="index.php?tab=AdminFeatures&addfeature_value&id_feature='.(int)$tab_features['id_feature'].'&token='.Tools::getAdminToken('AdminFeatures'.(int)(Tab::getIdFromClassName('AdminFeatures')).(int)$context->employee->id).'" style="color: #666; text-decoration: underline;">'.$this->l('Add pre-defined values first').'</a></span>';
|
||||
|
||||
echo '
|
||||
</td>
|
||||
@@ -3564,7 +3548,7 @@ class AdminProducts extends AdminTab
|
||||
echo '</table>
|
||||
<hr style="width:100%;" />
|
||||
<div style="text-align:center;">
|
||||
<a href="index.php?tab=AdminFeatures&addfeature&token='.Tools::getAdminToken('AdminFeatures'.(int)(Tab::getIdFromClassName('AdminFeatures')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.$this->l('You will lose all modifications not saved, you may want to save modifications first?', __CLASS__, true, false).'\');"><img src="../img/admin/add.gif" alt="new_features" title="'.$this->l('Add a new feature').'" /> '.$this->l('Add a new feature').'</a>
|
||||
<a href="index.php?tab=AdminFeatures&addfeature&token='.Tools::getAdminToken('AdminFeatures'.(int)(Tab::getIdFromClassName('AdminFeatures')).(int)$context->employee->id).'" onclick="return confirm(\''.$this->l('You will lose all modifications not saved, you may want to save modifications first?', __CLASS__, true, false).'\');"><img src="../img/admin/add.gif" alt="new_features" title="'.$this->l('Add a new feature').'" /> '.$this->l('Add a new feature').'</a>
|
||||
</div>';
|
||||
}
|
||||
else
|
||||
@@ -3581,10 +3565,9 @@ class AdminProducts extends AdminTab
|
||||
|
||||
private function displayPack(Product $obj)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$boolPack = (($obj->id AND Pack::isPack($obj->id)) OR Tools::getValue('ppack')) ? true : false;
|
||||
$packItems = $boolPack ? Pack::getItems($obj->id, $cookie->id_lang) : array();
|
||||
$packItems = $boolPack ? Pack::getItems($obj->id, $context->language->id) : array();
|
||||
|
||||
echo '
|
||||
<tr>
|
||||
@@ -3809,7 +3792,6 @@ class AdminProducts extends AdminTab
|
||||
*/
|
||||
protected function loadObject($opt = false)
|
||||
{
|
||||
global $cookie;
|
||||
if ($id = (int)(Tools::getValue($this->identifier)) AND Validate::isUnsignedId($id))
|
||||
{
|
||||
if (!$this->_object)
|
||||
|
||||
@@ -29,8 +29,7 @@ class AdminProfiles extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$this->table = 'profile';
|
||||
$this->className = 'Profile';
|
||||
$this->lang = true;
|
||||
@@ -43,7 +42,7 @@ class AdminProfiles extends AdminTab
|
||||
$this->identifier = 'id_profile';
|
||||
|
||||
$list_profile = array();
|
||||
foreach(Profile::getProfiles($cookie->id_lang) as $profil)
|
||||
foreach(Profile::getProfiles($context->language->id) as $profil)
|
||||
$list_profile[] = array('value' => $profil['id_profile'], 'name' => $profil['name']);
|
||||
|
||||
parent::__construct();
|
||||
@@ -59,7 +58,6 @@ class AdminProfiles extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
|
||||
@@ -46,7 +46,6 @@ class AdminQuickAccesses extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
|
||||
@@ -66,12 +66,11 @@ class AdminRangePrice extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
$context = Context::getContext();
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$currency = $context->currency;
|
||||
|
||||
$carrierArray = array();
|
||||
$carriers = Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
|
||||
|
||||
@@ -66,7 +66,6 @@ class AdminRangeWeight extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
|
||||
@@ -91,9 +91,8 @@ class AdminReferrers extends AdminTab
|
||||
|
||||
public function displayJavascript()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$products = Product::getSimpleProducts((int)($cookie->id_lang));
|
||||
$context = Context::getContext();
|
||||
$products = Product::getSimpleProducts($context->language->id);
|
||||
$productsArray = array();
|
||||
foreach ($products as $product)
|
||||
$productsArray[] = $product['id_product'];
|
||||
@@ -132,7 +131,7 @@ class AdminReferrers extends AdminTab
|
||||
{
|
||||
referrerStatus[id_referrer] = true;
|
||||
for (var i = 0; i < productIds.length; ++i)
|
||||
$.getJSON("'.dirname($currentIndex).'/ajax.php",{ajaxReferrers:1, ajaxProductFilter:1,id_employee:'.(int)($cookie->id_employee).',token:"'.Tools::getValue('token').'",id_referrer:id_referrer,id_product:productIds[i]},
|
||||
$.getJSON("'.dirname(self::$currentIndex).'/ajax.php",{ajaxReferrers:1, ajaxProductFilter:1,id_employee:'.(int)$context->employee->id.',token:"'.Tools::getValue('token').'",id_referrer:id_referrer,id_product:productIds[i]},
|
||||
function(result) {
|
||||
var newLine = newProductLine(id_referrer, result[0]);
|
||||
$(newLine).hide().insertAfter(getE(\'trid_\'+id_referrer)).fadeIn();
|
||||
@@ -151,8 +150,6 @@ class AdminReferrers extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (!Tools::isSubmit('viewreferrer'))
|
||||
echo $this->displayJavascript();
|
||||
|
||||
@@ -202,8 +199,6 @@ class AdminReferrers extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if ($this->enableCalendar())
|
||||
{
|
||||
$calendarTab = new AdminStats();
|
||||
@@ -225,7 +220,6 @@ class AdminReferrers extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -380,7 +374,7 @@ class AdminReferrers extends AdminTab
|
||||
|
||||
public function viewreferrer()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
$context = Context::getContext();
|
||||
$referrer = new Referrer((int)(Tools::getValue('id_referrer')));
|
||||
|
||||
$displayTab = array(
|
||||
@@ -400,7 +394,7 @@ class AdminReferrers extends AdminTab
|
||||
<script type="text/javascript">
|
||||
function updateConversionRate(id_product)
|
||||
{
|
||||
$.getJSON("'.dirname($currentIndex).'/ajax.php",{ajaxReferrers:1, ajaxProductFilter:1,id_employee:'.(int)($cookie->id_employee).',token:"'.Tools::getValue('token').'",id_referrer:'.$referrer->id.',id_product:id_product},
|
||||
$.getJSON("'.dirname(self::$currentIndex).'/ajax.php",{ajaxReferrers:1, ajaxProductFilter:1,id_employee:'.(int)$context->employee->id.',token:"'.Tools::getValue('token').'",id_referrer:'.$referrer->id.',id_product:id_product},
|
||||
function(j) {';
|
||||
foreach ($displayTab as $key => $value)
|
||||
echo '$("#'.$key.'").html(j[0].'.$key.');';
|
||||
@@ -412,8 +406,8 @@ class AdminReferrers extends AdminTab
|
||||
{
|
||||
var form = document.layers ? document.forms.product : document.product;
|
||||
var filter = form.filterProduct.value;
|
||||
$.getJSON("'.dirname($currentIndex).'/ajax.php",
|
||||
{ajaxReferrers:1,ajaxFillProducts:1,id_employee:'.(int)($cookie->id_employee).',token:"'.Tools::getValue('token').'",id_lang:'.(int)($cookie->id_lang).',filter:filter},
|
||||
$.getJSON("'.dirname(self::$currentIndex).'/ajax.php",
|
||||
{ajaxReferrers:1,ajaxFillProducts:1,id_employee:'.(int)$context->employee->id.',token:"'.Tools::getValue('token').'",id_lang:'.(int)$context->language->id.',filter:filter},
|
||||
function(j) {
|
||||
|
||||
form.selectProduct.length = j.length + 1;
|
||||
@@ -447,8 +441,6 @@ class AdminReferrers extends AdminTab
|
||||
|
||||
public function displayListContent($token = NULL)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$irow = 0;
|
||||
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
if ($this->_list)
|
||||
|
||||
Reference in New Issue
Block a user