当前位置: 首页>>代码示例>>PHP>>正文


PHP Shop::getBaseURI方法代码示例

本文整理汇总了PHP中Shop::getBaseURI方法的典型用法代码示例。如果您正苦于以下问题:PHP Shop::getBaseURI方法的具体用法?PHP Shop::getBaseURI怎么用?PHP Shop::getBaseURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shop的用法示例。


在下文中一共展示了Shop::getBaseURI方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postProcess

 public function postProcess()
 {
     // Check if cart is valid
     $cart = new Cart((int) Tools::getValue('id_cart'));
     if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) {
         $this->returnError('Invalid cart');
     }
     // Check if customer exists
     $customer = new Customer($cart->id_customer);
     if (!Validate::isLoadedObject($customer)) {
         $this->returnError('Invalid customer');
     }
     $currency = new Currency((int) $cart->id_currency);
     $total_paid = Tools::getValue('total_paid');
     $extra_vars = array('transaction_id' => Tools::getValue('transaction_id'));
     // Build the validation token
     $validation_token = md5(Configuration::get('MYMOD_API_CRED_SALT') . Tools::getValue('id_cart') . $total_paid . Tools::getValue('transaction_id'));
     // Check validation token
     if (Tools::getValue('validation_token') != $validation_token) {
         $this->returnError('Invalid token');
     }
     // Validate order
     $this->module->validateOrder($cart->id, Configuration::get('PS_OS_PAYMENT'), $total_paid, $this->module->displayName . ' API', NULL, $extra_vars, (int) $currency->id, false, $customer->secure_key);
     // Redirect on order confirmation page
     $shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
     $return_url = Tools::getShopProtocol() . $shop->domain . $shop->getBaseURI();
     $this->returnSuccess($return_url . 'index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key);
 }
开发者ID:FabienSerny,项目名称:mymodpayment,代码行数:28,代码来源:validationAPI.php

示例2: getPhotosLink

 /**
  * Create a link to a photo
  *
  * @param mixed $photo Photos object (can be an ID supplier, but deprecated)
  * @param string $alias
  * @param int $id_lang
  * @return string
  */
 public static function getPhotosLink($photo, $alias = null, $id_lang = null, $id_shop = null)
 {
     if (!$id_lang) {
         $id_lang = Context::getContext()->language->id;
     }
     if ($id_shop === null) {
         $shop = Context::getContext()->shop;
     } else {
         $shop = new Shop($id_shop);
     }
     $url = 'http://' . $shop->domain . $shop->getBaseURI() . $this->getLangLink($id_lang, null, $id_shop);
     $dispatcher = Dispatcher::getInstance();
     if (!is_object($photo)) {
         if ($alias !== null && !$dispatcher->hasKeyword('photo_rule', $id_lang, 'meta_keywords', $id_shop) && !$dispatcher->hasKeyword('photo_rule', $id_lang, 'meta_title', $id_shop)) {
             return $url . $dispatcher->createUrl('photo_rule', $id_lang, array('id' => (int) $photo, 'rewrite' => (string) $alias), $this->allow, '', $id_shop);
         }
         $photo = new Photos($photo, $id_lang);
     }
     // Set available keywords
     $params = array();
     $params['id'] = $photo->id;
     $params['rewrite'] = !$alias ? $photo->link_rewrite : $alias;
     $params['meta_keywords'] = Tools::str2url($photo->meta_keywords);
     $params['meta_title'] = Tools::str2url($photo->meta_title);
     return $url . $dispatcher->createUrl('photo_rule', $id_lang, $params, $this->allow, '', $id_shop);
 }
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:34,代码来源:Link.php

示例3: run

 public function run($params)
 {
     $api_url = Configuration::get('MYMOD_API_URL');
     $api_credentials_id = Configuration::get('MYMOD_API_CRED_ID');
     $api_credentials_salt = Configuration::get('MYMOD_API_CRED_SALT');
     $total_to_pay = (double) $this->context->cart->getOrderTotal(true, Cart::BOTH);
     $id_cart = $this->context->cart->id;
     $payment_token = md5($api_credentials_salt . $id_cart . $total_to_pay);
     $validation_url = $this->context->link->getModuleLink('mymodpayment', 'validationapi');
     $shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
     $return_url = Tools::getShopProtocol() . $shop->domain . $shop->getBaseURI();
     $cancel_url = Tools::getShopProtocol() . $shop->domain . $shop->getBaseURI();
     $this->context->smarty->assign('api_url', $api_url);
     $this->context->smarty->assign('api_credentials_id', $api_credentials_id);
     $this->context->smarty->assign('total_to_pay', $total_to_pay);
     $this->context->smarty->assign('id_cart', $id_cart);
     $this->context->smarty->assign('payment_token', $payment_token);
     $this->context->smarty->assign('validation_url', $validation_url);
     $this->context->smarty->assign('return_url', $return_url);
     $this->context->smarty->assign('cancel_url', $cancel_url);
     $this->context->controller->addCSS($this->_path . 'views/css/mymodpayment.css', 'all');
     return $this->module->display($this->file, 'displayPayment.tpl');
 }
