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


PHP Tools::getToken方法代码示例

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


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

示例1: hookRightColumn

 function hookRightColumn($params)
 {
     global $smarty, $category_path;
     $category_path_ids = array();
     foreach ($category_path as $cat) {
         $category_path_ids[] = $cat['id_category'];
     }
     $currency = new Currency(intval($params['cookie']->id_currency));
     $bestsellers = ProductSale::getBestSalesLight(intval($params['cookie']->id_lang), 0, 25);
     $best_sellers = array();
     $nr = 0;
     foreach ($bestsellers as $bestseller) {
         if ($nr >= 5) {
             break;
         }
         $display = false;
         foreach (Product::getIndexedCategories($bestseller['id_product']) as $row) {
             if (in_array($row['id_category'], $category_path_ids)) {
                 $display = true;
                 break;
             }
         }
         if ($display) {
             $bestseller['price'] = Tools::displayPrice(Product::getPriceStaticLC(intval($bestseller['id_product'])), $currency, false, false);
             $best_sellers[] = $bestseller;
             $nr += 1;
         }
     }
     $smarty->assign(array('best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium'), 'static_token' => Tools::getToken(false)));
     return $this->display(__FILE__, 'blockbestsellers.tpl');
 }
开发者ID:redb,项目名称:prestashop,代码行数:31,代码来源:blockbestsellers.php

示例2: displayHeader

 public function displayHeader()
 {
     global $css_files, $js_files;
     if (!self::$initialized) {
         $this->init();
     }
     // P3P Policies (http://www.w3.org/TR/2002/REC-P3P-20020416/#compact_policies)
     header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
     /* Hooks are volontary out the initialize array (need those variables already assigned) */
     self::$smarty->assign(array('time' => time(), 'static_token' => Tools::getToken(false), 'token' => Tools::getToken(), 'logo_image_width' => Configuration::get('SHOP_LOGO_WIDTH'), 'logo_image_height' => Configuration::get('SHOP_LOGO_HEIGHT'), 'priceDisplayPrecision' => _PS_PRICE_DISPLAY_PRECISION_, 'content_only' => (int) Tools::getValue('content_only')));
     self::$smarty->assign(array('HOOK_HEADER' => Module::hookExec('header'), 'HOOK_TOP' => Module::hookExec('top'), 'HOOK_BELOWNAVH' => Module::hookExec('belownavh'), 'HOOK_FILTERBY_CENTER' => Module::hookExec('filterbyCenter')));
     if ((Configuration::get('PS_CSS_THEME_CACHE') or Configuration::get('PS_JS_THEME_CACHE')) and is_writable(_PS_THEME_DIR_ . 'cache')) {
         // CSS compressor management
         if (Configuration::get('PS_CSS_THEME_CACHE')) {
             Tools::cccCss();
         }
         //JS compressor management
         if (Configuration::get('PS_JS_THEME_CACHE')) {
             Tools::cccJs();
         }
     }
     self::$smarty->assign('css_files', $css_files);
     self::$smarty->assign('js_files', array_unique($js_files));
     self::$smarty->display(_PS_THEME_DIR_ . 'header.tpl');
 }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:25,代码来源:FrontController.php

