// Context part 25

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7794 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-07-28 14:17:58 +00:00
parent a1a32714ab
commit d3b2ff2664
55 changed files with 432 additions and 535 deletions
+3 -4
View File
@@ -63,13 +63,12 @@ class AdminAccess extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
$currentProfile = (int)($this->getCurrentProfileId());
$tabs = Tab::getTabs($context->language->id);
$profiles = Profile::getProfiles($context->language->id);
$accesses = Profile::getProfileAccesses($context->language->id);
$tabs = Tab::getTabs($this->context->language->id);
$profiles = Profile::getProfiles($this->context->language->id);
$accesses = Profile::getProfileAccesses($this->context->language->id);
echo '
<script type="text/javascript">
+6 -8
View File
@@ -35,7 +35,6 @@ class AdminAddresses extends AdminTab
public function __construct()
{
$context = Context::getContext();
$this->table = 'address';
$this->className = 'Address';
$this->lang = false;
@@ -43,14 +42,15 @@ class AdminAddresses extends AdminTab
$this->delete = true;
$this->requiredDatabase = true;
$this->addressType = 'customer';
$this->context = Context::getContext();
if (!Tools::getValue('realedit'))
$this->deleted = true;
$this->_select = 'cl.`name` as country';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON
(cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$context->language->id.')';
(cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.')';
$countries = Country::getCountries($context->language->id);
$countries = Country::getCountries($this->context->language->id);
foreach ($countries AS $country)
$this->countriesArray[$country['id_country']] = $country['name'];
@@ -161,10 +161,9 @@ class AdminAddresses extends AdminTab
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL, $id_lang_shop = NULL)
{
parent::getList($id_lang, $orderBy, $orderWay, $start, $limit);
$context = Context::getContext();
/* Manage default params values */
if (empty($limit))
$limit = ((!isset($context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $context->cookie->{$this->table.'_pagination'});
$limit = ((!isset($this->context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $this->context->cookie->{$this->table.'_pagination'});
if (!Validate::isTableOrIdentifier($this->table))
die('filter is corrupted');
@@ -173,7 +172,7 @@ class AdminAddresses extends AdminTab
if (empty($orderWay))
$orderWay = Tools::getValue($this->table.'Orderway', 'ASC');
$limit = (int)(Tools::getValue('pagination', $limit));
$context->cookie->{$this->table.'_pagination'} = $limit;
$this->context->cookie->{$this->table.'_pagination'} = $limit;
/* Check params validity */
if (!Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay)
@@ -224,7 +223,6 @@ class AdminAddresses extends AdminTab
public function displayForm($isMainTab = true)
{
parent::displayForm();
$context = Context::getContext();
if (!($obj = $this->loadObject(true)))
return;
@@ -256,7 +254,7 @@ class AdminAddresses extends AdminTab
if ($obj->id)
{
$customer = new Customer($obj->id_customer);
$tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id);
$tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id);
echo '
<label>'.$this->l('Customer').'</label>
<div class="margin-form"><a style="display: block; padding-top: 4px;" href="?tab=AdminCustomers&id_customer='.$customer->id.'&viewcustomer&token='.$tokenCustomer.'">'.$customer->lastname.' '.$customer->firstname.' ('.$customer->email.')</a></div>
+5 -8
View File
@@ -101,8 +101,7 @@ class AdminAttributeGenerator extends AdminTab
static private function displayAndReturnAttributeJs()
{
$context = Context::getContext();
$attributes = Attribute::getAttributes($context->language->id, true);
$attributes = Attribute::getAttributes($this->context->language->id, true);
$attributeJs = array();
foreach ($attributes AS $k => $attribute)
$attributeJs[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
@@ -175,9 +174,8 @@ class AdminAttributeGenerator extends AdminTab
private function displayGroupeTable($attributeJs, $attributesGroups)
{
$context = Context::getContext();
$combinationsGroups = $this->product->getAttributesGroups($context->language->id);
$combinationsGroups = $this->product->getAttributesGroups($this->context->language->id);
$attributes = array();
$impacts = self::getAttributesImpacts($this->product->id);
foreach ($combinationsGroups AS &$combination)
@@ -202,7 +200,7 @@ class AdminAttributeGenerator extends AdminTab
<thead>
<tr>
<th id="tab_h1" style="width: 150px">'.htmlspecialchars(stripslashes($attributeGroup['name'])).'</th>
<th id="tab_h2" style="width: 350px" colspan="2">'.$this->l('Price impact').' ('.$context->currency->sign.')'.'</th>
<th id="tab_h2" style="width: 350px" colspan="2">'.$this->l('Price impact').' ('.$this->context->currency->sign.')'.'</th>
<th style="width: 150px">'.$this->l('Weight impact').' ('.Configuration::get('PS_WEIGHT_UNIT').')'.'</th>
</tr>
</thead>
@@ -218,11 +216,10 @@ class AdminAttributeGenerator extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
$jsAttributes = self::displayAndReturnAttributeJs();
$attributesGroups = AttributeGroup::getAttributesGroups($context->language->id);
$attributesGroups = AttributeGroup::getAttributesGroups($this->context->language->id);
$this->product = new Product((int)(Tools::getValue('id_product')));
// JS Init
@@ -272,7 +269,7 @@ class AdminAttributeGenerator extends AdminTab
<script type="text/javascript" src="../js/attributesBack.js"></script>
<form enctype="multipart/form-data" method="post" id="generator" action="'.self::$currentIndex.'&&id_product='.(int)(Tools::getValue('id_product')).'&id_category='.(int)(Tools::getValue('id_category')).'&attributegenerator&token='.Tools::getValue('token').'">
<fieldset style="margin-bottom: 35px;"><legend><img src="../img/admin/asterisk.gif" />'.$this->l('Attributes generator').'</legend>'.
$this->l('Add or modify attributes for product:').' <b>'.$this->product->name[$context->language->id].'</b>
$this->l('Add or modify attributes for product:').' <b>'.$this->product->name[$this->context->language->id].'</b>
<br /><br />
';
echo '
+2 -3
View File
@@ -184,7 +184,6 @@ class AdminBackup extends AdminTab
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL, $id_lang_shop = NULL)
{
$context = Context::getContext();
if (!Validate::isTableOrIdentifier($this->table))
die('filter is corrupted');
@@ -217,9 +216,9 @@ class AdminBackup extends AdminTab
$orderWay = 'desc';
}
if (empty($limit))
$limit = ((!isset($context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $context->cookie->{$this->table.'_pagination'});
$limit = ((!isset($this->context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $this->context->cookie->{$this->table.'_pagination'});
$limit = (int)(Tools::getValue('pagination', $limit));
$context->cookie->{$this->table.'_pagination'} = $limit;
$this->context->cookie->{$this->table.'_pagination'} = $limit;
/* Determine offset from current page */
if (!empty($_POST['submitFilter'.$this->table]) AND is_numeric($_POST['submitFilter'.$this->table]))
+7 -10
View File
@@ -75,7 +75,6 @@ class AdminCMS extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
$obj = $this->loadObject(true);
@@ -91,7 +90,7 @@ class AdminCMS extends AdminTab
echo '<label>'.$this->l('CMS Category:').' </label>
<div class="margin-form">
<select name="id_cms_category">';
$categories = CMSCategory::getCategories($context->language->id, false);
$categories = CMSCategory::getCategories($this->context->language->id, false);
CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($obj, 'id_cms_category'));
echo '
</select>
@@ -167,7 +166,7 @@ class AdminCMS extends AdminTab
'.$this->_displayDraftWarning($obj->active).'
</form>';
// TinyMCE
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$context->language->iso_code.'.js') ? $context->language->iso_code : 'en');
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$this->context->language->iso_code.'.js') ? $this->context->language->iso_code : 'en');
$ad = dirname($_SERVER["PHP_SELF"]);
echo '
<script type="text/javascript">
@@ -181,11 +180,10 @@ class AdminCMS extends AdminTab
public function display($token = NULL)
{
$context = Context::getContext();
if (($id_cms_category = (int)Tools::getValue('id_cms_category')))
self::$currentIndex .= '&id_cms_category='.$id_cms_category;
$this->getList($context->language->id, !$context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL);
$this->getList($this->context->language->id, !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL);
if (!$id_cms_category)
$id_cms_category = 1;
@@ -213,10 +211,9 @@ class AdminCMS extends AdminTab
function postProcess()
{
$context = Context::getContext();
if (Tools::isSubmit('viewcms') AND ($id_cms = (int)(Tools::getValue('id_cms'))) AND $cms = new CMS($id_cms, $context->language->id) AND Validate::isLoadedObject($cms))
if (Tools::isSubmit('viewcms') AND ($id_cms = (int)(Tools::getValue('id_cms'))) AND $cms = new CMS($id_cms, $this->context->language->id) AND Validate::isLoadedObject($cms))
{
$redir = $context->link->getCMSLink($cms);
$redir = $this->context->link->getCMSLink($cms);
if (!$cms->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
@@ -276,7 +273,7 @@ class AdminCMS extends AdminTab
$this->_errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.' ('.Db::getInstance()->getMsgError().')</b>';
elseif (Tools::isSubmit('submitAddcmsAndPreview'))
{
$preview_url = $context->link->getCMSLink($cms, $this->getFieldValue($object, 'link_rewrite', $this->_defaultFormLanguage), $context->language->id);
$preview_url = $this->context->link->getCMSLink($cms, $this->getFieldValue($object, 'link_rewrite', $this->_defaultFormLanguage), $this->context->language->id);
if (!$cms->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
@@ -298,7 +295,7 @@ class AdminCMS extends AdminTab
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.' ('.Db::getInstance()->getMsgError().')</b>';
elseif (Tools::isSubmit('submitAddcmsAndPreview'))
{
$preview_url = $context->link->getCMSLink($cms, $this->getFieldValue($object, 'link_rewrite', $this->_defaultFormLanguage), $context->language->id);
$preview_url = $this->context->link->getCMSLink($cms, $this->getFieldValue($object, 'link_rewrite', $this->_defaultFormLanguage), $this->context->language->id);
if (!$cms->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
+3 -6
View File
@@ -74,10 +74,9 @@ class AdminCMSCategories extends AdminTab
public function display($token = NULL)
{
$context = Context::getContext();
$id_cms_category = (int)(Tools::getValue('id_cms_category', 1));
$this->getList((int)($context->cookie->id_lang), !$context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL);
$this->getList((int)($this->context->cookie->id_lang), !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$this->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>
@@ -88,8 +87,7 @@ class AdminCMSCategories extends AdminTab
public function postProcess($token = NULL)
{
$context = Context::getContext();
$this->tabAccess = Profile::getProfileAccess($context->employee->id_profile, $this->id);
$this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id);
if (Tools::isSubmit('submitAdd'.$this->table))
{
@@ -191,7 +189,6 @@ class AdminCMSCategories extends AdminTab
public function displayForm($token=NULL)
{
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -222,7 +219,7 @@ class AdminCMSCategories extends AdminTab
<label>'.$this->l('Parent CMS Category:').' </label>
<div class="margin-form">
<select name="id_parent">';
$categories = CMSCategory::getCategories($context->language->id, false);
$categories = CMSCategory::getCategories($this->context->language->id, false);
CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($obj, 'id_parent'));
echo '
</select>
+6 -7
View File
@@ -60,7 +60,6 @@ class AdminCarts extends AdminTab
{
if (!($cart = $this->loadObject(true)))
return;
$context = Context::getContext();
$customer = new Customer($cart->id_customer);
$customerStats = $customer->getStats();
$products = $cart->getProducts();
@@ -82,9 +81,9 @@ class AdminCarts extends AdminTab
<span style="font-weight: bold; font-size: 14px;">';
if ($customer->id)
echo '
<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="?tab=AdminCustomers&id_customer='.$customer->id.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id).'"> '.$customer->firstname.' '.$customer->lastname.'</a></span> ('.$this->l('#').$customer->id.')<br />
(<a href="mailto:'.$customer->email.'">'.$customer->email.'</a>)<br /><br />
'.$this->l('Account registered:').' '.Tools::displayDate($customer->date_add, $context->language->id, true).'<br />
'.$this->l('Account registered:').' '.Tools::displayDate($customer->date_add, $this->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($customerStats['total_orders'], $currency, false).'</b><br />';
else
@@ -119,9 +118,9 @@ class AdminCarts extends AdminTab
<span style="font-weight: bold; font-size: 14px;">';
if ($order->id)
echo '
<a href="?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id).'"> '.$this->l('Order #').sprintf('%06d', $order->id).'</a></span>
<a href="?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id).'"> '.$this->l('Order #').sprintf('%06d', $order->id).'</a></span>
<br /><br />
'.$this->l('Made on:').' '.Tools::displayDate($order->date_add, $context->language->id, true).'<br /><br /><br /><br />';
'.$this->l('Made on:').' '.Tools::displayDate($order->date_add, $this->context->language->id, true).'<br /><br /><br /><br />';
else
echo $this->l('No order created from this cart').'</span>';
echo '</fieldset>';
@@ -144,7 +143,7 @@ class AdminCarts extends AdminTab
<th style="width: 30px; text-align: center">'.$this->l('Stock').'</th>
<th style="width: 90px; text-align: right; font-weight:bold;">'.$this->l('Total').'</th>
</tr>';
$tokenCatalog = Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id);
$tokenCatalog = Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id);
foreach ($products as $k => $product)
{
if ($order->getTaxCalculationMethod() == PS_TAX_EXC)
@@ -235,7 +234,7 @@ class AdminCarts extends AdminTab
foreach ($discounts as $discount)
echo '
<tr>
<td><a href="?tab=AdminDiscounts&id_discount='.$discount['id_discount'].'&updatediscount&token='.Tools::getAdminToken('AdminDiscounts'.(int)(Tab::getIdFromClassName('AdminDiscounts')).(int)$context->employee->id).'">'.$discount['name'].'</a></td>
<td><a href="?tab=AdminDiscounts&id_discount='.$discount['id_discount'].'&updatediscount&token='.Tools::getAdminToken('AdminDiscounts'.(int)(Tab::getIdFromClassName('AdminDiscounts')).(int)$this->context->employee->id).'">'.$discount['name'].'</a></td>
<td align="center">- '.Tools::displayPrice($discount['value_real'], $currency, false).'</td>
</tr>';
echo '
+7 -10
View File
@@ -73,9 +73,8 @@ class AdminCategories extends AdminTab
public function display($token = NULL)
{
$context = Context::getContext();
$this->getList((int)($context->language->id), !$context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL, 0, NULL, $context->shop->getID(true));
$this->getList((int)($this->context->language->id), !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL, 0, NULL, $this->context->shop->getID(true));
echo '<h3>'.(!$this->_listTotal ? ($this->l('There are no subcategories')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('subcategories') : $this->l('subcategory')))).' '.$this->l('in category').' "'.stripslashes($this->_category->getName()).'"</h3>';
if ($this->tabAccess['add'] === '1')
echo '<a href="'.__PS_BASE_URI__.substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)).'?tab=AdminCatalog&add'.$this->table.'&id_parent='.$this->_category->id.'&token='.($token!=NULL ? $token : $this->token).'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new subcategory').'</a>';
@@ -86,8 +85,7 @@ class AdminCategories extends AdminTab
public function postProcess($token = NULL)
{
$context = Context::getContext();
$this->tabAccess = Profile::getProfileAccess($context->employee->id_profile, $this->id);
$this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id);
if (Tools::isSubmit('submitAdd'.$this->table))
{
@@ -185,13 +183,12 @@ class AdminCategories extends AdminTab
{
parent::displayForm();
$context = Context::getContext();
if (!($obj = $this->loadObject(true)))
return;
$active = $this->getFieldValue($obj, 'active');
$customer_groups = $obj->getGroups();
if ($context->shop->getContextType() == Shop::CONTEXT_SHOP)
$id_category = $context->shop->getCategory();
if ($this->context->shop->getContextType() == Shop::CONTEXT_SHOP)
$id_category = $this->context->shop->getCategory();
else
$id_category = (int)Tools::getValue('id_parent');
@@ -219,7 +216,7 @@ class AdminCategories extends AdminTab
<label>'.$this->l('Parent category:').' </label>
<div class="margin-form">
<select name="id_parent">';
$categories = Category::getCategories((int)$context->language->id, false);
$categories = Category::getCategories((int)$this->context->language->id, false);
Category::recurseCategory($categories, $categories[0][1], 1, ($obj->id ? $this->getFieldValue($obj, 'id_parent') : $id_category));
echo '
</select>
@@ -235,7 +232,7 @@ class AdminCategories extends AdminTab
</div>
<label>'.$this->l('Image:').' </label>
<div class="margin-form">';
echo $this->displayImage($obj->id, _PS_IMG_DIR_.'c/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).$context->employee->id), true);
echo $this->displayImage($obj->id, _PS_IMG_DIR_.'c/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).$this->context->employee->id), true);
echo ' <br /><input type="file" name="image" />
<p>'.$this->l('Upload category logo from your computer').'</p>
</div>
@@ -280,7 +277,7 @@ class AdminCategories extends AdminTab
</div>
<label>'.$this->l('Groups access:').' </label>
<div class="margin-form">';
$groups = Group::getGroups((int)($context->language->id));
$groups = Group::getGroups((int)($this->context->language->id));
if (sizeof($groups))
{
echo '
+4 -5
View File
@@ -44,14 +44,14 @@ class AdminContact extends AdminPreferences
private function _getDefaultFieldsContent()
{
$context = Context::getContext();
$this->context = Context::getContext();
$countryList = array();
$countryList[] = array('id' => '0', 'name' => $this->l('Choose your country'));
foreach (Country::getCountries($context->language->id) AS $country)
foreach (Country::getCountries($this->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($context->language->id) AS $state)
foreach (State::getStates($this->context->language->id) AS $state)
$stateList[] = array('id' => $state['id_state'], 'name' => $state['name']);
$formFields = array(
@@ -108,10 +108,9 @@ class AdminContact extends AdminPreferences
protected function _postConfig($fields)
{
$context = Context::getContext();
if (!$this->_errors && isset($_POST['PS_SHOP_COUNTRY_ID']))
{
$country = new Country($_POST['PS_SHOP_COUNTRY_ID'], $context->language->id);
$country = new Country($_POST['PS_SHOP_COUNTRY_ID'], $this->context->language->id);
Configuration::updateValue('PS_SHOP_COUNTRY', pSQL($country->name));
}
if (!$this->_errors && isset($_POST['PS_SHOP_STATE_ID']))
+1 -2
View File
@@ -106,7 +106,6 @@ class AdminCounty extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -132,7 +131,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($context->language->id, true, true);
$countries = Country::getCountries($this->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')).');">';
+28 -32
View File
@@ -29,7 +29,7 @@ class AdminCustomerThreads extends AdminTab
{
public function __construct()
{
$context = Context::getContext();
$this->context = Context::getContext();
$this->table = 'customer_thread';
$this->lang = false;
$this->className = 'CustomerThread';
@@ -47,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)$context->language->id.')';
LEFT JOIN `'._DB_PREFIX_.'contact_lang` cl ON (cl.`id_contact` = a.`id_contact` AND cl.`id_lang` = '.(int)$this->context->language->id.')';
$contactArray = array();
$contacts = Contact::getContacts($context->language->id);
$contacts = Contact::getContacts($this->context->language->id);
foreach ($contacts AS $contact)
$contactArray[$contact['id_contact']] = $contact['name'];
@@ -91,7 +91,6 @@ class AdminCustomerThreads extends AdminTab
public function postProcess()
{
$context = Context::getContext();
if ($id_customer_thread = (int)Tools::getValue('id_customer_thread'))
{
@@ -109,7 +108,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)$context->language->id.')
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$this->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').'
@@ -119,10 +118,10 @@ class AdminCustomerThreads extends AdminTab
$output .= $this->displayMsg($message, true, (int)Tools::getValue('id_employee_forward'));
$cm = new CustomerMessage();
$cm->id_employee = (int)$context->employee->id;
$cm->id_employee = (int)$this->context->employee->id;
$cm->id_customer_thread = (int)Tools::getValue('id_customer_thread');
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
$currentEmployee = $context->employee;
$currentEmployee = $this->context->employee;
if (($id_employee = (int)Tools::getValue('id_employee_forward')) AND ($employee = new Employee($id_employee)) AND Validate::isLoadedObject($employee))
{
$params = array(
@@ -130,7 +129,7 @@ class AdminCustomerThreads extends AdminTab
'{employee}' => $currentEmployee->firstname.' '.$currentEmployee->lastname,
'{comment}' => stripslashes($_POST['message_forward']));
if (Mail::Send($context->language->id, 'forward_msg', Mail::l('Fwd: Customer message'), $params,
if (Mail::Send($this->context->language->id, 'forward_msg', Mail::l('Fwd: Customer message'), $params,
$employee->email, $employee->firstname.' '.$employee->lastname,
$currentEmployee->email, $currentEmployee->firstname.' '.$currentEmployee->lastname,
NULL, NULL, _PS_MAIL_DIR_, true))
@@ -162,7 +161,7 @@ class AdminCustomerThreads extends AdminTab
{
$ct = new CustomerThread($id_customer_thread);
$cm = new CustomerMessage();
$cm->id_employee = (int)$context->employee->id;
$cm->id_employee = (int)$this->context->employee->id;
$cm->id_customer_thread = $ct->id;
$cm->message = Tools::htmlentitiesutf8(Tools::nl2br(Tools::getValue('reply_message')));
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
@@ -179,7 +178,7 @@ class AdminCustomerThreads extends AdminTab
}
$params = array(
'{reply}' => Tools::nl2br(Tools::getValue('reply_message')),
'{link}' => Tools::url($context->link->getPageLink('contact', true), 'id_customer_thread='.(int)($ct->id).'&token='.$ct->token),
'{link}' => Tools::url($this->context->link->getPageLink('contact', true), 'id_customer_thread='.(int)($ct->id).'&token='.$ct->token),
);
if (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, NULL,
@@ -200,7 +199,6 @@ class AdminCustomerThreads extends AdminTab
public function display()
{
$context = Context::getContext();
if (isset($_GET['filename']) AND file_exists(_PS_UPLOAD_DIR_.$_GET['filename']))
self::openUploadedFile();
@@ -208,14 +206,13 @@ class AdminCustomerThreads extends AdminTab
$this->viewcustomer_thread();
else
{
$this->getList($context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_upd' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
$this->getList($this->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)
{
$context = Context::getContext();
$contacts = Db::getInstance()->ExecuteS('
SELECT cl.*, COUNT(*) as total, (
SELECT id_customer_thread
@@ -225,13 +222,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 = '.(int)$context->language->id.')
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$this->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 = '.(int)$context->language->id.')
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$this->context->language->id.')
WHERE ct.customer_service = 1');
$dim = count($categories);
@@ -298,9 +295,8 @@ class AdminCustomerThreads extends AdminTab
}
private function displayMsg($message, $email = false, $id_employee = null)
{
$context = Context::getContext();
$customersToken = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id);
$contacts = Contact::getContacts($context->language->id);
$customersToken = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id);
$contacts = Contact::getContacts($this->context->language->id);
if (!$email)
{
@@ -329,21 +325,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'], $context->language->id, true).'<br />'.(
<b>'.$this->l('Sent on:').'</b> '.Tools::displayDate($message['date_add'], $this->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)$context->employee->id).'&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)$this->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)$context->employee->id).'" 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)$this->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)$context->employee->id).'" 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)$this->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">
@@ -409,10 +405,10 @@ class AdminCustomerThreads extends AdminTab
public function viewcustomer_thread()
{
$context = Context::getContext();
$this->context = Context::getContext();
if (!($thread = $this->loadObject()))
return;
$context->cookie->{'customer_threadFilter_cl!id_contact'} = $thread->id_contact;
$this->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
@@ -453,7 +449,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)$context->language->id.')
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$this->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').'
@@ -468,8 +464,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
)
'.($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'} : '').
'.($this->context->cookie->{'customer_threadFilter_cl!id_contact'} ? 'AND ct.id_contact = '.(int)$this->context->cookie->{'customer_threadFilter_cl!id_contact'} : '').'
'.($this->context->cookie->{'customer_threadFilter_l!id_lang'} ? 'AND ct.id_lang = '.(int)$this->context->cookie->{'customer_threadFilter_l!id_lang'} : '').
' ORDER BY ct.date_upd ASC');
if ($nextThread)
@@ -529,7 +525,7 @@ class AdminCustomerThreads extends AdminTab
{
$totalOK = 0;
$ordersOK = array();
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id);
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id);
foreach ($orders as $order)
if ($order['valid'])
{
@@ -554,7 +550,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'], $context->language->id).'</td>
<td>'.Tools::displayDate($order['date_add'], $this->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>
@@ -562,7 +558,7 @@ class AdminCustomerThreads extends AdminTab
<td align="center"><a href="?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.$tokenOrders.'"><img src="../img/admin/details.gif" /></a></td>
</tr>';
echo '</table>
<h3 style="color:green;font-weight:700;margin-top:10px">'.$this->l('Validated Orders:').' '.$countOK.' '.$this->l('for').' '.Tools::displayPrice($totalOK, $context->currency).'</h3>
<h3 style="color:green;font-weight:700;margin-top:10px">'.$this->l('Validated Orders:').' '.$countOK.' '.$this->l('for').' '.Tools::displayPrice($totalOK, $this->context->currency).'</h3>
</div>';
}
}
@@ -579,11 +575,11 @@ class AdminCustomerThreads extends AdminTab
<th class="center">'.$this->l('Actions').'</th>
</tr>';
$irow = 0;
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id);
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->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'], $context->language->id, true).'</td>
<td>'.Tools::displayDate($product['date_add'], $this->context->language->id, true).'</td>
<td>'.$product['product_id'].'</td>
<td>'.$product['product_name'].'</td>
<td align="right">'.$product['product_quantity'].'</td>
+21 -22
View File
@@ -261,9 +261,8 @@ class AdminCustomers extends AdminTab
public function viewcustomer()
{
$context = Context::getContext();
$irow = 0;
$defaultLanguage = $context->language->id;
$defaultLanguage = $this->context->language->id;
if (!($customer = $this->loadObject()))
return;
$customerStats = $customer->getStats();
@@ -289,8 +288,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, $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 />
'.$this->l('Registration date:').' '.Tools::displayDate($customer->date_add, $this->context->language->id, true).'<br />
'.$this->l('Last visit:').' '.($customerStats['last_visit'] ? Tools::displayDate($customerStats['last_visit'], $this->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>
@@ -300,8 +299,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, $context->language->id).')' : $this->l('unknown')).'<br /><br />
'.$this->l('Last update:').' '.Tools::displayDate($customer->date_upd, $context->language->id, true).'<br />
'.$this->l('Age:').' '.$customerStats['age'].' '.((!empty($customer->birthday['age'])) ? '('.Tools::displayDate($customer->birthday, $this->context->language->id).')' : $this->l('unknown')).'<br /><br />
'.$this->l('Last update:').' '.Tools::displayDate($customer->date_upd, $this->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())
{
@@ -372,7 +371,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'], $context->language->id, true).'</td>
<td>'.Tools::displayDate($message['date_add'], $this->context->language->id, true).'</td>
</tr>';
echo '</table>
<div class="clear">&nbsp;</div>';
@@ -395,7 +394,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)$context->employee->id);
$tokenGroups = Tools::getAdminToken('AdminGroups'.(int)(Tab::getIdFromClassName('AdminGroups')).(int)$this->context->employee->id);
foreach ($groups AS $group)
{
$objGroup = new Group($group);
@@ -416,7 +415,7 @@ class AdminCustomers extends AdminTab
$totalOK = 0;
$ordersOK = array();
$ordersKO = array();
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)Tab::getIdFromClassName('AdminOrders').(int)$context->employee->id);
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)Tab::getIdFromClassName('AdminOrders').(int)$this->context->employee->id);
foreach ($orders AS $order)
if ($order['valid'])
{
@@ -439,11 +438,11 @@ class AdminCustomers extends AdminTab
$orderFoot = '</table>';
if ($countOK = sizeof($ordersOK))
{
echo '<div style="float:left;margin-right:20px"><h3 style="color:green;font-weight:700">'.$this->l('Valid orders:').' '.$countOK.' '.$this->l('for').' '.Tools::displayPrice($totalOK, $context->currency->id).'</h3>'.$orderHead;
echo '<div style="float:left;margin-right:20px"><h3 style="color:green;font-weight:700">'.$this->l('Valid orders:').' '.$countOK.' '.$this->l('for').' '.Tools::displayPrice($totalOK, $this->context->currency->id).'</h3>'.$orderHead;
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'], $context->language->id).'</td>
<td>'.Tools::displayDate($order['date_add'], $this->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>
@@ -459,7 +458,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'], $context->language->id).'</td>
<td>'.Tools::displayDate($order['date_add'], $this->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>
@@ -483,11 +482,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)$context->employee->id);
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->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'], $context->language->id, true).'</td>
<td>'.Tools::displayDate($product['date_add'], $this->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>
@@ -509,7 +508,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)$context->employee->id);
$tokenAddresses = Tools::getAdminToken('AdminAddresses'.(int)(Tab::getIdFromClassName('AdminAddresses')).(int)$this->context->employee->id);
foreach ($addresses AS $address)
echo '
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').'>
@@ -543,7 +542,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)$context->employee->id);
$tokenDiscounts = Tools::getAdminToken('AdminDiscounts'.(int)(Tab::getIdFromClassName('AdminDiscounts')).(int)$this->context->employee->id);
foreach ($discounts AS $discount)
{
echo '
@@ -581,7 +580,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)$context->employee->id);
$tokenCarts = Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)$this->context->employee->id);
foreach ($carts AS $cart)
{
$cartI = new Cart((int)($cart['id_cart']));
@@ -591,7 +590,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'], $context->language->id, true).'</td>
<td>'.Tools::displayDate($cart['date_add'], $this->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>
@@ -622,8 +621,8 @@ class AdminCustomers extends AdminTab
<table cellspacing="0" cellpadding="0" class="table">';
foreach ($interested as $p)
{
$product = new Product($p['id_product'], false, $context->language->id, $p['id_shop']);
$url = $context->link->getProductLink($product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, $context->language->id), null, null, $p['cp_id_shop']);
$product = new Product($p['id_product'], false, $this->context->language->id, $p['id_shop']);
$url = $this->context->link->getProductLink($product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, $this->context->language->id), null, null, $p['cp_id_shop']);
echo '
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \''.$url.'\'">
<td>'.(int)$product->id.'</td>
@@ -651,7 +650,7 @@ class AdminCustomers extends AdminTab
</tr>';
foreach ($connections as $connection)
echo '<tr>
<td>'.Tools::displayDate($connection['date_add'], $context->language->id, true).'</td>
<td>'.Tools::displayDate($connection['date_add'], $this->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>
@@ -671,7 +670,7 @@ class AdminCustomers extends AdminTab
</tr>';
foreach ($referrers as $referrer)
echo '<tr>
<td>'.Tools::displayDate($referrer['date_add'], $context->language->id, true).'</td>
<td>'.Tools::displayDate($referrer['date_add'], $this->context->language->id, true).'</td>
<td>'.$referrer['name'].'</td>
'.((Tools::isMultiShopActivated())? '<td>'.$referrer['shop_name'].'</td>' : '').'
</tr>';
+5 -6
View File
@@ -29,7 +29,7 @@ class AdminDiscounts extends AdminTab
{
public function __construct()
{
$context = Context::getContext();
$this->context = Context::getContext();
$this->table = 'discount';
$this->className = 'Discount';
$this->lang = true;
@@ -42,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)$context->language->id.')';
LEFT JOIN `'._DB_PREFIX_.'discount_type_lang` dtl ON (dt.`id_discount_type` = dtl.`id_discount_type` AND dtl.`id_lang` = '.(int)$this->context->language->id.')';
$typesArray = array();
$types = Discount::getDiscountTypes($context->language->id);
$types = Discount::getDiscountTypes($this->context->language->id);
foreach ($types AS $type)
$typesArray[$type['id_discount_type']] = $type['name'];
@@ -179,7 +179,6 @@ class AdminDiscounts extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -231,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($context->language->id);
$discountTypes = Discount::getDiscountTypes($this->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>';
@@ -283,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($context->language->id, false);
$categories = Category::getCategories($this->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);
+1 -2
View File
@@ -31,11 +31,10 @@ class AdminEmails extends AdminPreferences
{
public function __construct()
{
$context = Context::getContext();
$this->className = 'Configuration';
$this->table = 'configuration';
foreach (Contact::getContacts($context->language->id) AS $contact)
foreach (Contact::getContacts($this->context->language->id) AS $contact)
$arr[] = array('email_message' => $contact['id_contact'], 'name' => $contact['name']);
$this->_fieldsEmail = array(
+6 -7
View File
@@ -32,7 +32,7 @@ class AdminEmployees extends AdminTab
public function __construct()
{
$context = Context::getContext();
$this->context = Context::getContext();
$this->table = 'employee';
$this->className = 'Employee';
$this->lang = false;
@@ -40,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)$context->language->id.')';
LEFT JOIN `'._DB_PREFIX_.'profile_lang` pl ON (pl.`id_profile` = p.`id_profile` AND pl.`id_lang` = '.(int)$this->context->language->id.')';
$profiles = Profile::getProfiles($context->language->id);
$profiles = Profile::getProfiles($this->context->language->id);
if (!$profiles)
$this->_errors[] = Tools::displayError('No profile');
else
@@ -82,12 +82,11 @@ class AdminEmployees extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
$profiles = Profile::getProfiles($context->language->id);
$profiles = Profile::getProfiles($this->context->language->id);
echo '<script type="text/javascript" src="'._PS_JS_DIR_.'/jquery/jquery-colorpicker.js"></script>
<script type="text/javascript">
@@ -176,10 +175,10 @@ class AdminEmployees extends AdminTab
public function postProcess()
{
$context = Context::getContext();
$this->context = Context::getContext();
if (Tools::isSubmit('deleteemployee') OR Tools::isSubmit('status') OR Tools::isSubmit('statusemployee'))
{
if ($context->employee->id == Tools::getValue('id_employee'))
if ($this->context->employee->id == Tools::getValue('id_employee'))
{
$this->_errors[] = Tools::displayError('You cannot disable or delete your own account.');
return false;
+1 -2
View File
@@ -178,8 +178,7 @@ class AdminFeatures extends AdminTab
public function postProcess()
{
$context = Context::getContext();
$this->adminFeaturesValues->tabAccess = Profile::getProfileAccess($context->employee->id_profile, $this->id);
$this->adminFeaturesValues->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id);
$this->adminFeaturesValues->postProcess($this->token);
if(Tools::getValue('submitDel'.$this->table))
+2 -2
View File
@@ -29,7 +29,7 @@ class AdminGeolocation extends AdminTab
{
public function display()
{
$context = Context::getContext();
$this->context = Context::getContext();
echo '
<h2>'.$this->l('Geolocation').'</h2>
';
@@ -97,7 +97,7 @@ class AdminGeolocation extends AdminTab
</thead>
<tbody>
';
foreach (Country::getCountries($context->language->id) AS $country)
foreach (Country::getCountries($this->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>
+9 -10
View File
@@ -58,13 +58,12 @@ class AdminGroups extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
$groupReductions = $obj->id ? GroupReduction::getGroupReductions($obj->id, $context->language->id) : array();
$categories = Category::getSimpleCategories($context->language->id);
$groupReductions = $obj->id ? GroupReduction::getGroupReductions($obj->id, $this->context->language->id) : array();
$categories = Category::getSimpleCategories($this->context->language->id);
echo '
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
@@ -167,7 +166,7 @@ class AdminGroups extends AdminTab
public function viewgroup()
{
$context = Context::getContext();
$this->context = Context::getContext();
self::$currentIndex = 'index.php?tab=AdminGroups';
if (!($obj = $this->loadObject(true)))
return;
@@ -175,7 +174,7 @@ class AdminGroups extends AdminTab
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)$context->language->id]).'</span>
<span style="font-weight: bold; font-size: 14px;">'.strval($obj->name[(int)$this->context->language->id]).'</span>
<div class="clear">&nbsp;</div>
'.$this->l('Discount:').' '.(float)($obj->reduction).$this->l('%').'
</fieldset>
@@ -257,16 +256,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'], $context->language->id).'</td>
<td>'.Tools::displayDate($customer['date_add'], $context->language->id).'</td>
<td>'.Tools::displayDate($customer['birthday'], $this->context->language->id).'</td>
<td>'.Tools::displayDate($customer['date_add'], $this->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)$context->employee->id).'">
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->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)$context->employee->id).'">
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&addcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->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)$context->employee->id).'" 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)$this->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>';
+3 -4
View File
@@ -151,13 +151,12 @@ class AdminHome extends AdminTab
public function display()
{
$context = Context::getContext();
$this->warnDomainName();
$tab = get_class();
$protocol = (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off')?'https':'http';
$isoUser = $context->language->iso_code;
$currency = $context->currency;
$isoUser = $this->context->language->iso_code;
$currency = $this->context->currency;
echo '<div>
<h1>'.$this->l('Dashboard').'</h1>
<hr style="background-color: #812143;color: #812143;" />
@@ -177,7 +176,7 @@ class AdminHome extends AdminTab
}
echo '</div>';
if ($context->employee->show_screencast)
if ($this->context->employee->show_screencast)
echo'
<div id="adminpresentation">
<iframe src="'.$protocol.'://screencasts.prestashop.com/screencast.php?iso_lang='.Tools::strtolower($isoUser).'" style="border:none;width:100%;height:420px;" scrolling="no"></iframe>
+3 -4
View File
@@ -799,7 +799,7 @@ class AdminImport extends AdminTab
$specificPrice = new SpecificPrice();
$specificPrice->id_product = (int)($product->id);
// @todo multishop specific price import
$specificPrice->id_shop = $context->shop->getID(true);
$specificPrice->id_shop = $this->context->shop->getID(true);
$specificPrice->id_currency = 0;
$specificPrice->id_country = 0;
$specificPrice->id_group = 0;
@@ -860,7 +860,7 @@ class AdminImport extends AdminTab
if (isset($product->image) AND is_array($product->image) and sizeof($product->image))
{
$productHasImages = (bool)Image::getImages($context->language->id, (int)($product->id));
$productHasImages = (bool)Image::getImages($this->context->language->id, (int)($product->id));
foreach ($product->image AS $key => $url)
if (!empty($url))
{
@@ -1292,7 +1292,6 @@ class AdminImport extends AdminTab
{
parent::displayForm();
$context = Context::getContext();
if ((Tools::getValue('import')) AND (isset($this->_warnings) AND !sizeof($this->_warnings)))
echo '<div class="module_confirmation conf confirm"><img src="../img/admin/ok.gif" alt="" title="" style="margin-right:5px; float:left;" />'.$this->l('The .CSV file has been imported into your shop.').'</div>';
@@ -1373,7 +1372,7 @@ class AdminImport extends AdminTab
<div class="margin-form">
<select name="iso_lang">';
foreach ($this->_languages AS $lang)
echo '<option value="'.$lang['iso_code'].'" '.($lang['id_lang'] == $context->language->id ? 'selected="selected"' : '').'>'.$lang['name'].'</option>';
echo '<option value="'.$lang['iso_code'].'" '.($lang['id_lang'] == $this->context->language->id ? 'selected="selected"' : '').'>'.$lang['name'].'</option>';
echo '</select></div><label for="convert" class="clear">'.$this->l('iso-8859-1 encoded file').' </label>
<div class="margin-form">
<input name="convert" id="convert" type="checkbox" style="margin-top: 6px;"/>
+2 -3
View File
@@ -43,8 +43,7 @@ class AdminInvoices extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
$statuses = OrderState::getOrderStates($context->language->id);
$statuses = OrderState::getOrderStates($this->context->language->id);
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT COUNT(*) as nbOrders, (
SELECT oh.id_order_state
@@ -54,7 +53,7 @@ class AdminInvoices extends AdminTab
LIMIT 1
) id_order_state
FROM '._DB_PREFIX_.'orders o
WHERE o.id_shop IN('.implode(', ', $context->shop->getListOfID()).')
WHERE o.id_shop IN('.implode(', ', $this->context->shop->getListOfID()).')
GROUP BY id_order_state');
$statusStats = array();
foreach ($result as $row)
+1 -2
View File
@@ -120,7 +120,6 @@ class AdminLanguages extends AdminTab
public function postProcess()
{
$context = Context::getContext();
if (isset($_GET['delete'.$this->table]))
{
if ($this->tabAccess['delete'] === '1')
@@ -149,7 +148,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($context->language->id, $_POST[$this->table.'Box']))
elseif (in_array($this->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
{
+13 -15
View File
@@ -34,16 +34,16 @@ class AdminManufacturers extends AdminTab
public function __construct()
{
$context = Context::getContext();
$this->table = 'manufacturer';
$this->className = 'Manufacturer';
$this->lang = false;
$this->edit = true;
$this->delete = true;
$this->context = Context::getContext();
// Sub tab addresses
$countries = Country::getCountries($context->language->id);
$countries = Country::getCountries($this->context->language->id);
foreach ($countries AS $country)
$this->countriesArray[$country['id_country']] = $country['name'];
@@ -57,7 +57,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)$context->language->id.') ';
(cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->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));
@@ -94,7 +94,6 @@ class AdminManufacturers extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
if (!($manufacturer = $this->loadObject(true)))
@@ -133,7 +132,7 @@ class AdminManufacturers extends AdminTab
echo '</div>';
// TinyMCE
$iso = $context->language->iso_code;
$iso = $this->context->language->iso_code;
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
$ad = dirname($_SERVER["PHP_SELF"]);
echo '
@@ -206,13 +205,12 @@ class AdminManufacturers extends AdminTab
public function viewmanufacturer()
{
$context = Context::getContext();
if (!($manufacturer = $this->loadObject()))
return;
echo '<h2>'.$manufacturer->name.'</h2>';
$products = $manufacturer->getProductsLite($context->language->id);
$addresses = $manufacturer->getAddresses($context->language->id);
$products = $manufacturer->getProductsLite($this->context->language->id);
$addresses = $manufacturer->getAddresses($this->context->language->id);
echo '<h3>'.$this->l('Total addresses:').' '.sizeof($addresses).'</h3>';
echo '<hr />';
@@ -246,14 +244,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, $context->language->id);
$product = new Product($product['id_product'], false, $this->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)$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>
<a href="?tab=AdminCatalog&id_product='.$product->id.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->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)$this->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>
@@ -269,10 +267,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)$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>
<a href="?tab=AdminCatalog&id_product='.$product->id.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->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)$this->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)$context->employee->id).'">'.$product->name.'</a></h3>
<h3><a href="?tab=AdminCatalog&id_product='.$product->id.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->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>
@@ -282,7 +280,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($context->language->id);
$combinaisons = $product->getAttributeCombinaisons($this->context->language->id);
foreach ($combinaisons AS $k => $combinaison)
{
$combArray[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
+7 -9
View File
@@ -29,18 +29,17 @@ class AdminMessages extends AdminTab
{
public function __construct()
{
$context = Context::getContext();
$this->table = 'order';
$this->className = 'Order';
$this->view = 'noActionColumn';
$this->colorOnBackground = true;
$this->context = Context::getContext();
$start = 0;
$this->_defaultOrderBy = 'date_add';
/* Manage default params values */
if (empty($limit))
$limit = ((!isset($context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $context->cookie->{$this->table.'_pagination'});
$limit = ((!isset($this->context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $this->context->cookie->{$this->table.'_pagination'});
if (!Validate::isTableOrIdentifier($this->table))
die (Tools::displayError('Table name is invalid:').' "'.$this->table.'"');
@@ -54,7 +53,7 @@ class AdminMessages extends AdminTab
$orderWay = Tools::getValue($this->table.'Orderway', 'ASC');
$limit = (int)(Tools::getValue('pagination', $limit));
$context->cookie->{$this->table.'_pagination'} = $limit;
$this->context->cookie->{$this->table.'_pagination'} = $limit;
/* Check params validity */
if (!Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay)
@@ -76,7 +75,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)$context->employee->id.') 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)$this->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,7 +97,6 @@ class AdminMessages extends AdminTab
public function display()
{
$context = Context::getContext();
if (isset($_GET['ajax']) && !empty($_GET['id_cart']))
{
ob_clean();
@@ -128,7 +126,7 @@ class AdminMessages extends AdminTab
</tr>
<tr>
<td>'.$this->l('Date:').'</td>
<td>'.Tools::displayDate($message['date_add'], $context->language->id, true).'</td>
<td>'.Tools::displayDate($message['date_add'], $this->context->language->id, true).'</td>
</tr>
</table>
<p>'.$this->l('Message:').' '.Tools::htmlentitiesUTF8($message['message']).'</p>
@@ -138,7 +136,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)$context->employee->id));
Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($_GET['id_order']).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id));
else
{
if (isset($_GET['id_order']) AND (empty($_GET['id_order']) OR $_GET['id_order'] == '--'))
@@ -153,7 +151,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)$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>';
$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)$this->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" />
+1 -2
View File
@@ -29,7 +29,6 @@ class AdminMeta extends AdminTab
{
public function __construct()
{
$context = Context::getContext();
$this->table = 'meta';
$this->className = 'Meta';
$this->lang = true;
@@ -47,7 +46,7 @@ class AdminMeta extends AdminTab
$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)$context->employee->id).'">'.$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)$this->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__'))
+27 -30
View File
@@ -79,8 +79,7 @@ class AdminModules extends AdminTab
public function postProcess()
{
$context = Context::getContext();
$id_employee = (int)$context->employee->id;
$id_employee = (int)$this->context->employee->id;
$filter_conf = Configuration::getMultiple(array(
'PS_SHOW_TYPE_MODULES_'.$id_employee,
'PS_SHOW_COUNTRY_MODULES_'.$id_employee,
@@ -285,11 +284,10 @@ class AdminModules extends AdminTab
$toolbar .= '<tr>
<th colspan="4">
<input type="checkbox" name="activateModule" value="1" '.(($module->active) ? 'checked="checked"' : '').' '.$activateOnclick.' /> '.$this->l('Activate module for').' ';
$context = Context::getContext();
if ($context->shop->getContextType() == Shop::CONTEXT_SHOP)
$toolbar .= 'shop <b>'.$context->shop->name.'</b>';
elseif ($context->shop->getContextType() == Shop::CONTEXT_GROUP)
$toolbar .= 'all shops of group shop <b>'.$context->shop->getGroup()->name.'</b>';
if ($this->context->shop->getContextType() == Shop::CONTEXT_SHOP)
$toolbar .= 'shop <b>'.$this->context->shop->name.'</b>';
elseif ($this->context->shop->getContextType() == Shop::CONTEXT_GROUP)
$toolbar .= 'all shops of group shop <b>'.$this->context->shop->getGroup()->name.'</b>';
else
$toolbar .= 'all shops';
$toolbar .= '</th>
@@ -309,7 +307,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)$context->employee->id));
Tools::redirectAdmin('index.php?tab=AdminPayment&token='.Tools::getAdminToken('AdminPayment'.(int)(Tab::getIdFromClassName('AdminPayment')).(int)$this->context->employee->id));
}
if (sizeof($module_errors))
{
@@ -462,16 +460,16 @@ class AdminModules extends AdminTab
public function displayList()
{
$context = Context::getContext();
$this->context = Context::getContext();
$modulesAuthors = array();
$autocompleteList = 'var moduleList = [';
$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);
$showTypeModules = Configuration::get('PS_SHOW_TYPE_MODULES_'.(int)$this->context->employee->id);
$showInstalledModules = Configuration::get('PS_SHOW_INSTALLED_MODULES_'.(int)$this->context->employee->id);
$showEnabledModules = Configuration::get('PS_SHOW_ENABLED_MODULES_'.(int)$this->context->employee->id);
$showCountryModules = Configuration::get('PS_SHOW_COUNTRY_MODULES_'.(int)$this->context->employee->id);
$nameCountryDefault = Country::getNameById($context->language->id, Configuration::get('PS_COUNTRY_DEFAULT'));
$nameCountryDefault = Country::getNameById($this->context->language->id, Configuration::get('PS_COUNTRY_DEFAULT'));
$isoCountryDefault = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
$serialModules = '';
@@ -906,14 +904,13 @@ class AdminModules extends AdminTab
public function displaySelectedFilter()
{
$context = Context::getContext();
$selected_filter = '';
$id_employee = (int)$context->employee->id;
$id_employee = (int)$this->context->employee->id;
$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);
$showTypeModules = Configuration::get('PS_SHOW_TYPE_MODULES_'.(int)$this->context->employee->id);
$showInstalledModules = Configuration::get('PS_SHOW_INSTALLED_MODULES_'.(int)$this->context->employee->id);
$showEnabledModules = Configuration::get('PS_SHOW_ENABLED_MODULES_'.(int)$this->context->employee->id);
$showCountryModules = Configuration::get('PS_SHOW_COUNTRY_MODULES_'.(int)$this->context->employee->id);
$selected_filter .= ($showTypeModules == 'allModules' ? $this->l('All Modules').' - ' : '').
($showTypeModules == 'nativeModules' ? $this->l('Native Modules').' - ' : '').
($showTypeModules == 'partnerModules' ? $this->l('Partners Modules').' - ' : '').
@@ -934,20 +931,20 @@ class AdminModules extends AdminTab
private function setFilterModules($module_type, $country_module_value, $module_install, $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);
$this->context = Context::getContext();
Configuration::updateValue('PS_SHOW_TYPE_MODULES_'.(int)$this->context->employee->id, $module_type);
Configuration::updateValue('PS_SHOW_COUNTRY_MODULES_'.(int)$this->context->employee->id, $country_module_value);
Configuration::updateValue('PS_SHOW_INSTALLED_MODULES_'.(int)$this->context->employee->id, $module_install);
Configuration::updateValue('PS_SHOW_ENABLED_MODULES_'.(int)$this->context->employee->id, $module_status);
}
private function resetFilterModules()
{
$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');
$this->context = Context::getContext();
Configuration::updateValue('PS_SHOW_TYPE_MODULES_'.(int)$this->context->employee->id, 'allModules');
Configuration::updateValue('PS_SHOW_COUNTRY_MODULES_'.(int)$this->context->employee->id, 0);
Configuration::updateValue('PS_SHOW_INSTALLED_MODULES_'.(int)$this->context->employee->id, 'installedUninstalled');
Configuration::updateValue('PS_SHOW_ENABLED_MODULES_'.(int)$this->context->employee->id, 'enabledDisabled');
}
}
+3 -4
View File
@@ -215,7 +215,6 @@ class AdminModulesPositions extends AdminTab
public function displayList()
{
$context = Context::getContext();
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1);
@@ -253,12 +252,12 @@ class AdminModulesPositions extends AdminTab
</form>
<fieldset style="width:250px;float:right"><legend>'.$this->l('Live edit').'</legend>';
if (Tools::isMultiShopActivated() && $context->shop->getContextType() != Shop::CONTEXT_SHOP)
if (Tools::isMultiShopActivated() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP)
echo '<p>'.$this->l('You have to select a shop to use live edit').'</p>';
else
echo '<p>'.$this->l('By clicking here you will be redirected to the front office of your shop to move and delete modules directly.').'</p>
<br>
<a href="'.$context->link->getPageLink('index').'&live_edit&ad='.$admin_dir.'&liveToken='.sha1($admin_dir._COOKIE_KEY_).'" target="_blank" class="button">'.$this->l('Run LiveEdit').'</a>';
<a href="'.$this->context->link->getPageLink('index').'&live_edit&ad='.$admin_dir.'&liveToken='.sha1($admin_dir._COOKIE_KEY_).'" target="_blank" class="button">'.$this->l('Run LiveEdit').'</a>';
echo '</fieldset>';
// Print hook list
@@ -268,7 +267,7 @@ class AdminModulesPositions extends AdminTab
echo '<div id="unhook_button_position_top"><input class="button floatr" type="submit" name="unhookform" value="'.$this->l('Unhook the selection').'"/></div>';
$canMove = (Tools::isMultiShopActivated() && $context->shop->getContextType() != Shop::CONTEXT_SHOP) ? false : true;
$canMove = (Tools::isMultiShopActivated() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP) ? false : true;
if (!$canMove)
echo '<br /><div><b>'.$this->l('If you want to order / move following data, please go in shop context (select a shop in shop list)').'</b></div>';
foreach ($hooks AS $hook)
+33 -37
View File
@@ -29,8 +29,7 @@ class AdminOrders extends AdminTab
{
public function __construct()
{
$context = Context::getContext();
$this->context = Context::getContext();
$this->table = 'order';
$this->className = 'Order';
$this->view = true;
@@ -45,11 +44,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)$context->language->id.')';
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$this->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)$context->language->id);
$states = OrderState::getOrderStates((int)$this->context->language->id);
foreach ($states AS $state)
$statesArray[$state['id_order_state']] = $state['name'];
@@ -69,7 +68,6 @@ class AdminOrders extends AdminTab
public function postProcess()
{
$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)))
@@ -117,7 +115,7 @@ class AdminOrders extends AdminTab
{
$history = new OrderHistory();
$history->id_order = (int)$id_order;
$history->id_employee = (int)$context->employee->id;
$history->id_employee = (int)$this->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));
@@ -170,7 +168,7 @@ class AdminOrders extends AdminTab
if (!sizeof($this->_errors))
{
$message = new Message();
$message->id_employee = (int)$context->employee->id;
$message->id_employee = (int)$this->context->employee->id;
$message->message = htmlentities(Tools::getValue('message'), ENT_COMPAT, 'UTF-8');
$message->id_order = $id_order;
$message->private = Tools::getValue('visibility');
@@ -278,7 +276,7 @@ class AdminOrders extends AdminTab
{
$updProductAttributeID = !empty($orderDetail->product_attribute_id) ? (int)($orderDetail->product_attribute_id) : NULL;
$newProductQty = Product::getQuantity($orderDetail->product_id, $updProductAttributeID);
$product = get_object_vars(new Product($orderDetail->product_id, false, $context->language->id, $order->id_shop));
$product = get_object_vars(new Product($orderDetail->product_id, false, $this->context->language->id, $order->id_shop));
if (!empty($orderDetail->product_attribute_id))
{
$updProduct['quantity_attribute'] = (int)($newProductQty);
@@ -336,7 +334,7 @@ class AdminOrders extends AdminTab
$this->_errors[] = Tools::displayError('Cannot generate voucher');
else
{
$currency = $context->currency;
$currency = $this->context->currency;
$params['{voucher_amount}'] = Tools::displayPrice($voucher->value, $currency, false);
$params['{voucher_num}'] = $voucher->name;
@Mail::Send((int)($order->id_lang), 'voucher', Mail::l('New voucher regarding your order'),
@@ -357,7 +355,7 @@ class AdminOrders extends AdminTab
}
elseif (isset($_GET['messageReaded']))
{
Message::markAsReaded($_GET['messageReaded'], $context->employee->id);
Message::markAsReaded($_GET['messageReaded'], $this->context->employee->id);
}
parent::postProcess();
}
@@ -458,29 +456,28 @@ class AdminOrders extends AdminTab
public function viewDetails()
{
$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, $context->language->id);
$addressInvoice = new Address($order->id_address_invoice, $this->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, $context->language->id);
$addressDelivery = new Address($order->id_address_delivery, $this->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($context->language->id);
$history = $order->getHistory($this->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($context->language->id);
$states = OrderState::getOrderStates($this->context->language->id);
$currency = new Currency($order->id_currency);
$currentLanguage = $context->language;
$currentLanguage = $this->context->language;
$currentState = OrderHistory::getLastOrderState($order->id);
$sources = ConnectionsSource::getOrderSources($order->id);
$cart = Cart::getCartByOrderId($order->id);
@@ -528,7 +525,7 @@ class AdminOrders extends AdminTab
echo '
<table cellspacing="0" cellpadding="0" class="table" style="width: 429px">
<tr>
<th>'.Tools::displayDate($row['date_add'], $context->language->id, true).'</th>
<th>'.Tools::displayDate($row['date_add'], $this->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>
@@ -538,7 +535,7 @@ class AdminOrders extends AdminTab
{
echo '
<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
<td>'.Tools::displayDate($row['date_add'], $context->language->id, true).'</td>
<td>'.Tools::displayDate($row['date_add'], $this->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>
@@ -552,7 +549,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($context->language->id);
$currentStateTab = $order->getCurrentStateFull($this->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 '
@@ -567,7 +564,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)$context->employee->id).'"> '.$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)$this->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())
{
@@ -586,7 +583,7 @@ class AdminOrders extends AdminTab
}
else
{
echo $this->l('Account registered:').' '.Tools::displayDate($customer->date_add, $context->language->id, true).'<br />
echo $this->l('Account registered:').' '.Tools::displayDate($customer->date_add, $this->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 />';
}
@@ -600,7 +597,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="height: 200px; overflow-y: scroll; width: 360px;"' : '').'>';
foreach ($sources as $source)
echo '<li>
'.Tools::displayDate($source['date_add'], $context->language->id, true).'<br />
'.Tools::displayDate($source['date_add'], $this->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 />
@@ -619,8 +616,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', $context->language->id).sprintf('%06d', $order->invoice_number).'</b></a>
<br />'.$this->l('Created on:').' '.Tools::displayDate($order->invoice_date, $context->language->id, true);
<a href="pdf.php?id_order='.$order->id.'&pdf">'.$this->l('Invoice #').'<b>'.Configuration::get('PS_INVOICE_PREFIX', $this->context->language->id).sprintf('%06d', $order->invoice_number).'</b></a>
<br />'.$this->l('Created on:').' '.Tools::displayDate($order->invoice_date, $this->context->language->id, true);
else
echo '<legend><img src="../img/admin/charged_ko.gif" />'.$this->l('Invoice').'</legend>
'.$this->l('No invoice yet.');
@@ -632,7 +629,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', $context->language->id).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', $this->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>)' : '');
@@ -669,7 +666,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)$context->employee->id).'">'.$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)$this->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;">
@@ -703,7 +700,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)$context->employee->id).'&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)$this->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)
@@ -713,7 +710,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)$context->employee->id).'"><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)$this->context->employee->id).'"><img src="../img/admin/edit.gif" /></a></div>
'.$this->displayAddressDetail($addressInvoice)
.(!empty($addressInvoice->other) ? '<hr />'.$addressInvoice->other.'<br />' : '')
@@ -742,7 +739,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)$context->employee->id);
$tokenCatalog = Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id);
foreach ($products as $k => $product)
{
if ($order->getTaxCalculationMethod() == PS_TAX_EXC)
@@ -906,7 +903,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'], $context->language->id, true);
echo $this->l('At').' <i>'.Tools::displayDate($message['date_add'], $this->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>'.Tools::nl2br($message['message']).'</p>';
@@ -928,9 +925,9 @@ class AdminOrders extends AdminTab
foreach ($returns as $return)
{
$state = new OrderReturnState($return['state']);
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 '('.Tools::displayDate($return['date_upd'], $this->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)$this->context->employee->id).'">'.$this->l('#').sprintf('%06d', $return['id_order_return']).'</a></b> -
'.$state->name[$this->context->language->id].'<br />';
}
echo '</fieldset>';
@@ -943,7 +940,7 @@ class AdminOrders extends AdminTab
echo $this->l('No slip for this order.');
else
foreach ($slips as $slip)
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 '('.Tools::displayDate($slip['date_upd'], $this->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">&nbsp;</div>';
@@ -962,14 +959,13 @@ class AdminOrders extends AdminTab
public function display()
{
$context = Context::getContext();
if (isset($_GET['view'.$this->table]))
$this->viewDetails();
else
{
$this->getList($context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
$this->getList($this->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(), $context->currency).'</h2>';
echo '<h2 class="space" style="text-align:right; margin-right:44px;">'.$this->l('Total:').' '.Tools::displayPrice($this->getTotal(), $this->context->currency).'</h2>';
}
}
+3 -3
View File
@@ -52,7 +52,7 @@ class AdminOrdersStates extends AdminTab
public function postProcess()
{
$context = Context::getContext();
$this->context = Context::getContext();
if (Tools::isSubmit('submitAdd'.$this->table))
{
$_POST['invoice'] = Tools::getValue('invoice');
@@ -69,7 +69,7 @@ class AdminOrdersStates extends AdminTab
}
elseif (isset($_GET['delete'.$this->table]))
{
$orderState = new OrderState($_GET['id_order_state'], $context->language->id);
$orderState = new OrderState($_GET['id_order_state'], $this->context->language->id);
if (!$orderState->isRemovable())
$this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
else
@@ -79,7 +79,7 @@ class AdminOrdersStates extends AdminTab
{
foreach ($_POST[$this->table.'Box'] AS $selection)
{
$orderState = new OrderState($selection, $context->language->id);
$orderState = new OrderState($selection, $this->context->language->id);
if (!$orderState->isRemovable())
{
$this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
+2 -3
View File
@@ -99,9 +99,8 @@ class AdminPDF extends AdminPreferences
public function display()
{
$context = Context::getContext();
if (!Validate::isLoadedObject($context->language))
if (!Validate::isLoadedObject($this->context->language))
die(Tools::displayError());
$this->_displayForm('PDF', $this->_fieldsPDF, $this->l('PDF settings for the current language:').' '.$context->language->name, 'width2', 'pdf');
$this->_displayForm('PDF', $this->_fieldsPDF, $this->l('PDF settings for the current language:').' '.$this->context->language->name, 'width2', 'pdf');
}
}
+4 -4
View File
@@ -96,14 +96,14 @@ class AdminPayment extends AdminTab
public function display()
{
$context = Context::getContext();
$this->context = Context::getContext();
$displayRestrictions = false;
$currencies = Currency::getCurrencies();
$countries = Country::getCountries($context->language->id);
$groups = Group::getGroups($context->language->id);
$countries = Country::getCountries($this->context->language->id);
$groups = Group::getGroups($this->context->language->id);
$tokenModules = Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)$context->employee->id);
$tokenModules = Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)$this->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>';
+5 -7
View File
@@ -29,13 +29,13 @@ class AdminPreferences extends AdminTab
{
public function __construct()
{
$context = Context::getContext();
$this->context = Context::getContext();
$this->className = 'Configuration';
$this->table = 'configuration';
$timezones = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT name FROM '._DB_PREFIX_.'timezone');
$taxes[] = array('id' => 0, 'name' => $this->l('None'));
foreach (Tax::getTaxes($context->language->id) as $tax)
foreach (Tax::getTaxes($this->context->language->id) as $tax)
$taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']);
$order_process_type = array(
@@ -70,7 +70,7 @@ class AdminPreferences extends AdminTab
'name' => $this->l('None')
)
);
foreach (CMS::listCms($context->language->id) as $cms_file)
foreach (CMS::listCms($this->context->language->id) as $cms_file)
$cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']);
$this->_fieldsGeneral = array(
'PS_SHOP_ENABLE' => array('title' => $this->l('Enable Shop'), 'desc' => $this->l('Activate or deactivate your shop. Deactivate your shop while you perform maintenance on it. Please note that the webservice will not be disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
@@ -170,7 +170,6 @@ class AdminPreferences extends AdminTab
*/
protected function _postConfig($fields)
{
$context = Context::getContext();
$languages = Language::getLanguages(false);
Tools::clearCache($smarty);
@@ -321,7 +320,6 @@ class AdminPreferences extends AdminTab
*/
protected function _displayForm($name, $fields, $tabname, $size, $icon)
{
$context = Context::getContext();
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
$languages = Language::getLanguages(false);
$confValues = $this->getConf($fields, $languages);
@@ -361,7 +359,7 @@ class AdminPreferences extends AdminTab
echo '<div class="margin-form" style="padding-top:5px;">';
}
$isDisabled = (Tools::isMultiShopActivated() && isset($field['visibility']) && $field['visibility'] > $context->shop->getContextType()) ? true : false;
$isDisabled = (Tools::isMultiShopActivated() && isset($field['visibility']) && $field['visibility'] > $this->context->shop->getContextType()) ? true : false;
/* Display the appropriate input type for each field */
switch ($field['type'])
@@ -446,7 +444,7 @@ class AdminPreferences extends AdminTab
break;
case 'price':
echo $context->currency->getSign('left').'<input type="'.$field['type'].'" size="'.(isset($field['size']) ? (int)($field['size']) : 5).'" name="'.$key.'" value="'.($field['type'] == 'password' ? '' : htmlentities($val, ENT_COMPAT, 'UTF-8')).'" '.(($isDisabled) ? 'disabled="disabled"' : '').' />'.$context->currency->getSign('right').' '.$this->l('(tax excl.)');
echo $this->context->currency->getSign('left').'<input type="'.$field['type'].'" size="'.(isset($field['size']) ? (int)($field['size']) : 5).'" name="'.$key.'" value="'.($field['type'] == 'password' ? '' : htmlentities($val, ENT_COMPAT, 'UTF-8')).'" '.(($isDisabled) ? 'disabled="disabled"' : '').' />'.$this->context->currency->getSign('right').' '.$this->l('(tax excl.)');
break;
case 'textLang':
+61 -76
View File
@@ -35,7 +35,6 @@ class AdminProducts extends AdminTab
public function __construct()
{
$context = Context::getContext();
$this->table = 'product';
$this->className = 'Product';
@@ -45,6 +44,7 @@ class AdminProducts extends AdminTab
$this->view = false;
$this->duplicate = true;
$this->imageType = 'jpg';
$this->context = Context::getContext();
$this->fieldsDisplay = array(
'id_product' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 20),
@@ -62,7 +62,7 @@ class AdminProducts extends AdminTab
$this->_join = Product::sqlStock('a').'
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = a.`id_product` AND i.`cover` = 1)
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (a.`id_tax_rules_group` = tr.`id_tax_rules_group` AND tr.`id_country` = '.(int)$context->country->id.' AND tr.`id_state` = 0)
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (a.`id_tax_rules_group` = tr.`id_tax_rules_group` AND tr.`id_country` = '.(int)$this->context->country->id.' AND tr.`id_state` = 0)
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)';
$this->_filter = 'AND cp.`id_category` = '.(int)($this->_category->id);
$this->_select = 'cp.`position`, i.`id_image`, (a.`price` * ((100 + (t.`rate`))/100)) AS price_final, SUM(stock.quantity) AS quantity';
@@ -119,9 +119,8 @@ class AdminProducts extends AdminTab
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL, $id_lang_shop = NULL)
{
$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);
$orderByPriceFinal = (empty($orderBy) ? ($this->context->cookie->__get($this->table.'Orderby') ? $this->context->cookie->__get($this->table.'Orderby') : 'id_'.$this->table) : $orderBy);
$orderWayPriceFinal = (empty($orderWay) ? ($this->context->cookie->__get($this->table.'Orderway') ? $this->context->cookie->__get($this->table.'Orderby') : 'ASC') : $orderWay);
if ($orderByPriceFinal == 'price_final')
{
$orderBy = 'id_'.$this->table;
@@ -170,7 +169,6 @@ class AdminProducts extends AdminTab
*/
public function postProcess($token = NULL)
{
$context = Context::getContext();
/* Add a new product */
if (Tools::isSubmit('submitAddproduct') OR Tools::isSubmit('submitAddproductAndStay') OR Tools::isSubmit('submitAddProductAndPreview'))
{
@@ -523,7 +521,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, $context->employee->id))
if (!$product->addStockMvt(Tools::getValue('attribute_mvt_quantity'), $id_reason, $id_product_attribute, NULL, $this->context->employee->id))
$this->_errors[] = Tools::displayError('An error occurred while updating qty.');
}
Hook::updateProductAttribute((int)$id_product_attribute);
@@ -1085,10 +1083,9 @@ class AdminProducts extends AdminTab
*/
public function submitAddProduct($token = NULL)
{
$context = Context::getContext();
$className = 'Product';
$rules = call_user_func(array($this->className, 'getValidationRules'), $this->className);
$defaultLanguage = $context->language;
$defaultLanguage = $this->context->language;
$languages = Language::getLanguages(false);
/* Check required fields */
@@ -1173,7 +1170,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, $context->employee->id))
if (!$object->addStockMvt(Tools::getValue('mvt_quantity'), $id_reason, NULL, NULL, $this->context->employee->id))
$this->_errors[] = Tools::displayError('An error occurred while updating qty.');
}
$this->updateAccessories($object);
@@ -1197,7 +1194,7 @@ class AdminProducts extends AdminTab
// Save and preview
if (Tools::isSubmit('submitAddProductAndPreview'))
{
$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)));
$preview_url = ($this->context->link->getProductLink($this->getFieldValue($object, 'id'), $this->getFieldValue($object, 'link_rewrite', $this->context->language->id), Category::getLinkRewrite($this->getFieldValue($object, 'id_category_default'), $this->context->language->id)));
if (!$object->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
@@ -1253,7 +1250,7 @@ class AdminProducts extends AdminTab
// Save and preview
if (Tools::isSubmit('submitAddProductAndPreview'))
{
$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)));
$preview_url = ($this->context->link->getProductLink($this->getFieldValue($object, 'id'), $this->getFieldValue($object, 'link_rewrite', $this->context->language->id), Category::getLinkRewrite($this->getFieldValue($object, 'id_category_default'), $this->context->language->id)));
if (!$object->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
@@ -1399,11 +1396,10 @@ class AdminProducts extends AdminTab
public function display($token = NULL)
{
$context = Context::getContext();
if ($id_category = (int)Tools::getValue('id_category'))
AdminTab::$currentIndex .= '&id_category='.$id_category;
$this->getList($context->language->id, !$context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL, 0, NULL, $context->shop->getID(true));
$this->getList($this->context->language->id, !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL, 0, NULL, $this->context->shop->getID(true));
$id_category = Tools::getValue('id_category', 1);
if (!$id_category)
@@ -1518,7 +1514,6 @@ class AdminProducts extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
if ($id_category_back = (int)(Tools::getValue('id_category')))
@@ -1527,7 +1522,7 @@ class AdminProducts extends AdminTab
if (!($obj = $this->loadObject(true)))
return;
$currency = $context->currency;
$currency = $this->context->currency;
if ($obj->id)
self::$currentIndex .= '&id_product='.$obj->id;
@@ -1625,7 +1620,7 @@ class AdminProducts extends AdminTab
{
$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)$context->employee->id) : '').'">
<a href="'.$productIndex.($this->token ? '&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id) : '').'">
<img src="../img/admin/arrow2.gif" /> '.$this->l('Back to the category').'
</a><br />';
}
@@ -1633,15 +1628,14 @@ class AdminProducts extends AdminTab
function displayFormPrices($obj, $languages, $defaultLanguage)
{
$context = Context::getContext();
if ($obj->id)
{
$shops = Shop::getShops();
$currencies = Currency::getCurrencies();
$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);
$countries = Country::getCountries($this->context->language->id);
$groups = Group::getGroups($this->context->language->id);
$this->_displaySpecificPriceAdditionForm( $this->context->currency, $shops, $currencies, $countries, $groups);
$this->_displaySpecificPriceModificationForm( $this->context->currency, $shops, $currencies, $countries, $groups);
}
else
echo '<b>'.$this->l('You must save this product before adding specific prices').'.</b>';
@@ -1657,13 +1651,12 @@ class AdminProducts extends AdminTab
protected function _displaySpecificPriceModificationForm($defaultCurrency, $shops, $currencies, $countries, $groups)
{
$context = Context::getContext();
if (!($obj = $this->loadObject()))
return;
$specificPrices = SpecificPrice::getByProductId((int)($obj->id));
$specificPricePriorities = SpecificPrice::getPriority((int)($obj->id));
$taxRate = TaxRulesGroup::getTaxesRate($obj->id_tax_rules_group, $context->country->id, 0, 0);
$taxRate = TaxRulesGroup::getTaxesRate($obj->id_tax_rules_group, $this->context->country->id, 0, 0);
$tmp = array();
foreach ($shops as $shop)
@@ -1694,11 +1687,11 @@ class AdminProducts extends AdminTab
<th class="cell border" style="width: 12%;">'.$this->l('Currency').'</th>
<th class="cell border" style="width: 11%;">'.$this->l('Country').'</th>
<th class="cell border" style="width: 13%;">'.$this->l('Group').'</th>
<th class="cell border" style="width: 12%;">'.$this->l('Price').' '.($context->country->display_tax_label ? $this->l('(tax excl.)') : '').'</th>
<th class="cell border" style="width: 12%;">'.$this->l('Price').' '.($this->context->country->display_tax_label ? $this->l('(tax excl.)') : '').'</th>
<th class="cell border" style="width: 10%;">'.$this->l('Reduction').'</th>
<th class="cell border" style="width: 15%;">'.$this->l('Period').'</th>
<th class="cell border" style="width: 10%;">'.$this->l('From (quantity)').'</th>
<th class="cell border" style="width: 15%;">'.$this->l('Final price').' '.($context->country->display_tax_label ? $this->l('(tax excl.)') : '').'</th>
<th class="cell border" style="width: 15%;">'.$this->l('Final price').' '.($this->context->country->display_tax_label ? $this->l('(tax excl.)') : '').'</th>
<th class="cell border" style="width: 2%;">'.$this->l('Action').'</th>
</tr>
</thead>
@@ -1813,7 +1806,6 @@ class AdminProducts extends AdminTab
{
if (!($product = $this->loadObject()))
return;
$context = Context::getContext();
echo '
<a href="#" onclick="$(\'#add_specific_price\').slideToggle();return false;"><img src="../img/admin/add.gif" alt="" /> '.$this->l('Add a new specific price').'</a>
@@ -1863,7 +1855,7 @@ class AdminProducts extends AdminTab
</div>
<label>'.$this->l('Product price');
if ($context->country->display_tax_label)
if ($this->context->country->display_tax_label)
echo ' '.$this->l('(tax excl.):');
echo '</label>
<div class="margin-form">
@@ -2023,12 +2015,11 @@ class AdminProducts extends AdminTab
function displayFormAttachments($obj, $languages, $defaultLanguage)
{
$context = Context::getContext();
if (!($obj = $this->loadObject(true)))
return;
$languages = Language::getLanguages(false);
$attach1 = Attachment::getAttachments($context->language->id, $obj->id, true);
$attach2 = Attachment::getAttachments($context->language->id, $obj->id, false);
$attach1 = Attachment::getAttachments($this->context->language->id, $obj->id, true);
$attach2 = Attachment::getAttachments($this->context->language->id, $obj->id, false);
echo '
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
@@ -2095,7 +2086,6 @@ class AdminProducts extends AdminTab
function displayFormInformations($obj, $currency)
{
parent::displayForm(false);
$context = Context::getContext();
$has_attribute = $obj->hasAttributes();
$qty = $obj->getStock();
@@ -2156,7 +2146,7 @@ class AdminProducts extends AdminTab
$preview_url = '';
if (isset($obj->id))
{
$preview_url = ($context->link->getProductLink($this->getFieldValue($obj, 'id'), $this->getFieldValue($obj, 'link_rewrite', $this->_defaultFormLanguage), Category::getLinkRewrite($this->getFieldValue($obj, 'id_category_default'), $context->language->id)));
$preview_url = ($this->context->link->getProductLink($this->getFieldValue($obj, 'id'), $this->getFieldValue($obj, 'link_rewrite', $this->_defaultFormLanguage), Category::getLinkRewrite($this->getFieldValue($obj, 'id_category_default'), $this->context->language->id)));
if (!$obj->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
@@ -2173,7 +2163,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 '&nbsp;-&nbsp;<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 '&nbsp;-&nbsp;<a href="index.php?tab=AdminStats&module=statsproduct&id_product='.$obj->id.'&token='.Tools::getAdminToken('AdminStats'.(int)(Tab::getIdFromClassName('AdminStats')).(int)$this->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"/>
@@ -2295,7 +2285,7 @@ class AdminProducts extends AdminTab
echo ' <option value="'.$id_manufacturer.'" selected="selected">'.Manufacturer::getNameById($id_manufacturer).'</option>
<option disabled="disabled">----------</option>';
echo '
</select>&nbsp;&nbsp;&nbsp;<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>
</select>&nbsp;&nbsp;&nbsp;<a href="?tab=AdminManufacturers&addmanufacturer&token='.Tools::getAdminToken('AdminManufacturers'.(int)(Tab::getIdFromClassName('AdminManufacturers')).(int)$this->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>
@@ -2307,7 +2297,7 @@ class AdminProducts extends AdminTab
echo ' <option value="'.$id_supplier.'" selected="selected">'.Supplier::getNameById($id_supplier).'</option>
<option disabled="disabled">----------</option>';
echo '
</select>&nbsp;&nbsp;&nbsp;<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>
</select>&nbsp;&nbsp;&nbsp;<a href="?tab=AdminSuppliers&addsupplier&token='.Tools::getAdminToken('AdminSuppliers'.(int)(Tab::getIdFromClassName('AdminSuppliers')).(int)$this->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>
@@ -2517,7 +2507,7 @@ class AdminProducts extends AdminTab
</td>
</tr>';
$tax_rules_groups = TaxRulesGroup::getTaxRulesGroups(true);
$taxesRatesByGroup = TaxRulesGroup::getAssociatedTaxRatesByIdCountry($context->country->id);
$taxesRatesByGroup = TaxRulesGroup::getAssociatedTaxRatesByIdCountry($this->context->country->id);
$ecotaxTaxRate = Tax::getProductEcotaxRate();
echo '<script type="text/javascript">';
echo 'noTax = '.(Tax::excludeTaxeOption() ? 'true' : 'false'), ";\n";
@@ -2545,11 +2535,11 @@ class AdminProducts extends AdminTab
echo '</select>
<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>
<a href="?tab=AdminTaxRulesGroup&addtax_rules_group&token='.Tools::getAdminToken('AdminTaxRulesGroup'.(int)(Tab::getIdFromClassName('AdminTaxRulesGroup')).(int)$this->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)$context->employee->id).'">'.$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)$this->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" />';
}
@@ -2567,7 +2557,7 @@ class AdminProducts extends AdminTab
</td>
</tr>';
if ($context->country->display_tax_label)
if ($this->context->country->display_tax_label)
{
echo '
<tr '.(Tax::excludeTaxeOption() ? 'style="display:none"' : '' ).'>
@@ -2584,7 +2574,7 @@ class AdminProducts extends AdminTab
<td class="col-left">'.$this->l('Unit price without tax:').'</td>
<td style="padding-bottom:5px;">
'.($currency->format % 2 != 0 ? ' '.$currency->sign : '').' <input size="11" maxlength="14" id="unit_price" name="unit_price" type="text" value="'.($this->getFieldValue($obj, 'unit_price_ratio') != 0 ? Tools::ps_round($this->getFieldValue($obj, 'price') / $this->getFieldValue($obj, 'unit_price_ratio'), 2) : 0).'" onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\'); unitPriceWithTax(\'unit\');"/>'.($currency->format % 2 == 0 ? ' '.$currency->sign : '').' '.$this->l('per').' <input size="6" maxlength="10" id="unity" name="unity" type="text" value="'.htmlentities($this->getFieldValue($obj, 'unity'), ENT_QUOTES, 'UTF-8').'" onkeyup="if (isArrowKey(event)) return ;unitySecond();" onchange="unitySecond();"/>'.
(Configuration::get('PS_TAX') && $context->country->display_tax_label ? '<span style="margin-left:15px">'.$this->l('or').' '.($currency->format % 2 != 0 ? ' '.$currency->sign : '').'<span id="unit_price_with_tax">0.00</span>'.($currency->format % 2 == 0 ? ' '.$currency->sign : '').' '.$this->l('per').' <span id="unity_second">'.$this->getFieldValue($obj, 'unity').'</span> '.$this->l('with tax') : '').'</span>
(Configuration::get('PS_TAX') && $this->context->country->display_tax_label ? '<span style="margin-left:15px">'.$this->l('or').' '.($currency->format % 2 != 0 ? ' '.$currency->sign : '').'<span id="unit_price_with_tax">0.00</span>'.($currency->format % 2 == 0 ? ' '.$currency->sign : '').' '.$this->l('per').' <span id="unity_second">'.$this->getFieldValue($obj, 'unity').'</span> '.$this->l('with tax') : '').'</span>
<p>'.$this->l('Eg. $15 per Lb').'</p>
</td>
</tr>
@@ -2597,15 +2587,15 @@ class AdminProducts extends AdminTab
<tr>
<td class="col-left"><b>'.$this->l('Final retail price:').'</b></td>
<td style="padding-bottom:5px;">
<span style="'.($context->country->display_tax_label ? '' : 'display:none').'">
<span style="'.($this->context->country->display_tax_label ? '' : 'display:none').'">
'.($currency->format % 2 != 0 ? $currency->sign.' ' : '').'<span id="finalPrice" style="font-weight: bold;"></span>'.($currency->format % 2 == 0 ? ' '.$currency->sign : '').'<span'.(!Configuration::get('PS_TAX') ? ' style="display:none;"' : '').'> ('.$this->l('tax incl.').')</span>
</span>
<span'.(!Configuration::get('PS_TAX') ? ' style="display:none;"' : '').'>';
if ($context->country->display_tax_label)
if ($this->context->country->display_tax_label)
echo ' / ';
echo ($currency->format % 2 != 0 ? $currency->sign.' ' : '').'<span id="finalPriceWithoutTax" style="font-weight: bold;"></span>'.($currency->format % 2 == 0 ? ' '.$currency->sign : '').' '.($context->country->display_tax_label ? '('.$this->l('tax excl.').')' : '').'</span>
echo ($currency->format % 2 != 0 ? $currency->sign.' ' : '').'<span id="finalPriceWithoutTax" style="font-weight: bold;"></span>'.($currency->format % 2 == 0 ? ' '.$currency->sign : '').' '.($this->context->country->display_tax_label ? '('.$this->l('tax excl.').')' : '').'</span>
</td>
</tr>
<tr>
@@ -2629,7 +2619,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($context->language->id);
$reasons = StockMvtReason::getStockMvtReasons($this->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>';
@@ -2684,7 +2674,7 @@ class AdminProducts extends AdminTab
<td class="col-left">'.$this->l('Additional shipping cost:').'</td>
<td style="padding-bottom:5px;">
<input type="text" name="additional_shipping_cost" value="'.($this->getFieldValue($obj, 'additional_shipping_cost')).'" />'.($currency->format % 2 == 0 ? ' '.$currency->sign : '');
if ($context->country->display_tax_label)
if ($this->context->country->display_tax_label)
echo ' ('.$this->l('tax excl.').')';
echo '<p>'.$this->l('Carrier tax will be applied.').'</p>
@@ -2722,7 +2712,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)$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>
<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)$this->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>
@@ -2864,7 +2854,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($context->language->id, $obj->id);
$accessories = Product::getAccessoriesLight($this->context->language->id, $obj->id);
if ($postAccessories = Tools::getValue('inputAccessories'))
{
@@ -2937,7 +2927,7 @@ class AdminProducts extends AdminTab
<br />
</div>';
// TinyMCE
$iso = $context->language->iso_code;
$iso = $this->context->language->iso_code;
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
$ad = dirname($_SERVER["PHP_SELF"]);
echo '
@@ -2959,7 +2949,6 @@ class AdminProducts extends AdminTab
function displayFormImages($obj, $token = NULL)
{
global $attributeJs, $images;
$context = Context::getContext();
$countImages = (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'image WHERE id_product = '.(int)$obj->id);
echo '
<div class="tab-page" id="step2">
@@ -3023,7 +3012,7 @@ class AdminProducts extends AdminTab
<tr>
<td colspan="2" style="text-align:center;">';
echo '<input type="hidden" name="resizer" value="auto" />';
$images = Image::getImages($context->language->id, $obj->id);
$images = Image::getImages($this->context->language->id, $obj->id);
$imagesTotal = Image::getImagesTotal($obj->id);
if (isset($obj->id) AND sizeof($images))
@@ -3129,7 +3118,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($context->language->id, true);
$attributes = Attribute::getAttributes($this->context->language->id, true);
$attributeJs = array();
foreach ($attributes AS $k => $attribute)
@@ -3149,12 +3138,11 @@ class AdminProducts extends AdminTab
public function initCombinationImagesJS()
{
$context = Context::getContext();
if (!($obj = $this->loadObject(true)))
return;
$content = 'var combination_images = new Array();';
if (!$allCombinationImages = $obj->getCombinationImages($context->language->id))
if (!$allCombinationImages = $obj->getCombinationImages($this->context->language->id))
return $content;
foreach ($allCombinationImages AS $id_product_attribute => $combinationImages)
{
@@ -3168,18 +3156,17 @@ class AdminProducts extends AdminTab
function displayFormAttributes($obj, $languages, $defaultLanguage)
{
$context = Context::getContext();
$attributeJs = array();
$attributes = Attribute::getAttributes($context->language->id, true);
$attributes = Attribute::getAttributes($this->context->language->id, true);
foreach ($attributes AS $k => $attribute)
$attributeJs[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
$currency = $context->currency;
$attributes_groups = AttributeGroup::getAttributesGroups($context->language->id);
$currency = $this->context->currency;
$attributes_groups = AttributeGroup::getAttributesGroups($this->context->language->id);
$default_country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT'));
$images = Image::getImages($context->language->id, $obj->id);
$images = Image::getImages($this->context->language->id, $obj->id);
if ($obj->id)
{
echo '
@@ -3194,7 +3181,7 @@ class AdminProducts extends AdminTab
<table cellpadding="5">
<tr>
<td colspan="2"><b>'.$this->l('Add or modify combinations for this product').'</b> -
&nbsp;<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').'" />&nbsp;'.$this->l('Product combinations generator').'</a>
&nbsp;<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)$this->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').'" />&nbsp;'.$this->l('Product combinations generator').'</a>
</td>
</tr>
</table>
@@ -3261,7 +3248,7 @@ class AdminProducts extends AdminTab
</select>
<span id="span_impact">&nbsp;&nbsp;'.$this->l('of').'&nbsp;&nbsp;'.($currency->format % 2 != 0 ? $currency->sign.' ' : '').'
<input type="text" size="6" name="attribute_price" id="attribute_price" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\'); calcImpactPriceTI();"/>'.($currency->format % 2 == 0 ? ' '.$currency->sign : '');
if ($context->country->display_tax_label)
if ($this->context->country->display_tax_label)
{
echo ' '.$this->l('(tax excl.)').'<span '.(Tax::excludeTaxeOption() ? 'style="display:none"' : '' ).'> '.$this->l('or').' '.($currency->format % 2 != 0 ? $currency->sign.' ' : '').'
<input type="text" size="6" name="attribute_priceTI" id="attribute_priceTI" value="0.00" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\'); calcImpactPriceTE();"/>'.($currency->format % 2 == 0 ? ' '.$currency->sign : '').' '.$this->l('(tax incl.)').'</span> '.$this->l('final product price will be set to').' '.($currency->format % 2 != 0 ? $currency->sign.' ' : '').'<span id="attribute_new_total_price">0.00</span>'.($currency->format % 2 == 0 ? $currency->sign.' ' : '');
@@ -3309,7 +3296,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($context->language->id);
$reasons = StockMvtReason::getStockMvtReasons($this->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>
@@ -3382,11 +3369,11 @@ class AdminProducts extends AdminTab
if ($obj->id)
{
/* Build attributes combinaisons */
$combinaisons = $obj->getAttributeCombinaisons($context->language->id);
$combinaisons = $obj->getAttributeCombinaisons($this->context->language->id);
$groups = array();
if (is_array($combinaisons))
{
$combinationImages = $obj->getCombinationImages($context->language->id);
$combinationImages = $obj->getCombinationImages($this->context->language->id);
foreach ($combinaisons AS $k => $combinaison)
{
$combArray[$combinaison['id_product_attribute']]['wholesale_price'] = $combinaison['wholesale_price'];
@@ -3441,13 +3428,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>&nbsp;
'.(!$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).'">
'.(!$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')).$this->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)$context->employee->id).'" 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)$this->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)$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>';
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)$this->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>';
@@ -3487,7 +3474,7 @@ class AdminProducts extends AdminTab
echo '
</select>
&nbsp;&nbsp;<input type="submit" value="'.$this->l('OK').'" name="submitAdd'.$this->table.'AndStay" class="button" />
&nbsp;&nbsp;&nbsp;&nbsp;<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>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="index.php?tab=AdminAttributesGroups&token='.Tools::getAdminToken('AdminAttributesGroups'.(int)(Tab::getIdFromClassName('AdminAttributesGroups')).(int)$this->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>
@@ -3499,12 +3486,11 @@ class AdminProducts extends AdminTab
function displayFormFeatures($obj)
{
$context = Context::getContext();
parent::displayForm();
if ($obj->id)
{
$feature = Feature::getFeatures($context->language->id);
$feature = Feature::getFeatures($this->context->language->id);
$ctab = '';
foreach ($feature AS $tab)
$ctab .= 'ccustom_'.$tab['id_feature'].'¤';
@@ -3524,7 +3510,7 @@ class AdminProducts extends AdminTab
</table>
<hr style="width:100%;" /><br />';
// Header
$nb_feature = Feature::nbFeatures($context->language->id);
$nb_feature = Feature::nbFeatures($this->context->language->id);
echo '
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:900px;">
<tr>
@@ -3550,7 +3536,7 @@ class AdminProducts extends AdminTab
if ($tab_products['id_feature'] == $tab_features['id_feature'])
$current_item = $tab_products['id_feature_value'];
$featureValues = FeatureValue::getFeatureValuesWithLang($context->language->id, (int)$tab_features['id_feature']);
$featureValues = FeatureValue::getFeatureValuesWithLang($this->context->language->id, (int)$tab_features['id_feature']);
echo '
<tr>
@@ -3574,7 +3560,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)$context->employee->id).'" 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)$this->context->employee->id).'" style="color: #666; text-decoration: underline;">'.$this->l('Add pre-defined values first').'</a></span>';
echo '
</td>
@@ -3598,7 +3584,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)$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').'" />&nbsp;'.$this->l('Add a new feature').'</a>
<a href="index.php?tab=AdminFeatures&addfeature&token='.Tools::getAdminToken('AdminFeatures'.(int)(Tab::getIdFromClassName('AdminFeatures')).(int)$this->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').'" />&nbsp;'.$this->l('Add a new feature').'</a>
</div>';
}
else
@@ -3615,9 +3601,8 @@ class AdminProducts extends AdminTab
private function displayPack(Product $obj)
{
$context = Context::getContext();
$boolPack = (($obj->id AND Pack::isPack($obj->id)) OR Tools::getValue('ppack')) ? true : false;
$packItems = $boolPack ? Pack::getItems($obj->id, $context->language->id) : array();
$packItems = $boolPack ? Pack::getItems($obj->id, $this->context->language->id) : array();
echo '
<tr>
+2 -2
View File
@@ -29,7 +29,7 @@ class AdminProfiles extends AdminTab
{
public function __construct()
{
$context = Context::getContext();
$this->context = Context::getContext();
$this->table = 'profile';
$this->className = 'Profile';
$this->lang = true;
@@ -42,7 +42,7 @@ class AdminProfiles extends AdminTab
$this->identifier = 'id_profile';
$list_profile = array();
foreach(Profile::getProfiles($context->language->id) as $profil)
foreach(Profile::getProfiles($this->context->language->id) as $profil)
$list_profile[] = array('value' => $profil['id_profile'], 'name' => $profil['name']);
parent::__construct();
+1 -2
View File
@@ -67,10 +67,9 @@ class AdminRangePrice extends AdminTab
public function displayForm($isMainTab = true)
{
parent::displayForm();
$context = Context::getContext();
if (!($obj = $this->loadObject(true)))
return;
$currency = $context->currency;
$currency = $this->context->currency;
$carrierArray = array();
$carriers = Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
+5 -8
View File
@@ -90,8 +90,7 @@ class AdminReferrers extends AdminTab
public function displayJavascript()
{
$context = Context::getContext();
$products = Product::getSimpleProducts($context->language->id);
$products = Product::getSimpleProducts($this->context->language->id);
$productsArray = array();
foreach ($products as $product)
$productsArray[] = $product['id_product'];
@@ -130,7 +129,7 @@ class AdminReferrers extends AdminTab
{
referrerStatus[id_referrer] = true;
for (var i = 0; i < productIds.length; ++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]},
$.getJSON("'.dirname(self::$currentIndex).'/ajax.php",{ajaxReferrers:1, ajaxProductFilter:1,id_employee:'.(int)$this->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();
@@ -373,7 +372,6 @@ class AdminReferrers extends AdminTab
public function viewreferrer()
{
$context = Context::getContext();
$referrer = new Referrer((int)(Tools::getValue('id_referrer')));
$displayTab = array(
@@ -393,7 +391,7 @@ class AdminReferrers extends AdminTab
<script type="text/javascript">
function updateConversionRate(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},
$.getJSON("'.dirname(self::$currentIndex).'/ajax.php",{ajaxReferrers:1, ajaxProductFilter:1,id_employee:'.(int)$this->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.');';
@@ -406,7 +404,7 @@ class AdminReferrers extends AdminTab
var form = document.layers ? document.forms.product : document.product;
var filter = form.filterProduct.value;
$.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},
{ajaxReferrers:1,ajaxFillProducts:1,id_employee:'.(int)$this->context->employee->id.',token:"'.Tools::getValue('token').'",id_lang:'.(int)$this->context->language->id.',filter:filter},
function(j) {
form.selectProduct.length = j.length + 1;
@@ -440,7 +438,6 @@ class AdminReferrers extends AdminTab
public function displayListContent($token = NULL)
{
$context = Context::getContext();
$irow = 0;
if ($this->_list)
foreach ($this->_list AS $tr)
@@ -452,7 +449,7 @@ class AdminReferrers extends AdminTab
{
echo '<td onclick="showProductLines('.$id.');" class="pointer '.(isset($params['align']) ? $params['align'] : '').'">'.(isset($params['prefix']) ? $params['prefix'] : '');
if (isset($tr[$key]) AND isset($params['price']))
echo Tools::displayPrice($tr[$key], $context->currency);
echo Tools::displayPrice($tr[$key], $this->context->currency);
elseif (isset($tr[$key]))
echo $tr[$key];
else
+8 -10
View File
@@ -29,12 +29,12 @@ class AdminReturn extends AdminTab
{
public function __construct()
{
$context = Context::getContext();
$this->context = Context::getContext();
$this->table = 'order_return';
$this->className = 'OrderReturn';
$this->colorOnBackground = true;
$this->_select = 'orsl.`name`';
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = '.(int)$context->language->id.')';
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = '.(int)$this->context->language->id.')';
$this->fieldsDisplay = array(
'id_order_return' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
@@ -53,7 +53,7 @@ class AdminReturn extends AdminTab
public function postProcess()
{
$context = Context::getContext();
$this->context = Context::getContext();
if (Tools::isSubmit('deleteorder_return_detail'))
{
if ($this->tabAccess['delete'] === '1')
@@ -119,7 +119,6 @@ class AdminReturn extends AdminTab
public function display()
{
$context = Context::getContext();
// Include current tab
if (isset($_GET['update'.$this->table]))
{
@@ -133,7 +132,7 @@ class AdminReturn extends AdminTab
}
else
{
$this->getList($context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
$this->getList($this->context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
$this->displayList();
$this->displayOptionsList();
$this->includeSubTab('display');
@@ -158,7 +157,6 @@ class AdminReturn extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -174,12 +172,12 @@ class AdminReturn extends AdminTab
$customer = new Customer((int)($obj->id_customer));
echo '
<div class="margin-form">'.$customer->firstname.' '.$customer->lastname.'
<p style="clear: both"><a href="index.php?tab=AdminCustomers&id_customer='.$customer->id.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'">'.$this->l('View details on customer page').'</a></p>
<p style="clear: both"><a href="index.php?tab=AdminCustomers&id_customer='.$customer->id.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id).'">'.$this->l('View details on customer page').'</a></p>
</div>
<label>'.$this->l('Order:').' </label>';
$order = new Order((int)($obj->id_order));
echo ' <div class="margin-form">'.$this->l('Order #').sprintf('%06d', $order->id).' '.$this->l('from').' '.Tools::displayDate($order->date_upd, $order->id_lang).'
<p style="clear: both"><a href="index.php?tab=AdminOrders&id_order='.$order->id.'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id).'">'.$this->l('View details on order page').'</a></p>
<p style="clear: both"><a href="index.php?tab=AdminOrders&id_order='.$order->id.'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id).'">'.$this->l('View details on order page').'</a></p>
</div>
<label>'.$this->l('Customer explanation:').' </label>
<div class="margin-form">'.$obj->question.'</div>
@@ -187,7 +185,7 @@ class AdminReturn extends AdminTab
<label>'.$this->l('Status:').' </label>
<div class="margin-form">
<select name=\'state\'>';
$states = OrderReturnState::getOrderReturnStates($context->language->id);
$states = OrderReturnState::getOrderReturnStates($this->context->language->id);
foreach ($states as $state)
echo '<option value="'.$state['id_order_return_state'].'"'.($obj->state == $state['id_order_return_state'] ? ' selected="selected"' : '').'>'.$state['name'].'</option>';
echo ' </select>
@@ -196,7 +194,7 @@ class AdminReturn extends AdminTab
if ($obj->state >= 3)
echo ' <label>'.$this->l('Slip:').' </label>
<div class="margin-form">'.$this->l('Generate a new slip from the customer order').'
<p style="clear: both"><a href="index.php?tab=AdminOrders&id_order='.$order->id.'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id).'#products">'.$this->l('More information on order page').'</a></p>
<p style="clear: both"><a href="index.php?tab=AdminOrders&id_order='.$order->id.'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id).'#products">'.$this->l('More information on order page').'</a></p>
</div>';
echo ' <label>'.$this->l('Products:').' </label>
<div class="margin-form">';
+2 -3
View File
@@ -127,7 +127,6 @@ class AdminScenes extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -141,7 +140,7 @@ class AdminScenes extends AdminTab
echo 'startingData = new Array();'."\n";
foreach ($obj->getProducts() as $key => $product)
{
$productObj = new Product($product['id_product'], true, $context->language->id);
$productObj = new Product($product['id_product'], true, $this->context->language->id);
echo 'startingData['.$key.'] = new Array(\''.$productObj->name.'\', '.$product['id_product'].', '.$product['x_axis'].', '.$product['y_axis'].', '.$product['zone_width'].', '.$product['zone_height'].');';
}
@@ -244,7 +243,7 @@ class AdminScenes extends AdminTab
<th>'.$this->l('ID').'</th>
<th>'.$this->l('Image map name:').'</th>
</tr>';
$categories = Category::getCategories($context->language->id, false);
$categories = Category::getCategories($this->context->language->id, false);
$done = array();
$index = array();
if (Tools::isSubmit('categories'))
+19 -20
View File
@@ -35,13 +35,13 @@ class AdminSearch extends AdminTab
*/
public function searchCatalog($query)
{
$context = Context::getContext();
$this->_list['products'] = Product::searchByName($context->language->id, $query);
$this->context = Context::getContext();
$this->_list['products'] = Product::searchByName($this->context->language->id, $query);
if (!empty($this->_list['products']))
for ($i = 0; $i < count($this->_list['products']); $i++)
$this->_list['products'][$i]['nameh'] = str_ireplace($query, '<span class="highlight">'.Tools::htmlentitiesUTF8($query).'</span>', $this->_list['products'][$i]['name']);
$this->_list['categories'] = Category::searchByName($context->language->id, $query);
$this->_list['categories'] = Category::searchByName($this->context->language->id, $query);
}
/**
@@ -56,7 +56,7 @@ class AdminSearch extends AdminTab
function postProcess()
{
$context = Context::getContext();
$this->context = Context::getContext();
$query = trim(Tools::getValue('bo_query'));
$searchType = (int)Tools::getValue('bo_search_type');
@@ -71,7 +71,7 @@ class AdminSearch extends AdminTab
{
global $_LANGADM;
$tabs = array();
$result = Db::getInstance()->ExecuteS('SELECT class_name, name FROM '._DB_PREFIX_.'tab t INNER JOIN '._DB_PREFIX_.'tab_lang tl ON t.id_tab = tl.id_tab AND tl.id_lang = '.(int)$context->language->id);
$result = Db::getInstance()->ExecuteS('SELECT class_name, name FROM '._DB_PREFIX_.'tab t INNER JOIN '._DB_PREFIX_.'tab_lang tl ON t.id_tab = tl.id_tab AND tl.id_lang = '.(int)$this->context->language->id);
foreach ($result as $row)
$tabs[$row['class_name']] = $row['name'];
foreach (AdminTab::$tabParenting as $key => $value)
@@ -130,7 +130,7 @@ class AdminSearch extends AdminTab
/* Handle product ID */
if ($searchType == 1 AND (int)$query AND Validate::isUnsignedInt((int)$query))
if ($product = new Product((int)$query) AND Validate::isLoadedObject($product))
Tools::redirectAdmin('index.php?tab=AdminCatalog&id_product='.(int)($product->id).'&addproduct'.'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id));
Tools::redirectAdmin('index.php?tab=AdminCatalog&id_product='.(int)($product->id).'&addproduct'.'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id));
/* Normal catalog search */
$this->searchCatalog($query);
@@ -154,7 +154,7 @@ class AdminSearch extends AdminTab
/* Handle customer ID */
if ($searchType AND (int)$query AND Validate::isUnsignedInt((int)$query))
if ($customer = new Customer((int)$query) AND Validate::isLoadedObject($customer))
Tools::redirectAdmin('index.php?tab=AdminCustomers&id_customer='.(int)($customer->id).'&viewcustomer'.'&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id));
Tools::redirectAdmin('index.php?tab=AdminCustomers&id_customer='.(int)($customer->id).'&viewcustomer'.'&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id));
/* Normal customer search */
$this->searchCustomer($query);
@@ -164,7 +164,7 @@ class AdminSearch extends AdminTab
if ($searchType == 3)
{
if ((int)$query AND Validate::isUnsignedInt((int)$query) AND $order = new Order((int)$query) AND Validate::isLoadedObject($order))
Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id));
Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id));
$this->_errors[] = Tools::displayError('No order found with this ID:').' '.Tools::htmlentitiesUTF8($query);
}
@@ -180,7 +180,7 @@ class AdminSearch extends AdminTab
if ($searchType == 5)
{
if ((int)$query AND Validate::isUnsignedInt((int)$query) AND $cart = new Cart((int)$query) AND Validate::isLoadedObject($cart))
Tools::redirectAdmin('index.php?tab=AdminCarts&id_cart='.(int)($cart->id).'&viewcart'.'&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)$context->employee->id));
Tools::redirectAdmin('index.php?tab=AdminCarts&id_cart='.(int)($cart->id).'&viewcart'.'&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)$this->context->employee->id));
$this->_errors[] = Tools::displayError('No cart found with this ID:').' '.Tools::htmlentitiesUTF8($query);
}
}
@@ -188,7 +188,6 @@ class AdminSearch extends AdminTab
public function display()
{
$context = Context::getContext();
self::$currentIndex = 'index.php';
$query = trim(Tools::getValue('bo_query'));
$nbCategories = $nbProducts = $nbCustomers = 0;
@@ -221,17 +220,17 @@ class AdminSearch extends AdminTab
<td>'.$product['id_product'].'</td>
<td align="center">'.($product['manufacturer_name'] != NULL ? stripslashes($product['manufacturer_name']) : '--').'</td>
<td>'.$product['reference'].'</td>
<td><a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">'.stripslashes($product['nameh']).'</a></td>
<td>'.Tools::displayPrice($product['price'], $context->currency).'</td>
<td><a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'">'.stripslashes($product['nameh']).'</a></td>
<td>'.Tools::displayPrice($product['price'], $this->context->currency).'</td>
<td>'.stripslashes($product['tax_name']).'</td>
<td align="center">'.$product['quantity'].'</td>
<td align="center">'.$product['weight'].' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
<td align="center"><a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">
<td align="center"><a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'">
<img src="../img/admin/'.($product['active'] ? 'enabled.gif' : 'forbbiden.gif').'" alt="" /></a></td>
<td>
<a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">
<a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'">
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this product').'" /></a>&nbsp;
<a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'"
<a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'"
onclick="return confirm(\''.$this->l('Do you want to delete this product?', __CLASS__, true, false).' ('.addslashes($product['name']).')\');">
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this product').'" /></a>
</td>
@@ -260,16 +259,16 @@ class AdminSearch 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'], $context->language->id).'</td>
<td>'.Tools::displayDate($customer['date_add'], $context->language->id).'</td>
<td>'.Tools::displayDate($customer['birthday'], $this->context->language->id).'</td>
<td>'.Tools::displayDate($customer['date_add'], $this->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="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'">
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id).'">
<img src="../img/admin/details.gif" alt="'.$this->l('View orders').'" /></a>
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&addcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'">
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&addcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id).'">
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this customer').'" /></a>
<a href="'.self::$currentIndex.'?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).'\');">
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&deletecustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->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>';
+4 -5
View File
@@ -32,11 +32,11 @@ class AdminShipping extends AdminTab
public function __construct()
{
$context = Context::getContext();
$this->context = Context::getContext();
$this->table = 'delivery';
$this->_fieldsHandling = array(
'PS_SHIPPING_HANDLING' => array('title' => $this->l('Handling charges'), 'suffix' => $context->currency, 'validation' => 'isPrice', 'cast' => 'floatval'),
'PS_SHIPPING_FREE_PRICE' => array('title' => $this->l('Free shipping starts at'), 'suffix' => $context->currency, 'validation' => 'isPrice', 'cast' => 'floatval'),
'PS_SHIPPING_HANDLING' => array('title' => $this->l('Handling charges'), 'suffix' => $this->context->currency, 'validation' => 'isPrice', 'cast' => 'floatval'),
'PS_SHIPPING_FREE_PRICE' => array('title' => $this->l('Free shipping starts at'), 'suffix' => $this->context->currency, 'validation' => 'isPrice', 'cast' => 'floatval'),
'PS_SHIPPING_FREE_WEIGHT' => array('title' => $this->l('Free shipping starts at'), 'suffix' => Configuration::get('PS_WEIGHT_UNIT'), 'validation' => 'isUnsignedFloat', 'cast' => 'floatval'),
'PS_SHIPPING_METHOD' => array('title' => $this->l('Billing'), 'validation' => 'isBool', 'cast' => 'intval'));
@@ -202,7 +202,6 @@ class AdminShipping extends AdminTab
public function displayFormFees()
{
$context = Context::getContext();
$carrierArray = array();
$id_carrier = Tools::getValue('id_carrier');
$carriers = Carrier::getCarriers(Configuration::get('PS_LANG_DEFAULT'), true , false,false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
@@ -239,7 +238,7 @@ class AdminShipping extends AdminTab
<tr>
<th>'.$this->l('Zone / Range').'</th>';
$currency = $context->currency;
$currency = $this->context->currency;
$rangeObj = $carrierSelected->getRangeObject();
$rangeTable = $carrierSelected->getRangeTable();
$suffix = $carrierSelected->getRangeSuffix();
+3 -5
View File
@@ -30,8 +30,7 @@ class AdminShop extends AdminTab
{
public function __construct()
{
$context = Context::getContext();
$this->context = Context::getContext();
$this->table = 'shop';
$this->className = 'Shop';
$this->edit = true;
@@ -40,7 +39,7 @@ class AdminShop extends AdminTab
$this->_select = 'gs.name group_shop_name, cl.name category_name';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'group_shop` gs ON (a.id_group_shop = gs.id_group_shop)
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.id_category = cl.id_category AND cl.id_lang='.(int)$context->language->id.')';
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.id_category = cl.id_category AND cl.id_lang='.(int)$this->context->language->id.')';
$this->_group = 'GROUP BY id_shop';
$this->fieldsDisplay = array(
@@ -80,7 +79,6 @@ class AdminShop extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm($isMainTab);
if (!($obj = $this->loadObject(true)))
@@ -111,7 +109,7 @@ class AdminShop extends AdminTab
echo '<label for="id_category">'.$this->l('Category root').'</label>
<div class="margin-form">
<select id="id_category" name="id_category">';
$categories = Category::getCategories($context->language->id, false);
$categories = Category::getCategories($this->context->language->id, false);
Category::recurseCategory($categories, $categories[0][1], 1, $obj->id_category);
echo '
+1 -2
View File
@@ -66,9 +66,8 @@ class AdminSlip extends AdminTab
public function display()
{
$context = Context::getContext();
echo '<div style="float:left;width:600px">';
$this->getList($context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
$this->getList($this->context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
$this->displayList();
echo '</div>';
+1 -2
View File
@@ -98,7 +98,6 @@ class AdminStates extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -121,7 +120,7 @@ class AdminStates extends AdminTab
<label>'.$this->l('Country:').' </label>
<div class="margin-form">
<select name="id_country">';
$countries = Country::getCountries($context->language->id, false, true);
$countries = Country::getCountries($this->context->language->id, false, true);
foreach ($countries AS $country)
echo '<option value="'.(int)($country['id_country']).'"'.(($this->getFieldValue($obj, 'id_country') == $country['id_country']) ? ' selected="selected"' : '').'>'.$country['name'].'</option>';
echo '
+7 -8
View File
@@ -40,7 +40,7 @@ abstract class AdminStatsTab extends AdminPreferences
public function postProcess()
{
$context = Context::getContext();
$this->context = Context::getContext();
if (Tools::isSubmit('submitDatePicker'))
{
if (!Validate::isDate($from = Tools::getValue('datepickerFrom')) OR !Validate::isDate($to = Tools::getValue('datepickerTo')))
@@ -81,9 +81,9 @@ abstract class AdminStatsTab extends AdminPreferences
}
if (isset($from) AND isset($to) AND !sizeof($this->_errors))
{
$context->employee->stats_date_from = $from;
$context->employee->stats_date_to = $to;
$context->employee->update();
$this->context->employee->stats_date_from = $from;
$this->context->employee->stats_date_to = $to;
$this->context->employee->update();
Tools::redirectAdmin($_SERVER['REQUEST_URI']);
}
if (Tools::getValue('submitSettings'))
@@ -137,10 +137,9 @@ abstract class AdminStatsTab extends AdminPreferences
protected function getDate()
{
$context = Context::getContext();
$year = isset($context->cookie->stats_year) ? $context->cookie->stats_year : date('Y');
$month = isset($context->cookie->stats_month) ? sprintf('%02d', $context->cookie->stats_month) : '%';
$day = isset($context->cookie->stats_day) ? sprintf('%02d', $context->cookie->stats_day) : '%';
$year = isset($this->context->cookie->stats_year) ? $this->context->cookie->stats_year : date('Y');
$month = isset($this->context->cookie->stats_month) ? sprintf('%02d', $this->context->cookie->stats_month) : '%';
$day = isset($this->context->cookie->stats_day) ? sprintf('%02d', $this->context->cookie->stats_day) : '%';
return $year.'-'.$month.'-'.$day;
}
+10 -12
View File
@@ -29,6 +29,7 @@ class AdminStockMvt extends AdminTab
{
public function __construct()
{
$this->context = Context::getContext();
$this->table = 'stock_mvt';
$this->className = 'StockMvt';
$this->edit = false;
@@ -44,15 +45,14 @@ class AdminStockMvt extends AdminTab
'employee' => array('title' => $this->l('Employee'), 'width' => 100, 'havingFilter' => true),
);
$context = Context::getContext();
$this->_select = 'CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name, CONCAT(e.lastname, \' \', e.firstname) employee, mrl.name reason';
$this->_join = 'INNER JOIN '._DB_PREFIX_.'stock stock ON a.id_stock = stock.id_stock '.$context->shop->sqlSharedStock('stock').'
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (stock.id_product = pl.id_product AND pl.id_lang = '.(int)$context->language->id.$context->shop->sqlLang('pl').')
LEFT JOIN `'._DB_PREFIX_.'stock_mvt_reason_lang` mrl ON (a.id_stock_mvt_reason = mrl.id_stock_mvt_reason AND mrl.id_lang = '.(int)$context->language->id.')
$this->_join = 'INNER JOIN '._DB_PREFIX_.'stock stock ON a.id_stock = stock.id_stock '.$this->context->shop->sqlSharedStock('stock').'
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (stock.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
LEFT JOIN `'._DB_PREFIX_.'stock_mvt_reason_lang` mrl ON (a.id_stock_mvt_reason = mrl.id_stock_mvt_reason AND mrl.id_lang = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = a.id_employee)
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.id_product_attribute = stock.id_product_attribute)
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (al.id_attribute = pac.id_attribute AND al.id_lang = '.(int)$context->language->id.')';
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (al.id_attribute = pac.id_attribute AND al.id_lang = '.(int)$this->context->language->id.')';
$this->_group = 'GROUP BY a.id_stock_mvt';
parent::__construct();
}
@@ -60,7 +60,7 @@ class AdminStockMvt extends AdminTab
public function postProcess()
{
if (Tools::isSubmit('rebuildStock'))
StockMvt::addMissingMvt($context->employee->id, false);
StockMvt::addMissingMvt($this->context->employee->id, false);
return parent::postProcess();
}
@@ -100,10 +100,9 @@ class AdminStockMvt extends AdminTab
public function viewstock_mvt()
{
$context = Context::getContext();
$stockMvt = new StockMvt((int)Tools::getValue('id_stock_mvt'));
$product = new Product((int)$stockMvt->id_product, true, $context->language->id);
$movements = $product->getStockMvts($context->language->id);
$product = new Product((int)$stockMvt->id_product, true, $this->context->language->id);
$movements = $product->getStockMvts($this->context->language->id);
echo '<h2>'.$this->l('Stock Movements for').' '.$product->name.'</h2>
<table cellspacing="0" cellpadding="0" class="table widthfull">
@@ -127,7 +126,7 @@ class AdminStockMvt extends AdminTab
<td>'.$mvt['reason'].'</td>
<td>'.$mvt['employee'].'</td>
<td>#'.$mvt['id_order'].'</td>
<td>'.Tools::displayDate($mvt['date_add'], $context->language->id).'</td>
<td>'.Tools::displayDate($mvt['date_add'], $this->context->language->id).'</td>
</tr>';
}
echo '</table>';
@@ -136,7 +135,6 @@ class AdminStockMvt extends AdminTab
public function display()
{
$old_post = false;
$context = Context::getContext();
if (!isset($_GET['addstock_mvt_reason']) OR (Tools::isSubmit('submitAddstock_mvt_reason') AND Tools::getValue('id_stock_mvt_reason')))
{
@@ -178,7 +176,7 @@ class AdminStockMvt extends AdminTab
'sign' => array('title' => $this->l('Sign'), 'width' => 15, 'align' => 'center', 'type' => 'select', 'icon' => array(-1 => 'arrow_down.png', 1 => 'arrow_up.png'), 'orderby' => false),
'name' => array('title' => $this->l('Name'), 'width' => 500));
$reasons = StockMvtReason::getStockMvtReasons($context->language->id);
$reasons = StockMvtReason::getStockMvtReasons($this->context->language->id);
$this->_fieldsOptions = array('PS_STOCK_MVT_REASON_DEFAULT' => array('title' => $this->l('Default Stock Movement reason:'),
'cast' => 'intval',
'type' => 'select',
+4 -5
View File
@@ -34,7 +34,7 @@ class AdminStores extends AdminTab
public function __construct()
{
$context = Context::getContext();
$this->context = Context::getContext();
$this->table = 'store';
$this->className = 'Store';
$this->lang = false;
@@ -45,11 +45,11 @@ class AdminStores extends AdminTab
$this->_select = 'cl.`name` country, st.`name` state';
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'state` st ON (st.`id_state` = a.`id_state`)';
$this->_group = 'GROUP BY a.id_store';
$countries = Country::getCountries($context->language->id);
$countries = Country::getCountries($this->context->language->id);
foreach ($countries AS $country)
$this->countriesArray[$country['id_country']] = $country['name'];
@@ -151,7 +151,6 @@ class AdminStores extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -266,7 +265,7 @@ class AdminStores extends AdminTab
<input type="file" name="image" />
<p class="clear">'.$this->l('Store window picture').'</p>';
echo $this->displayImage($obj->id, _PS_STORE_IMG_DIR_.'/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminStores'.(int)(Tab::getIdFromClassName('AdminStores')).(int)$context->employee->id), true);
echo $this->displayImage($obj->id, _PS_STORE_IMG_DIR_.'/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminStores'.(int)(Tab::getIdFromClassName('AdminStores')).(int)$this->context->employee->id), true);
echo '</div>
<table cellpadding="2" cellspacing="2" style="padding: 10px; margin-top: 15px; border: 1px solid #BBB;">
+5 -6
View File
@@ -55,23 +55,22 @@ class AdminSuppliers extends AdminTab
public function viewsupplier()
{
$context = Context::getContext();
if (!($supplier = $this->loadObject()))
return;
echo '<h2>'.$supplier->name.'</h2>';
$products = $supplier->getProductsLite($context->language->id);
$products = $supplier->getProductsLite($this->context->language->id);
echo '<h3>'.$this->l('Total products:').' '.sizeof($products).'</h3>';
foreach ($products AS $product)
{
$product = new Product($product['id_product'], false, $context->language->id);
$product = new Product($product['id_product'], false, $this->context->language->id);
echo '<hr />';
if (!$product->hasAttributes())
{
echo '
<table border="0" cellpadding="0" cellspacing="0" class="table width3">
<tr>
<th><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" target="_blank">'.$product->name.'</a></th>
<th><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'" target="_blank">'.$product->name.'</a></th>
'.(!empty($product->reference) ? '<th width="150">'.$this->l('Ref:').' '.$product->reference.'</th>' : '').'
'.(!empty($product->ean13) ? '<th width="120">'.$this->l('EAN13:').' '.$product->ean13.'</th>' : '').'
'.(!empty($product->upc) ? '<th width="120">'.$this->l('UPC:').' '.$product->upc.'</th>' : '').'
@@ -82,7 +81,7 @@ class AdminSuppliers extends AdminTab
else
{
echo '
<h3><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" target="_blank">'.$product->name.'</a></h3>
<h3><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'" target="_blank">'.$product->name.'</a></h3>
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width: 600px;">
<tr>
<th>'.$this->l('Attribute name').'</th>
@@ -92,7 +91,7 @@ class AdminSuppliers extends AdminTab
'.(Configuration::get('PS_STOCK_MANAGEMENT') ? '<th class="right" width="40">'.$this->l('Quantity').'</th>' : '').'
</tr>';
/* Build attributes combinaisons */
$combinaisons = $product->getAttributeCombinaisons($context->language->id);
$combinaisons = $product->getAttributeCombinaisons($this->context->language->id);
foreach ($combinaisons AS $k => $combinaison)
{
$combArray[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
+7 -8
View File
@@ -29,19 +29,19 @@ class AdminTabs extends AdminTab
{
public function __construct()
{
$context = Context::getContext();
$this->context = Context::getContext();
$this->table = 'tab';
$this->className = 'Tab';
$this->lang = true;
$this->edit = true;
$this->delete = true;
$this->_select = '(SELECT stl.`name` FROM `'._DB_PREFIX_.'tab_lang` stl WHERE stl.`id_tab` = a.`id_parent` AND stl.`id_lang` = '.(int)$context->language->id.' LIMIT 1) AS parent';
$this->_select = '(SELECT stl.`name` FROM `'._DB_PREFIX_.'tab_lang` stl WHERE stl.`id_tab` = a.`id_parent` AND stl.`id_lang` = '.(int)$this->context->language->id.' LIMIT 1) AS parent';
$this->fieldImageSettings = array('name' => 'icon', 'dir' => 't');
$this->imageType = 'gif';
$tabs = array(0 => $this->l('Home'));
foreach (Tab::getTabs($context->language->id, 0) AS $tab)
foreach (Tab::getTabs($this->context->language->id, 0) AS $tab)
$tabs[$tab['id_tab']] = $tab['name'];
$this->fieldsDisplay = array(
'id_tab' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
@@ -92,21 +92,20 @@ class AdminTabs extends AdminTab
public function displayList()
{
$context = Context::getContext();
$this->context = Context::getContext();
parent::displayList();
$tabs = Tab::getTabs($context->language->id, 0);
$tabs = Tab::getTabs($this->context->language->id, 0);
echo '<br /><h2>'.$this->l('Positions').'</h2>
<h3>'.$this->l('Level').' 1</h3>';
$this->_posTabs($this->l('Main'), $tabs);
echo '<h3>'.$this->l('Level').' 2</h3>';
foreach ($tabs AS $t)
$this->_posTabs(stripslashes($t['name']), Tab::getTabs($context->language->id, $t['id_tab']));
$this->_posTabs(stripslashes($t['name']), Tab::getTabs($this->context->language->id, $t['id_tab']));
}
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -151,7 +150,7 @@ class AdminTabs extends AdminTab
<select name="id_parent">
<option value="-1" '.(($this->getFieldValue($obj, 'id_parent') == -1) ? 'selected="selected"' : '').'>'.$this->l('None').'</option>
<option value="0" '.(($this->getFieldValue($obj, 'id_parent') == 0) ? 'selected="selected"' : '').'>'.$this->l('Home').'</option>';
foreach (Tab::getTabs($context->language->id, 0) AS $tab)
foreach (Tab::getTabs($this->context->language->id, 0) AS $tab)
echo ' <option value="'.$tab['id_tab'].'" '.($tab['id_tab'] == $this->getFieldValue($obj, 'id_parent') ? 'selected="selected"' : '').'>'.$tab['name'].'</option>';
echo ' </select>
</div>
+6 -9
View File
@@ -69,8 +69,7 @@ class AdminTaxRulesGroup extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
$tax_rules = isset($obj->id) ? $tax_rules = TaxRule::getTaxRulesByGroupId($obj->id) : array();
@@ -181,7 +180,7 @@ class AdminTaxRulesGroup extends AdminTab
<script type="text/javascript">
var tabPane1 = new WebFXTabPane( document.getElementById( "tab-pane-1" ) );
</script>
<link type="text/css" rel="stylesheet" href="../css/tabpane.css" />'.$this->renderZones($tax_rules, $context->language->id);
<link type="text/css" rel="stylesheet" href="../css/tabpane.css" />'.$this->renderZones($tax_rules, $this->context->language->id);
echo '
<div class="margin-form" style="margin-top: 10px">
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />&nbsp;&nbsp;
@@ -383,11 +382,10 @@ class AdminTaxRulesGroup extends AdminTab
protected function afterUpdate($object)
{
$context = Context::getContext();
TaxRule::deleteByGroupId($object->id);
foreach(Country::getCountries($context->language->id, true) AS $country)
foreach(Country::getCountries($this->context->language->id, true) AS $country)
{
$id_tax = (int)Tools::getValue('tax_'.$country['id_country'].'_0');
@@ -455,7 +453,6 @@ class AdminTaxRulesGroup extends AdminTab
public function postProcess()
{
$context = Context::getContext();
if (!isset($this->table))
return false;
@@ -522,7 +519,7 @@ class AdminTaxRulesGroup extends AdminTab
// Default behavior (save and back)
$id_product = (int)Tools::getValue('id_product');
if ($id_product)
Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id));
Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id));
Tools::redirectAdmin(self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token);
}
@@ -554,7 +551,7 @@ class AdminTaxRulesGroup extends AdminTab
$this->updateAssoGroupShop($object->id);
$id_product = (int)Tools::getValue('id_product');
if ($id_product)
Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id));
Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id));
Tools::redirectAdmin(self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token);
// Default behavior (save and back)
+1 -2
View File
@@ -62,13 +62,12 @@ class AdminTaxes extends AdminTab
public function displayForm($isMainTab = true)
{
$context = Context::getContext();
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
$zones = Zone::getZones(true);
$states = State::getStates($context->language->id);
$states = State::getStates($this->context->language->id);
echo '
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
+14 -17
View File
@@ -50,7 +50,6 @@ class AdminTracking extends AdminTab
public function getObjects($type)
{
$context = Context::getContext();
switch ($type)
{
case 'categories_empty':
@@ -96,10 +95,10 @@ class AdminTracking extends AdminTab
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = pa.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer` = m.`id_manufacturer`)
WHERE pa.quantity <= 0
ORDER BY pa.`id_product_attribute`
@@ -130,7 +129,6 @@ class AdminTracking extends AdminTab
public function displayProducts()
{
$context = Context::getContext();
if (isset($this->_list['obj']))
{
$nbProducts = sizeof($this->_list['obj']);
@@ -159,7 +157,7 @@ class AdminTracking extends AdminTab
foreach ($this->_list['obj'] AS $k => $prod)
{
$product = new Product((int)($prod['id_product']));
$product->name = $product->name[(int)$context->language->id];
$product->name = $product->name[(int)$this->context->language->id];
$taxrate = Tax::getProductTaxRate($product->id);
echo '
@@ -167,16 +165,16 @@ class AdminTracking extends AdminTab
<td>'.$product->id.'</td>
<td align="center">'.($product->manufacturer_name != NULL ? stripslashes($product->manufacturer_name) : '--').'</td>
<td>'.$product->reference.'</td>
<td><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">'.stripslashes($product->name).'</a></td>
<td>'.Tools::displayPrice($product->getPrice(), $context->currency).'</td>
<td><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'">'.stripslashes($product->name).'</a></td>
<td>'.Tools::displayPrice($product->getPrice(), $this->context->currency).'</td>
<td>'.(float)$taxrate.'% </td>
<td align="center">'.$product->quantity.'</td>
<td align="center">'.$product->weight.' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'"><img src="../img/admin/'.($product->active ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'"><img src="../img/admin/'.($product->active ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
<td>
<a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">
<a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'">
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this product').'" /></a>&nbsp;
<a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.str_replace('"', ' ', $product->name)).' ?\');">
<a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.str_replace('"', ' ', $product->name)).' ?\');">
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this product').'" /></a>
</td>
</tr>';
@@ -187,7 +185,6 @@ class AdminTracking extends AdminTab
public function displayAttributes()
{
$context = Context::getContext();
if (isset($this->_list['obj']))
{
@@ -238,16 +235,16 @@ class AdminTracking extends AdminTab
<td>'.$prod['id_product'].'</td>
<td align="center">'.($prod['manufacturer_name'] != NULL ? stripslashes($prod['manufacturer_name']) : '--').'</td>
<td>'.$prod['reference'].'</td>
<td><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">'.stripslashes($prod['name']).' ('.$prod['combination_name'].')'.'</a></td>
<td>'.Tools::displayPrice(Product::getPriceStatic((int)($prod['id_product']), true, $prod['id_product_attribute']), $context->currency).'</td>
<td><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'">'.stripslashes($prod['name']).' ('.$prod['combination_name'].')'.'</a></td>
<td>'.Tools::displayPrice(Product::getPriceStatic((int)($prod['id_product']), true, $prod['id_product_attribute']), $this->context->currency).'</td>
<td>'.(float)$taxrate.'% </td>
<td align="center">'.$prod['quantity'].'</td>
<td align="center">'.($prod['weight'] + $prod['product_weight']).' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'"><img src="../img/admin/'.($prod['active'] ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'"><img src="../img/admin/'.($prod['active'] ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
<td>
<a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">
<a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'">
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this product').'" /></a>&nbsp;
<a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.$prod['name']).' ?\');">
<a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id).'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.$prod['name']).' ?\');">
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this product').'" /></a>
</td>
</tr>';
+1 -2
View File
@@ -671,7 +671,6 @@ class AdminTranslations extends AdminTab
}
public function display()
{
$context = Context::getContext();
$translations = array(
'front' => $this->l('Front Office translations'),
'back' => $this->l('Back Office translations'),
@@ -780,7 +779,7 @@ class AdminTranslations extends AdminTab
<fieldset class="width3"><legend><img src="../img/admin/copy_files.gif" />'.$this->l('Copy').'</legend>
<p>'.$this->l('Copies data from one language to another.').'<br />'.
$this->l('Be careful, as it will replace all existing data for the destination language!').'<br />'.
$this->l('If necessary').', <b><a href="index.php?tab=AdminLanguages&addlang&token='.Tools::getAdminToken('AdminLanguages'.(int)(Tab::getIdFromClassName('AdminLanguages')).(int)$context->employee->id).'">'.$this->l('first create a new language').'</a></b>.</p>
$this->l('If necessary').', <b><a href="index.php?tab=AdminLanguages&addlang&token='.Tools::getAdminToken('AdminLanguages'.(int)(Tab::getIdFromClassName('AdminLanguages')).(int)$this->context->employee->id).'">'.$this->l('first create a new language').'</a></b>.</p>
<div style="float:left;">
<p>
<div style="width:75px; font-weight:bold; float:left;">'.$this->l('From:').'</div>
+2 -3
View File
@@ -234,7 +234,6 @@ echo '
public function display()
{
$context = Context::getContext();
// Include other tab in current tab
if ($this->includeSubTab('display', array('submitAdd2', 'add', 'update', 'view'))){}
@@ -252,7 +251,7 @@ echo '
}
elseif (isset($_GET['update'.$this->table]))
{
if ($this->tabAccess['edit'] === '1' OR ($this->table == 'employee' AND $context->employee->id == Tools::getValue('id_employee')))
if ($this->tabAccess['edit'] === '1' OR ($this->table == 'employee' AND $this->context->employee->id == Tools::getValue('id_employee')))
{
$this->displayForm();
if ($this->tabAccess['view'])
@@ -268,7 +267,7 @@ echo '
{
$this->checkForWarning();
$this->getList($context->language->id);
$this->getList($this->context->language->id);
$this->displayList();
$this->displayRequiredFields();
+43 -54
View File
@@ -176,7 +176,7 @@ abstract class AdminTabCore
public function __construct()
{
$context = Context::getContext();
$this->context = Context::getContext();
$this->id = Tab::getCurrentTabId();
$this->_conf = array(
@@ -198,7 +198,7 @@ abstract class AdminTabCore
$className = get_class($this);
if ($className == 'AdminCategories' OR $className == 'AdminProducts')
$className = 'AdminCatalog';
$this->token = Tools::getAdminToken($className.(int)$this->id.(int)$context->employee->id);
$this->token = Tools::getAdminToken($className.(int)$this->id.(int)$this->context->employee->id);
if (!Tools::isMultiShopActivated())
$this->shopLinkType = '';
@@ -247,7 +247,6 @@ abstract class AdminTabCore
*/
public function display()
{
$context = Context::getContext();
// Include other tab in current tab
if ($this->includeSubTab('display', array('submitAdd2', 'add', 'update', 'view'))){}
@@ -265,7 +264,7 @@ abstract class AdminTabCore
}
elseif (isset($_GET['update'.$this->table]))
{
if ($this->tabAccess['edit'] === '1' OR ($this->table == 'employee' AND $context->employee->id == Tools::getValue('id_employee')))
if ($this->tabAccess['edit'] === '1' OR ($this->table == 'employee' AND $this->context->employee->id == Tools::getValue('id_employee')))
{
$this->displayForm();
if ($this->tabAccess['view'])
@@ -279,7 +278,7 @@ abstract class AdminTabCore
else
{
$this->getList($context->language->id);
$this->getList($this->context->language->id);
$this->displayList();
$this->displayOptionsList();
$this->displayRequiredFields();
@@ -543,7 +542,6 @@ abstract class AdminTabCore
// set token
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
$context = Context::getContext();
// Sub included tab postProcessing
$this->includeSubTab('postProcess', array('status', 'submitAdd1', 'submitDel', 'delete', 'submitFilter', 'submitReset'));
@@ -669,7 +667,7 @@ abstract class AdminTabCore
/* Object update */
if (isset($id) AND !empty($id))
{
if ($this->tabAccess['edit'] === '1' OR ($this->table == 'employee' AND $context->employee->id == Tools::getValue('id_employee') AND Tools::isSubmit('updateemployee')))
if ($this->tabAccess['edit'] === '1' OR ($this->table == 'employee' AND $this->context->employee->id == Tools::getValue('id_employee') AND Tools::isSubmit('updateemployee')))
{
$object = new $this->className($id);
if (Validate::isLoadedObject($object))
@@ -766,7 +764,7 @@ abstract class AdminTabCore
/* Cancel all filters for this tab */
elseif (isset($_POST['submitReset'.$this->table]))
{
$filters = $context->cookie->getFamily($this->table.'Filter_');
$filters = $this->context->cookie->getFamily($this->table.'Filter_');
foreach ($filters AS $cookieKey => $filter)
if (strncmp($cookieKey, $this->table.'Filter_', 7 + Tools::strlen($this->table)) == 0)
{
@@ -775,14 +773,14 @@ abstract class AdminTabCore
$tmpTab = explode('!', $key);
$key = (count($tmpTab) > 1 ? $tmpTab[1] : $tmpTab[0]);
if (array_key_exists($key, $this->fieldsDisplay))
unset($context->cookie->$cookieKey);
unset($this->context->cookie->$cookieKey);
}
if (isset($context->cookie->{'submitFilter'.$this->table}))
unset($context->cookie->{'submitFilter'.$this->table});
if (isset($context->cookie->{$this->table.'Orderby'}))
unset($context->cookie->{$this->table.'Orderby'});
if (isset($context->cookie->{$this->table.'Orderway'}))
unset($context->cookie->{$this->table.'Orderway'});
if (isset($this->context->cookie->{'submitFilter'.$this->table}))
unset($this->context->cookie->{'submitFilter'.$this->table});
if (isset($this->context->cookie->{$this->table.'Orderby'}))
unset($this->context->cookie->{$this->table.'Orderby'});
if (isset($this->context->cookie->{$this->table.'Orderway'}))
unset($this->context->cookie->{$this->table.'Orderway'});
unset($_POST);
}
@@ -793,9 +791,9 @@ abstract class AdminTabCore
}
/* Manage list filtering */
elseif (Tools::isSubmit('submitFilter'.$this->table) OR $context->cookie->{'submitFilter'.$this->table} !== false)
elseif (Tools::isSubmit('submitFilter'.$this->table) OR $this->context->cookie->{'submitFilter'.$this->table} !== false)
{
$_POST = array_merge($context->cookie->getFamily($this->table.'Filter_'), (isset($_POST) ? $_POST : array()));
$_POST = array_merge($this->context->cookie->getFamily($this->table.'Filter_'), (isset($_POST) ? $_POST : array()));
foreach ($_POST AS $key => $value)
{
/* Extracting filters from $_POST on key filter_ */
@@ -1151,22 +1149,21 @@ abstract class AdminTabCore
*/
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL, $id_lang_shop = false)
{
$context = Context::getContext();
/* Manage default params values */
if (empty($limit))
$limit = ((!isset($context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[1] : $limit = $context->cookie->{$this->table.'_pagination'});
$limit = ((!isset($this->context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[1] : $limit = $this->context->cookie->{$this->table.'_pagination'});
if (!Validate::isTableOrIdentifier($this->table))
die (Tools::displayError('Table name is invalid:').' "'.$this->table.'"');
if (empty($orderBy))
$orderBy = $context->cookie->__get($this->table.'Orderby') ? $context->cookie->__get($this->table.'Orderby') : $this->_defaultOrderBy;
$orderBy = $this->context->cookie->__get($this->table.'Orderby') ? $this->context->cookie->__get($this->table.'Orderby') : $this->_defaultOrderBy;
if (empty($orderWay))
$orderWay = $context->cookie->__get($this->table.'Orderway') ? $context->cookie->__get($this->table.'Orderway') : 'ASC';
$orderWay = $this->context->cookie->__get($this->table.'Orderway') ? $this->context->cookie->__get($this->table.'Orderway') : 'ASC';
$limit = (int)(Tools::getValue('pagination', $limit));
$context->cookie->{$this->table.'_pagination'} = $limit;
$this->context->cookie->{$this->table.'_pagination'} = $limit;
/* Check params validity */
if (!Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay)
@@ -1197,14 +1194,14 @@ abstract class AdminTabCore
$selectShop = ', shop.name as shop_name ';
$joinShop = ' LEFT JOIN '._DB_PREFIX_.$this->shopLinkType.' shop
ON a.id_'.$this->shopLinkType.' = shop.id_'.$this->shopLinkType;
$whereShop = $context->shop->sqlRestriction($this->shopShareDatas, 'a', $this->shopLinkType);
$whereShop = $this->context->shop->sqlRestriction($this->shopShareDatas, 'a', $this->shopLinkType);
}
$assos = Shop::getAssoTables();
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'shop')
{
$filterKey = $assos[$this->table]['type'];
$idenfierShop = $context->shop->getListOfID();
$idenfierShop = $this->context->shop->getListOfID();
}
else if (Context::shop() == Shop::CONTEXT_GROUP)
{
@@ -1212,7 +1209,7 @@ abstract class AdminTabCore
if (isset($assos[$this->table]) AND $assos[$this->table]['type'] == 'group_shop')
{
$filterKey = $assos[$this->table]['type'];
$idenfierShop = array($context->shop->getGroupID());
$idenfierShop = array($this->context->shop->getGroupID());
}
}
@@ -1269,7 +1266,6 @@ abstract class AdminTabCore
*/
public function displayListHeader($token = NULL)
{
$context = Context::getContext();
$isCms = false;
if (preg_match('/cms/Ui', $this->identifier))
$isCms = true;
@@ -1279,7 +1275,7 @@ abstract class AdminTabCore
$token = $this->token;
/* Determine total page number */
$totalPages = ceil($this->_listTotal / Tools::getValue('pagination', (isset($context->cookie->{$this->table.'_pagination'}) ? $context->cookie->{$this->table.'_pagination'} : $this->_pagination[0])));
$totalPages = ceil($this->_listTotal / Tools::getValue('pagination', (isset($this->context->cookie->{$this->table.'_pagination'}) ? $this->context->cookie->{$this->table.'_pagination'} : $this->_pagination[0])));
if (!$totalPages) $totalPages = 1;
echo '<a name="'.$this->table.'">&nbsp;</a>';
@@ -1311,7 +1307,7 @@ abstract class AdminTabCore
echo ' | '.$this->l('Display').'
<select name="pagination">';
/* Choose number of results per page */
$selectedPagination = Tools::getValue('pagination', (isset($context->cookie->{$this->table.'_pagination'}) ? $context->cookie->{$this->table.'_pagination'} : NULL));
$selectedPagination = Tools::getValue('pagination', (isset($this->context->cookie->{$this->table.'_pagination'}) ? $this->context->cookie->{$this->table.'_pagination'} : NULL));
foreach ($this->_pagination AS $value)
echo '<option value="'.(int)($value).'"'.($selectedPagination == $value ? ' selected="selected"' : (($selectedPagination == NULL && $value == $this->_pagination[1]) ? ' selected="selected2"' : '')).'>'.(int)($value).'</option>';
echo '
@@ -1498,7 +1494,6 @@ abstract class AdminTabCore
* icon : icon determined by values
* active : allow to toggle status
*/
$context = Context::getContext();
$id_category = 1; // default categ
$irow = 0;
@@ -1571,13 +1566,13 @@ abstract class AdminTabCore
elseif (isset($params['icon']) AND (isset($params['icon'][$tr[$key]]) OR isset($params['icon']['default'])))
echo '<img src="../img/admin/'.(isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default'].'" alt="'.$tr[$key]).'" title="'.$tr[$key].'" />';
elseif (isset($params['price']))
echo Tools::displayPrice($tr[$key], (isset($params['currency']) ? Currency::getCurrencyInstance($tr['id_currency']) : $context->currency), false);
echo Tools::displayPrice($tr[$key], (isset($params['currency']) ? Currency::getCurrencyInstance($tr['id_currency']) : $this->context->currency), false);
elseif (isset($params['float']))
echo rtrim(rtrim($tr[$key], '0'), '.');
elseif (isset($params['type']) AND $params['type'] == 'date')
echo Tools::displayDate($tr[$key], $context->language->id);
echo Tools::displayDate($tr[$key], $this->context->language->id);
elseif (isset($params['type']) AND $params['type'] == 'datetime')
echo Tools::displayDate($tr[$key], $context->language->id, true);
echo Tools::displayDate($tr[$key], $this->context->language->id, true);
elseif (isset($tr[$key]))
{
if ($key == 'price')
@@ -1692,11 +1687,10 @@ abstract class AdminTabCore
*/
public function displayOptionsList()
{
$context = Context::getContext();
if (!isset($this->_fieldsOptions) OR !sizeof($this->_fieldsOptions))
return false;
$defaultLanguage = (int)$context->language->id;
$defaultLanguage = (int)$this->context->language->id;
$this->_languages = Language::getLanguages(false);
$tab = Tab::getTab($defaultLanguage, $this->id);
echo '<br /><br />';
@@ -1718,7 +1712,7 @@ abstract class AdminTabCore
if (!Validate::isCleanHtml($val))
$val = Configuration::get($key);
$isDisabled = (Tools::isMultiShopActivated() && isset($field['visibility']) && $field['visibility'] > $context->shop->getContextType()) ? true : false;
$isDisabled = (Tools::isMultiShopActivated() && isset($field['visibility']) && $field['visibility'] > $this->context->shop->getContextType()) ? true : false;
echo $this->getHtmlDefaultConfigurationValue($key, $this->_languages);
echo '<label>'.$field['title'].' </label>
@@ -1849,20 +1843,19 @@ abstract class AdminTabCore
*/
public function displayForm($firstCall = true)
{
$context = Context::getContext();
$allowEmployeeFormLang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
if ($allowEmployeeFormLang && !$context->cookie->employee_form_lang)
$context->cookie->employee_form_lang = (int)(Configuration::get('PS_LANG_DEFAULT'));
if ($allowEmployeeFormLang && !$this->context->cookie->employee_form_lang)
$this->context->cookie->employee_form_lang = (int)(Configuration::get('PS_LANG_DEFAULT'));
$useLangFromCookie = false;
$this->_languages = Language::getLanguages(false);
if ($allowEmployeeFormLang)
foreach ($this->_languages AS $lang)
if ($context->cookie->employee_form_lang == $lang['id_lang'])
if ($this->context->cookie->employee_form_lang == $lang['id_lang'])
$useLangFromCookie = true;
if (!$useLangFromCookie)
$this->_defaultFormLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
else
$this->_defaultFormLanguage = (int)($context->cookie->employee_form_lang);
$this->_defaultFormLanguage = (int)($this->context->cookie->employee_form_lang);
// Only if it is the first call to displayForm, otherwise it has already been defined
if ($firstCall)
@@ -1929,11 +1922,10 @@ abstract class AdminTabCore
public function viewAccess($disable = false)
{
$context = Context::getContext();
if ($disable)
return true;
$this->tabAccess = Profile::getProfileAccess($context->employee->id_profile, $this->id);
$this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id);
if ($this->tabAccess['view'] === '1')
return true;
@@ -1998,15 +1990,14 @@ abstract class AdminTabCore
protected function displayAssoShop($field_name = 'name', $selectName = null)
{
$context = Context::getContext();
if (!Tools::isMultiShopActivated() || (!$this->_object && $context->shop->getContextType() != Shop::CONTEXT_ALL))
if (!Tools::isMultiShopActivated() || (!$this->_object && $this->context->shop->getContextType() != Shop::CONTEXT_ALL))
return;
$shops = Shop::getShops();
$sql = 'SELECT DISTINCT a.`'.pSQL($this->identifier).'`, '.(($this->lang AND isset($this->fieldsDisplay[$field_name]['filter_key']) AND $this->fieldsDisplay[$field_name]['filter_key'] == 'b!'.$field_name) ? 'b' : 'a').'.`'.pSQL($field_name).'`
FROM `'._DB_PREFIX_.pSQL($this->table).'`a '.
(($this->lang AND isset($this->fieldsDisplay[$field_name]['filter_key']) AND $this->fieldsDisplay[$field_name]['filter_key'] == 'b!'.$field_name) ? ' LEFT JOIN `'._DB_PREFIX_.pSQL($this->table).'_lang` b ON (a.`'.pSQL($this->identifier).'`=b.`'.pSQL($this->identifier).'`)' : '').
' WHERE 1'.(($this->lang AND isset($this->fieldsDisplay[$field_name]['filter_key']) AND $this->fieldsDisplay[$field_name]['filter_key'] == 'b!'.$field_name) ? ' AND b.id_lang='.(int)$context->language->id : '').($this->_object ? ' AND a.`'.pSQL($this->identifier).'`='.(int)$this->_object->id : '');
' WHERE 1'.(($this->lang AND isset($this->fieldsDisplay[$field_name]['filter_key']) AND $this->fieldsDisplay[$field_name]['filter_key'] == 'b!'.$field_name) ? ' AND b.id_lang='.(int)$this->context->language->id : '').($this->_object ? ' AND a.`'.pSQL($this->identifier).'`='.(int)$this->_object->id : '');
$objects = Db::getInstance()->ExecuteS($sql);
$assos = array();
$res = Db::getInstance()->ExecuteS('SELECT id_shop, `'.pSQL($this->identifier).'`
@@ -2060,14 +2051,13 @@ abstract class AdminTabCore
protected function displayAssoGroupShop($field_name = 'name')
{
$context = Context::getContext();
if (!Tools::isMultiShopActivated() || (!$this->_object && $context->shop->getContextType() != Shop::CONTEXT_ALL))
if (!Tools::isMultiShopActivated() || (!$this->_object && $this->context->shop->getContextType() != Shop::CONTEXT_ALL))
return;
$objects = Db::getInstance()->ExecuteS('SELECT DISTINCT a.`'.pSQL($this->identifier).'`, '.(($this->lang AND isset($this->fieldsDisplay[$field_name]['filter_key']) AND $this->fieldsDisplay[$field_name]['filter_key'] == 'b!'.$field_name) ? 'b' : 'a').'.`'.pSQL($field_name).'`
FROM `'._DB_PREFIX_.pSQL($this->table).'` a'.
(($this->lang AND isset($this->fieldsDisplay[$field_name]['filter_key']) AND $this->fieldsDisplay[$field_name]['filter_key'] == 'b!'.$field_name) ? ' LEFT JOIN `'._DB_PREFIX_.pSQL($this->table).'_lang` b ON (a.`'.pSQL($this->identifier).'`=b.`'.pSQL($this->identifier).'`)' : '').
' WHERE 1'.(($this->lang AND isset($this->fieldsDisplay[$field_name]['filter_key']) AND $this->fieldsDisplay[$field_name]['filter_key'] == 'b!'.$field_name) ? ' AND b.id_lang='.(int)$context->language->id : '').($this->_object ? ' AND a.`'.pSQL($this->identifier).'`='.(int)$this->_object->id : ''));
' WHERE 1'.(($this->lang AND isset($this->fieldsDisplay[$field_name]['filter_key']) AND $this->fieldsDisplay[$field_name]['filter_key'] == 'b!'.$field_name) ? ' AND b.id_lang='.(int)$this->context->language->id : '').($this->_object ? ' AND a.`'.pSQL($this->identifier).'`='.(int)$this->_object->id : ''));
$groups_shop = GroupShop::getGroupShops();
$assos = array();
$res = Db::getInstance()->ExecuteS('SELECT id_group_shop, `'.pSQL($this->identifier).'`
@@ -2142,22 +2132,21 @@ abstract class AdminTabCore
*/
protected function getHtmlDefaultConfigurationValue($key, $languages)
{
$context = Context::getContext();
if (Configuration::isLangKey($key))
{
$testContext = false;
foreach ($languages as $lang)
if (($context->shop->getContextType() == Shop::CONTEXT_SHOP && Configuration::hasContext($key, $lang['id_lang'], Shop::CONTEXT_SHOP))
|| ($context->shop->getContextType() == Shop::CONTEXT_GROUP && Configuration::hasContext($key, $lang['id_lang'], Shop::CONTEXT_GROUP)))
if (($this->context->shop->getContextType() == Shop::CONTEXT_SHOP && Configuration::hasContext($key, $lang['id_lang'], Shop::CONTEXT_SHOP))
|| ($this->context->shop->getContextType() == Shop::CONTEXT_GROUP && Configuration::hasContext($key, $lang['id_lang'], Shop::CONTEXT_GROUP)))
$testContext = true;
}
else
{
$testContext = (($context->shop->getContextType() == Shop::CONTEXT_SHOP && Configuration::hasContext($key, null, Shop::CONTEXT_SHOP))
|| ($context->shop->getContextType() == Shop::CONTEXT_GROUP && Configuration::hasContext($key, null, Shop::CONTEXT_GROUP))) ? true : false;
$testContext = (($this->context->shop->getContextType() == Shop::CONTEXT_SHOP && Configuration::hasContext($key, null, Shop::CONTEXT_SHOP))
|| ($this->context->shop->getContextType() == Shop::CONTEXT_GROUP && Configuration::hasContext($key, null, Shop::CONTEXT_GROUP))) ? true : false;
}
if (Tools::isMultiShopActivated() && $context->shop->getContextType() != Shop::CONTEXT_ALL && $testContext)
if (Tools::isMultiShopActivated() && $this->context->shop->getContextType() != Shop::CONTEXT_ALL && $testContext)
{
echo '<div class="multishop_config">';
echo '<a href="#" title="'.$this->l('Click here to use default value for this field').'"><img src="../img/admin/multishop_config.png" /></a>';
+1 -1
View File
@@ -564,7 +564,7 @@ class PDFCore extends PDF_PageGroupCore
elseif (self::$delivery)
$pdf->Cell(0, 6, self::l('DELIVERY SLIP #').Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_DELIVERY_PREFIX', $context->language->id)).sprintf('%06d', self::$delivery).' '.self::l('from') . ' ' .Tools::displayDate(self::$order->delivery_date, self::$order->id_lang), 1, 2, 'L', 1);
elseif ((int)self::$order->invoice_date)
$pdf->Cell(0, 6, self::l('INVOICE #').' '.Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_INVOICE_PREFIX', (int)($cookie->id_lang))).sprintf('%06d', self::$order->invoice_number).' '.self::l('from') . ' ' .Tools::displayDate(self::$order->invoice_date, self::$order->id_lang), 1, 2, 'L', 1);
$pdf->Cell(0, 6, self::l('INVOICE #').' '.Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_INVOICE_PREFIX', $context->language->id)).sprintf('%06d', self::$order->invoice_number).' '.self::l('from') . ' ' .Tools::displayDate(self::$order->invoice_date, self::$order->id_lang), 1, 2, 'L', 1);
else
$pdf->Cell(0, 6, self::l('Invoice draft'), 1, 2, 'L', 1);