本文整理汇总了PHP中Link::getModuleLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::getModuleLink方法的具体用法?PHP Link::getModuleLink怎么用?PHP Link::getModuleLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Link
的用法示例。
在下文中一共展示了Link::getModuleLink方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayViewLink
public function displayViewLink($token = null, $id, $name = null)
{
$link = new Link();
if (!array_key_exists('View', self::$cache_lang)) {
self::$cache_lang['View'] = $this->l('View', 'Helper');
}
if (Module::isInstalled('agilenewsletters') and in_array($this->context->controller->table, array('agile_mail_history'))) {
return '<a href="' . $link->getModuleLink('agilenewsletters', 'newsletterdetail', array('nid' => $id), true) . '" target="_new"><img src="../img/admin/details.gif" alt="' . self::$cache_lang['View'] . '" title="' . self::$cache_lang['View'] . '" /></a>';
}
return parent::displayViewLink($token, $id);
}
示例2: toggleWebservice
protected function toggleWebservice($force_webservice = false, $active = true)
{
if ($force_webservice !== false) {
$cron_mode = 'webservice';
} else {
$cron_mode = Tools::getValue('cron_mode', 'webservice');
$active = $cron_mode == 'advanced' ? false : true;
}
$link = new Link();
Configuration::updateValue('CRONJOBS_MODE', $cron_mode);
$admin_folder = str_replace(_PS_ROOT_DIR_ . '/', null, _PS_ADMIN_DIR_);
$path = Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . $admin_folder;
$cron_url = $path . '/' . $link->getAdminLink('AdminCronJobs', false);
$webservice_id = Configuration::get('CRONJOBS_WEBSERVICE_ID') ? '/' . Configuration::get('CRONJOBS_WEBSERVICE_ID') : null;
$data = array('callback' => $link->getModuleLink($this->name, 'callback'), 'cronjob' => $cron_url . '&token=' . Configuration::get('CRONJOBS_EXECUTION_TOKEN', null, 0, 0), 'cron_token' => Configuration::get('CRONJOBS_EXECUTION_TOKEN', null, 0, 0), 'active' => (int) $active);
$context_options = array('http' => array('method' => is_null($webservice_id) == true ? 'POST' : 'PUT', 'content' => http_build_query($data)));
$context = stream_context_create($context_options);
$result = Tools::file_get_contents($this->webservice_url . $webservice_id, false, $context);
Configuration::updateValue('CRONJOBS_WEBSERVICE_ID', (int) $result);
if ($this->isLocalEnvironment() == true) {
return true;
} elseif ((Tools::isSubmit('install') == false || Tools::isSubmit('reset') == false) && (bool) $result == false) {
return $this->setErrorMessage('An error occurred while trying to contact PrestaShop\'s cron tasks webservice.');
} elseif ((Tools::isSubmit('install') == true || Tools::isSubmit('reset') == true) && (bool) $result == false) {
return true;
}
Configuration::updateValue('CRONJOBS_MODE', $cron_mode);
switch ($cron_mode) {
case 'advanced':
return $this->setSuccessMessage('Your cron tasks have been successfully registered using the Advanced mode.');
case 'webservice':
return $this->setSuccessMessage('Your cron tasks have been successfully added to PrestaShop\'s cron tasks webservice.');
default:
return;
}
return true;
}
示例3: updateWebservice
protected function updateWebservice($use_webservice)
{
$link = new Link();
$admin_folder = $this->getAdminDir();
$path = Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . $admin_folder;
$cron_url = $path . '/' . $link->getAdminLink('AdminCronJobs', false);
$webservice_id = Configuration::get('CRONJOBS_WEBSERVICE_ID') ? '/' . Configuration::get('CRONJOBS_WEBSERVICE_ID') : null;
$data = array('callback' => $link->getModuleLink($this->name, 'callback'), 'domain' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__, 'cronjob' => $cron_url . '&token=' . Configuration::getGlobalValue('CRONJOBS_EXECUTION_TOKEN'), 'cron_token' => Configuration::getGlobalValue('CRONJOBS_EXECUTION_TOKEN'), 'active' => (bool) $use_webservice);
$context_options = array('http' => array('method' => is_null($webservice_id) == true ? 'POST' : 'PUT', 'content' => http_build_query($data)));
$result = Tools::file_get_contents($this->webservice_url . $webservice_id, false, stream_context_create($context_options));
if ($result != false) {
Configuration::updateValue('CRONJOBS_WEBSERVICE_ID', (int) $result);
}
if ((Tools::isSubmit('install') == true || Tools::isSubmit('reset') == true) && (bool) $result == false) {
return true;
} elseif ((Tools::isSubmit('install') == false || Tools::isSubmit('reset') == false) && (bool) $result == false) {
return $this->setErrorMessage('An error occurred while trying to contact PrestaShop\'s cron tasks webservice.');
} elseif ($this->isLocalEnvironment() == true) {
return true;
}
if ((bool) $use_webservice == true) {
return $this->setSuccessMessage('Your cron tasks have been successfully added to PrestaShop\'s cron tasks webservice.');
}
return $this->setSuccessMessage('Your cron tasks have been successfully registered using the Advanced mode.');
}
示例4: getModuleUrl
/**
* Builds a module controller url for the language and shop.
*
* We created our own method due to the existing one in `LinkCore` behaving differently across PS versions.
*
* @param string $name the name of the module to create an url for.
* @param string $path the path of the module to create an url for (PS 1.4 only).
* @param string $controller the name of the controller.
* @param int|null $id_lang the language ID (falls back on current context if not set).
* @param int|null $id_shop the shop ID (falls back on current context if not set).
* @param array $params additional params to add to the url.
* @return string the url.
*/
public function getModuleUrl($name, $path, $controller, $id_lang = null, $id_shop = null, array $params = array())
{
if (is_null($id_lang)) {
$id_lang = (int) Context::getContext()->language->id;
}
if (is_null($id_shop)) {
$id_shop = (int) Context::getContext()->shop->id;
}
$params['module'] = $name;
$params['controller'] = $controller;
if (version_compare(_PS_VERSION_, '1.5.0.0') === -1) {
$params['id_lang'] = $id_lang;
return $this->getBaseUrl($id_shop) . $path . 'ctrl.php?' . http_build_query($params);
} elseif (version_compare(_PS_VERSION_, '1.5.5.0') === -1) {
// For PS versions 1.5.0.0 - 1.5.4.1 we always hard-code the urls to be in non-friendly format and fetch
// the shops base url ourselves. This is a workaround to all the bugs related to url building in these
// PS versions.
$params['fc'] = 'module';
$params['module'] = $name;
$params['controller'] = $controller;
$params['id_lang'] = $id_lang;
return $this->getBaseUrl($id_shop) . 'index.php?' . http_build_query($params);
} else {
/** @var LinkCore $link */
$link = new Link();
return $link->getModuleLink($name, 'oauth2', $params, null, $id_lang, $id_shop);
}
}
示例5: count
echo $objItem->id_loffc_block;
?>
<?php
echo count($items) % 2 ? 'alt_row' : '';
?>
">\
<td class="dragHandle"><?php
echo $objItem->title[Tools::getValue('id_lang', $cookie->id_lang)];
?>
</td>\
<td class="dragHandle"><?php
echo $objItem->type;
?>
</td>\
<td><a class="display lofaddnew-block-item" href="<?php
echo $link->getModuleLink("blockadvfooter", "popup", array('id_shop' => (int) $this->context->shop->id, 'id_loffc_block' => $objItem->id_loffc_block, 'addItem' => 1, 'bo_theme' => Tools::getValue('bo_theme'), 'id_loffc_block_item' => $objItem->id, 'id_loftr' => 'tr_0_' . $objItem->id . '_' . $objItem->id_loffc_block, 'token' => Tools::getValue('token'), 'secure_key' => $module->secure_key));
?>
" title="edit">\
<img title="edit" alt="edit" src="<?php
echo _PS_ADMIN_IMG_;
?>
edit.gif">\
</a>\
<a class="display" onclick="LofDelete(\'tr_0_<?php
echo $objItem->id;
?>
_<?php
echo $objItem->id_loffc_block;
?>
\',\'loftable-<?php
echo $objItem->id_loffc_block;
示例6: hookPayment
/**
* Show kwixo's payment on payment page
*
* @param type $params
* @return boolean
*/
public function hookPayment($params)
{
if (!$this->active) {
return;
}
$total_cart = $params['cart']->getOrderTotal(true);
if (_PS_VERSION_ < '1.5') {
$kwixo = new KwixoPayment();
} else {
$kwixo = new KwixoPayment($params['cart']->id_shop);
}
if ($kwixo->getStatus() == 'test') {
$customer = new Customer((int) $params['cart']->id_customer);
$customer_mail = $customer->email;
if (Configuration::get('KWIXO_EMAILS_TEST') != '') {
$mails_test = explode(',', Configuration::get('KWIXO_EMAILS_TEST'));
if (!in_array($customer_mail, $mails_test)) {
KwixoLogger::insertLogKwixo(__METHOD__ . " : " . __LINE__, "L'adresse {$customer_mail} n'est pas autorisée à utiliser Kwixo en test.");
KwixoLogger::insertLogKwixo(__METHOD__ . " : " . __LINE__, "Liste des adresses autorisées : " . implode(', ', $mails_test));
return false;
}
}
}
$mobile_detect = new MobileDetect();
$mobile = $mobile_detect->isMobile();
$kwixo_standard = Configuration::get('KWIXO_OPTION_STANDARD') == '1' ? '1' : '0';
$kwixo_comptant = Configuration::get('KWIXO_OPTION_COMPTANT') == '1' ? '1' : '0';
$kwixo_facturable = Configuration::get('KWIXO_OPTION_FACTURABLE') == '1' ? '1' : '0';
$kwixo_credit = Configuration::get('KWIXO_OPTION_CREDIT') == '1' && $total_cart >= 150 && $total_cart <= 4000 && !$mobile ? '1' : '0';
if (version_compare(_PS_VERSION_, '1.5', '<')) {
//token security
$token = Tools::getAdminToken($kwixo->getSiteid() . $kwixo->getAuthkey());
$kwixo_std_link = __PS_BASE_URI__ . 'modules/' . $this->name . '/sendtoKwixo.php?payment=1&token=' . $token;
$kwixo_cpt_link = __PS_BASE_URI__ . 'modules/' . $this->name . '/sendtoKwixo.php?payment=2&token=' . $token;
$kwixo_credit_link = __PS_BASE_URI__ . 'modules/' . $this->name . '/sendtoKwixo.php?payment=3&token=' . $token;
$kwixo_facturable_link = __PS_BASE_URI__ . 'modules/' . $this->name . '/sendtoKwixo.php?payment=4&token=' . $token;
} else {
$link = new Link();
$kwixo_std_link = $link->getModuleLink('kwixo', 'payment', array('payment' => '1'), true);
$kwixo_cpt_link = $link->getModuleLink('kwixo', 'payment', array('payment' => '2'), true);
$kwixo_credit_link = $link->getModuleLink('kwixo', 'payment', array('payment' => '3'), true);
$kwixo_facturable_link = $link->getModuleLink('kwixo', 'payment', array('payment' => '4'), true);
}
$this->smarty->assign(array('kwixo_standard' => $kwixo_standard, 'kwixo_comptant' => $kwixo_comptant, 'kwixo_credit' => $kwixo_credit, 'kwixo_facturable' => $kwixo_facturable, 'kwixo_std_link' => $kwixo_std_link, 'kwixo_cpt_link' => $kwixo_cpt_link, 'kwixo_credit_link' => $kwixo_credit_link, 'kwixo_facturable_link' => $kwixo_facturable_link, 'url_simul' => 'https://secure.kwixo.com/credit/calculator.htm?merchantId=' . $kwixo->getSiteId() . '&amount=' . $total_cart, 'logo_kwixo_standard' => __PS_BASE_URI__ . 'modules/' . $this->name . '/img/kwixo_standard.jpg', 'logo_kwixo_comptant' => __PS_BASE_URI__ . 'modules/' . $this->name . '/img/kwixo_comptant.jpg', 'logo_kwixo_credit' => __PS_BASE_URI__ . 'modules/' . $this->name . '/img/kwixo_credit.jpg'));
return $this->display(__FILE__, '/views/templates/hook/payment_short_description.tpl');
}
示例7: hookDisplayBanner
/**
* Show correct re_write url on BlockLanguage module
* http://ps_1609_test/vn/index.php?controller=blog?id=9&fc=module&module=leoblog
* $default_rewrite = array(
'1' => 'http://ps_1609_test/en/blog/lang-en-b9.html',
'2' => 'http://ps_1609_test/vn/blog/lang-vn-b9.html',
'3' => 'http://ps_1609_test/cb/blog/lang-cb-b9.html',
);
*
*/
public function hookDisplayBanner()
{
if (Module::isEnabled('blocklanguages')) {
$default_rewrite = array();
$module = Validate::isModuleName(Tools::getValue('module')) ? Tools::getValue('module') : '';
$controller = Tools::getValue('controller');
if ($module == 'leoblog' && $controller == 'blog' && ($id_blog = (int) Tools::getValue('id'))) {
$languages = Language::getLanguages(true, $this->context->shop->id);
if (!count($languages)) {
return false;
}
$link = new Link();
foreach ($languages as $lang) {
$config = LeoBlogConfig::getInstance();
$config->cur_id_lang = $lang['id_lang'];
$cur_key = 'link_rewrite' . '_' . Context::getContext()->language->id;
$cur_prefix = '/' . ($config->cur_prefix_rewrite = $config->get($cur_key, 'blog') . '/');
$other_key = 'link_rewrite' . '_' . $lang['id_lang'];
$other_prefix = '/' . ($config->cur_prefix_rewrite = $config->get($other_key, 'blog') . '/');
$blog = new LeoBlogBlog($id_blog, $lang['id_lang']);
$temp_link = $link->getModuleLink($module, $controller, array('id' => $id_blog, 'rewrite' => $blog->link_rewrite), null, $lang['id_lang']);
$default_rewrite[$lang['id_lang']] = str_replace($cur_prefix, $other_prefix, $temp_link);
// $default_rewrite[$lang['id_lang']] = $link->getModuleLink($module, $controller, array('id'=>$id_blog, 'rewrite'=>$blog->link_rewrite), null, $lang['id_lang']);
}
} elseif ($module == 'leoblog' && $controller == 'category' && ($id_blog = (int) Tools::getValue('id'))) {
$languages = Language::getLanguages(true, $this->context->shop->id);
if (!count($languages)) {
return false;
}
$link = new Link();
foreach ($languages as $lang) {
$config = LeoBlogConfig::getInstance();
$config->cur_id_lang = $lang['id_lang'];
$cur_key = 'link_rewrite' . '_' . Context::getContext()->language->id;
$cur_prefix = '/' . ($config->cur_prefix_rewrite = $config->get($cur_key, 'blog') . '/');
$other_key = 'link_rewrite' . '_' . $lang['id_lang'];
$other_prefix = '/' . ($config->cur_prefix_rewrite = $config->get($other_key, 'blog') . '/');
$blog = new Leoblogcat($id_blog, $lang['id_lang']);
$temp_link = $link->getModuleLink($module, $controller, array('id' => $id_blog, 'rewrite' => $blog->link_rewrite), null, $lang['id_lang']);
$default_rewrite[$lang['id_lang']] = str_replace($cur_prefix, $other_prefix, $temp_link);
// $default_rewrite[$lang['id_lang']] = $link->getModuleLink($module, $controller, array('id'=>$id_blog, 'rewrite'=>$blog->link_rewrite), null, $lang['id_lang']);
}
} elseif ($module == 'leoblog' && $controller == 'list') {
$languages = Language::getLanguages(true, $this->context->shop->id);
if (!count($languages)) {
return false;
}
$link = new Link();
foreach ($languages as $lang) {
$config = LeoBlogConfig::getInstance();
$config->cur_id_lang = $lang['id_lang'];
$cur_key = 'link_rewrite' . '_' . Context::getContext()->language->id;
$cur_prefix = '/' . ($config->cur_prefix_rewrite = $config->get($cur_key, 'blog') . '');
$other_key = 'link_rewrite' . '_' . $lang['id_lang'];
$other_prefix = '/' . ($config->cur_prefix_rewrite = $config->get($other_key, 'blog') . '');
$temp_link = $link->getModuleLink($module, $controller, array(), null, $lang['id_lang']);
$default_rewrite[$lang['id_lang']] = str_replace($cur_prefix, $other_prefix, $temp_link);
}
}
$this->context->smarty->assign('lang_leo_rewrite_urls', $default_rewrite);
}
}
示例8: insertphotoajax
public function insertphotoajax($post, $file)
{
global $cookie;
$db = Db::getInstance();
$plik_tmp = $file['file']['tmp_name'];
$plik_nazwa = $file['file']['name'];
$plik_rozmiar = $file['file']['size'];
$plik_nazwa = strtolower(preg_replace('/[^a-zA-Z0-9\\.]/', '', $plik_nazwa));
$filetype = pathinfo($plik_nazwa, PATHINFO_EXTENSION);
if (!file_exists("../files/{$post['oid']}")) {
mkdir("../files/{$post['oid']}", 0777);
}
if (is_uploaded_file($plik_tmp)) {
$key = "";
$sciezka = "../files/{$post['oid']}/";
$plik = $plik_nazwa;
if (file_exists("{$sciezka}{$plik}")) {
$key = $this->generatekey(10, "abcdfghijklmnouprstuwxyz1234567890");
$plik = "{$key}{$plik_nazwa}";
}
if (move_uploaded_file($plik_tmp, "{$sciezka}{$plik}")) {
$query = "INSERT INTO `" . _DB_PREFIX_ . "orderfiles` (title,description,filename,id_order,id_customer) VALUES ('','','{$key}{$plik_nazwa}','{$post['oid']}','{$cookie->id_customer}')";
$db->Execute($query);
$query2 = "SELECT id FROM `" . _DB_PREFIX_ . "orderfiles` WHERE filename='" . ($key . $plik_nazwa) . "' AND id_order='" . $post['oid'] . "'";
$returnr = Db::getInstance()->getRow($query2);
$link = new Link();
if ($this->psversion() == 5 || $this->psversion() == 6) {
echo '
<div class="bootstrap">
<div style="border:1px solid #c0c0c0; padding:10px; position:relative; display:block; clear:both; overflow:hidden; margin-bottom:10px;">
<img src="' . _MODULE_DIR_ . 'orderfiles/img/file.png" style="display:inline-block; float:left; margin-right:10px;"/>
<div style="display:inline-block; float:left; padding-bottom:30px;">
<b>' . ($key . $plik_nazwa) . ' - <a href="' . $this->getBaseLink() . 'modules/orderfiles/download.php?t=files&opt=' . $post['oid'] . '&f=' . $key . $plik_nazwa . '"><strong>' . $this->l('download') . '</strong></a>
<p style="margin-top:5px; display:block; clear:both; width:420px; line-height:20px;"> </p>
<form method="post" action="' . $link->getModuleLink('orderfiles', 'filesmanager') . '">
<input type="hidden" name="oid" value="' . $post['oid'] . '"/>
<input type="hidden" name="fid" value="' . $returnr['id'] . '"/>
<input type="hidden" name="pty" value="order"/>
<div style="position:absolute; right:10px; bottom:10px;">
<input type="submit" name="editfile" value="' . $this->l('Edit') . '" class="button"/>
<input type="submit" name="delfile" value="' . $this->l('Delete') . '" class="button"/>
</div>
</form>
</div>
</div>
</div>';
} else {
echo '<div class="warning" style="position:relative; display:block; clear:both; overflow:hidden; margin-bottom:10px;">
<img src="' . _MODULE_DIR_ . 'orderfiles/img/file.png" style="display:inline-block; float:left; margin-right:10px;"/>
<div style="display:inline-block; float:left; padding-bottom:30px;">
<b>' . ($key . $plik_nazwa) . '</b>
<p style="margin-top:5px; display:block; clear:both; width:420px; line-height:20px;"></p>
<form method="post" action="">
<input type="hidden" name="oid" value="' . $post['oid'] . '"/>
<input type="hidden" name="fid" value="' . $returnr['id'] . '"/>
<input type="submit" name="delfile" value="' . $this->l('Delete') . '" class="button" style="position:absolute; right:10px; bottom:10px;"/>
</form>
</div>
</div>';
}
}
}
}
示例9: hookExtraCarrier
//.........这里部分代码省略.........
}
}
}
} 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');
}
}
示例10: orders
//.........这里部分代码省略.........
PowaTagLogs::initAPILog('Process order', PowaTagLogs::ERROR, $message);
}
return PowaTagAPI::powaError($error);
}
if ($value = $powatagcosts->getSummary()) {
if (PowaTagAPI::apiLog()) {
PowaTagLogs::initAPILog('Process calculate Costs', PowaTagLogs::SUCCESS, 'Customer : ' . $customer->firstName . ' ' . $customer->lastName);
}
if (PowaTagAPI::requestLog()) {
PowaTagLogs::initRequestLog('Process calculate Costs', PowaTagLogs::SUCCESS, $value);
}
return $value;
} else {
$error = $powatagcosts->getError();
if (PowaTagAPI::apiLog()) {
PowaTagLogs::initAPILog('Process calculate Costs', PowaTagLogs::ERROR, $error['message']);
}
return PowaTagAPI::powaError($error);
}
} else {
if (count($args) == 2 && Validate::isInt($args[0]) && ($args[1] = 'confirm-payment')) {
//Three step payment confirmation
if (PowaTagAPI::apiLog()) {
PowaTagLogs::initAPILog('Process payment', PowaTagLogs::IN_PROGRESS, 'Order ID : ' . $args[0]);
}
if (PowaTagAPI::requestLog()) {
PowaTagLogs::initRequestLog('Create payment', PowaTagLogs::IN_PROGRESS, $datas);
}
$payment = new PowaTagPayment($datas, (int) $args[0]);
if ($id_order = $payment->confirmPayment()) {
if (PowaTagAPI::apiLog()) {
PowaTagLogs::initAPILog('Process payment', PowaTagLogs::SUCCESS, 'ID Order : ' . $id_order);
}
if (PowaTagAPI::requestLog()) {
PowaTagLogs::initRequestLog('Process payment', PowaTagLogs::SUCCESS, $id_order);
}
$data = array('providerTxCode' => isset($datas->paymentResult->providerTxCode) ? $datas->paymentResult->providerTxCode : 'providerTxCode Empty', 'message' => 'Authorization success order ' . $id_order . ' created');
if ($payment->checkOrderState($id_order, $data) == 'error') {
$this->setResponse($data['response']);
}
return $data;
} else {
$error = $payment->getError();
if (PowaTagAPI::apiLog()) {
PowaTagLogs::initAPILog('Process payment', PowaTagLogs::ERROR, $error['message']);
}
return PowaTagAPI::powaError($error);
}
} else {
if (!count($args)) {
//Two step payment or three step payment
if (isset($datas->order)) {
$customer = $datas->order->customer;
} else {
$customer = current($datas->orders)->customer;
}
if (PowaTagAPI::apiLog()) {
PowaTagLogs::initAPILog('Process order 123', PowaTagLogs::IN_PROGRESS, 'Customer : ' . $customer->firstName . ' ' . $customer->lastName);
}
if (PowaTagAPI::requestLog()) {
PowaTagLogs::initRequestLog('Create order', PowaTagLogs::IN_PROGRESS, $datas);
}
$order = new PowaTagOrders($datas);
if ($error = $order->getError()) {
$message = $error['message'];
if (PowaTagAPI::apiLog()) {
PowaTagLogs::initAPILog('Process order', PowaTagLogs::ERROR, $message);
}
return PowaTagAPI::powaError($error);
}
list($id_cart, $id_order, $message) = $order->validateOrder();
if ($id_order || $id_cart) {
if (PowaTagAPI::apiLog()) {
PowaTagLogs::initAPILog('Process order', PowaTagLogs::SUCCESS, 'Order has been created : ' . $id_order);
}
$link = new Link();
$cart = new Cart($id_cart);
$data = array('orderResults' => array(array('orderId' => $id_order ? $id_order : $id_cart, 'message' => $message, 'redirectUrl' => $link->getModuleLink('powatag', 'confirmation', array('id_cart' => (int) $id_cart, 'id_customer' => (int) $cart->id_customer)))));
if ($error = $order->getError()) {
return PowaTagAPI::powaError($error);
}
if ($order->checkOrderState($id_order, $data)) {
$this->setResponse($data['response']);
}
return $data;
} else {
$message = '';
$errorCode = '';
if ($error = $order->getError()) {
$message = $error['message'];
}
if (PowaTagAPI::apiLog()) {
PowaTagLogs::initAPILog('Process order', PowaTagLogs::ERROR, $message);
}
return PowaTagAPI::powaError($error);
}
}
}
}
}
示例11: hookPaymentOptions
public function hookPaymentOptions($params)
{
if (!$this->isAvailable()) {
return array();
}
/** @var Cart $cart */
$cart = $params['cart'];
$currency = new Currency((int) $cart->id_currency);
if (!$this->checkCurrency($currency)) {
return array();
}
$link = new Link();
$this->context->smarty->assign($this->getButtonTemplateVars($currency, $cart));
$newOption = new PrestaShop\PrestaShop\Core\Payment\PaymentOption();
$newOption->setCallToActionText($this->l('Pay with Aplazame'))->setAction($link->getModuleLink('aplazame', 'redirect'))->setAdditionalInformation($this->fetch('module:aplazame/views/templates/hook/payment_1.7.tpl'));
return array($newOption);
}