示例3: displayOrderStep

 function displayOrderStep($params)
 {
     global $smarty, $cart, $errors;
     $smarty->assign('errors', $errors);
     if (file_exists(_PS_SHIP_IMG_DIR_ . intval($cart->id_carrier) . '.jpg')) {
         $smarty->assign('carrierPicture', 1);
     }
     $cart->save();
     // Hack to get loyalty and other modules happy
     $summary = $cart->getSummaryDetails();
     $customizedDatas = Product::getAllCustomizedDatas(intval($cart->id));
     Product::addCustomizationPrice($summary['products'], $customizedDatas);
     if ($free_ship = intval(Configuration::get('PS_SHIPPING_FREE_PRICE'))) {
         $discounts = $cart->getDiscounts();
         $total_free_ship = $free_ship - ($summary['total_products_wt'] + $summary['total_discounts']);
         foreach ($discounts as $discount) {
             if ($discount['id_discount_type'] == 3) {
                 $total_free_ship = 0;
                 break;
             }
         }
         $smarty->assign('free_ship', $total_free_ship);
     }
     $smarty->assign($summary);
     $token = Tools::getToken(false);
     $smarty->assign(array('token_cart' => $token, 'voucherAllowed' => Configuration::get('PS_VOUCHERS'), 'HOOK_SHOPPING_CART' => Module::hookExec('shoppingCart', $summary), 'HOOK_SHOPPING_CART_EXTRA' => Module::hookExec('shoppingCartExtra', $summary), 'shippingCost' => $cart->getOrderTotalLC(true, 5), 'shippingCostTaxExc' => $cart->getOrderTotalLC(false, 5), 'customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'lastProductAdded' => $cart->getLastProduct()));
     Tools::safePostVars();
     include_once dirname(__FILE__) . '/../../header.php';
     echo $this->display(__FILE__, 'ordersummary.tpl');
 }
开发者ID:redb,项目名称:prestashop,代码行数:30,代码来源:ordersummary.php

示例4: displayHeader

 public function displayHeader()
 {
     global $css_files, $js_files;
     if (!self::$initialized) {
         $this->init();
     }
     // P3P Policies (http://www.w3.org/TR/2002/REC-P3P-20020416/#compact_policies)
     header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
     /* Hooks are volontary out the initialize array (need those variables already assigned) */
     self::$smarty->assign(array('time' => time(), 'img_update_time' => Configuration::get('PS_IMG_UPDATE_TIME'), 'static_token' => Tools::getToken(false), 'token' => Tools::getToken(), 'logo_image_width' => Configuration::get('SHOP_LOGO_WIDTH'), 'logo_image_height' => Configuration::get('SHOP_LOGO_HEIGHT'), 'priceDisplayPrecision' => _PS_PRICE_DISPLAY_PRECISION_, 'content_only' => (int) Tools::getValue('content_only'), 'hide_left_column' => 0, 'hide_right_column' => 1));
     self::$smarty->assign(array('HOOK_HEADER' => Module::hookExec('header'), 'HOOK_TOP' => Module::hookExec('top'), 'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn'), 'HOOK_RIGHT_COLUMN' => Module::hookExec('rightColumn'), 'HOOK_BHEAD_TOP' => Module::hookExec('displayBheadTop'), 'HOOK_BHEAD_BTM' => Module::hookExec('displayBheadBtm'), 'HOOK_BBODY_TOP' => Module::hookExec('displayBbodyTop'), 'HOOK_SIDE1_TOP' => Module::hookExec('displaySide1Top'), 'HOOK_SIDE1_BTM' => Module::hookExec('displaySide1Btm'), 'HOOK_MAIN_TOP' => Module::hookExec('displayMainTop'), 'HOOK_CONTENT_SIDE1' => Module::hookExec('displayContentSide1'), 'HOOK_CONTENT_TOP' => Module::hookExec('displayContentTop'), 'HOOK_CONTENT_BTM' => Module::hookExec('displayContentBtm'), 'HOOK_CONTENT_SIDE2' => Module::hookExec('displayContentSide2'), 'HOOK_MAIN_BTM' => Module::hookExec('displayMainBtm'), 'HOOK_SIDE2_TOP' => Module::hookExec('displaySide2Top'), 'HOOK_SIDE2_BTM' => Module::hookExec('displaySide2Btm')));
     $page_array_left = array("no-index", "no-search", "no-category", "prices-drop", "new-products", "all-products", "best-sales", "no-product", "order", "authentication", "my-account", "history", "orde//r-slip", "search", "identity", "discount", "sendtoafriend-form", "password", "addresses", "no-cms", "contact-form");
     self::$smarty->assign(array('page_array_left' => $page_array_left));
     $page_array_right = array("index", "no-search", "category", "prices-drop", "new-products", "all-products", "best-sales", "product", "order", "authentication", "my-account", "history", "orde//r-slip", "search", "identity", "discount", "sendtoafriend-form", "password", "addresses", "cms", "contact-form");
     self::$smarty->assign(array('page_array_right' => $page_array_right));
     if ((Configuration::get('PS_CSS_THEME_CACHE') || Configuration::get('PS_JS_THEME_CACHE')) && is_writable(_PS_THEME_DIR_ . 'cache')) {
         // CSS compressor management
         if (Configuration::get('PS_CSS_THEME_CACHE')) {
             Tools::cccCss();
         }
         // JS compressor management
         if (Configuration::get('PS_JS_THEME_CACHE')) {
             Tools::cccJs();
         }
     }
     self::$smarty->assign('css_files', $css_files);
     self::$smarty->assign('js_files', array_unique($js_files));
     self::$smarty->display(_PS_THEME_DIR_ . 'header.tpl');
 }
开发者ID:bubujie,项目名称:xixia,代码行数:29,代码来源:FrontController.php

示例5: displayHeader

 public function displayHeader()
 {
     if (!$this->instantSearch and !$this->ajaxSearch) {
         parent::displayHeader();
     } else {
         self::$smarty->assign('static_token', Tools::getToken(false));
     }
 }
开发者ID:greench,项目名称:prestashop,代码行数:8,代码来源:SearchController.php

示例6: hookFooter

 /**
  * Returns module content for header
  *
  * @param array $params Parameters
  * @return string Content
  */
 function hookFooter($params)
 {
     global $smarty, $cookie, $cart;
     if (isset($smarty->_tpl_vars['HOOK_EXTRACARRIER']) and $smarty->_tpl_vars['page_name'] == 'order') {
         $smarty->assign('TNTCarrierId', $this->_id_carrier);
         //			if ($smarty->_tpl_vars['page_name'] == 'order')
         //				$smarty->assign('TNT_js', 'relaisColis');
         if ($smarty->_tpl_vars['page_name'] == 'history') {
             $smarty->assign('TNT_js', 'suiviColis');
         }
         return $this->display(__FILE__, 'relaistnt_footer.tpl');
     } elseif ($smarty->_tpl_vars['page_name'] == 'order' and (Tools::isSubmit('processCarrier') or Tools::getValue('step') === '3') and Validate::isLoadedObject($cart)) {
         if ($cart->id_carrier != intval($this->_id_carrier)) {
             return;
         }
         if (Configuration::get('PS_TOKEN_ENABLE') == 1 && strcmp(Tools::getToken(false), Tools::getValue('token')) && $cookie->isLogged() === true) {
             $error = $this->l('invalid token');
         }
         $tntRCSelectedCode = pSQL(Tools::getValue('tntRCSelectedCode'));
         if (empty($tntRCSelectedCode) or is_null($tntRCSelectedCode)) {
             $error = $this->l('Avec la livraison TNT, vous devez choisir le relais dans lequel votre colis sera livré.');
         }
         if (!isset($error)) {
             $address_TNT = new Address();
             $address_TNT->id_country = intval(Configuration::get('PS_COUNTRY_DEFAULT'));
             $address_TNT->id_customer = intval($cart->id_customer);
             $address_TNT->alias = $this->l('TNT-') . $cart->id . '-' . $tntRCSelectedCode;
             $address_TNT->lastname = $this->l('TNT');
             $address_TNT->firstname = $this->l('Relais Colis');
             if (Validate::isName(Tools::getValue('tntRCSelectedNom'))) {
                 $address_TNT->company = pSQL(Tools::getValue('tntRCSelectedNom'));
                 $address_TNT->firstname .= ' - ' . pSQL(Tools::getValue('tntRCSelectedNom'));
             }
             if (Validate::isAddress(Tools::getValue('tntRCSelectedAdresse'))) {
                 $address_TNT->address1 = pSQL(Tools::getValue('tntRCSelectedAdresse'));
             }
             if (Validate::isPostCode(Tools::getValue('tntRCSelectedCodePostal'))) {
             }
             $address_TNT->postcode = pSQL(Tools::getValue('tntRCSelectedCodePostal'));
             if (Validate::isCityName(preg_replace('[\\d]', '', pSQL(Tools::getValue('tntRCSelectedCommune'))))) {
                 $address_TNT->city = preg_replace('[\\d]', '', pSQL(Tools::getValue('tntRCSelectedCommune')));
             }
             $address_TNT->deleted = 1;
             $errors = $address_TNT->validateControler();
             if (is_array($errors) and isset($errors[0])) {
                 Tools::redirect('order.php?step=2&error;=' . urlencode($errors[0]));
             }
             if ($address_TNT->save()) {
                 $cart->id_address_delivery = intval($address_TNT->id);
                 $cart->save();
             } else {
                 Tools::redirect('order.php?step=2&error;=' . urlencode($this->l('could not save TNT address')));
             }
         } else {
             Tools::redirect('order.php?step=2&error;=' . urlencode($error));
         }
     }
 }
开发者ID:bastnic,项目名称:presta-relaistnt,代码行数:64,代码来源:relaistnt.php

示例7: assign

 /**
  * Assign wishlist template
  */
 public function assign()
 {
     $errors = array();
     if ($this->context->customer->isLogged()) {
         $add = Tools::getIsset('add');
         $add = empty($add) === false ? 1 : 0;
         $delete = Tools::getIsset('deleted');
         $delete = empty($delete) === false ? 1 : 0;
         $id_wishlist = Tools::getValue('id_wishlist');
         if (Tools::isSubmit('submitWishlist')) {
             if (Configuration::get('PS_TOKEN_ACTIVATED') == 1 and strcmp(Tools::getToken(), Tools::getValue('token'))) {
                 $errors[] = $this->module->l('Invalid token', 'mywishlist');
             }
             if (!sizeof($errors)) {
                 $name = Tools::getValue('name');
                 if (empty($name)) {
                     $errors[] = $this->module->l('You must specify a name.', 'mywishlist');
                 }
                 if (WishList::isExistsByNameForUser($name)) {
                     $errors[] = $this->module->l('This name is already used by another list.', 'mywishlist');
                 }
                 if (!sizeof($errors)) {
                     $wishlist = new WishList();
                     $wishlist->id_shop = $this->context->shop->id;
                     $wishlist->id_shop_group = $this->context->shop->id_shop_group;
                     $wishlist->name = $name;
                     $wishlist->id_customer = (int) $this->context->customer->id;
                     list($us, $s) = explode(' ', microtime());
                     srand($s * $us);
                     $wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true) . _COOKIE_KEY_ . $this->context->customer->id), 0, 16));
                     $wishlist->add();
                     Mail::Send($this->context->language->id, 'wishlink', Mail::l('Your wishlist\'s link', $this->context->language->id), array('{wishlist}' => $wishlist->name, '{message}' => Tools::getProtocol() . htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/blockwishlist/view.php?token=' . $wishlist->token), $this->context->customer->email, $this->context->customer->firstname . ' ' . $this->context->customer->lastname, NULL, strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, $this->module->getLocalPath() . 'mails/');
                 }
             }
         } else {
             if ($add) {
                 WishList::addCardToWishlist($this->context->customer->id, Tools::getValue('id_wishlist'), $this->context->language->id);
             } else {
                 if ($delete and empty($id_wishlist) === false) {
                     $wishlist = new WishList((int) $id_wishlist);
                     if (Validate::isLoadedObject($wishlist)) {
                         $wishlist->delete();
                     } else {
                         $errors[] = $this->module->l('Cannot delete this wishlist', 'mywishlist');
                     }
                 }
             }
         }
         $this->context->smarty->assign('wishlists', WishList::getByIdCustomer($this->context->customer->id));
         $this->context->smarty->assign('nbProducts', WishList::getInfosByIdCustomer($this->context->customer->id));
     } else {
         Tools::redirect('index.php?controller=authentication&back=' . urlencode($this->context->link->getModuleLink('blockwishlist', 'mywishlist')));
     }
     $this->context->smarty->assign(array('id_customer' => (int) $this->context->customer->id, 'errors' => $errors, 'form_link' => $errors));
     $this->setTemplate('mywishlist.tpl');
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:59,代码来源:mywishlist.php

