本文整理汇总了PHP中Link::getPageLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::getPageLink方法的具体用法?PHP Link::getPageLink怎么用?PHP Link::getPageLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Link
的用法示例。
在下文中一共展示了Link::getPageLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initContent
public function initContent()
{
parent::initContent();
$params = KwixoURLCallFrontController::ManageUrlCall();
$payment_ok = $params['payment_status'];
$errors = $params['errors'];
$id_order = $params['id_order'];
if ($id_order != false) {
$order = new Order($id_order);
$cart = new Cart($order->id_cart);
$products = $cart->getProducts();
$amount = $order->total_paid_tax_incl;
$total_shipping = $order->total_shipping;
} else {
$products = false;
$amount = false;
$total_shipping = false;
}
$link = new Link();
$this->context->smarty->assign('payment_ok', $payment_ok);
$this->context->smarty->assign('errors', $errors);
$this->context->smarty->assign('amount', $amount);
$this->context->smarty->assign('total_shipping', $total_shipping);
$this->context->smarty->assign('products', $products);
$this->context->smarty->assign('path_order', $link->getPageLink('order', true));
$this->context->smarty->assign('path_history', $link->getPageLink('history', true));
$this->context->smarty->assign('path_contact', $link->getPageLink('contact', true));
$this->setTemplate('urlcall.tpl');
}
示例2: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
/* id_carrier is not defined in database before choosing a carrier, set it to a default one to match a potential cart _rule */
if (empty($this->context->cart->id_carrier)) {
$checked = $this->context->cart->simulateCarrierSelectedOutput();
$checked = (int) Cart::desintifier($checked);
$this->context->cart->id_carrier = $checked;
$this->context->cart->update();
CartRule::autoRemoveFromCart($this->context);
CartRule::autoAddToCart($this->context);
}
// SHOPPING CART
$this->_assignSummaryInformations();
// WRAPPING AND TOS
$this->_assignWrappingAndTOS();
if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
$countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
} else {
$countries = Country::getCountries($this->context->language->id, true);
}
// If a rule offer free-shipping, force hidding shipping prices
$free_shipping = false;
foreach ($this->context->cart->getCartRules() as $rule) {
if ($rule['free_shipping'] && !$rule['carrier_restriction']) {
$free_shipping = true;
break;
}
}
$this->context->smarty->assign(array('free_shipping' => $free_shipping, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, 'sl_country' => (int) Tools::getCountry(), 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'errorCarrier' => Tools::displayError('You must choose a carrier.', false), 'errorTOS' => Tools::displayError('You must accept the Terms of Service.', false), 'isPaymentStep' => isset($_GET['isPaymentStep']) && $_GET['isPaymentStep'], 'genders' => Gender::getGenders(), 'one_phone_at_least' => (int) Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')));
$years = Tools::dateYears();
$months = Tools::dateMonths();
$days = Tools::dateDays();
$this->context->smarty->assign(array('years' => $years, 'months' => $months, 'days' => $days));
/* Load guest informations */
if ($this->isLogged && $this->context->cookie->is_guest) {
$this->context->smarty->assign('guestInformations', $this->_getGuestInformations());
}
// ADDRESS
if ($this->isLogged) {
$this->_assignAddress();
}
// CARRIER
$this->_assignCarrier();
// PAYMENT
$this->_assignPayment();
Tools::safePostVars();
$newsletter = Configuration::get('PS_CUSTOMER_NWSL') || Module::isInstalled('blocknewsletter') && Module::getInstanceByName('blocknewsletter')->active;
$this->context->smarty->assign('newsletter', $newsletter);
$this->context->smarty->assign('optin', (bool) Configuration::get('PS_CUSTOMER_OPTIN'));
$this->context->smarty->assign('field_required', $this->context->customer->validateFieldsRequiredDatabase());
$this->_processAddressFormat();
$link = new Link();
if (Tools::getValue('deleteFromOrderLine')) {
$id_product = Tools::getValue('id_product');
$date_from = Tools::getValue('date_from');
$date_to = Tools::getValue('date_to');
$obj_cart_bk_data = new HotelCartBookingData();
$cart_data_dlt = $obj_cart_bk_data->deleteRoomDataFromOrderLine($this->context->cart->id, $this->context->cart->id_guest, $id_product, $date_from, $date_to);
if ($cart_data_dlt) {
Tools::redirect($link->getPageLink('order', null, $this->context->language->id));
}
}
if ((bool) Configuration::get('PS_ADVANCED_PAYMENT_API')) {
$this->addJS(_THEME_JS_DIR_ . 'advanced-payment-api.js');
$this->setTemplate(_PS_THEME_DIR_ . 'order-opc-advanced.tpl');
} else {
if (Module::isInstalled('hotelreservationsystem')) {
require_once _PS_MODULE_DIR_ . 'hotelreservationsystem/define.php';
$obj_cart_bk_data = new HotelCartBookingData();
$obj_htl_bk_dtl = new HotelBookingDetail();
$obj_rm_type = new HotelRoomType();
$htl_rm_types = $this->context->cart->getProducts();
if (!empty($htl_rm_types)) {
foreach ($htl_rm_types as $type_key => $type_value) {
$product = new Product($type_value['id_product'], false, $this->context->language->id);
$cover_image_arr = $product->getCover($type_value['id_product']);
if (!empty($cover_image_arr)) {
$cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $cover_image_arr['id_image'], 'small_default');
} else {
$cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code . "-default", 'small_default');
}
$unit_price = Product::getPriceStatic($type_value['id_product'], true, null, 6, null, false, true, 1);
if (isset($this->context->customer->id)) {
$cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($this->context->cart->id, $this->context->cart->id_guest, $type_value['id_product']);
} else {
$cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($this->context->cart->id, $this->context->cart->id_guest, $type_value['id_product']);
}
$rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['id_product']);
$cart_htl_data[$type_key]['id_product'] = $type_value['id_product'];
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
$cart_htl_data[$type_key]['name'] = $product->name;
$cart_htl_data[$type_key]['unit_price'] = $unit_price;
$cart_htl_data[$type_key]['adult'] = $rm_dtl['adult'];
$cart_htl_data[$type_key]['children'] = $rm_dtl['children'];
foreach ($cart_bk_data as $data_k => $data_v) {
//.........这里部分代码省略.........
示例3: displayList
public function displayList()
{
global $currentIndex;
$link = new Link();
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
echo '
<script type="text/javascript" src="../js/jquery/jquery.tablednd_0_5.js"></script>
<script type="text/javascript">
var token = \'' . $this->token . '\';
var come_from = \'AdminModulesPositions\';
</script>
<script type="text/javascript" src="../js/admin-dnd.js"></script>
';
echo '<a href="' . $currentIndex . '&addToHook' . ($this->displayKey ? '&show_modules=' . $this->displayKey : '') . '&token=' . $this->token . '"><img src="../img/admin/add.gif" border="0" /> <b>' . $this->l('Transplant a module') . '</b></a><br /><br />';
// Print select list
echo '
<form>
' . $this->l('Show') . ' :
<select id="show_modules" onChange="autoUrl(\'show_modules\', \'' . $currentIndex . '&token=' . $this->token . '&show_modules=\')">
<option value="all">' . $this->l('All modules') . ' </option>
<option>---------------</option>';
$modules = Module::getModulesInstalled();
$moduleIdList = array();
foreach ($modules as $module) {
$moduleIdList[] = (int) $module['id_module'];
}
Module::preloadModuleNameFromId($moduleIdList);
foreach ($modules as $module) {
Module::getInstanceById((int) $module['id_module']);
if ($tmpInstance = Module::getInstanceById((int) $module['id_module'])) {
$cm[$tmpInstance->displayName] = $tmpInstance;
}
}
ksort($cm);
foreach ($cm as $module) {
echo '
<option value="' . (int) $module->id . '" ' . ($this->displayKey == $module->id ? 'selected="selected" ' : '') . '>' . $module->displayName . '</option>';
}
echo '
</select><br /><br />
<input type="checkbox" id="hook_position" onclick="autoUrlNoList(\'hook_position\', \'' . $currentIndex . '&token=' . $this->token . '&show_modules=' . (int) Tools::getValue('show_modules') . '&hook_position=\')" ' . (Tools::getValue('hook_position') ? 'checked="checked" ' : '') . ' /> <label class="t" for="hook_position">' . $this->l('Display non-positionable hook') . '</label>
</form>
<fieldset style="width:250px;float:right"><legend>' . $this->l('Live edit') . '</legend>
<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="' . $link->getPageLink('index.php') . '?live_edit&ad=' . $admin_dir . '&liveToken=' . sha1($admin_dir . _COOKIE_KEY_) . '" target="_blank" class="button">' . $this->l('Run LiveEdit') . '</a>
</fieldset>
';
// Print hook list
echo '<form method="post" action="' . $currentIndex . '&token=' . $this->token . '">';
$irow = 0;
$hooks = Hook::getHooks(!(int) Tools::getValue('hook_position'));
echo '<div id="unhook_button_position_top"><input class="button floatr" type="submit" name="unhookform" value="' . $this->l('Unhook the selection') . '"/></div>';
Hook::preloadModulesFromHooks();
foreach ($hooks as $hook) {
$modules = array();
if (!$this->displayKey) {
$modules = Hook::getModulesFromHook($hook['id_hook']);
} elseif ($res = Hook::getModuleFromHook($hook['id_hook'], $this->displayKey)) {
$modules[0] = $res;
}
$nbModules = sizeof($modules);
echo '
<a name="' . $hook['name'] . '"/>
<table cellpadding="0" cellspacing="0" class="table width3 space' . ($nbModules >= 2 ? ' tableDnD' : '') . '" id="' . $hook['id_hook'] . '">
<tr class="nodrag nodrop"><th colspan="4">' . $hook['title'] . ' - <span style="color: red">' . $nbModules . '</span> ' . ($nbModules > 1 ? $this->l('modules') : $this->l('module'));
if ($nbModules) {
echo '<input type="checkbox" id="Ghook' . $hook['id_hook'] . '" class="floatr" style="margin-right: 2px;" onclick="hookCheckboxes(' . $hook['id_hook'] . ', 0, this)"/>';
}
if (!empty($hook['description'])) {
echo ' <span style="font-size:0.8em; font-weight: normal">[' . $hook['description'] . ']</span>';
}
echo ' <sub style="color:grey;"><i>(' . $this->l('Technical name: ') . $hook['name'] . ')</i></sub></th></tr>';
// Print modules list
if ($nbModules) {
$instances = array();
foreach ($modules as $module) {
$moduleIdList[] = (int) $module['id_module'];
}
Module::preloadModuleNameFromId($moduleIdList);
foreach ($modules as $module) {
if ($tmpInstance = Module::getInstanceById((int) $module['id_module'])) {
$instances[$tmpInstance->getPosition($hook['id_hook'])] = $tmpInstance;
}
}
ksort($instances);
foreach ($instances as $position => $instance) {
echo '
<tr id="' . $hook['id_hook'] . '_' . $instance->id . '"' . ($irow++ % 2 ? ' class="alt_row"' : '') . ' style="height: 42px;">';
if (!$this->displayKey) {
echo '
<td class="positions" width="40">' . (int) $position . '</td>
<td' . ($nbModules >= 2 ? ' class="dragHandle"' : '') . ' id="td_' . $hook['id_hook'] . '_' . $instance->id . '" width="40">
<a' . ($position == 1 ? ' style="display: none;"' : '') . ' href="' . $currentIndex . '&id_module=' . $instance->id . '&id_hook=' . $hook['id_hook'] . '&direction=0&token=' . $this->token . '&changePosition=' . rand() . '#' . $hook['name'] . '"><img src="../img/admin/up.gif" alt="' . $this->l('Up') . '" title="' . $this->l('Up') . '" /></a><br />
<a ' . ($position == sizeof($instances) ? ' style="display: none;"' : '') . 'href="' . $currentIndex . '&id_module=' . $instance->id . '&id_hook=' . $hook['id_hook'] . '&direction=1&token=' . $this->token . '&changePosition=' . rand() . '#' . $hook['name'] . '"><img src="../img/admin/down.gif" alt="' . $this->l('Down') . '" title="' . $this->l('Down') . '" /></a>
</td>
<td style="padding-left: 10px;"><label class="lab_modules_positions" for="mod' . $hook['id_hook'] . '_' . $instance->id . '">
';
//.........这里部分代码省略.........
示例4: _paymentAdvanced
/**
* This method is called by PayPal when an order has been placed by a customer using PayPal Payments Advanced (from the <iframe>)
*
* We will first double-check the PayPal tokens and then create the order in the database
*/
private function _paymentAdvanced()
{
/* Step 1 - The tokens sent by PayPal must match the ones stores in the customer cookie while displaying the <iframe> (see hookPayment() method in paypalmx.php) */
if (isset($this->context->cookie->paypal_advanced_token) && Tools::getValue('SECURETOKEN') != '' && Tools::getValue('SECURETOKEN') == $this->context->cookie->paypal_advanced_token) {
/* Step 2 - Determine the order status in accordance with the response from PayPal */
/* Approved */
if (Tools::getValue('RESULT') == 0) {
$order_status = (int) Configuration::get('PS_OS_PAYMENT');
} elseif (Tools::getValue('RESULT') == 126) {
$order_status = (int) Configuration::get('PS_OS_PAYPAL');
} else {
$order_status = (int) Configuration::get('PS_OS_ERROR');
}
$credit_card_types = array('Visa', 'MasterCard', 'Discover', 'American Express', 'Diners Club', 'JCB');
$currency = new Currency((int) $this->context->cart->id_currency);
$message = '
Status: ' . Tools::getValue('Review') . '
Comment: ' . Tools::getValue('RESPMSG') . '
Comment 2: ' . Tools::getValue('PREFPSMSG') . '
Credit card type: ' . $credit_card_types[Tools::getValue('CARDTYPE')] . '
Credit card last 4 digits: ' . Tools::getValue('ACCT') . '
Amount charged: ' . Tools::getValue('AMT') . '
Currency: ' . $currency->iso_code . '
Time: ' . Tools::getValue('TRANSTIME') . '
Method: ' . Tools::getValue('METHOD') . '
PayPal result code: ' . (int) Tools::getValue('RESULT') . '
Transaction ID: ' . Tools::getValue('PNREF');
/* Step 3 - Create the order in the database */
$customer = new Customer((int) $this->context->cart->id_customer);
if ($this->paypal_mx->validateOrder((int) $this->context->cart->id, (int) $order_status, (double) Tools::getValue('AMT'), $this->paypal_mx->displayName, $message, array(), null, false, false)) {
/* Store the transaction ID and details */
$this->paypal_mx->addTransactionId((int) $this->paypal_mx->currentOrder, Tools::getValue('PNREF'));
$this->paypal_mx->addTransaction('payment', array('source' => 'advanced', 'id_shop' => (int) $this->context->cart->id_shop, 'id_customer' => (int) $this->context->cart->id_customer, 'id_cart' => (int) $this->context->cart->id, 'id_order' => (int) $this->paypal_mx->currentOrder, 'id_transaction' => Tools::getValue('PNREF'), 'amount' => (double) Tools::getValue('AMT'), 'currency' => $currency->iso_code, 'cc_type' => $credit_card_types[Tools::getValue('CARDTYPE')], 'cc_exp' => Tools::getValue('EXPDATE'), 'cc_last_digits' => Tools::getValue('ACCT'), 'cvc_check' => 0, 'fee' => 0));
}
/* Reset the PayPal's token so the customer will be able to place a new order in the future */
unset($this->context->cookie->paypal_advanced_token);
$redirect = '';
/* Step 4 - Redirect the user to the order confirmation page */
if (version_compare(_PS_VERSION_, '1.5', '<')) {
//$redirect = _PS_BASE_URL_.'/order-confirmation.php?id_cart='.(int)$this->context->cart->id.'&id_module='.(int)$this->paypal_mx->id.'&id_order='.(int)$this->paypal_mx->currentOrder.'&key='.$customer->secure_key;
$redirect = Link::getPageLink('order-confirmation.php', array('id_cart' => (int) $this->context->cart->id, 'id_module' => (int) $this->paypal_mx->id, 'id_order' => (int) $this->paypal_mx->currentOrder, 'key' => $customer->secure_key));
} else {
$redirect = _PS_BASE_URL_ . '/index.php?controller=order-confirmation&id_cart=' . (int) $this->context->cart->id . '&id_module=' . (int) $this->paypal_mx->id . '&id_order=' . (int) $this->paypal_mx->currentOrder . '&key=' . $customer->secure_key;
}
die('
<script type="text/javascript">
<!--
window.top.location.href = "' . $redirect . '";
//-->
</script>');
} else {
$this->context->smarty->assign('paypal_mx_error_messages', array($this->paypal_mx->l('Invalid PayPal token')));
$this->setTemplate('errors-messages.tpl');
}
}
示例5: dirname
*
* @author PaymentSense <devsupport@paymentsense.com>
* @copyright 2013 PaymentSense
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*
This file is part of the Prestashop PaymentSense Re-Directed Payment Module
See paymentsense.php for Licensing and support info.
File Last Modified: 12/03/2013 - By Shaun Ponting - Opal Creations
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../init.php';
include dirname(__FILE__) . '/paymentsense.php';
$paymentsense = new PaymentSense();
if ($paymentsense->active) {
if ((int) Configuration::get('PS_REWRITING_SETTINGS') === 1) {
$rewrited_url = __PS_BASE_URI__;
}
/*include(dirname(__FILE__).'/../../header.php');*/
$controller = new FrontController();
$controller->init();
$controller->initContent();
$controller->setMedia();
$controller->displayHeader();
if (!isset($link)) {
$link = new Link();
}
$smarty->assign('contactURL', $link->getPageLink('contact-form.php'));
$smarty->assign('advice', '<a href="javascript: history.go(-1);">' . $paymentsense->l('click here') . '</a>');
$smarty->display(dirname(__FILE__) . '/views/templates/front/failure.tpl');
$controller->displayFooter();
}
示例6: dirname
*
* @author PaymentSense <devsupport@paymentsense.com>
* @copyright 2013 PaymentSense
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*
This file is part of the Prestashop PaymentSense Re-Directed Payment Module
See paymentsense.php for Licensing and support info.
File Last Modified: 12/03/2013 - By Shaun Ponting - Opal Creations
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../init.php';
include dirname(__FILE__) . '/paymentsense.php';
$paymentsense = new PaymentSense();
if ($paymentsense->active) {
if ((int) Configuration::get('PS_REWRITING_SETTINGS') === 1) {
$rewrited_url = __PS_BASE_URI__;
}
/*include(dirname(__FILE__).'/../../header.php');*/
$controller = new FrontController();
$controller->init();
$controller->initContent();
$controller->setMedia();
$controller->displayHeader();
if (!isset($link)) {
$link = new Link();
}
$smarty->assign('cartURL', $link->getPageLink('order.php?step=1'));
$smarty->assign('contactURL', $link->getPageLink('contact-form.php'));
$smarty->display(dirname(__FILE__) . '/views/templates/front/return.tpl');
$controller->displayFooter();
}
示例7: hookDisplayTop
/**
* Display Bootstrap MegaMenu
*/
public function hookDisplayTop()
{
$this->context->controller->addCSS($this->_path . 'megamenu.css', 'all');
$tpl = 'views/templates/hook/megamenu.tpl';
if (!$this->isCached($tpl, $this->getCacheId())) {
$link = new Link();
$params = array();
$params['params'] = Configuration::get('LEO_MEGAMENU_PARAMS');
$show_cavas = Configuration::get('LEO_MEGAMENU_CAVAS');
$current_link = $link->getPageLink('', false, $this->context->language->id);
if (isset($params['params']) && !empty($params['params'])) {
# validate module
$params['params'] = Tools::jsonDecode($params['params']);
}
$obj = new Btmegamenu();
$obj->setModule($this);
$boostrapmenu = $obj->getFrontTree(1, false, $params['params']);
$this->smarty->assign('boostrapmenu', $boostrapmenu);
$this->smarty->assign('current_link', $current_link);
$this->smarty->assign('show_cavas', $show_cavas);
return $this->display(__FILE__, $tpl, $this->getCacheId());
}
return $this->display(__FILE__, $tpl, $this->getCacheId());
}
示例8: _displayLogo
private function _displayLogo()
{
global $smarty;
$blockPositionList = array(self::DISABLE => $this->l('Disable'), self::LEFT_COLUMN => $this->l('Left Column'), self::RIGHT_COLUMN => $this->l('Right Column'));
$currentLogoBlockPosition = $this->isRegisteredInHook('leftColumn') ? self::LEFT_COLUMN : ($this->isRegisteredInHook('rightColumn') ? self::RIGHT_COLUMN : -1);
$option = '';
foreach ($blockPositionList as $position => $translation) {
$selected = $currentLogoBlockPosition == $position ? 'selected="selected"' : '';
$option .= '<option value="' . $position . '" ' . $selected . '>' . $translation . '</option>';
}
$link = new Link();
$admin_dir = substr(_PS_ADMIN_DIR_, strrpos(_PS_ADMIN_DIR_, '/') + 1);
$smarty->assign('option', $option);
$smarty->assign('link', $link->getPageLink('index.php') . '?live_edit&ad=' . $admin_dir . '&liveToken=' . sha1($admin_dir . _COOKIE_KEY_));
return $this->display(__FILE__, 'tpl/logo.tpl');
}
示例9: hookActionObjectDeleteBefore
public function hookActionObjectDeleteBefore($params)
{
if ((bool) Configuration::get('MGRT_DELPARENTREDIR') === true) {
if (isset($params['object']) && !empty($params['object'])) {
$object = $params['object'];
$type = get_class($object);
if (!in_array($type, array('Product', 'Manufacturer', 'Supplier', 'Category', 'CMS', 'CMSCategory'))) {
// Ok not our job
return;
}
$shops = $this->getShopsIds();
$link = new Link();
$redirect_list = array();
// Incremental way, it's a bugfix, for supplier for example
$shop_urls = array();
$shop_urls[] = 'https:';
$shop_urls[] = 'http:';
foreach ($shops as $id_shop) {
$shop = new ShopUrl($id_shop);
$shop_urls[] = str_replace(array('http://', 'https://'), '', $shop->getURL(true));
$shop_urls[] = str_replace(array('http://', 'https://'), '', $shop->getURL(false));
}
$shop_urls = array_unique($shop_urls);
foreach ($shops as $id_shop) {
// foreach langs, foreach shops ...
$langs = Language::getLanguages(false, $id_shop, true);
foreach ($langs as $id_lang) {
switch ($type) {
case 'Manufacturer':
$manufacturer = new Manufacturer($object->id, $id_lang);
if (Validate::isLoadedObject($manufacturer)) {
$old_link = $link->getManufacturerLink($manufacturer, null, null, null, $id_lang, $id_shop);
// Redirect to manufacturers page
$new_link = $link->getPageLink(Tools::strtolower($type), null, $id_lang, null, false, $id_shop);
}
break;
case 'Supplier':
$supplier = new Supplier($object->id, $id_lang);
if (Validate::isLoadedObject($supplier)) {
$old_link = $link->getSupplierLink($supplier, null, $id_lang, $id_shop);
// Redirect to suppliers page
$new_link = $link->getPageLink(Tools::strtolower($type), null, $id_lang, null, false, $id_shop);
}
break;
case 'CMS':
$cms = new CMS($object->id, $id_lang, $id_shop);
if (Validate::isLoadedObject($cms)) {
$old_link = $link->getCMSLink($cms, null, null, $id_lang, $id_shop);
$new_link = $link->getCMSCategoryLink($cms->id_parent, null, $id_lang, $id_shop);
}
break;
case 'Product':
$product = new Product($object->id, null, $id_lang, $id_shop);
if (Validate::isLoadedObject($product)) {
$old_link = $link->getProductLink($product, null, null, null, $id_lang, $id_shop);
$new_link = $link->getCategoryLink($product->id_category_default, null, $id_lang, null, $id_shop);
}
break;
case 'Category':
$category = new Category($object->id, $id_lang, $id_shop);
if (Validate::isLoadedObject($category)) {
$old_link = $link->getCategoryLink($category, null, $id_lang, null, $id_shop);
$new_link = $link->getCategoryLink($category->id_parent, null, $id_lang, null, $id_shop);
}
break;
case 'CMSCategory':
$cmscategory = new CMSCategory($object->id, $id_lang, $id_shop);
if (Validate::isLoadedObject($product)) {
$old_link = $link->getCMSCategoryLink($cmscategory, null, $id_lang, $id_shop);
$new_link = $link->getCMSCategoryLink($cmscategory->id_parent, null, $id_lang, $id_shop);
}
break;
default:
// UFO
break;
}
// Escape shops urls, it's a multishop relative approach
$old = str_replace('//', '/', $old_link);
$old = str_replace($shop_urls, '', $old_link);
$old = '/' . ltrim($old, '/');
$new = str_replace('//', '/', $new_link);
$new = str_replace($shop_urls, '', $new_link);
$new = '/' . ltrim($new, '/');
// Avoid duplicates, simplify complex mapings
$md5 = md5($old . $new);
if (!isset($redirect_list[$md5])) {
$redirect_list[$md5]['old'] = $old;
$redirect_list[$md5]['new'] = $new;
$redirect_list[$md5]['shops'][] = $id_shop;
} elseif (!in_array($id_shop, $redirect_list[$md5]['shops'])) {
$redirect_list[$md5]['shops'][] = $id_shop;
}
}
}
if (!empty($redirect_list)) {
// Force new redirect
$this->insertRedirects($redirect_list, true);
}
}
}
//.........这里部分代码省略.........
示例10: _getCurrentUrl
/**
* _getCurrentUrl() method returns current URL
*
* @return array
*/
private function _getCurrentUrl()
{
$sLink = '';
// PS 1.5
if (version_compare(_PS_VERSION_, '1.5', '>')) {
// check if OPC deactivated and get redirect on authentication page
if (Tools::getValue('controller') == 'authentication' && Tools::getIsset('back')) {
$sLink = urldecode(Tools::getValue('back'));
if ($sLink == 'my-account') {
$sLink = BT_FPCModuleTools::getAccountPageLink();
}
} elseif (Tools::getValue('controller') == 'orderopc' || Tools::getValue('controller') == 'order') {
$sLink = $_SERVER['REQUEST_URI'];
} else {
$sLink = BT_FPCModuleTools::getAccountPageLink();
}
} elseif (version_compare(_PS_VERSION_, '1.4', '>')) {
// check if OPC deactivated and get redirect on authentication page
if (strstr($_SERVER['SCRIPT_NAME'], 'authentication') && Tools::getIsset('back')) {
if ($sLink == 'my-account.php') {
$sLink = BT_FPCModuleTools::getAccountPageLink();
} else {
$oLink = new Link();
$sLink = $oLink->getPageLink('order.php');
unset($oLink);
}
} elseif (strstr($_SERVER['SCRIPT_NAME'], 'order-opc') || strstr($_SERVER['SCRIPT_NAME'], 'order')) {
$sLink = $_SERVER['REQUEST_URI'];
} else {
$sLink = BT_FPCModuleTools::getAccountPageLink();
}
} else {
// check if get redirect on authentication page
if (strstr($_SERVER['SCRIPT_NAME'], 'authentication') || Tools::getIsset('back')) {
$sLink = Tools::getValue('back');
// get PS_BASE_URI
$sLink = Configuration::get('PS_BASE_URI') . $sLink;
} elseif (strstr($_SERVER['SCRIPT_NAME'], 'order')) {
$sLink = $_SERVER['REQUEST_URI'];
} else {
global $smarty;
$sLink = $smarty->_tpl_vars['base_dir_ssl'] . 'my-account.php';
}
}
return $sLink;
}
示例11: getMenuCustomerLink
public function getMenuCustomerLink($lang_id = NULL)
{
$menu_items = $this->getMenuItems();
$id_lang = (int) $this->context->language->id;
$id_shop = (int) Shop::getContextShopID();
foreach ($menu_items as $item) {
if (!$item) {
continue;
}
preg_match($this->pattern, $item, $value);
$id = (int) substr($item, strlen($value[1]), strlen($item));
switch (substr($item, 0, strlen($value[1]))) {
case 'CAT':
$this->_menuLink .= $this->drawCustomMenuItem($id, 0, false, 0, $lang_id);
break;
case 'PRD':
$selected = $this->page_name == 'product' && Tools::getValue('id_product') == $id ? ' class="sfHover"' : '';
$product = new Product((int) $id, true, (int) $id_lang);
if (!is_null($product->id)) {
$this->_menuLink .= '<div id ="pt_menu_product" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($product->getLink()) . '"><span>' . $product->name . '</span></a></div></div>' . PHP_EOL;
}
break;
case 'CMS':
$selected = $this->page_name == 'cms' && Tools::getValue('id_cms') == $id ? ' class="sfHover"' : '';
$cms = CMS::getLinks((int) $id_lang, array($id));
if (count($cms)) {
$this->_menuLink .= '<div id ="pt_menu_cms" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($cms[0]['link']) . '"><span>' . $cms[0]['meta_title'] . '</span></a></div></div>' . PHP_EOL;
}
break;
case 'CMS_CAT':
$category = new CMSCategory((int) $id, (int) $id_lang);
if (Validate::isLoadedObject($category)) {
$this->_menuLink .= '<div id ="pt_menu_cms" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($category->getLink()) . '"><span>' . $category->name . '</span></a>';
}
$this->_menuLink .= '</div>' . PHP_EOL;
$this->_menuLink .= $this->getCMSMenuItems($category->id);
// Case to handle the option to show all Manufacturers
// Case to handle the option to show all Manufacturers
case 'ALLMAN':
$link = new Link();
$this->_menuLink .= '<div id ="pt_menu_allsub" class ="pt_menu"><div class="parentMenu" ><a href="' . $link->getPageLink('manufacturer') . '" ><span>' . $this->l('All manufacturers') . '</span></a></div>' . PHP_EOL;
$manufacturers = Manufacturer::getManufacturers();
$this->_menuLink .= '<div class ="popup" style ="display:none">';
foreach ($manufacturers as $key => $manufacturer) {
$this->_menuLink .= '<div class ="block1"><div class="column col1"><div class="itemSubMenu level3"><a href="' . $link->getManufacturerLink((int) $manufacturer['id_manufacturer'], $manufacturer['link_rewrite']) . '">' . $manufacturer['name'] . '</a></div></div></div>' . PHP_EOL;
}
$this->_menuLink .= '</div></div>';
break;
case 'MAN':
$selected = $this->page_name == 'manufacturer' && Tools::getValue('id_manufacturer') == $id ? ' class="sfHover"' : '';
$manufacturer = new Manufacturer((int) $id, (int) $id_lang);
if (!is_null($manufacturer->id)) {
if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) {
$manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name);
} else {
$manufacturer->link_rewrite = 0;
}
$link = new Link();
$this->_menuLink .= '<div id ="pt_menu_man" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($link->getManufacturerLink((int) $id, $manufacturer->link_rewrite)) . '"><span>' . $manufacturer->name . '</span></a></div></div>' . PHP_EOL;
}
break;
// Case to handle the option to show all Suppliers
// Case to handle the option to show all Suppliers
case 'ALLSUP':
$link = new Link();
$this->_menuLink .= '<div id ="pt_menu_allsub" class ="pt_menu"><div class="parentMenu" ><a href="' . $link->getPageLink('supplier') . '" ><span>' . $this->l('All suppliers') . '</span></a></div>' . PHP_EOL;
$suppliers = Supplier::getSuppliers();
$this->_menuLink .= '<div class ="popup" style ="display:none">';
foreach ($suppliers as $key => $supplier) {
$this->_menuLink .= '<div class ="block1"><div class="column col1"><div class="itemSubMenu level3"><a href="' . $link->getSupplierLink((int) $supplier['id_supplier'], $supplier['link_rewrite']) . '">' . $supplier['name'] . '</a></div></div></div>' . PHP_EOL;
}
$this->_menuLink .= '</div></div>';
break;
case 'SUP':
$selected = $this->page_name == 'supplier' && Tools::getValue('id_supplier') == $id ? ' class="sfHover"' : '';
$supplier = new Supplier((int) $id, (int) $id_lang);
if (!is_null($supplier->id)) {
$link = new Link();
$this->_menuLink .= '<div id ="pt_menu_sub" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($link->getSupplierLink((int) $id, $supplier->link_rewrite)) . '"><span>' . $supplier->name . '</span></a></div></div>' . PHP_EOL;
}
break;
case 'SHOP':
$selected = $this->page_name == 'index' && $this->context->shop->id == $id ? ' class="sfHover"' : '';
$shop = new Shop((int) $id);
if (Validate::isLoadedObject($shop)) {
$link = new Link();
$this->_menuLink .= '<div id ="pt_menu_sub" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($shop->getBaseURL()) . '"><span>' . $supplier->name . '</span></a></div></div>' . PHP_EOL;
}
break;
case 'LNK':
$link = VegaTopLinks::get((int) $id, (int) $id_lang, (int) $id_shop);
if (count($link)) {
if (!isset($link[0]['label']) || $link[0]['label'] == '') {
$default_language = Configuration::get('PS_LANG_DEFAULT');
$link = VegaTopLinks::get($link[0]['id_linksvegatop'], $default_language, (int) Shop::getContextShopID());
}
$this->_menuLink .= '<div id ="pt_ver_menu_link" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($link[0]['link']) . '"' . ($link[0]['new_window'] ? ' target="_blank"' : '') . '><span>' . $link[0]['label'] . '</a></span></div></div>' . PHP_EOL;
}
break;
}
//.........这里部分代码省略.........
示例12: hookPaymentTop
public function hookPaymentTop($param)
{
if (!$this->_activeVerification()) {
return false;
}
$smarty = Context::getContext()->smarty;
$customer = new Customer($param['cart']->id_customer);
$addresses = $customer->getAddresses(Context::getContext()->language->id);
$address = new Address($addresses[0]['id_address']);
$cart = new Cart($param['cart']->id);
$link = new Link();
$fidbag_user = new FidbagUser($param['cart']->id_customer);
$fidbag_user->getFidBagUser();
$var = array('path' => $this->_path, 'img' => _PS_IMG_, 'id_customer' => $param['cart']->id_customer, 'id_cart' => $param['cart']->id, 'fidbag_token' => Configuration::get('FIDBAG_TOKEN'), 'module' => _PS_MODULE_DIR_ . $this->_moduleName . '/');
$smarty->assign('glob', $var);
$smarty->assign('main_url', $this->getMainUrl());
$smarty->assign('fidbag_token', Tools::encrypt((int) $param['cart']->id_customer));
$smarty->assign('price', $cart->getOrderTotal(true, Cart::ONLY_PRODUCTS_WITHOUT_SHIPPING));
$smarty->assign('shipment', $cart->getOrderTotal(true, Cart::ONLY_SHIPPING));
$smarty->assign('total_cart', $cart->getOrderTotal());
$smarty->assign('shipping', $cart->getOrderTotal(true, Cart::ONLY_SHIPPING));
$smarty->assign('discount', $cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
$smarty->assign('fidbag_login', $fidbag_user->getLogin());
$smarty->assign('fidbag_password', $fidbag_user->getPassword());
if (_PS_VERSION_ < '1.5') {
$smarty->assign('base_dir', Tools::getProtocol() . Tools::getHttpHost() . __PS_BASE_URI__);
}
if ((int) Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
$smarty->assign('redirect', $link->getPageLink('order-opc.php'));
} else {
if (_PS_VERSION_ >= '1.5') {
$smarty->assign('redirect', $link->getPageLink('order.php', false, null, array('step' => '3')));
} else {
$smarty->assign('redirect', $link->getPageLink('order.php?step=3'));
}
}
if (isset($customer->id_gender)) {
$smarty->assign('sub_gender', $customer->id_gender);
}
$smarty->assign('sub_lastname', $customer->lastname);
$smarty->assign('sub_firstname', $customer->firstname);
$smarty->assign('sub_email', $customer->email);
$smarty->assign('sub_address', $address->address1 . ' ' . $address->address2);
$smarty->assign('sub_zipcode', $address->postcode);
$smarty->assign('sub_city', $address->city);
if (_PS_VERSION_ < '1.5') {
return $this->display(__FILE__, 'views/templates/hook/payment_top_14x.tpl');
}
return $this->display(__FILE__, 'views/templates/hook/payment_top.tpl');
}
示例13: sendShopParamsToApp
private function sendShopParamsToApp($token)
{
// Get default language
$default_lang = (int) Configuration::get('PS_LANG_DEFAULT');
// Get order states
$oss = OrderState::getOrderStates($default_lang);
$states = array();
foreach ($oss as $os) {
$states[$os['id_order_state']] = $os['name'];
}
// Get payment modules
$token = Configuration::get('checkyourdata_token');
$modules = array();
$pms = PaymentModule::getInstalledPaymentModules();
foreach ($pms as $pm) {
$p = Module::getInstanceByName($pm['name']);
if (is_object($p)) {
$modules[$pm['id_module']] = $p->displayName;
}
}
// get confirmation page url
$l = new Link();
$shopUrl = $this->context->shop->getBaseURL();
$confirmUrl = str_replace($shopUrl, '', $l->getPageLink('order-confirmation'));
// get confirmation page title
$meta = MetaCore::getMetaByPage('order-confirmation', $default_lang);
$confirmTitle = $meta['title'];
$data = array('token' => $token, 'action' => 'setShopParams', 'data' => array('modules' => $modules, 'states' => $states, 'trackers' => Configuration::get('checkyourdata_trackers'), 'confirm_url' => $confirmUrl, 'confirm_title' => $confirmTitle));
return CheckYourDataWSHelper::send(self::$dcUrl, $data);
}
示例14: getLinks
/**
* @return array
*/
private function getLinks()
{
if (version_compare(_PS_VERSION_, '1.5', 'gt')) {
$order_complete_link = $this->context->link->getModuleLink('payu', 'success');
$order_notify_link = $this->context->link->getModuleLink('payu', 'notification');
$order_cancel_link = $this->context->link->getPageLink('order.php', true);
return array($order_complete_link, $order_notify_link, $order_cancel_link);
} else {
$link = new Link();
$order_complete_link = $this->getModuleAddress() . 'backward_compatibility/success.php';
$order_notify_link = $this->getModuleAddress() . 'backward_compatibility/notification.php';
$order_cancel_link = $link->getPageLink(__PS_BASE_URI__ . 'order.php');
return array($order_complete_link, $order_notify_link, $order_cancel_link);
}
}
示例15: _updateEmail
/**
* _updateEmail() method update customer email
*
* @param array $aParams
* @return bool
*/
private function _updateEmail(array $aParams)
{
$aAssign = array();
if (version_compare(_PS_VERSION_, '1.4', '>')) {
$oLink = new Link();
$sLink = $oLink->getPageLink('my-account.php');
unset($oLink);
} else {
global $smarty;
$sLink = $smarty->_tpl_vars['base_dir_ssl'] . 'my-account.php';
}
$aAssign['sLink'] = $sLink;
// get serialized connector data
BT_FPCModuleTools::getConnectorData();
// check if customer is the same customer connected and if the e-mail is valid
if (!empty($aParams['connector']) && !empty($GLOBALS[_FPC_MODULE_NAME . '_CONNECTORS'][$aParams['connector']]['data']['activeConnector']) && !empty($aParams['customerId']) && $aParams['customerId'] === md5(_FPC_MODULE_NAME . $aParams['connector'] . FacebookPsConnect::$oCookie->id_customer) && !empty($aParams['customerId']) && filter_var($aParams['socialEmail'], FILTER_VALIDATE_EMAIL) !== false) {
// include
require_once _FPC_PATH_LIB . 'module-dao_class.php';
require_once _FPC_PATH_LIB . 'mail-send_class.php';
// check if exists and return id customer if exists
$iCustomerId = BT_FPCModuleDao::existCustomerEmail($aParams['socialEmail']);
// if customer not exists
if (empty($iCustomerId)) {
if (BT_FPCModuleDao::updateCustomerEmail(FacebookPsConnect::$oCookie->id_customer, $aParams['socialEmail'])) {
$aAssign['sMsg'] = FacebookPsConnect::$oModule->l('Your information has been updated', 'hook-action_class');
// set the new e-mail in cookie
if (version_compare(_PS_VERSION_, '1.5', '>')) {
Context::getContext()->cookie->email = $aParams['socialEmail'];
} else {
global $cookie;
$cookie->email = $aParams['socialEmail'];
}
} else {
$aAssign['aErrors'][] = array('msg' => FacebookPsConnect::$oModule->l('Internal server error. The customer e-mail has not been updated. Please try again by clicking on reload button below', 'hook-action_class') . '.', 'code' => 590);
}
// manage the update firstname and name for twitter connexion
BT_FPCModuleDao::updateCustomerFirstName(FacebookPsConnect::$oCookie->id_customer, $aParams['socialFirstName']);
BT_FPCModuleDao::updateCustomerName(FacebookPsConnect::$oCookie->id_customer, $aParams['socialName']);
BT_FPCModuleDao::updateCustomerPassword(FacebookPsConnect::$oCookie->id_customer, $aParams['socialPassword']);
BT_FpcMailSend::_updateEmailTwitter($aParams['socialFirstName'], $aParams['socialName'], $aParams['socialEmail'], $aParams['socialPassword'], FacebookPsConnect::$iCurrentLang, FacebookPsConnect::$iShopId);
} else {
$aAssign['aErrors'][] = array('msg' => FacebookPsConnect::$oModule->l('This e-mail address is already taken by a customer account or you already have linked this e-mail address with another network. Please try again by clicking on reload button below', 'hook-action_class') . '.', 'code' => 591);
}
} else {
$aAssign['aErrors'][] = array('msg' => FacebookPsConnect::$oModule->l('Internal server error. The customer could not be identified. You may be a victim of cross-site request forgery', 'hook-action_class') . '.', 'code' => 592);
}
if (empty($aAssign['aErrors'])) {
$sTpl = _FPC_TPL_CONFIRM;
} else {
$sTpl = _FPC_TPL_ERROR;
}
return array('tpl' => $sTpl, 'assign' => $aAssign);
}