function render_page($license = false) { global $aidlink, $ver, $navbar_links, $settings, $main_style, $locale, $userdata, $lettering_string, $use_flash, $neon_banner_path, $flash_banner_path, $site_footer, $fusion_version; echo "<table align='center' cellspacing='0' cellpadding='0' width='" . THEME_WIDTH . "' class='outer-border'>\n<tr>\n<td>\n<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n<td class='full-header'>\n <table cellpadding='0' cellspacing='0' width='100%'>\n <tr>\n <p><td width='100%' height='111'>"; if ($use_flash == 1) { echo "<object type='application/x-shockwave-flash' data={$flash_banner_path} width='898' height='242'>\n<param name='movie' value={$flash_banner_path} /><param name='wmode' value='transparent'>\n </object>"; for ($b = 0; $b <= Configuration::Get('lettering.begin.spaces'); $b++) { echo "<img src='" . BASEDIR . "images/logo/wotlk/space.png' align='center' />"; } if (Configuration::Get('lettering.message') != '') { echo $lettering_string; } } if ($use_flash == 0) { if ($neon_banner_path != '') { echo "<img src='" . $neon_banner_path . "' align='center'>"; } } echo "</td></p>\n </tr>\n </table>\n </td></tr>\n</tr></table>\n"; echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n<td width='140'><img src='" . THEME . "images/menuleft.gif' alt='' style='border-left: 1px #a7a7a7 solid;' /></td>\n<td align='center' class='sub-header-alti'>" . showsublinks(" | ") . "</td>\n<td width='140'><img src='" . THEME . "images/menuright.gif' alt='' style='border-right: 1px #a7a7a7 solid;' /></td>\n</tr>\n</table>\n"; //echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n"; //Content echo "<table cellpadding='0' cellspacing='0' class='border' width='" . THEME_WIDTH . "' align='center'>\n<tr>\n"; if (LEFT) { echo "<td class='side-border-left' valign='top'>" . LEFT . "</td>"; } echo "<td class='main-bg' valign='top'>" . U_CENTER . CONTENT . L_CENTER . "</td>"; if (RIGHT) { echo "<td class='side-border-right' valign='top'>" . RIGHT . "</td>"; } echo "</tr>\n</table>\n"; //footer echo "<table cellpadding='0' cellspacing='0' width='" . THEME_WIDTH . "' align='center'>\n<tr>\n<td align='left' width='50%' height='241' class='footer'><br/>\n"; if (!$license) { echo "<br/>"; echo "ArcSite CMS v" . $ver . " Scripted by <font color=red>The_Red</font>"; echo " | \n"; } echo showcounter() . "<br/>Built Using <a target='_blank' href='http://www.php-fusion.co.uk/'>PHP-Fusion v7.00.07</a><br/>\n<a href='http://validator.w3.org/check?uri=referer'><img src='" . THEME . "images/vhtml.png' alt='XHTML' /></a> <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='" . THEME . "images/vcss.png' alt='CSS' /></a>\n</td>\n<td align='right' width='50%' class='footerright'>\n"; echo "{$navbar_links}<br/><br/><br/><br/>\n"; echo "</td>\n</tr>\n</table>\n</td>\n</tr>\n</table>\n"; }
public function hookExtraCarrier($params) { global $smarty, $cookie; $customer = new Customer($params['address']->id_customer); $gender = array('1' => 'MR', '2' => 'MME'); if (in_array((int) $customer->id_gender, array(1, 2))) { $cecivility = $gender[(int) $customer->id_gender]; } else { $cecivility = 'MR'; } $carrierSo = new Carrier((int) Configuration::get('SOCOLISSIMO_CARRIER_ID')); if (isset($carrierSo) and $carrierSo->active) { $signature = $this->make_key(substr($this->lower($params['address']->lastname), 0, 34), (int) Configuration::Get('SOCOLISSIMO_PREPARATION_TIME'), number_format((double) $params['cart']->getOrderShippingCost($carrierSo->id, true), 2, ',', ''), (int) $params['address']->id_customer, (int) $params['address']->id); $orderId = $this->formatOrderId((int) $params['address']->id); $inputs = array('PUDOFOID' => Configuration::get('SOCOLISSIMO_ID'), 'ORDERID' => $orderId, 'CENAME' => substr($this->lower($params['address']->lastname), 0, 34), 'TRCLIENTNUMBER' => $this->upper((int) $params['address']->id_customer), 'CECIVILITY' => $cecivility, 'CEFIRSTNAME' => substr($this->lower($params['address']->firstname), 0, 29), 'CECOMPANYNAME' => substr($this->upper($params['address']->company), 0, 38), 'CEEMAIL' => $params['cookie']->email, 'CEPHONENUMBER' => str_replace(array(' ', '.', '-', ',', ';', '+', '/', '\\', '+', '(', ')'), '', $params['address']->phone_mobile), 'CEADRESS3' => substr($this->upper($params['address']->address1), 0, 38), 'CEADRESS4' => substr($this->upper($params['address']->address2), 0, 38), 'CEZIPCODE' => $params['address']->postcode, 'CETOWN' => substr($this->upper($params['address']->city), 0, 32), 'DYWEIGHT' => (double) $params['cart']->getTotalWeight() * 1000, 'SIGNATURE' => htmlentities($signature, ENT_NOQUOTES, 'UTF-8'), 'TRPARAMPLUS' => (int) $carrierSo->id, 'DYFORWARDINGCHARGES' => number_format((double) $params['cart']->getOrderShippingCost($carrierSo->id), 2, ',', ''), 'DYPREPARATIONTIME' => (int) Configuration::Get('SOCOLISSIMO_PREPARATION_TIME'), 'TRRETURNURLKO' => htmlentities($this->url, ENT_NOQUOTES, 'UTF-8'), 'TRRETURNURLOK' => htmlentities($this->url, ENT_NOQUOTES, 'UTF-8')); $serialsInput = ''; foreach ($inputs as $key => $val) { $serialsInput .= '&' . $key . '=' . $val; } $serialsInput = ltrim($serialsInput, '&'); $row['id_carrier'] = (int) $carrierSo->id; $smarty->assign(array('urlSo' => Configuration::get('SOCOLISSIMO_URL') . '?trReturnUrlKo=' . htmlentities($this->url, ENT_NOQUOTES, 'UTF-8'), 'id_carrier' => (int) $row['id_carrier'], 'inputs' => $inputs, 'serialsInput' => $serialsInput, 'finishProcess' => $this->l('To choose SoColissimo, click on a delivery method'))); $country = new Country((int) $params['address']->id_country); $carriers = Carrier::getCarriers($cookie->id_lang, true, false, false, NULL, ALL_CARRIERS); $ids = array(); foreach ($carriers as $carrier) { $ids[] = $carrier['id_carrier']; } if ($this->getDeliveryInfos((int) $cookie->id_cart, (int) $cookie->id_customer)) { $smarty->assign('already_select_delivery', true); } else { $smarty->assign('already_select_delivery', false); } if ($country->iso_code == 'FR' and Configuration::Get('SOCOLISSIMO_ID') != NULL and Configuration::get('SOCOLISSIMO_KEY') != NULL and $this->checkAvailibility() and $this->checkSoCarrierAvailable((int) Configuration::get('SOCOLISSIMO_CARRIER_ID')) and in_array((int) Configuration::get('SOCOLISSIMO_CARRIER_ID'), $ids)) { return $this->display(__FILE__, 'socolissimo_carrier.tpl'); } else { $smarty->assign('ids', explode('|', Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST'))); return $this->display(__FILE__, 'socolissimo_error.tpl'); } } }
public function initContent() { if (Tools::isSubmit('addnewmodule') && $this->context->mode == Context::MODE_HOST) { $this->display = 'add'; $this->context->smarty->assign(array('iso_code' => $this->context->language->iso_code)); return parent::initContent(); } $this->meta_title = 'Modules'; // If we are on a module configuration, no need to load all modules if (Tools::getValue('configure') != '') { $this->context->smarty->assign(array('maintenance_mode' => !(bool) Configuration::Get('PS_SHOP_ENABLE'))); return true; } $this->initToolbar(); $this->initPageHeaderToolbar(); // Init $smarty = $this->context->smarty; $autocomplete_list = 'var moduleList = ['; $category_filtered = array(); $filter_categories = explode('|', Configuration::get('PS_SHOW_CAT_MODULES_' . (int) $this->id_employee)); if (count($filter_categories) > 0) { foreach ($filter_categories as $fc) { if (!empty($fc)) { $category_filtered[$fc] = 1; } } } if (empty($category_filtered) && Tools::getValue('tab_module')) { $category_filtered[Tools::getValue('tab_module')] = 1; } foreach ($this->list_modules_categories as $k => $v) { $this->list_modules_categories[$k]['nb'] = 0; } // Retrieve Modules Preferences $modules_preferences = ''; $tab_modules_preferences = array(); $modules_preferences_tmp = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'module_preference` WHERE `id_employee` = ' . (int) $this->id_employee); $tab_modules_preferences_tmp = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'tab_module_preference` WHERE `id_employee` = ' . (int) $this->id_employee); foreach ($tab_modules_preferences_tmp as $i => $j) { $tab_modules_preferences[$j['module']][] = $j['id_tab']; } foreach ($modules_preferences_tmp as $k => $v) { if ($v['interest'] == null) { unset($v['interest']); } if ($v['favorite'] == null) { unset($v['favorite']); } $modules_preferences[$v['module']] = $v; } // Retrieve Modules List $modules = Module::getModulesOnDisk(true, $this->logged_on_addons, $this->id_employee); $this->initModulesList($modules); $this->nb_modules_total = count($modules); $module_errors = array(); $module_success = array(); $upgrade_available = array(); $dont_filter = false; //Add succes message for one module update if (Tools::getValue('updated') && Tools::getValue('module_name')) { $module_names = (string) Tools::getValue('module_name'); if (strpos($module_names, '|')) { $module_names = explode('|', $module_names); $dont_filter = true; } if (!is_array($module_names)) { $module_names = (array) $module_names; } foreach ($modules as $km => $module) { if (in_array($module->name, $module_names)) { $module_success[] = array('name' => $module->displayName, 'message' => array(0 => sprintf($this->l('Current version: %s'), $module->version))); } } } if (Tools::getValue('allUpdated')) { $this->confirmations[] = $this->l('All modules updated successfully.'); } // Browse modules list foreach ($modules as $km => $module) { //if we are in favorites view we only display installed modules if (Tools::getValue('select') == 'favorites' && !$module->id) { unset($modules[$km]); continue; } // Upgrade Module process, init check if a module could be upgraded if (Module::initUpgradeModule($module)) { // When the XML cache file is up-to-date, the module may not be loaded yet if (!class_exists($module->name)) { if (!file_exists(_PS_MODULE_DIR_ . $module->name . '/' . $module->name . '.php')) { continue; } require_once _PS_MODULE_DIR_ . $module->name . '/' . $module->name . '.php'; } if ($object = Adapter_ServiceLocator::get($module->name)) { /** @var Module $object */ $object->runUpgradeModule(); if (count($errors_module_list = $object->getErrors())) { $module_errors[] = array('name' => $module->displayName, 'message' => $errors_module_list); } elseif (count($conf_module_list = $object->getConfirmations())) { $module_success[] = array('name' => $module->displayName, 'message' => $conf_module_list); } unset($object); } } elseif (Module::getUpgradeStatus($module->name)) { // When the XML cache file is up-to-date, the module may not be loaded yet if (!class_exists($module->name)) { if (file_exists(_PS_MODULE_DIR_ . $module->name . '/' . $module->name . '.php')) { require_once _PS_MODULE_DIR_ . $module->name . '/' . $module->name . '.php'; $object = Adapter_ServiceLocator::get($module->name); $module_success[] = array('name' => $module->name, 'message' => array(0 => sprintf($this->l('Current version: %s'), $object->version), 1 => $this->l('No file upgrades applied (none exist).'))); } else { continue; } } unset($object); } // Make modules stats $this->makeModulesStats($module); // Assign warnings if ($module->active && isset($module->warning) && !empty($module->warning) && !$this->ajax) { $href = Context::getContext()->link->getAdminLink('AdminModules', true) . '&module_name=' . $module->name . '&tab_module=' . $module->tab . '&configure=' . $module->name; $this->context->smarty->assign('text', sprintf($this->l('%1$s: %2$s'), $module->displayName, $module->warning)); $this->context->smarty->assign('module_link', $href); $this->displayWarning($this->context->smarty->fetch('controllers/modules/warning_module.tpl')); } // AutoComplete array $autocomplete_list .= Tools::jsonEncode(array('displayName' => (string) $module->displayName, 'desc' => (string) $module->description, 'name' => (string) $module->name, 'author' => (string) $module->author, 'image' => isset($module->image) ? (string) $module->image : '', 'option' => '')) . ', '; // Apply filter if ($this->isModuleFiltered($module) && Tools::getValue('select') != 'favorites') { unset($modules[$km]); } else { if (isset($modules_preferences[$modules[$km]->name])) { $modules[$km]->preferences = $modules_preferences[$modules[$km]->name]; } $this->fillModuleData($module, 'array'); $module->categoryName = isset($this->list_modules_categories[$module->tab]['name']) ? $this->list_modules_categories[$module->tab]['name'] : $this->list_modules_categories['others']['name']; } unset($object); if ($module->installed && isset($module->version_addons) && $module->version_addons) { $upgrade_available[] = array('anchor' => ucfirst($module->name), 'name' => $module->name, 'displayName' => $module->displayName); } if (in_array($module->name, $this->list_partners_modules)) { $module->type = 'addonsPartner'; } if (isset($module->description_full) && trim($module->description_full) != '') { $module->show_quick_view = true; } } // Don't display categories without modules $cleaned_list = array(); foreach ($this->list_modules_categories as $k => $list) { if ($list['nb'] > 0) { $cleaned_list[$k] = $list; } } // Actually used for the report of the upgraded errors if (count($module_errors)) { $html = $this->generateHtmlMessage($module_errors); $this->errors[] = sprintf(Tools::displayError('The following module(s) were not upgraded successfully: %s.'), $html); } if (count($module_success)) { $html = $this->generateHtmlMessage($module_success); $this->confirmations[] = sprintf($this->l('The following module(s) were upgraded successfully: %s.'), $html); } ConfigurationKPI::updateValue('UPDATE_MODULES', count($upgrade_available)); if (count($upgrade_available) == 0 && (int) Tools::getValue('check') == 1) { $this->confirmations[] = $this->l('Everything is up-to-date'); } // Init tpl vars for smarty $tpl_vars = array('token' => $this->token, 'upgrade_available' => $upgrade_available, 'currentIndex' => self::$currentIndex, 'dirNameCurrentIndex' => dirname(self::$currentIndex), 'ajaxCurrentIndex' => str_replace('index', 'ajax-tab', self::$currentIndex), 'autocompleteList' => rtrim($autocomplete_list, ' ,') . '];', 'showTypeModules' => $this->filter_configuration['PS_SHOW_TYPE_MODULES_' . (int) $this->id_employee], 'showCountryModules' => $this->filter_configuration['PS_SHOW_COUNTRY_MODULES_' . (int) $this->id_employee], 'showInstalledModules' => $this->filter_configuration['PS_SHOW_INSTALLED_MODULES_' . (int) $this->id_employee], 'showEnabledModules' => $this->filter_configuration['PS_SHOW_ENABLED_MODULES_' . (int) $this->id_employee], 'nameCountryDefault' => Country::getNameById($this->context->language->id, Configuration::get('PS_COUNTRY_DEFAULT')), 'isoCountryDefault' => $this->iso_default_country, 'categoryFiltered' => $category_filtered, 'modules' => $modules, 'nb_modules' => $this->nb_modules_total, 'nb_modules_favorites' => count($this->context->employee->favoriteModulesList()), 'nb_modules_installed' => $this->nb_modules_installed, 'nb_modules_uninstalled' => $this->nb_modules_total - $this->nb_modules_installed, 'nb_modules_activated' => $this->nb_modules_activated, 'nb_modules_unactivated' => $this->nb_modules_installed - $this->nb_modules_activated, 'list_modules_categories' => $cleaned_list, 'list_modules_authors' => $this->modules_authors, 'add_permission' => $this->tabAccess['add'], 'tab_modules_preferences' => $tab_modules_preferences, 'kpis' => $this->renderKpis(), 'module_name' => Tools::getValue('module_name'), 'page_header_toolbar_title' => $this->page_header_toolbar_title, 'page_header_toolbar_btn' => $this->page_header_toolbar_btn, 'modules_uri' => __PS_BASE_URI__ . basename(_PS_MODULE_DIR_), 'dont_filter' => $dont_filter, 'is_contributor' => (int) $this->context->cookie->is_contributor, 'maintenance_mode' => !(bool) Configuration::Get('PS_SHOP_ENABLE')); if ($this->logged_on_addons) { $tpl_vars['logged_on_addons'] = 1; $tpl_vars['username_addons'] = $this->context->cookie->username_addons; } $smarty->assign($tpl_vars); }
public function hookpaymentTop($params) { if ($params['cart']->id_carrier == Configuration::Get('SOCOLISSIMO_CARRIER_ID') and !$this->getDeliveryInfos((int) $params['cookie']->id_cart, (int) $params['cookie']->id_customer)) { $params['cart']->id_carrier = 0; } }
$locale['405'] = "Invalid password, use alpha numeric characters only.<br />\nPassword must be a minimum of 6 characters long."; $locale['1405'] = "Invalid Game Account password, use alpha numeric characters only.<br />\nPassword must be a minimum of 6 characters long."; $locale['406'] = "Your email address does not appear to be valid."; $locale['407'] = "Sorry, the user name " . (isset($_POST['username']) ? $_POST['username'] : "") . " is in use."; $locale['1407'] = "Sorry, the Game Account user name " . (isset($_POST['game_username']) ? $_POST['game_username'] : "") . " is in use."; $locale['408'] = "Sorry, the email address " . (isset($_POST['email']) ? $_POST['email'] : "") . " is in use."; $locale['409'] = "An inactive account has been registered with the email address."; $locale['410'] = "Incorrect validation code."; $locale['411'] = "Your email address or email domain is blacklisted."; // Email Message $locale['449'] = "Welcome to " . $settings['sitename']; $locale['450'] = "Hello " . (isset($_POST['username']) ? $_POST['username'] : "") . ",\n\nWelcome to " . $settings['sitename'] . ". Here are your login details:\n\nUsername: "******"") . "\nPassword: "******"") . "\n\nPlease activate your account via the following link:\n"; // Registration Success/Fail $locale['451'] = "Registration complete"; $locale['452'] = "You can now log in."; $locale['1452'] = "<font color=red size=3>You will be able to login within 3-5 mins. Set your realmlist to: " . Configuration::Get('realmlist') . "</font>"; $locale['453'] = "An administrator will activate your account shortly."; $locale['454'] = "Your registration is almost complete, you will receive an email containing your login details along with a link to verify your account."; $locale['455'] = "Your account has been verified."; $locale['1455'] = "Your game account has been created."; $locale['456'] = "Registration Failed"; $locale['457'] = "Send mail failed, please contact the <a href='mailto:" . $settings['siteemail'] . "'>Site Administrator</a>."; $locale['458'] = "Registration failed for the following reason(s):"; $locale['459'] = "Please Try Again"; // Register Form $locale['500'] = ""; $locale['501'] = "A verification email will be sent to your specified email address. "; $locale['502'] = ""; $locale['503'] = " You can enter additional information by going to Edit Profile once you are logged in."; $locale['504'] = "Validation Code:"; $locale['505'] = "Enter Validation Code:";
} else { $navbar_links = ""; } for ($p = 1; $p <= Configuration::Get('navbar.link.count'); $p++) { if (Configuration::Get('navbar.link' . $p) != '|' && Configuration::Get('navbar.link' . $p) != null && Configuration::Get('navbar.link' . $p) != '') { $link_info = explode("|", Configuration::Get('navbar.link' . $p)); $navbar_links .= " <a href='" . $folder_level . $link_info[1] . "'>" . $link_info[0] . "</a> |"; } } $use_flash = Configuration::Get('use.flash.banner'); $flash_banner_path = $folder_level . Configuration::Get('flash.banner.location'); $neon_banner_path = $folder_level . Configuration::Get('neon.theme.banner.path'); $bloody_banner_path = $folder_level . Configuration::Get('bloody.theme.banner.path'); $bloody_header_path = $folder_level . Configuration::Get('bloody.theme.header.path'); $agreed = Configuration::Get('use.agreement'); if (Configuration::Get('lettering.type') == 1) { $letters = "wotlk"; } elseif (Configuration::Get('lettering.type') == 2) { $letters = "tbc"; } elseif (Configuration::Get('lettering.type') == 3) { $letters = "reg"; } $letter_string = array_change_key_case(str_split(Configuration::Get('lettering.message'), 1), CASE_LOWER); while (in_array(' ', $letter_string)) { $numar = array_search(' ', $letter_string); $letter_string[$numar] = 'space'; } $lettering_string = ""; for ($i = 0; $i < count($letter_string); $i++) { $lettering_string .= "<img src='" . $folder_level . "images/logo/" . $letters . "/" . $letter_string[$i] . ".png' align='center'>"; }
public function hookExtraCarrier($params) { $carrierSo = new Carrier((int) Configuration::get('SOCOLISSIMO_CARRIER_ID')); if (!isset($carrierSo) || !$carrierSo->active) { return ''; } $country = new Country((int) $params['address']->id_country); $carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, defined('ALL_CARRIERS') ? ALL_CARRIERS : Carrier::ALL_CARRIERS); // Backward compatibility 1.5 $id_carrier = $carrierSo->id; // For now works only with single shipping ! if (method_exists($params['cart'], 'carrierIsSelected')) { if ($params['cart']->carrierIsSelected((int) $carrierSo->id, $params['address']->id)) { $id_carrier = (int) $carrierSo->id; } } $customer = new Customer($params['address']->id_customer); // Keep this fields order (see doc.) $inputs = array('pudoFOId' => Configuration::get('SOCOLISSIMO_ID'), 'ceName' => $this->replaceAccentedChars(substr($params['address']->lastname, 0, 34)), 'dyPreparationTime' => (int) Configuration::Get('SOCOLISSIMO_PREPARATION_TIME'), 'dyForwardingCharges' => number_format((double) (version_compare(_PS_VERSION_, '1.5', '>') ? $params['cart']->getTotalShippingCost() : $params['cart']->getOrderShippingCost($carrierSo->id)), 2, ',', ''), 'trClientNumber' => (int) $params['address']->id_customer, 'orderId' => $this->formatOrderId((int) $params['address']->id), 'numVersion' => $this->getNumVersion(), 'ceCivility' => $this->replaceAccentedChars($this->getTitle($customer)), 'ceFirstName' => $this->replaceAccentedChars(substr($params['address']->firstname, 0, 29)), 'ceCompanyName' => $this->replaceAccentedChars(substr($params['address']->company, 0, 38)), 'ceAdress3' => $this->replaceAccentedChars(substr($params['address']->address1, 0, 38)), 'ceAdress4' => $this->replaceAccentedChars(substr($params['address']->address2, 0, 38)), 'ceZipCode' => $this->replaceAccentedChars($params['address']->postcode), 'ceTown' => $this->replaceAccentedChars(substr($params['address']->city, 0, 32)), 'ceEmail' => $this->replaceAccentedChars($params['cookie']->email), 'cePhoneNumber' => $this->replaceAccentedChars(str_replace(array(' ', '.', '-', ',', ';', '+', '/', '\\', '+', '(', ')'), '', $params['address']->phone_mobile)), 'dyWeight' => (double) $params['cart']->getTotalWeight() * 1000, 'trParamPlus' => $carrierSo->id, 'trReturnUrlKo' => htmlentities($this->url, ENT_NOQUOTES, 'UTF-8'), 'trReturnUrlOk' => htmlentities($this->url, ENT_NOQUOTES, 'UTF-8')); $inputs['signature'] = $this->generateKey($inputs); $this->context->smarty->assign(array('select_label' => $this->l('Select delivery mode'), 'edit_label' => $this->l('Edit delivery mode'), 'token' => sha1('socolissimo' . _COOKIE_KEY_ . Context::getContext()->cookie->id_cart), 'urlSo' => Configuration::get('SOCOLISSIMO_URL') . '?trReturnUrlKo=' . htmlentities($this->url, ENT_NOQUOTES, 'UTF-8'), 'id_carrier' => $id_carrier, 'SOBWD_C' => _PS_VERSION_ < '1.5' ? false : true, 'inputs' => $inputs, 'finishProcess' => $this->l('To choose SoColissimo, click on a delivery method'))); $ids = array(); foreach ($carriers as $carrier) { $ids[] = $carrier['id_carrier']; } if ($params['cart']->id_carrier == Configuration::Get('SOCOLISSIMO_CARRIER_ID') && $this->getDeliveryInfos($this->context->cart->id, $this->context->customer->id)) { $this->context->smarty->assign('already_select_delivery', true); } else { $this->context->smarty->assign('already_select_delivery', false); } if ($country->iso_code == 'FR' and Configuration::Get('SOCOLISSIMO_ID') != NULL && Configuration::get('SOCOLISSIMO_KEY') != NULL and $this->checkAvailibility() && $this->checkSoCarrierAvailable((int) Configuration::get('SOCOLISSIMO_CARRIER_ID')) && in_array((int) Configuration::get('SOCOLISSIMO_CARRIER_ID'), $ids)) { if (Configuration::get('PS_ORDER_PROCESS_TYPE') || Configuration::get('SOCOLISSIMO_USE_FANCYBOX')) { return $this->display(__FILE__, 'socolissimo_fancybox.tpl'); } return $this->display(__FILE__, 'socolissimo_redirect.tpl'); } else { $this->context->smarty->assign('ids', explode('|', Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST'))); return $this->display(__FILE__, 'socolissimo_error.tpl'); } }
public function hookExtraCarrier($params) { $customer = new Customer($params['address']->id_customer); $cecivility = false; if (_PS_VERSION_ < '1.5') { $gender = array('1' => 'MR', '2' => 'MME'); $cecivility = 'MR'; if (in_array((int) $customer->id_gender, array(1, 2))) { $cecivility = $gender[(int) $customer->id_gender]; } } else { $gender = new Gender($customer->id_gender); } $carrierSo = new Carrier((int) Configuration::get('SOCOLISSIMO_CARRIER_ID')); if (isset($carrierSo) and $carrierSo->active) { $signature = $this->make_key(substr($this->lower($params['address']->lastname), 0, 34), (int) Configuration::Get('SOCOLISSIMO_PREPARATION_TIME'), number_format((double) (version_compare(_PS_VERSION_, '1.5', '>') ? $params['cart']->getTotalShippingCost() : $params['cart']->getOrderShippingCost($carrierSo->id, true)), 2, ',', ''), (int) $params['address']->id_customer, (int) $params['address']->id); $orderId = $this->formatOrderId((int) $params['address']->id); $inputs = array('PUDOFOID' => Configuration::get('SOCOLISSIMO_ID'), 'ORDERID' => $orderId, 'CENAME' => substr($this->lower($params['address']->lastname), 0, 34), 'TRCLIENTNUMBER' => $this->upper((int) $params['address']->id_customer), 'CECIVILITY' => $cecivility ? $cecivility : $gender->name, 'CEFIRSTNAME' => substr($this->lower($params['address']->firstname), 0, 29), 'CECOMPANYNAME' => substr($this->upper($params['address']->company), 0, 38), 'CEEMAIL' => $params['cookie']->email, 'CEPHONENUMBER' => str_replace(array(' ', '.', '-', ',', ';', '+', '/', '\\', '+', '(', ')'), '', $params['address']->phone_mobile), 'CEADRESS3' => substr($this->upper($params['address']->address1), 0, 38), 'CEADRESS4' => substr($this->upper($params['address']->address2), 0, 38), 'CEZIPCODE' => $params['address']->postcode, 'CETOWN' => substr($this->upper($params['address']->city), 0, 32), 'DYWEIGHT' => (double) $params['cart']->getTotalWeight() * 1000, 'SIGNATURE' => htmlentities($signature, ENT_NOQUOTES, 'UTF-8'), 'carrier_id' => (int) $carrierSo->id, 'gift' => '', 'gift_message' => '', 'TRPARAMPLUS' => '', 'DYFORWARDINGCHARGES' => number_format((double) (version_compare(_PS_VERSION_, '1.5', '>') ? $params['cart']->getTotalShippingCost() : $params['cart']->getOrderShippingCost($carrierSo->id)), 2, ',', ''), 'DYPREPARATIONTIME' => (int) Configuration::Get('SOCOLISSIMO_PREPARATION_TIME'), 'TRRETURNURLKO' => htmlentities($this->url, ENT_NOQUOTES, 'UTF-8'), 'TRRETURNURLOK' => htmlentities($this->url, ENT_NOQUOTES, 'UTF-8')); $serialsInput = ''; foreach ($inputs as $key => $val) { $serialsInput .= '&' . $key . '=' . $val; } $serialsInput = ltrim($serialsInput, '&'); // Backward compatibility 1.5 $id_carrier = 0; // For now works only with single shipping ! if (method_exists($params['cart'], 'carrierIsSelected')) { if ($params['cart']->carrierIsSelected((int) $carrierSo->id, $params['address']->id)) { $id_carrier = (int) $carrierSo->id; } } else { $id_carrier = $carrierSo->id; } $this->context->smarty->assign(array('select_label' => $this->l('Select delivery mode'), 'edit_label' => $this->l('Edit delivery mode'), 'token' => sha1('socolissimo' . _COOKIE_KEY_ . Context::getContext()->cookie->id_cart), 'urlSo' => Configuration::get('SOCOLISSIMO_URL') . '?trReturnUrlKo=' . htmlentities($this->url, ENT_NOQUOTES, 'UTF-8'), 'id_carrier' => $id_carrier, 'SOBWD_C' => _PS_VERSION_ < '1.5' ? false : true, 'inputs' => $inputs, 'serialsInput' => $serialsInput, 'finishProcess' => $this->l('To choose SoColissimo, click on a delivery method'))); $country = new Country((int) $params['address']->id_country); $carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, defined('ALL_CARRIERS') ? ALL_CARRIERS : Carrier::ALL_CARRIERS); $ids = array(); foreach ($carriers as $carrier) { $ids[] = $carrier['id_carrier']; } if ($params['cart']->id_carrier == Configuration::Get('SOCOLISSIMO_CARRIER_ID') && $this->getDeliveryInfos($this->context->cart->id, $this->context->customer->id)) { $this->context->smarty->assign('already_select_delivery', true); } else { $this->context->smarty->assign('already_select_delivery', false); } if ($country->iso_code == 'FR' and Configuration::Get('SOCOLISSIMO_ID') != NULL and Configuration::get('SOCOLISSIMO_KEY') != NULL and $this->checkAvailibility() and $this->checkSoCarrierAvailable((int) Configuration::get('SOCOLISSIMO_CARRIER_ID')) and in_array((int) Configuration::get('SOCOLISSIMO_CARRIER_ID'), $ids)) { if (Configuration::get('PS_ORDER_PROCESS_TYPE') || Configuration::get('SOCOLISSIMO_USE_FANCYBOX')) { return $this->display(__FILE__, 'socolissimo_fancybox.tpl'); } else { return $this->display(__FILE__, 'socolissimo_redirect.tpl'); } } else { $this->context->smarty->assign('ids', explode('|', Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST'))); return $this->display(__FILE__, 'socolissimo_error.tpl'); } } }
public function hookExtraCarrier($params) { $carrier_so = new Carrier((int) Configuration::get('SOCOLISSIMO_CARRIER_ID')); if (!isset($carrier_so) || !$carrier_so->active) { return ''; } $country = new Country((int) $params['address']->id_country); $carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, defined('ALL_CARRIERS') ? ALL_CARRIERS : Carrier::ALL_CARRIERS); // Backward compatibility 1.5 $id_carrier = $carrier_so->id; // bug fix for cart rule with restriction if (!version_compare(_PS_VERSION_, '1.5', '<')) { CartRule::autoAddToCart($this->context); } // For now works only with single shipping ! if (method_exists($params['cart'], 'carrierIsSelected')) { if ($params['cart']->carrierIsSelected((int) $carrier_so->id, $params['address']->id)) { $id_carrier = (int) $carrier_so->id; } } $customer = new Customer($params['address']->id_customer); $gender = array('1' => 'MR', '2' => 'MME', '3' => 'MLE'); if (in_array((int) $customer->id_gender, array(1, 2))) { $cecivility = $gender[(int) $customer->id_gender]; } else { $cecivility = 'MR'; } $tax_rate = Tax::getCarrierTaxRate($id_carrier, isset($params['cart']->id_address_delivery) ? $params['cart']->id_address_delivery : null); $tax_rate_seller = Tax::getCarrierTaxRate(Configuration::get('SOCOLISSIMO_CARRIER_ID_SELLER'), isset($params['cart']->id_address_delivery) ? $params['cart']->id_address_delivery : null); if ($tax_rate) { $std_cost_with_taxes = number_format((double) $this->initial_cost * (1 + $tax_rate / 100), 2, ',', ' '); } else { $std_cost_with_taxes = number_format((double) $this->initial_cost, 2, ',', ' '); } $seller_cost_with_taxes = 0; if ($this->seller_cost) { if ($tax_rate_seller) { $seller_cost_with_taxes = number_format((double) $this->seller_cost * (1 + $tax_rate_seller / 100), 2, ',', ' '); } else { $seller_cost_with_taxes = number_format((double) $this->seller_cost, 2, ',', ' '); } } $free_shipping = false; if (version_compare(_PS_VERSION_, '1.5', '<')) { $rules = $params['cart']->getDiscounts(); if (!empty($rules)) { foreach ($rules as $rule) { if ($rule['id_discount_type'] == 3) { $free_shipping = true; break; } } } } else { $rules = $params['cart']->getCartRules(); if (!empty($rules)) { foreach ($rules as $rule) { if ($rule['free_shipping'] && !$rule['carrier_restriction']) { $free_shipping = true; break; } } if (!$free_shipping) { $key_search = $id_carrier . ','; $deliveries_list = $params['cart']->getDeliveryOptionList(); foreach ($deliveries_list as $deliveries) { foreach ($deliveries as $key => $elt) { if ($key == $key_search) { $free_shipping = $elt['is_free']; } } } } } else { // for cart rule with restriction $key_search = $id_carrier . ','; $deliveries_list = $params['cart']->getDeliveryOptionList(); foreach ($deliveries_list as $deliveries) { foreach ($deliveries as $key => $elt) { if ($key == $key_search) { $free_shipping = $elt['is_free']; } } } } } if ($free_shipping) { $std_cost_with_taxes = 0; $seller_cost_with_taxes = 0; } // Keep this fields order (see doc.) $inputs = array('pudoFOId' => Configuration::get('SOCOLISSIMO_ID'), 'ceName' => $this->replaceAccentedChars(Tools::substr($params['address']->lastname, 0, 34)), 'dyPreparationTime' => (int) Configuration::Get('SOCOLISSIMO_PREPARATION_TIME'), 'dyForwardingCharges' => $std_cost_with_taxes, 'dyForwardingChargesCMT' => $seller_cost_with_taxes, 'trClientNumber' => (int) $params['address']->id_customer, 'orderId' => $this->formatOrderId((int) $params['address']->id), 'numVersion' => $this->getNumVersion(), 'ceCivility' => $cecivility, 'ceFirstName' => $this->replaceAccentedChars(Tools::substr($params['address']->firstname, 0, 29)), 'ceCompanyName' => $this->replaceAccentedChars(Tools::substr($params['address']->company, 0, 38)), 'ceAdress3' => $this->replaceAccentedChars(Tools::substr($params['address']->address1, 0, 38)), 'ceAdress4' => $this->replaceAccentedChars(Tools::substr($params['address']->address2, 0, 38)), 'ceZipCode' => $this->replaceAccentedChars($params['address']->postcode), 'ceTown' => $this->replaceAccentedChars(Tools::substr($params['address']->city, 0, 32)), 'ceEmail' => $this->replaceAccentedChars($params['cookie']->email), 'cePhoneNumber' => $this->replaceAccentedChars(str_replace(array(' ', '.', '-', ',', ';', '/', '\\', '(', ')'), '', $params['address']->phone_mobile)), 'dyWeight' => (double) $params['cart']->getTotalWeight() * 1000, 'trParamPlus' => $carrier_so->id, 'trReturnUrlKo' => htmlentities($this->url, ENT_NOQUOTES, 'UTF-8'), 'trReturnUrlOk' => htmlentities($this->url, ENT_NOQUOTES, 'UTF-8'), 'CHARSET' => 'UTF-8', 'cePays' => $country->iso_code, 'trInter' => Configuration::get('SOCOLISSIMO_EXP_BEL'), 'ceLang' => 'FR'); if (!$inputs['dyForwardingChargesCMT'] && !Configuration::get('SOCOLISSIMO_COST_SELLER')) { unset($inputs['dyForwardingChargesCMT']); } // set params for Api 3.0 if needed $inputs = $this->setInputParams($inputs); // generate key for API $inputs['signature'] = $this->generateKey($inputs); // calculate lowest cost $from_cost = $std_cost_with_taxes; if ($seller_cost_with_taxes || Configuration::get('SOCOLISSIMO_CARRIER_ID_SELLER') && Configuration::get('SOCOLISSIMO_COST_SELLER')) { if ((double) str_replace(',', '.', $seller_cost_with_taxes) < (double) str_replace(',', '.', $std_cost_with_taxes)) { $from_cost = $seller_cost_with_taxes; } } $rewrite_active = true; if (!Configuration::get('PS_REWRITING_SETTINGS')) { $rewrite_active = false; } // module link for prestashop 1.5 to get proper url $link = new Link(); $module_link = ''; if (!version_compare(_PS_VERSION_, '1.5', '<')) { $module_link = $link->getModuleLink('socolissimo', 'redirect', array(), true); } $module_link_mobile = ''; if (!version_compare(_PS_VERSION_, '1.5', '<')) { $module_link_mobile = $link->getModuleLink('socolissimo', 'redirectmobile', array(), true); } // automatic settings api protocol for ssl $protocol = 'http://'; if (Configuration::get('PS_SSL_ENABLED')) { $protocol = 'https://'; } $this->context->smarty->assign(array('select_label' => $this->l('Select delivery mode'), 'edit_label' => $this->l('Edit delivery mode'), 'token' => sha1('socolissimo' . _COOKIE_KEY_ . Context::getContext()->cookie->id_cart), 'urlSo' => $protocol . Configuration::get('SOCOLISSIMO_URL') . '?trReturnUrlKo=' . htmlentities($this->url, ENT_NOQUOTES, 'UTF-8'), 'urlSoMobile' => $protocol . Configuration::get('SOCOLISSIMO_URL_MOBILE') . '?trReturnUrlKo=' . htmlentities($this->url, ENT_NOQUOTES, 'UTF-8'), 'id_carrier' => $id_carrier, 'id_carrier_seller' => Configuration::get('SOCOLISSIMO_CARRIER_ID_SELLER'), 'SOBWD_C' => version_compare(_PS_VERSION_, '1.5', '<') ? false : true, 'inputs' => $inputs, 'initialCost_label' => $this->l('From'), 'initialCost' => $from_cost . $this->l(' €'), 'taxMention' => $this->l(' TTC'), 'finishProcess' => $this->l('To choose SoColissimo, click on a delivery method'), 'rewrite_active' => $rewrite_active, 'link_socolissimo' => $module_link, 'link_socolissimo_mobile' => $module_link_mobile)); $ids = array(); foreach ($carriers as $carrier) { $ids[] = $carrier['id_carrier']; } if ($params['cart']->id_carrier == Configuration::Get('SOCOLISSIMO_CARRIER_ID') && $this->getDeliveryInfos($this->context->cart->id, $this->context->customer->id)) { $this->context->smarty->assign('already_select_delivery', true); } else { $this->context->smarty->assign('already_select_delivery', false); } if (($country->iso_code == 'FR' || $country->iso_code == 'BE' && Configuration::get('SOCOLISSIMO_EXP_BEL')) && Configuration::Get('SOCOLISSIMO_ID') != null && Configuration::get('SOCOLISSIMO_KEY') != null && $this->checkAvailibility() && $this->checkSoCarrierAvailable((int) Configuration::get('SOCOLISSIMO_CARRIER_ID')) && in_array((int) Configuration::get('SOCOLISSIMO_CARRIER_ID'), $ids)) { // if mobile or iPad if (version_compare(_PS_VERSION_, '1.5', '<')) { // 1.4 if ($this->context->getMobileDevice()) { return $this->fetchTemplate('socolissimo_redirect_mobile.tpl'); } } else { // 1.5 if (Context::getContext()->getMobileDevice() || _THEME_NAME_ == 'prestashop_mobile' || $this->isIpad()) { if (Configuration::get('PS_ORDER_PROCESS_TYPE')) { $tab_id_soco = explode('|', Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST')); $tab_id_soco[] = $id_carrier; $this->context->smarty->assign('ids', $tab_id_soco); return $this->fetchTemplate('socolissimo_error_mobile_opc.tpl'); } else { return $this->fetchTemplate('socolissimo_redirect_mobile.tpl'); } } } // route display mode if (Configuration::get('PS_ORDER_PROCESS_TYPE') || Configuration::get('SOCOLISSIMO_USE_FANCYBOX')) { return $this->fetchTemplate('socolissimo_fancybox.tpl'); } if (Configuration::get('SOCOLISSIMO_USE_IFRAME')) { return $this->fetchTemplate('socolissimo_iframe.tpl'); } return $this->fetchTemplate('socolissimo_redirect.tpl'); } else { $tab_id_soco = explode('|', Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST')); $tab_id_soco[] = $id_carrier; $this->context->smarty->assign('ids', $tab_id_soco); return $this->fetchTemplate('socolissimo_error.tpl'); } }
public function hookExtraCarrier($params) { global $smarty, $cookie; //delete overcost product if exist $cart = new Cart(intval($params['cart']->id)); $products = $cart->getProducts(false); $ids = array(); foreach ($products as $product) { $ids[] .= intval($product['id_product']); } if (in_array(Configuration::get('SOCOLISSIMO_PRODUCT_ID'), $ids)) { $cart->deleteProduct(Configuration::get('SOCOLISSIMO_PRODUCT_ID')); } $cart->update(); $country = new Country(intval($params['address']->id_country)); $customer = new Customer($params['address']->id_customer); $gender = array('1' => 'MR', '2' => 'MME'); if (in_array(intval($customer->id_gender), array(1, 2))) { $cecivility = $gender[intval($customer->id_gender)]; } else { $cecivility = 'MR'; } $carrierSo = new Carrier(intval(Configuration::get('SOCOLISSIMO_CARRIER_ID'))); if (isset($carrierSo) and $carrierSo->active) { $signature = $this->make_key(substr($this->lower($params['address']->lastname), 0, 34), (int) Configuration::Get('SOCOLISSIMO_PREPARATION_TIME'), number_format((double) $params['cart']->getOrderShippingCost($carrierSo->id, true), 2, ',', ''), (int) $params['address']->id_customer, (int) $params['address']->id); if (Configuration::Get('SOCOLISSIMO_COST_SELLER') && Configuration::get('SOCOLISSIMO_CARRIER_ID_SELLER')) { $seller_cost = number_format((double) $params['cart']->getOrderShippingCost((int) Configuration::get('SOCOLISSIMO_CARRIER_ID_SELLER')), 2, ',', ''); } else { $seller_cost = 0; } $orderId = $this->formatOrderId((int) $params['address']->id); // Keep this fields order (see doc.) $inputs = array('pudoFOId' => Configuration::get('SOCOLISSIMO_ID'), 'ceName' => $this->replaceAccentedChars(substr($params['address']->lastname, 0, 34)), 'dyPreparationTime' => (int) Configuration::Get('SOCOLISSIMO_PREPARATION_TIME'), 'dyForwardingCharges' => number_format((double) $params['cart']->getOrderShippingCost($carrierSo->id), 2, ',', ''), 'dyForwardingChargesCMT' => $seller_cost, 'trClientNumber' => $this->upper((int) $params['address']->id_customer), 'orderId' => $orderId, 'numVersion' => $this->getNumVersion(), 'ceCivility' => $cecivility, 'ceFirstName' => $this->replaceAccentedChars(substr($params['address']->firstname, 0, 29)), 'ceCompanyName' => $this->replaceAccentedChars(substr($params['address']->company, 0, 38)), 'ceAdress3' => $this->replaceAccentedChars(substr($params['address']->address1, 0, 38)), 'ceAdress4' => $this->replaceAccentedChars(substr($params['address']->address2, 0, 38)), 'ceZipCode' => $this->replaceAccentedChars($params['address']->postcode), 'ceTown' => $this->replaceAccentedChars(substr($params['address']->city, 0, 32)), 'ceEmail' => $this->replaceAccentedChars($params['cookie']->email), 'cePhoneNumber' => $this->replaceAccentedChars(str_replace(array(' ', '.', '-', ',', ';', '+', '/', '\\', '+', '(', ')'), '', $params['address']->phone_mobile)), 'dyWeight' => (double) $params['cart']->getTotalWeight() * 1000, 'trParamPlus' => (int) $carrierSo->id, 'trReturnUrlKo' => htmlentities($this->url, ENT_NOQUOTES, 'UTF-8'), 'trReturnUrlOk' => htmlentities($this->url, ENT_NOQUOTES, 'UTF-8'), 'CHARSET' => 'UTF-8', 'cePays' => $country->iso_code, 'trInter' => Configuration::get('SOCOLISSIMO_EXP_BEL'), 'ceLang' => 'FR'); $row['id_carrier'] = intval($carrierSo->id); if (!$inputs['dyForwardingChargesCMT']) { unset($inputs['dyForwardingChargesCMT']); } $std_cost = number_format((double) $params['cart']->getOrderShippingCost($carrierSo->id), 2, ',', ''); $from_cost = $std_cost; if ($seller_cost) { if ((double) str_replace(',', '.', $seller_cost) < (double) str_replace(',', '.', $std_cost)) { $from_cost = $seller_cost; } } $smarty->assign(array('select_label' => $this->l('Select delivery mode'), 'edit_label' => $this->l('Edit delivery mode'), 'token' => sha1('socolissimo' . _COOKIE_KEY_ . $params['cart']->id), 'urlSo' => Configuration::get('SOCOLISSIMO_URL') . '?trReturnUrlKo=' . htmlentities($this->url, ENT_NOQUOTES, 'UTF-8'), 'id_carrier' => intval($row['id_carrier']), 'id_carrier_seller' => Configuration::get('SOCOLISSIMO_CARRIER_ID_SELLER'), 'SOBWD_C' => false, 'inputs' => $inputs, 'initialCost' => $this->l('From') . ' ' . $from_cost . ' €', 'finishProcess' => $this->l('To choose SoColissimo, click on a delivery method'))); $carriers = Carrier::getCarriers($cookie->id_lang, false); foreach ($carriers as $carrier) { $ids[] .= $carrier['id_carrier']; } if ($country->iso_code == 'FR' || $country->iso_code == 'BE' && Configuration::get('SOCOLISSIMO_EXP_BEL') and Configuration::Get('SOCOLISSIMO_ID') != NULL and Configuration::get('SOCOLISSIMO_KEY') != NULL and $this->checkAvailibility() and $this->checkSoCarrierAvailable(intval(Configuration::get('SOCOLISSIMO_CARRIER_ID'))) and in_array(intval(Configuration::get('SOCOLISSIMO_CARRIER_ID')), $ids)) { return $this->display(__FILE__, 'socolissimo_iframe.tpl'); } else { $smarty->assign('ids', explode('|', Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST'))); return $this->display(__FILE__, 'socolissimo_error.tpl'); } } }