示例8: _assignSummaryInformations

 protected function _assignSummaryInformations()
 {
     $summary = $this->context->cart->getSummaryDetails();
     $customizedDatas = Product::getAllCustomizedDatas($this->context->cart->id);
     // override customization tax rate with real tax (tax rules)
     if ($customizedDatas) {
         foreach ($summary['products'] as &$productUpdate) {
             $productId = (int) isset($productUpdate['id_product']) ? $productUpdate['id_product'] : $productUpdate['product_id'];
             $productAttributeId = (int) isset($productUpdate['id_product_attribute']) ? $productUpdate['id_product_attribute'] : $productUpdate['product_attribute_id'];
             if (isset($customizedDatas[$productId][$productAttributeId])) {
                 $productUpdate['tax_rate'] = Tax::getProductTaxRate($productId, $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
             }
         }
         Product::addCustomizationPrice($summary['products'], $customizedDatas);
     }
     $cart_product_context = Context::getContext()->cloneContext();
     foreach ($summary['products'] as $key => &$product) {
         $product['quantity'] = $product['cart_quantity'];
         // for compatibility with 1.2 themes
         if ($cart_product_context->shop->id != $product['id_shop']) {
             $cart_product_context->shop = new Shop((int) $product['id_shop']);
         }
         $product['price_without_specific_price'] = Product::getPriceStatic($product['id_product'], !Product::getTaxCalculationMethod(), $product['id_product_attribute'], _PS_PRICE_COMPUTE_PRECISION_, null, false, false, 1, false, null, null, null, $null, true, true, $cart_product_context);
         /**
          * ABU edit: variable is_discount set à 1 à tord, calcul foireux de presta
          * @bugfix: https://github.com/PrestaShop/PrestaShop/commit/379e28b341730ea95c0b2d6567817305ea841b23
          * @perso: soustraction de l'ecotax au price_without_specific_price @else
          */
         if (Product::getTaxCalculationMethod()) {
             // $product['is_discounted'] = $product['price_without_specific_price'] != Tools::ps_round($product['price'], _PS_PRICE_COMPUTE_PRECISION_);
             $product['is_discounted'] = Tools::ps_round($product['price_without_specific_price'], _PS_PRICE_COMPUTE_PRECISION_) != Tools::ps_round($product['price'], _PS_PRICE_COMPUTE_PRECISION_);
         } else {
             // $product['is_discounted'] = $product['price_without_specific_price'] != Tools::ps_round($product['price_wt'], _PS_PRICE_COMPUTE_PRECISION_);
             $product['is_discounted'] = Tools::ps_round($product['price_without_specific_price'] - $product['ecotax'], _PS_PRICE_COMPUTE_PRECISION_) != Tools::ps_round($product['price_wt'], _PS_PRICE_COMPUTE_PRECISION_);
         }
     }
     // Get available cart rules and unset the cart rules already in the cart
     $available_cart_rules = CartRule::getCustomerCartRules($this->context->language->id, isset($this->context->customer->id) ? $this->context->customer->id : 0, true, true, true, $this->context->cart);
     $cart_cart_rules = $this->context->cart->getCartRules();
     foreach ($available_cart_rules as $key => $available_cart_rule) {
         if (!$available_cart_rule['highlight'] || strpos($available_cart_rule['code'], CartRule::BO_ORDER_CODE_PREFIX) === 0) {
             unset($available_cart_rules[$key]);
             continue;
         }
         foreach ($cart_cart_rules as $cart_cart_rule) {
             if ($available_cart_rule['id_cart_rule'] == $cart_cart_rule['id_cart_rule']) {
                 unset($available_cart_rules[$key]);
                 continue 2;
             }
         }
     }
     $show_option_allow_separate_package = !$this->context->cart->isAllProductsInStock(true) && Configuration::get('PS_SHIP_WHEN_AVAILABLE');
     $this->context->smarty->assign($summary);
     $this->context->smarty->assign(array('token_cart' => Tools::getToken(false), 'isLogged' => $this->isLogged, 'isVirtualCart' => $this->context->cart->isVirtualCart(), 'productNumber' => $this->context->cart->nbProducts(), 'voucherAllowed' => CartRule::isFeatureActive(), 'shippingCost' => $this->context->cart->getOrderTotal(true, Cart::ONLY_SHIPPING), 'shippingCostTaxExc' => $this->context->cart->getOrderTotal(false, Cart::ONLY_SHIPPING), 'customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'lastProductAdded' => $this->context->cart->getLastProduct(), 'displayVouchers' => $available_cart_rules, 'show_option_allow_separate_package' => $show_option_allow_separate_package, 'smallSize' => Image::getSize(ImageType::getFormatedName('small'))));
     $this->context->smarty->assign(array('HOOK_SHOPPING_CART' => Hook::exec('displayShoppingCartFooter', $summary), 'HOOK_SHOPPING_CART_EXTRA' => Hook::exec('displayShoppingCart', $summary)));
 }
开发者ID:ecSta,项目名称:prestanight,代码行数:56,代码来源:ParentOrderController.php

示例9: displayHeader

 public function displayHeader()
 {
     global $css_files, $js_files;
     if (!self::$initialized) {
         $this->init();
     }
     // P3P Policies (http://www.w3.org/TR/2002/REC-P3P-20020416/#compact_policies)
     header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
     /* Hooks are volontary out the initialize array (need those variables already assigned) */
     self::$smarty->assign(array('time' => time(), 'img_update_time' => Configuration::get('PS_IMG_UPDATE_TIME'), 'static_token' => Tools::getToken(false), 'token' => Tools::getToken(), 'logo_image_width' => Configuration::get('SHOP_LOGO_WIDTH'), 'logo_image_height' => Configuration::get('SHOP_LOGO_HEIGHT'), 'priceDisplayPrecision' => _PS_PRICE_DISPLAY_PRECISION_, 'content_only' => (int) Tools::getValue('content_only')));
     self::$smarty->assign(array('HOOK_HEADER' => Module::hookExec('header'), 'HOOK_TOP' => Module::hookExec('top'), 'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn')));
     if ((Configuration::get('PS_CSS_THEME_CACHE') or Configuration::get('PS_JS_THEME_CACHE')) and is_writable(_PS_THEME_DIR_ . 'cache')) {
         // CSS compressor management
         if (Configuration::get('PS_CSS_THEME_CACHE')) {
             Tools::cccCss();
         }
         //JS compressor management
         if (Configuration::get('PS_JS_THEME_CACHE')) {
             Tools::cccJs();
         }
     }
     /*pl*/
     $tags_name = Tools::getValue('pltn');
     self::$smarty->assign('meta_title', $tags_name . ' - Blog ');
     // $id_pl_blog_category = (int) Tools::getValue('plidc');
     // if ($id_pl_blog_category != null)
     // {
     // $category = $this->getMetaCategoryById($id_pl_blog_category);
     // $meta_title = $category['category_meta_title'];
     // $meta_description = $category['category_meta_description'];
     // $meta_keywords = $category['category_meta_keywords'];
     // if ($meta_title != null)
     // self::$smarty->assign('meta_title', $meta_title.' - Blog ');
     // if ($meta_description != null)
     // self::$smarty->assign('meta_description',$meta_description);
     // if ($meta_keywords != null)
     // self::$smarty->assign('meta_keywords', $meta_keywords);
     // }
     // else
     // {
     // $category_name = 'List post';
     // self::$smarty->assign('meta_title', $category_name.' - Blog ');
     // }
     /* -pl */
     self::$smarty->assign('css_files', $css_files);
     self::$smarty->assign('js_files', array_unique($js_files));
     self::$smarty->display(_PS_THEME_DIR_ . 'header.tpl');
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:48,代码来源:BlogTagsController.php

示例10: initContent

 /**
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     if (Configuration::isCatalogMode()) {
         Tools::redirect('index.php');
     }
     parent::initContent();
     $presenter = new CartPresenter();
     $presented_cart = $presenter->present($this->context->cart);
     $this->context->smarty->assign(['cart' => $presented_cart, 'static_token' => Tools::getToken(false)]);
     if (count($presented_cart['products']) > 0) {
         $this->setTemplate('checkout/cart');
     } else {
         $this->context->smarty->assign(['allProductsLink' => $this->context->link->getCategoryLink(Configuration::get('PS_HOME_CATEGORY'))]);
         $this->setTemplate('checkout/cart-empty');
     }
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:19,代码来源:CartController.php

示例11: initContent

 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     $this->assignCountries();
     $this->assignVatNumber();
     $this->assignAddressFormat();
     // Assign common vars
     $this->context->smarty->assign(array('one_phone_at_least' => (int) Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'onr_phone_at_least' => (int) Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'ajaxurl' => _MODULE_DIR_, 'errors' => $this->errors, 'token' => Tools::getToken(false), 'select_address' => (int) Tools::getValue('select_address'), 'address' => $this->_address, 'id_address' => Validate::isLoadedObject($this->_address) ? $this->_address->id : 0));
     if ($back = Tools::getValue('back')) {
         $this->context->smarty->assign('back', Tools::safeOutput($back));
     }
     if ($mod = Tools::getValue('mod')) {
         $this->context->smarty->assign('mod', Tools::safeOutput($mod));
     }
     if (isset($this->context->cookie->account_created)) {
         $this->context->smarty->assign('account_created', 1);
         unset($this->context->cookie->account_created);
     }
     $this->setTemplate(_PS_THEME_DIR_ . 'address.tpl');
 }
开发者ID:h0n24,项目名称:leodig,代码行数:24,代码来源:AddressController.php

示例12: ajaxCall

 public function ajaxCall()
 {
     global $smarty, $cookie;
     $selected_filters = $this->getSelectedFilters();
     $filter_block = $this->getFilterBlock($selected_filters);
     $this->getProducts($selected_filters, $products, $nb_products, $p, $n, $pages_nb, $start, $stop, $range, $combinations);
     // Add pagination variable
     $nArray = (int) Configuration::get('PS_PRODUCTS_PER_PAGE') != 10 ? array((int) Configuration::get('PS_PRODUCTS_PER_PAGE'), 10, 20, 50) : array(10, 20, 50);
     // Clean duplicate values
     $nArray = array_unique($nArray);
     asort($nArray);
     if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
         $this->context->controller->addColorsToProductList($products);
     }
     $category = new Category(Tools::getValue('id_category_layered', Configuration::get('PS_HOME_CATEGORY')), (int) $cookie->id_lang);
     // Generate meta title and meta description
     $category_title = empty($category->meta_title) ? $category->name : $category->meta_title;
     $category_metas = Meta::getMetaTags((int) $cookie->id_lang, 'category');
     $title = '';
     $keywords = '';
     if (is_array($filter_block['title_values'])) {
         foreach ($filter_block['title_values'] as $key => $val) {
             $title .= ' > ' . $key . ' ' . implode('/', $val);
             $keywords .= $key . ' ' . implode('/', $val) . ', ';
         }
     }
     $title = $category_title . $title;
     if (!empty($title)) {
         $meta_title = $title;
     } else {
         $meta_title = $category_metas['meta_title'];
     }
     $meta_description = $category_metas['meta_description'];
     $keywords = substr(strtolower($keywords), 0, 1000);
     if (!empty($keywords)) {
         $meta_keywords = rtrim($category_title . ', ' . $keywords . ', ' . $category_metas['meta_keywords'], ', ');
     }
     $smarty->assign(array('homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'nb_products' => $nb_products, 'category' => $category, 'pages_nb' => (int) $pages_nb, 'p' => (int) $p, 'n' => (int) $n, 'range' => (int) $range, 'start' => (int) $start, 'stop' => (int) $stop, 'n_array' => (int) Configuration::get('PS_PRODUCTS_PER_PAGE') != 10 ? array((int) Configuration::get('PS_PRODUCTS_PER_PAGE'), 10, 20, 50) : array(10, 20, 50), 'comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'products' => $products, 'products_per_page' => (int) Configuration::get('PS_PRODUCTS_PER_PAGE'), 'static_token' => Tools::getToken(false), 'page_name' => 'category', 'nArray' => $nArray, 'compareProducts' => CompareProduct::getCompareProducts((int) $this->context->cookie->id_compare), 'combinations' => $combinations));
     // Prevent bug with old template where category.tpl contain the title of the category and category-count.tpl do not exists
     if (file_exists(_PS_THEME_DIR_ . 'category-count.tpl')) {
         $category_count = $smarty->fetch(_PS_THEME_DIR_ . 'category-count.tpl');
     } else {
         $category_count = '';
     }
     if ($nb_products == 0) {
         $product_list = $this->display(__FILE__, 'blocklayered-no-products.tpl');
     } else {
         $product_list = $smarty->fetch(_PS_THEME_DIR_ . 'product-list.tpl');
     }
     $vars = array('filtersBlock' => utf8_encode($this->generateFiltersBlock($selected_filters)), 'productList' => utf8_encode($product_list), 'pagination' => $smarty->fetch(_PS_THEME_DIR_ . 'pagination.tpl'), 'categoryCount' => $category_count, 'meta_title' => $meta_title . ' - ' . Configuration::get('PS_SHOP_NAME'), 'heading' => $meta_title, 'meta_keywords' => isset($meta_keywords) ? $meta_keywords : null, 'meta_description' => $meta_description, 'current_friendly_url' => (int) $n == (int) $nb_products ? '#/show-all' : '#' . $filter_block['current_friendly_url'], 'filters' => $filter_block['filters'], 'nbRenderedProducts' => (int) $nb_products, 'nbAskedProducts' => (int) $n, 'combinations' => $combinations);
     if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
         $vars = array_merge($vars, array('pagination_bottom' => $smarty->assign('paginationId', 'bottom')->fetch(_PS_THEME_DIR_ . 'pagination.tpl')));
     }
     /* We are sending an array in jSon to the .js controller, it will update both the filters and the products zones */
     return Tools::jsonEncode($vars);
 }
开发者ID:Beattle,项目名称:perrino-shop,代码行数:56,代码来源:blocklayered.php

示例13: dirname

* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <contact@prestashop.com>
*  @copyright  2007-2012 PrestaShop SA
*  @version  Release: $Revision$
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
require_once dirname(__FILE__) . '/WishList.php';
$context = Context::getContext();
// Instance of module class for translations
$module = new BlockWishList();
if (Configuration::get('PS_TOKEN_ENABLE') == 1 and strcmp(Tools::getToken(false), Tools::getValue('token')) and $context->customer->isLogged() === true) {
    exit($module->l('invalid token', 'sendwishlist'));
}
if ($context->customer->isLogged()) {
    $id_wishlist = (int) Tools::getValue('id_wishlist');
    if (empty($id_wishlist) === true) {
        exit($module->l('Invalid wishlist', 'sendwishlist'));
    }
    for ($i = 1; empty($_POST['email' . strval($i)]) === false; ++$i) {
        $to = Tools::getValue('email' . $i);
        $wishlist = WishList::exists($id_wishlist, $context->customer->id, true);
        if ($wishlist === false) {
            exit($module->l('Invalid wishlist', 'sendwishlist'));
        }
        if (WishList::addEmail($id_wishlist, $to) === false) {
            exit($module->l('Wishlist send error', 'sendwishlist'));
开发者ID:jicheng17,项目名称:vipinsg,代码行数:31,代码来源:sendwishlist.php

示例14: initContent

 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     if (!$this->errors) {
         // Assign to the template the id of the virtual product. "0" if the product is not downloadable.
         $this->context->smarty->assign('virtual', ProductDownload::getIdFromIdProduct((int) $this->product->id));
         // If the product is not active, it's the admin preview mode
         if (!$this->product->active) {
             $this->context->smarty->assign('adminActionDisplay', true);
         }
         // Product pictures management
         require_once 'images.inc.php';
         $this->context->smarty->assign('customizationFormTarget', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));
         if (Tools::isSubmit('submitCustomizedDatas')) {
             // If cart has not been saved, we need to do it so that customization fields can have an id_cart
             // We check that the cookie exists first to avoid ghost carts
             if (!$this->context->cart->id && isset($_COOKIE[$this->context->cookie->getName()])) {
                 $this->context->cart->add();
                 $this->context->cookie->id_cart = (int) $this->context->cart->id;
             }
             $this->pictureUpload();
             $this->textRecord();
             $this->formTargetFormat();
         } else {
             if (Tools::getIsset('deletePicture') && !$this->context->cart->deleteCustomizationToProduct($this->product->id, Tools::getValue('deletePicture'))) {
                 $this->errors[] = Tools::displayError('An error occurred while deleting the selected picture');
             }
         }
         $files = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_FILE, true);
         $pictures = array();
         foreach ($files as $file) {
             $pictures['pictures_' . $this->product->id . '_' . $file['index']] = $file['value'];
         }
         $texts = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_TEXTFIELD, true);
         $text_fields = array();
         foreach ($texts as $text_field) {
             $text_fields['textFields_' . $this->product->id . '_' . $text_field['index']] = str_replace('<br />', "\n", $text_field['value']);
         }
         $this->context->smarty->assign(array('pictures' => $pictures, 'textFields' => $text_fields));
         // Assign template vars related to the category + execute hooks related to the category
         $this->assignCategory();
         // Assign template vars related to the price and tax
         $this->assignPriceAndTax();
         // Assign template vars related to the images
         $this->assignImages();
         // Assign attribute groups to the template
         $this->assignAttributesGroups();
         // Assign attributes combinations to the template
         $this->assignAttributesCombinations();
         // Pack management
         $pack_items = $this->product->cache_is_pack ? Pack::getItemTable($this->product->id, $this->context->language->id, true) : array();
         $this->context->smarty->assign('packItems', $pack_items);
         $this->context->smarty->assign('packs', Pack::getPacksTable($this->product->id, $this->context->language->id, true, 1));
         if (isset($this->category->id) && $this->category->id) {
             $return_link = Tools::safeOutput($this->context->link->getCategoryLink($this->category));
         } else {
             $return_link = 'javascript: history.back();';
         }
         $this->context->smarty->assign(array('stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'), 'customizationFields' => $this->product->customizable ? $this->product->getCustomizationFields($this->context->language->id) : false, 'accessories' => $this->product->getAccessories($this->context->language->id), 'return_link' => $return_link, 'product' => $this->product, 'product_manufacturer' => new Manufacturer((int) $this->product->id_manufacturer, $this->context->language->id), 'token' => Tools::getToken(false), 'features' => $this->product->getFrontFeatures($this->context->language->id), 'attachments' => $this->product->cache_has_attachments ? $this->product->getAttachments($this->context->language->id) : array(), 'allow_oosp' => $this->product->isAvailableWhenOutOfStock((int) $this->product->out_of_stock), 'last_qties' => (int) Configuration::get('PS_LAST_QTIES'), 'HOOK_EXTRA_LEFT' => Hook::exec('displayLeftColumnProduct'), 'HOOK_EXTRA_RIGHT' => Hook::exec('displayRightColumnProduct'), 'HOOK_PRODUCT_OOS' => Hook::exec('actionProductOutOfStock', array('product' => $this->product)), 'HOOK_PRODUCT_ACTIONS' => Hook::exec('displayProductButtons'), 'HOOK_PRODUCT_TAB' => Hook::exec('displayProductTab'), 'HOOK_PRODUCT_TAB_CONTENT' => Hook::exec('displayProductTabContent'), 'display_qties' => (int) Configuration::get('PS_DISPLAY_QTIES'), 'display_ht' => !Tax::excludeTaxeOption(), 'currencySign' => $this->context->currency->sign, 'currencyRate' => $this->context->currency->conversion_rate, 'currencyFormat' => $this->context->currency->format, 'currencyBlank' => $this->context->currency->blank, 'jqZoomEnabled' => Configuration::get('PS_DISPLAY_JQZOOM'), 'ENT_NOQUOTES' => ENT_NOQUOTES, 'outOfStockAllowed' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK')));
     }
     $this->context->smarty->assign('errors', $this->errors);
     $this->setTemplate(_PS_THEME_DIR_ . 'product.tpl');
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:67,代码来源:ProductController.php

示例15: preProcess


//.........这里部分代码省略.........
                     /* New Guest customer */
                     if (Tools::isSubmit('is_new_customer')) {
                         $customer->is_guest = !Tools::getValue('is_new_customer', 1);
                     } else {
                         $customer->is_guest = 0;
                     }
                     if (!$customer->add()) {
                         $this->errors[] = Tools::displayError('An error occurred while creating your account.');
                     } else {
                         $address->id_customer = (int) $customer->id;
                         if (!$address->add()) {
                             $this->errors[] = Tools::displayError('An error occurred while creating your address.');
                         } else {
                             if (!$customer->is_guest) {
                                 if (!Mail::Send((int) self::$cookie->id_lang, 'account', Mail::l('Welcome!'), array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
                                     $this->errors[] = Tools::displayError('Cannot send email');
                                 }
                             }
                             self::$smarty->assign('confirmation', 1);
                             self::$cookie->id_customer = (int) $customer->id;
                             self::$cookie->customer_lastname = $customer->lastname;
                             self::$cookie->customer_firstname = $customer->firstname;
                             self::$cookie->passwd = $customer->passwd;
                             self::$cookie->logged = 1;
                             self::$cookie->email = $customer->email;
                             self::$cookie->is_guest = !Tools::getValue('is_new_customer', 1);
                             /* Update cart address */
                             self::$cart->secure_key = $customer->secure_key;
                             self::$cart->id_address_delivery = Address::getFirstCustomerAddressId((int) $customer->id);
                             self::$cart->id_address_invoice = Address::getFirstCustomerAddressId((int) $customer->id);
                             self::$cart->update();
                             Module::hookExec('createAccount', array('_POST' => $_POST, 'newCustomer' => $customer));
                             if (Tools::isSubmit('ajax')) {
                                 $return = array('hasError' => !empty($this->errors), 'errors' => $this->errors, 'isSaved' => true, 'id_customer' => (int) self::$cookie->id_customer, 'id_address_delivery' => self::$cart->id_address_delivery, 'id_address_invoice' => self::$cart->id_address_invoice, 'token' => Tools::getToken(false));
                                 die(Tools::jsonEncode($return));
                             }
                             if ($back = Tools::getValue('back')) {
                                 Tools::redirect($back);
                             }
                             Tools::redirect('my-account.php');
                         }
                     }
                 }
             }
         }
         if (sizeof($this->errors)) {
             if (!Tools::getValue('is_new_customer')) {
                 unset($_POST['passwd']);
             }
             if (Tools::isSubmit('ajax')) {
                 $return = array('hasError' => !empty($this->errors), 'errors' => $this->errors, 'isSaved' => false, 'id_customer' => 0);
                 die(Tools::jsonEncode($return));
             }
         }
     }
     if (Tools::isSubmit('SubmitLogin')) {
         Module::hookExec('beforeAuthentication');
         $passwd = trim(Tools::getValue('passwd'));
         $email = trim(Tools::getValue('email'));
         if (empty($email)) {
             $this->errors[] = Tools::displayError('E-mail address required');
         } elseif (!Validate::isEmail($email)) {
             $this->errors[] = Tools::displayError('Invalid e-mail address');
         } elseif (empty($passwd)) {
             $this->errors[] = Tools::displayError('Password is required');
         } elseif (Tools::strlen($passwd) > 32) {
开发者ID:ricardo-rdfs,项目名称:Portal-BIP,代码行数:67,代码来源:AuthController.php


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