// Context part 28

This commit is contained in:
tDidierjean
2011-07-29 15:06:20 +00:00
parent 9213581a03
commit 55c1a0afeb
3 changed files with 13 additions and 27 deletions
+3 -5
View File
@@ -133,8 +133,6 @@ class ProductToolTip extends Module
public function hookProductFooter($params) public function hookProductFooter($params)
{ {
global $smarty, $cookie;
$id_product = (int)($params['product']->id); $id_product = (int)($params['product']->id);
/* First we try to display the number of people who are currently watching this product page */ /* First we try to display the number of people who are currently watching this product page */
@@ -149,7 +147,7 @@ class ProductToolTip extends Module
WHERE p.id_page_type = 1 AND p.id_object = '.(int)($id_product).' AND cp.time_start > \''.pSQL($date).'\''); WHERE p.id_page_type = 1 AND p.id_object = '.(int)($id_product).' AND cp.time_start > \''.pSQL($date).'\'');
if (isset($nbPeople['nb']) AND $nbPeople['nb'] > 0) if (isset($nbPeople['nb']) AND $nbPeople['nb'] > 0)
$smarty->assign('nb_people', (int)($nbPeople['nb'])); $this->context->smarty->assign('nb_people', (int)($nbPeople['nb']));
} }
/* Then, we try to display last sale */ /* Then, we try to display last sale */
@@ -166,7 +164,7 @@ class ProductToolTip extends Module
ORDER BY o.date_add DESC'); ORDER BY o.date_add DESC');
if (isset($order['date_add']) && Validate::isDateFormat($order['date_add']) && $order['date_add'] != '0000-00-00 00:00:00') if (isset($order['date_add']) && Validate::isDateFormat($order['date_add']) && $order['date_add'] != '0000-00-00 00:00:00')
$smarty->assign('date_last_order', $order['date_add']); $this->context->smarty->assign('date_last_order', $order['date_add']);
else else
{ {
/* No sale? display last cart add instead */ /* No sale? display last cart add instead */
@@ -178,7 +176,7 @@ class ProductToolTip extends Module
WHERE cp.id_product = '.(int)($id_product)); WHERE cp.id_product = '.(int)($id_product));
if (isset($cart['date_add']) && Validate::isDateFormat($cart['date_add']) && $cart['date_add'] != '0000-00-00 00:00:00') if (isset($cart['date_add']) && Validate::isDateFormat($cart['date_add']) && $cart['date_add'] != '0000-00-00 00:00:00')
$smarty->assign('date_last_cart', $cart['date_add']); $this->context->smarty->assign('date_last_cart', $cart['date_add']);
} }
} }
} }
+9 -20
View File
@@ -296,12 +296,10 @@ class ReferralProgram extends Module
private function _displayFormRules() private function _displayFormRules()
{ {
global $cookie;
// Languages preliminaries // Languages preliminaries
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT')); $defaultLanguage = $this->context->language->id;
$languages = Language::getLanguages(); $languages = Language::getLanguages();
$iso = Language::getIsoById($defaultLanguage); $iso = $this->context->language->iso_code;
$divLangName = 'cpara¤dd'; $divLangName = 'cpara¤dd';
// xml loading // xml loading
@@ -311,8 +309,6 @@ class ReferralProgram extends Module
$this->_html .= $this->displayError($this->l('Your text is empty.')); $this->_html .= $this->displayError($this->l('Your text is empty.'));
// TinyMCE // TinyMCE
global $cookie;
$iso = Language::getIsoById((int)($cookie->id_lang));
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en'); $isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
$ad = dirname($_SERVER["PHP_SELF"]); $ad = dirname($_SERVER["PHP_SELF"]);
echo ' echo '
@@ -364,8 +360,7 @@ class ReferralProgram extends Module
if ($params['cart']->checkDiscountValidity($discount, $params['cart']->getDiscounts(), $params['cart']->getOrderTotal(true, Cart::ONLY_PRODUCTS), $params['cart']->getProducts(), false, $this->context) === false) if ($params['cart']->checkDiscountValidity($discount, $params['cart']->getDiscounts(), $params['cart']->getOrderTotal(true, Cart::ONLY_PRODUCTS), $params['cart']->getProducts(), false, $this->context) === false)
{ {
global $smarty; $this->context->smarty->assign(array('discount_display' => Discount::display($discount->value, $discount->id_discount_type, new Currency($params['cookie']->id_currency)), 'discount' => $discount));
$smarty->assign(array('discount_display' => Discount::display($discount->value, $discount->id_discount_type, new Currency($params['cookie']->id_currency)), 'discount' => $discount));
return $this->display(__FILE__, 'shopping-cart.tpl'); return $this->display(__FILE__, 'shopping-cart.tpl');
} }
return false; return false;
@@ -393,8 +388,6 @@ class ReferralProgram extends Module
{ {
include_once(dirname(__FILE__).'/ReferralProgramModule.php'); include_once(dirname(__FILE__).'/ReferralProgramModule.php');
global $smarty;
if (Configuration::get('PS_CIPHER_ALGORITHM')) if (Configuration::get('PS_CIPHER_ALGORITHM'))
$cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_); $cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
else else
@@ -425,8 +418,6 @@ class ReferralProgram extends Module
*/ */
public function hookCreateAccount($params) public function hookCreateAccount($params)
{ {
global $cookie;
$newCustomer = $params['newCustomer']; $newCustomer = $params['newCustomer'];
if (!Validate::isLoadedObject($newCustomer)) if (!Validate::isLoadedObject($newCustomer))
return false; return false;
@@ -468,8 +459,8 @@ class ReferralProgram extends Module
if (Validate::isLoadedObject($discount)) if (Validate::isLoadedObject($discount))
{ {
$data = array('{firstname}' => $newCustomer->firstname, '{lastname}' => $newCustomer->lastname, '{voucher_num}' => $discount->name, $data = array('{firstname}' => $newCustomer->firstname, '{lastname}' => $newCustomer->lastname, '{voucher_num}' => $discount->name,
'{voucher_amount}' => Tools::displayPrice((float)Configuration::get('REFERRAL_DISCOUNT_VALUE_'.(int)($cookie->id_currency)), (int)Configuration::get('PS_CURRENCY_DEFAULT'))); '{voucher_amount}' => Tools::displayPrice((float)Configuration::get('REFERRAL_DISCOUNT_VALUE_'.(int)$this->context->currency->id), (int)Configuration::get('PS_CURRENCY_DEFAULT')));
Mail::Send((int)$cookie->id_lang, 'referralprogram-voucher', Mail::l('Congratulations!'), $data, $newCustomer->email, $newCustomer->firstname.' '.$newCustomer->lastname, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/'); Mail::Send($this->context->language->id, 'referralprogram-voucher', Mail::l('Congratulations!'), $data, $newCustomer->email, $newCustomer->firstname.' '.$newCustomer->lastname, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/');
} }
} }
return true; return true;
@@ -490,7 +481,6 @@ class ReferralProgram extends Module
if (!Validate::isLoadedObject($customer)) if (!Validate::isLoadedObject($customer))
die (Tools::displayError('Incorrect object Customer.')); die (Tools::displayError('Incorrect object Customer.'));
global $cookie;
$friends = ReferralProgramModule::getSponsorFriend((int)$customer->id); $friends = ReferralProgramModule::getSponsorFriend((int)$customer->id);
if ($id_referralprogram = ReferralProgramModule::isSponsorised((int)$customer->id, true)) if ($id_referralprogram = ReferralProgramModule::isSponsorised((int)$customer->id, true))
{ {
@@ -500,7 +490,7 @@ class ReferralProgram extends Module
$html = ' $html = '
<h2>'.$this->l('Referral program').'</h2> <h2>'.$this->l('Referral program').'</h2>
<h3>'.(isset($sponsor) ? $this->l('Customer\'s sponsor:').' <a href="index.php?tab=AdminCustomers&id_customer='.(int)$sponsor->id.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'">'.$sponsor->firstname.' '.$sponsor->lastname.'</a>' : $this->l('No one has sponsored this customer.')).'</h3>'; <h3>'.(isset($sponsor) ? $this->l('Customer\'s sponsor:').' <a href="index.php?tab=AdminCustomers&id_customer='.(int)$sponsor->id.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id).'">'.$sponsor->firstname.' '.$sponsor->lastname.'</a>' : $this->l('No one has sponsored this customer.')).'</h3>';
if ($friends AND sizeof($friends)) if ($friends AND sizeof($friends))
{ {
@@ -520,11 +510,11 @@ class ReferralProgram extends Module
{ {
$orders = Order::getCustomerOrders($friend['id_customer']); $orders = Order::getCustomerOrders($friend['id_customer']);
$html.= ' $html.= '
<tr '.($key++ % 2 ? 'class="alt_row"' : '').' '.((int)($friend['id_customer']) ? 'style="cursor: pointer" onclick="document.location = \'?tab=AdminCustomers&id_customer='.$friend['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'\'"' : '').'> <tr '.($key++ % 2 ? 'class="alt_row"' : '').' '.((int)($friend['id_customer']) ? 'style="cursor: pointer" onclick="document.location = \'?tab=AdminCustomers&id_customer='.$friend['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id).'\'"' : '').'>
<td class="center">'.((int)($friend['id_customer']) ? $friend['id_customer'] : '--').'</td> <td class="center">'.((int)($friend['id_customer']) ? $friend['id_customer'] : '--').'</td>
<td>'.$friend['firstname'].' '.$friend['lastname'].'</td> <td>'.$friend['firstname'].' '.$friend['lastname'].'</td>
<td>'.$friend['email'].'</td> <td>'.$friend['email'].'</td>
<td>'.Tools::displayDate($friend['date_add'], (int)($cookie->id_lang), true).'</td> <td>'.Tools::displayDate($friend['date_add'], $this->context->language->id, true).'</td>
<td align="right">'.sizeof(ReferralProgramModule::getSponsorFriend($friend['id_customer'])).'</td> <td align="right">'.sizeof(ReferralProgramModule::getSponsorFriend($friend['id_customer'])).'</td>
<td align="right">'.($orders ? sizeof($orders) : 0).'</td> <td align="right">'.($orders ? sizeof($orders) : 0).'</td>
<td align="center">'.((int)$friend['id_customer'] ? '<img src="'._PS_ADMIN_IMG_.'enabled.gif" />' : '<img src="'._PS_ADMIN_IMG_.'disabled.gif" />').'</td> <td align="center">'.((int)$friend['id_customer'] ? '<img src="'._PS_ADMIN_IMG_.'enabled.gif" />' : '<img src="'._PS_ADMIN_IMG_.'disabled.gif" />').'</td>
@@ -561,8 +551,7 @@ class ReferralProgram extends Module
$discount = new Discount((int)$referralprogram->id_discount_sponsor); $discount = new Discount((int)$referralprogram->id_discount_sponsor);
if (!Validate::isLoadedObject($discount)) if (!Validate::isLoadedObject($discount))
return false; return false;
global $smarty; $this->context->smarty->assign(array('discount' => $discount->display($discount->value, (int)$discount->id_discount_type, new Currency((int)$params['objOrder']->id_currency)), 'sponsor_firstname' => $sponsor->firstname, 'sponsor_lastname' => $sponsor->lastname));
$smarty->assign(array('discount' => $discount->display($discount->value, (int)$discount->id_discount_type, new Currency((int)$params['objOrder']->id_currency)), 'sponsor_firstname' => $sponsor->firstname, 'sponsor_lastname' => $sponsor->lastname));
return $this->display(__FILE__, 'order-confirmation.tpl'); return $this->display(__FILE__, 'order-confirmation.tpl');
} }
return false; return false;
+1 -2
View File
@@ -84,9 +84,8 @@ class Reverso extends Module
public function hookCreateAccountTop($params) public function hookCreateAccountTop($params)
{ {
global $smarty;
$tag = '<img src='.(Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').'api.reversoform.com/includes/'.(Configuration::get('PS_SSL_ENABLED') ? 'www.reversoform.com/' : '').'js/trans.giff?d='.date('U').' with="0" height="0" />'; $tag = '<img src='.(Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').'api.reversoform.com/includes/'.(Configuration::get('PS_SSL_ENABLED') ? 'www.reversoform.com/' : '').'js/trans.giff?d='.date('U').' with="0" height="0" />';
$smarty->assign(array('reverso_tag' => $tag)); $this->context->smarty->assign(array('reverso_tag' => $tag));
return $this->display(__FILE__, 'reverso.tpl'); return $this->display(__FILE__, 'reverso.tpl');
} }