开发者ID:FabienSerny,项目名称:mymodpayment,代码行数:23,代码来源:displayPayment.php

示例4: getCategoryLink

 /**
  * Create a link to a category
  *
  * @param mixed $category Category object (can be an ID category, but deprecated)
  * @param string $alias
  * @param int $id_lang
  * @param string $selected_filters Url parameter to autocheck filters of the module blocklayered
  * @return string
  */
 public function getCategoryLink($category, $alias = null, $id_lang = null, $selected_filters = null, $id_shop = null)
 {
     if (!$id_lang) {
         $id_lang = Context::getContext()->language->id;
     }
     if ($id_shop === null) {
         $shop = Context::getContext()->shop;
     } else {
         $shop = new Shop($id_shop);
     }
     $url = 'http://' . $shop->domain . $shop->getBaseURI() . $this->getLangLink($id_lang, null, $id_shop);
     if (!is_object($category)) {
         $category = new Category($category, $id_lang);
     }
     // Set available keywords
     $params = array();
     $params['id'] = $category->id;
     $params['rewrite'] = !$alias ? $category->link_rewrite : $alias;
     $params['meta_keywords'] = Tools::str2url($category->meta_keywords);
     $params['meta_title'] = Tools::str2url($category->meta_title);
     // Selected filters is used by the module blocklayered
     $selected_filters = is_null($selected_filters) ? '' : $selected_filters;
     if (empty($selected_filters)) {
         $rule = 'category_rule';
     } else {
         $rule = 'layered_rule';
         $params['selected_filters'] = $selected_filters;
     }
     //$params['category'] = $category->link_rewrite;
     $cats = array();
     $subCategories = $this->_getParentsCategories($category->id);
     $subCategories = is_array($subCategories) === TRUE ? array_reverse($subCategories) : $subCategories;
     $skip_list = Link::$category_disable_rewrite;
     $skip_list[] = $category->id;
     foreach ($subCategories as $cat) {
         if (!in_array($cat['id_category'], $skip_list)) {
             //remove root and home category from the URL
             $cats[] = $cat['link_rewrite'];
         }
     }
     $params['categories'] = implode('/', $cats);
     return $url . Dispatcher::getInstance()->createUrl($rule, $id_lang, $params, $this->allow);
 }
开发者ID:codingang,项目名称:PrestaShop-modules-CleanURLs,代码行数:52,代码来源:Link.php

示例5: getPageLink

 /**
  * Create a simple link
  *
  * @param string $controller
  * @param bool $ssl
  * @param int $id_lang
  * @param string|array $request
  * @param bool $request_url_encode Use URL encode
  *
  * @return string Page link
  */
 public function getPageLink($controller, $ssl = false, $id_lang = null, $request = null, $request_url_encode = false, $id_shop = null)
 {
     $controller = Tools::strReplaceFirst('.php', '', $controller);
     if (!$id_lang) {
         $id_lang = (int) Context::getContext()->language->id;
     }
     if (!is_array($request)) {
         // @FIXME html_entity_decode has been added due to '&' => '%3B' ...
         $request = html_entity_decode($request);
         if ($request_url_encode) {
             $request = urlencode($request);
         }
         parse_str($request, $request);
     }
     if ($id_shop === null) {
         $shop = Context::getContext()->shop;
     } else {
         $shop = new Shop($id_shop);
     }
     $uri_path = Dispatcher::getInstance()->createUrl($controller, $id_lang, $request, false, '', $id_shop);
     $url = $ssl && $this->ssl_enable ? 'https://' : 'http://';
     $url .= $shop->domain . $shop->getBaseURI() . $this->getLangLink($id_lang, null, $id_shop) . ltrim($uri_path, '/');
     return $url;
 }
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:35,代码来源:Link.php

