// Context part 29

This commit is contained in:
tDidierjean
2011-08-08 13:17:12 +00:00
parent 2b71b8be68
commit 0310674fe0
40 changed files with 195 additions and 360 deletions
+1 -2
View File
@@ -56,7 +56,6 @@ class RatingAlert
public static function executeCronTask()
{
global $cookie;
if (!Configuration::get('TS_SEND_SEPERATE_MAIL'))
return true;
@@ -67,7 +66,7 @@ class RatingAlert
foreach ($alerts_infos AS $infos)
{
$cookie->id_lang = $infos['id_lang'];
$this->context->cookie->id_lang = $infos['id_lang'];
$subject = $ts_module->getL('title_part_1').' '.Configuration::get('PS_SHOP_NAME').$ts_module->getL('title_part_2');
$template_vars = array('{ts_id}' => Configuration::get('TS_ID_'.(int)($infos['id_lang'])),
'{button_url}' => TrustedShops::getHttpHost(true, true)._MODULE_DIR_.$ts_module->name.'/img',
+1 -1
View File
@@ -116,7 +116,7 @@ abstract class AbsTrustedShops
}
public function display($file, $template, $cacheId = NULL, $compileId = NULL)
{
global $smarty;
$smarty = $this->context->smarty;
if (Configuration::get('PS_FORCE_SMARTY_2')) /* Keep a backward compatibility for Smarty v2 */
{
+1 -2
View File
@@ -56,7 +56,6 @@ class RatingAlert
public static function executeCronTask()
{
global $cookie;
if (!Configuration::get('TS_SEND_SEPERATE_MAIL'))
return true;
@@ -67,7 +66,7 @@ class RatingAlert
foreach ($alerts_infos AS $infos)
{
$cookie->id_lang = $infos['id_lang'];
$this->context->cookie->id_lang = $infos['id_lang'];
$subject = $ts_module->getL('title_part_1').' '.Configuration::get('PS_SHOP_NAME').$ts_module->getL('title_part_2');
$template_vars = array('{ts_id}' => Configuration::get('TS_ID_'.(int)($infos['id_lang'])),
'{button_url}' => TrustedShops::getHttpHost(true, true)._MODULE_DIR_.$ts_module->name.'/img',
@@ -931,14 +931,13 @@ class TSBuyerProtection extends AbsTrustedShops
}
private function _displayPresentation()
{
global $cookie;
$link = '';
if (strtolower(Language::getIsoById((int)$cookie->id_lang)) == 'de')
if (strtolower(Context::getContext()->language->iso_code) == 'de')
$link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.de/shopbetreiber/mitgliedschaft.html?et_cid=14&et_lid=29069" target="_blank">Jetzt bei Trusted Shops anmelden!</a></b></p><br />';
if (strtolower(Language::getIsoById((int)$cookie->id_lang)) == 'en')
if (strtolower(Context::getContext()->language->iso_code) == 'en')
$link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.com/merchants/membership.html?shopsw=PRESTA&et_cid=53&et_lid=3361" target="_blank">Appy now!</a></b></p><br />';
if (strtolower(Language::getIsoById((int)$cookie->id_lang)) == 'fr')
if (strtolower(Context::getContext()->language->iso_code) == 'fr')
$link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.fr/marchands/tarifs.html?shopsw=PRESTA&et_cid=53&et_lid=3362" target="_blank">Enregistrement Trusted Shops</a></b></p><br />';
return '
+13 -21
View File
@@ -358,20 +358,18 @@ class TrustedShopsRating extends AbsTrustedShops
public function displayInformationsPage()
{
global $cookie;
$link = '';
if (strtolower(Language::getIsoById((int)$cookie->id_lang)) == 'de')
if (strtolower(Context::getContext()->language->iso_code) == 'de')
$link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="https://www.trustedshops.de/shopbetreiber/kundenbewertung_anmeldung.html?partnerPackage=PrestaShop&ratingProduct=RATING_PRO&et_cid=14en&et_lid=29069" target="_blank">Jetzt bei Trusted Shops anmelden!</a></b></p><br />';
if (strtolower(Language::getIsoById((int)$cookie->id_lang)) == 'en')
if (strtolower(Context::getContext()->language->iso_code) == 'en')
$link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.com/merchants/membership.html?shopsw=PRESTA&et_cid=53&et_lid=3361" target="_blank">Apply now!</a></b></p><br />';
if (strtolower(Language::getIsoById((int)$cookie->id_lang)) == 'fr')
if (strtolower(Context::getContext()->language->iso_code) == 'fr')
$link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.fr/marchands/tarifs.html?shopsw=PRESTA&et_cid=53&et_lid=3362" target="_blank">Enregistrement Trusted Shops</a></b></p><br />';
return '<fieldset>
<legend><img src="'.__PS_BASE_URI__.'modules/'.self::$module_name.'/logo.gif" alt="" />'.$this->l('Learn More').'</legend>
<img src="'._MODULE_DIR_.self::$module_name.'/img/ts_rating_'.$this->_getAllowedIsobyId($cookie->id_lang).'.jpg" />
<img src="'._MODULE_DIR_.self::$module_name.'/img/ts_rating_'.$this->_getAllowedIsobyId(Context::getContext()->language->id).'.jpg" />
<h3>'.$this->l('Trusted Shops Customer Rating').'</h3>
<p>'.$this->l('For online buyers, positive and verifiable customer ratings are an important indication of an online shop\'s trustworthiness. The required software is already included in Prestashop, so you can start collecting customer ratings in your online shop too. Integration is easy with just a few clicks.').'</p>
@@ -392,31 +390,27 @@ class TrustedShopsRating extends AbsTrustedShops
public function getApplyUrl()
{
global $cookie;
$lang = $this->_getAllowedIsobyId($cookie->id_lang);
$lang = $this->_getAllowedIsobyId(Context::getContext()->language->id);
return $this->apply_url_base[$lang].'?partnerPackage='.self::PARTNER_PACKAGE.'&shopsw='.self::SHOP_SW.'&website='.
urlencode(_PS_BASE_URL_.__PS_BASE_URI__).'&firstName='.urlencode($cookie->firstname).'&lastName='.
urlencode($cookie->lastname).'&email='.urlencode(Configuration::get('PS_TAB0_SHOP_EMAIL')).'&language='.strtoupper(Language::getIsoById((int)($cookie->id_lang))).
urlencode(_PS_BASE_URL_.__PS_BASE_URI__).'&firstName='.urlencode(Context::getContext()->customer->firstname).'&lastName='.
urlencode(Context::getContext()->customer->lastname).'&email='.urlencode(Configuration::get('PS_TAB0_SHOP_EMAIL')).'&language='.strtoupper(Context::getContext()->language->iso_code).
'&ratingProduct=RATING_PRO'.$this->apply_url_tracker[$lang];
}
public function getRatingUrl($id_order = '')
{
global $cookie;
$buyer_email = '';
if ($cookie->isLogged())
if (Context::getContext()->cookie->isLogged())
{
if (empty($id_order) && !empty($cookie->id_customer))
$id_order = $this->_getLastOrderId($cookie->id_customer);
if (empty($id_order) && !empty(Context::getContext()->customer->id))
$id_order = $this->_getLastOrderId(Context::getContext()->customer->id);
$buyer_email = $cookie->email;
$buyer_email = Context::getContext()->customer->email;
}
return $this->getRatingUrlWithBuyerEmail((int)($cookie->id_lang), $id_order, $buyer_email);
return $this->getRatingUrlWithBuyerEmail(Context::getContext()->language->id, $id_order, $buyer_email);
}
public function getRatingUrlWithBuyerEmail($id_lang, $id_order = '', $buyer_email = '')
@@ -460,9 +454,7 @@ class TrustedShopsRating extends AbsTrustedShops
public function getWidgetFilename()
{
global $cookie;
return self::$module_name.'/cache/'.Configuration::get('TS_TAB0_ID_'.(int)($cookie->id_lang)).'.gif';
return self::$module_name.'/cache/'.Configuration::get('TS_TAB0_ID_'.(int)Context::getContext()->language->id).'.gif';
}
public function hookOrderConfirmation($params)
+1 -2
View File
@@ -45,7 +45,6 @@ class TrustedShops extends Module
public function __construct()
{
global $smarty;
$this->name = 'trustedshops';
$this->tab = 'payment_security';
$this->version = 1.3;
@@ -60,7 +59,7 @@ class TrustedShops extends Module
$obj_ts_buyerprotection->_setEnvApi(TSBuyerProtection::ENV_PROD);
self::$objects_list = array($obj_ts_rating, $obj_ts_buyerprotection);
self::$objects_list[0]->setModuleName($this->name);
self::$objects_list[0]->setSmarty($smarty);
self::$objects_list[0]->setSmarty($this->context->smarty);
}
if (!extension_loaded('soap'))