示例6: getAgileBaseUrl

 private function getAgileBaseUrl($usevirtual, $id_seller, $ssl, $relative_protocol = false)
 {
     static $force_ssl = null;
     $def_shop_id = (int) Configuration::get('PS_SHOP_DEFAULT');
     $shop = new Shop($def_shop_id);
     if ($usevirtual && $id_seller > 0) {
         $sql = 'SELECT id_shop FROM ' . _DB_PREFIX_ . 'sellerinfo WHERE id_seller=' . (int) $id_seller;
         $id_shop = Db::getInstance()->getValue($sql);
         $shop = new Shop($id_shop);
     }
     if ($ssl === null) {
         if ($force_ssl === null) {
             $force_ssl = Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE');
         }
         $ssl = $force_ssl;
     } else {
         $ssl = $ssl && Configuration::get('PS_SSL_ENABLED');
     }
     if ($relative_protocol) {
         $base = '//' . ($ssl && $this->ssl_enable ? $shop->domain_ssl : $shop->domain);
     } else {
         $base = $ssl && $this->ssl_enable ? 'https://' . $shop->domain_ssl : 'http://' . $shop->domain;
     }
     return $base . $shop->getBaseURI();
 }
开发者ID:sho5kubota,项目名称:guidingyou2,代码行数:25,代码来源:Link.php

示例7: getProductLink

 /**
  * Create a link to a product
  *
  * @param mixed $product Product object (can be an ID product, but deprecated)
  * @param string $alias
  * @param string $category
  * @param string $ean13
  * @param int $id_lang
  * @param int $id_shop (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart
  * @param int $ipa ID product attribute
  * @return string
  */
 public function getProductLink($product, $alias = null, $category = null, $ean13 = null, $id_lang = null, $id_shop = null, $ipa = 0, $force_routes = false)
 {
     $dispatcher = Dispatcher::getInstance();
     if (!$id_lang) {
         $id_lang = Context::getContext()->language->id;
     }
     if (!$id_shop) {
         $shop = Context::getContext()->shop;
     } else {
         $shop = new Shop($id_shop);
     }
     $url = 'http://' . $shop->domain . $shop->getBaseURI() . $this->getLangLink($id_lang);
     if (!is_object($product)) {
         if (is_array($product) && isset($product['id_product'])) {
             $product = new Product($product['id_product'], false, $id_lang);
         } else {
             if (is_numeric($product) || !$product) {
                 $product = new Product($product, false, $id_lang);
             } else {
                 throw new PrestaShopException('Invalid product vars');
             }
         }
     }
     // Set available keywords
     $params = array();
     $params['id'] = $product->id;
     $params['rewrite'] = !$alias ? $product->getFieldByLang('link_rewrite') : $alias;
     $params['ean13'] = !$ean13 ? $product->ean13 : $ean13;
     $params['meta_keywords'] = Tools::str2url($product->getFieldByLang('meta_keywords'));
     $params['meta_title'] = Tools::str2url($product->getFieldByLang('meta_title'));
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'manufacturer')) {
         $params['manufacturer'] = Tools::str2url($product->isFullyLoaded ? $product->manufacturer_name : Manufacturer::getNameById($product->id_manufacturer));
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'supplier')) {
         $params['supplier'] = Tools::str2url($product->isFullyLoaded ? $product->supplier_name : Supplier::getNameById($product->id_supplier));
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'price')) {
         $params['price'] = $product->isFullyLoaded ? $product->price : Product::getPriceStatic($product->id, false, null, 6, null, false, true, 1, false, null, null, null, $product->specificPrice);
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'tags')) {
         $params['tags'] = Tools::str2url($product->getTags($id_lang));
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'category')) {
         $params['category'] = Tools::str2url($product->category);
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'reference')) {
         $params['reference'] = Tools::str2url($product->reference);
     }
     if ($dispatcher->hasKeyword('product_rule', $id_lang, 'categories')) {
         $params['category'] = !$category ? $product->category : $category;
         $cats = array();
         foreach ($product->getParentCategories() as $cat) {
             if (!in_array($cat['id_category'], array(1, 2))) {
                 //remove root and home category from the URL
                 $cats[] = $cat['link_rewrite'];
             }
         }
         $params['categories'] = implode('/', $cats);
     }
     $anchor = $ipa ? $product->getAnchor($ipa) : '';
     return $url . $dispatcher->createUrl('product_rule', $id_lang, $params, $force_routes, $anchor);
 }
开发者ID:jicheng17,项目名称:pengwine,代码行数:74,代码来源:Link.php


注:本文中的Shop::getBaseURI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。