Jump to content

Fixing some errors


MathiasReker

Recommended Posts

Hello,

 

I get these errors on Index page and all products and CMS pages:

 

 

Notice: Undefined index: start in /*****/****/public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php on line 184

 

Notice: Trying to get property of non-object in /*****/****/public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php on line 184

 

Notice: Undefined index: pages_nb in /*****/****/public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php on line 184

 

Notice: Trying to get property of non-object in /*****/****/public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php on line 184

 

Notice: Undefined index: pages_nb in /*****/****/public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php on line 191

 

Notice: Trying to get property of non-object in /*****/****/public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php on line 191

 

Line 184:

 

<?php if ($_smarty_tpl->tpl_vars['start']->value!=$_smarty_tpl->tpl_vars['pages_nb']->value&&$_smarty_tpl->tpl_vars['p']->value!=1) {?>
 

 

 

Line 191:

 

<?php if ($_smarty_tpl->tpl_vars['pages_nb']->value>1&&$_smarty_tpl->tpl_vars['p']->value!=$_smarty_tpl->tpl_vars['pages_nb']->value) {?>
 

I hope anyone can tell me what is the problem. I have searched on web, but noone else seems to have this error..

Link to comment
Share on other sites

Hi there!

 

To solve these issues you must go to the header.tpl file and find the smarty variables that trigger the notice and handle them when they are not set.

 

So for example find the {$start} variable and replace it with something like 

{if isset($strart)}{$start}{/if}

 do this for the variables and you are done :)

Link to comment
Share on other sites

Here is the code from my theme templete file:

		<!--Peg start-->
		{if $start != $pages_nb AND $p != 1}
			{assign var = 'p_previous' value = $p-1 }
			<link rel="prev" href="{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_previous)}" />
		{/if}
		{if $pages_nb > 1 AND $p != $pages_nb}
			{assign var='p_next' value= $p+1 }
			<link rel="next" href="{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_next)}" />
		{/if}
		<!--Peg end-->

Can you show me the fixed version, I don't want to mess something up. Hope you can help :-)

Link to comment
Share on other sites

try this!

<!--Peg start-->
{if isset($start) && isset($pages_nb)}
        {if $start != $pages_nb AND $p != 1}
            {assign var = 'p_previous' value = $p-1 }
            <link rel="prev" href="{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_previous)}" />
        {/if}
        {if $pages_nb > 1 AND $p != $pages_nb}
            {assign var='p_next' value= $p+1 }
            <link rel="next" href="{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_next)}" />
        {/if}
{/if}
<!--Peg end-->
  • Like 1
Link to comment
Share on other sites

Only some of the errors are solved. I don't see anymore errors on the website, but I still see a few errors in the log:

 

 

Error:

[31-Mar-2017 12:29:17 Europe/Copenhagen] PHP Notice:  Undefined index: p_req_uri in /public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php on line 195
[31-Mar-2017 12:29:17 Europe/Copenhagen] PHP Notice:  Trying to get property of non-object in /public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php on line 195
[31-Mar-2017 12:29:17 Europe/Copenhagen] PHP Notice:  Undefined index: requestPage in /public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php on line 196
[31-Mar-2017 12:29:17 Europe/Copenhagen] PHP Notice:  Trying to get property of non-object in /public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php on line 196
[31-Mar-2017 12:32:22 Europe/Copenhagen] PHP Notice:  Undefined index: p_req_uri in /public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php on line 195
[31-Mar-2017 12:32:22 Europe/Copenhagen] PHP Notice:  Trying to get property of non-object in /public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php on line 195
[31-Mar-2017 12:32:22 Europe/Copenhagen] PHP Notice:  Undefined index: requestPage in /public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php on line 196
[31-Mar-2017 12:32:22 Europe/Copenhagen] PHP Notice:  Trying to get property of non-object in /public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php on line 196

Line 195 and 196:

<?php echo $_smarty_tpl->tpl_vars['p_req_uri']->value[0];?>
<?php echo $_smarty_tpl->tpl_vars['link']->value->goPage($_smarty_tpl->tpl_vars['requestPage']->value,$_smarty_tpl->tpl_vars['p_next']->value);?>
Link to comment
Share on other sites

The only place p_req_uri and requestPage appear in header.tpl is in this section of code:

		<!--Peg start-->
		{if isset($start) && isset($pages_nb)}
	        {if $start != $pages_nb AND $p != 1}
	            {assign var = 'p_previous' value = $p-1 }
	            <link rel="prev" href="{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_previous)}" />
	        {/if}
	        {if $pages_nb > 1 AND $p != $pages_nb}
	            {assign var='p_next' value= $p+1 }
	            <link rel="next" href="{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_next)}" />
	        {/if}
		{/if}
		<!--Peg end-->
Link to comment
Share on other sites

        <!--Peg start-->
        {if isset($start) && isset($pages_nb)}
     {if $start != $pages_nb AND $p != 1 AND isset($p_req_uri[0]) AND isset($requestPage)}
     {assign var = 'p_previous' value = $p-1 }
     <link rel="prev" href="{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_previous)}" />
     {/if}
     {if $pages_nb > 1 AND $p != $pages_nb AND isset($p_req_uri[0]) AND isset($requestPage)}
     {assign var='p_next' value= $p+1 }
     <link rel="next" href="{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_next)}" />
     {/if}
        {/if}
        <!--Peg end-->

 be sure to check the output result cause this may cause the link element to disappear for certain cases.

Link to comment
Share on other sites

The last one did not work.

 

The second on does work better than the first I posted.

 

Here is raw output from dev mode in html:

<link rel="prev" href="https://xxx.dk/<br /> <b>Notice</b>: Undefined index: p_req_uri in <b>/home/xxx/public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php</b> on line <b>188</b><br /> <br /> <b>Notice</b>: Trying to get property of non-object in <b>/home/xxx/public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php</b> on line <b>188</b><br /> <br /> <b>Notice</b>: Undefined index: requestPage in <b>/home/xxx/public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php</b> on line <b>189</b><br /> <br /> <b>Notice</b>: Trying to get property of non-object in <b>/home/xxx/public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php</b> on line <b>189</b><br /> " />

<link rel="next" href="https://xxx.dk/<br /> <b>Notice</b>: Undefined index: p_req_uri in <b>/home/xxx/public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php</b> on line <b>195</b><br /> <br /> <b>Notice</b>: Trying to get property of non-object in <b>/home/xxx/public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php</b> on line <b>195</b><br /> <br /> <b>Notice</b>: Undefined index: requestPage in <b>/home/xxx/public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php</b> on line <b>196</b><br /> <br /> <b>Notice</b>: Trying to get property of non-object in <b>/home/xxxx/public_html/cache/smarty/compile/35/d5/8a/35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php</b> on line <b>196</b><br /> ?p=3" />
Link to comment
Share on other sites

ok an alternative would be

        <!--Peg start-->
        {if isset($start) && isset($pages_nb)}
     {if $start != $pages_nb AND $p != 1}
     {assign var = 'p_previous' value = $p-1 }
     <link rel="prev" href="{if isset($p_req_uri[0]) AND isset($requestPage)}{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_previous)}{else}#{/if}" />
     {/if}
     {if $pages_nb > 1 AND $p != $pages_nb}
     {assign var='p_next' value= $p+1 }
     <link rel="next" href="if isset($p_req_uri[0]) AND isset($requestPage)}{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_next)}{else}#{/if}" />
     {/if}
        {/if}
        <!--Peg end--
Link to comment
Share on other sites

That crached the website.

 

I think maybe my startcode is bad written?

 

Just found this: http://prestadev.ru/forum/tema-10053.html

 

File: /classes/controller/FrontController.php

after this code:

$compared_products = array();
if (Configuration::get('PS_COMPARATOR_MAX_ITEM') && isset($this->context->cookie->id_compare))
    $compared_products = CompareProduct::getCompareProducts($this->context->cookie->id_compare);

add:

if (get_class($this->context->controller) == 'CategoryController')
{
    $this->pagination($this->category->getProducts(NULL, NULL, NULL, NULL, NULL, true));
    $p = $this->context->smarty->getTemplateVars('p');
    $n = $this->context->smarty->getTemplateVars('n');
    if($p != $this->context->smarty->getTemplateVars('stop'))
        $this->context->smarty->assign('next', $this->context->link->goPage($this->context->smarty->getTemplateVars('current_url'), $p+1));
    if($p != 1)
        $this->context->smarty->assign('prev', $this->context->link->goPage($this->context->smarty->getTemplateVars('current_url'), $p-1));
}

File: /themes/тема/header.tpl

After this code:

{if isset($css_files)}

add:

{if isset($prev) && $prev}
    <link rel="prev" href="{$prev}" />
{/if}
{if isset($next) && $next}
    <link rel="next" href="{$next}" />
{/if}

Does this look as a better solution?

Link to comment
Share on other sites

Well I made an error on the code I sent you earlier. This should not crash now

        <!--Peg start-->
        {if isset($start) && isset($pages_nb)}
     {if $start != $pages_nb AND $p != 1}
     {assign var = 'p_previous' value = $p-1 }
     <link rel="prev" href="{if isset($p_req_uri[0]) AND isset($requestPage)}{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_previous)}{else}#{/if}" />
     {/if}
     {if $pages_nb > 1 AND $p != $pages_nb}
     {assign var='p_next' value= $p+1 }
     <link rel="next" href="{if isset($p_req_uri[0]) AND isset($requestPage)}{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_next)}{else}#{/if}" />
     {/if}
        {/if}
        <!--Peg end-->

If you need to go through some php code you should look the CategoryController.php. That is the file used to setup the category page including the pagination!

Link to comment
Share on other sites

Yes that was my intention. I suggest you now build on that.

The code is actually checking if there is a next page to previous and if there is not it outputs the # to the href. So I'm guessing that in the current page you are there are not enough products for them to need pagination and so you don't have next and previous links.

 

My advice is to create an if else statement outside of the link element and decide to show it or not.

 

Hope I helped :)

Link to comment
Share on other sites

My CategoryController.php looks like this:

<?php
/*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* 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 <[email protected]>
*  @copyright  2007-2016 PrestaShop SA
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/

class CategoryControllerCore extends FrontController
{
    /** string Internal controller name */
    public $php_self = 'category';

    /** @var Category Current category object */
    protected $category;

    /** @var bool If set to false, customer cannot view the current category. */
    public $customer_access = true;

    /** @var int Number of products in the current page. */
    protected $nbProducts;

    /** @var array Products to be displayed in the current page . */
    protected $cat_products;

    /**
     * Sets default medias for this controller
     */
    public function setMedia()
    {
        parent::setMedia();

        if (!$this->useMobileTheme()) {
            //TODO : check why cluetip css is include without js file
            $this->addCSS(array(
                _THEME_CSS_DIR_.'scenes.css'       => 'all',
                _THEME_CSS_DIR_.'category.css'     => 'all',
                _THEME_CSS_DIR_.'product_list.css' => 'all',
            ));
        }

        $scenes = Scene::getScenes($this->category->id, $this->context->language->id, true, false);
        if ($scenes && count($scenes)) {
            $this->addJS(_THEME_JS_DIR_.'scenes.js');
            $this->addJqueryPlugin(array('scrollTo', 'serialScroll'));
        }

        $this->addJS(_THEME_JS_DIR_.'category.js');
    }

    /**
     * Redirects to canonical or "Not Found" URL
     *
     * @param string $canonical_url
     */
    public function canonicalRedirection($canonical_url = '')
    {
        if (Tools::getValue('live_edit')) {
            return;
        }

        if (!Validate::isLoadedObject($this->category) || !$this->category->inShop() || !$this->category->isAssociatedToShop() || in_array($this->category->id, array(Configuration::get('PS_HOME_CATEGORY'), Configuration::get('PS_ROOT_CATEGORY')))) {
            $this->redirect_after = '404';
            $this->redirect();
        }

        if (!Tools::getValue('noredirect') && Validate::isLoadedObject($this->category)) {
            parent::canonicalRedirection($this->context->link->getCategoryLink($this->category));
        }
    }

    /**
     * Initializes controller
     *
     * @see FrontController::init()
     * @throws PrestaShopException
     */
    public function init()
    {
        // Get category ID
        $id_category = (int)Tools::getValue('id_category');
        if (!$id_category || !Validate::isUnsignedId($id_category)) {
            $this->errors[] = Tools::displayError('Missing category ID');
        }

        // Instantiate category
        $this->category = new Category($id_category, $this->context->language->id);

        parent::init();

        // Check if the category is active and return 404 error if is disable.
        if (!$this->category->active) {
            header('HTTP/1.1 404 Not Found');
            header('Status: 404 Not Found');
        }

        // Check if category can be accessible by current customer and return 403 if not
        if (!$this->category->checkAccess($this->context->customer->id)) {
            header('HTTP/1.1 403 Forbidden');
            header('Status: 403 Forbidden');
            $this->errors[] = Tools::displayError('You do not have access to this category.');
            $this->customer_access = false;
        }
    }

    /**
     * Initializes page content variables
     */
    public function initContent()
    {
        parent::initContent();

        $this->setTemplate(_PS_THEME_DIR_.'category.tpl');

        if (!$this->customer_access) {
            return;
        }

        if (isset($this->context->cookie->id_compare)) {
            $this->context->smarty->assign('compareProducts', CompareProduct::getCompareProducts((int)$this->context->cookie->id_compare));
        }

        // Product sort must be called before assignProductList()
        $this->productSort();

        $this->assignScenes();
        $this->assignSubcategories();
        $this->assignProductList();

        $this->context->smarty->assign(array(
            'category'             => $this->category,
            'description_short'    => Tools::truncateString($this->category->description, 350),
            'products'             => (isset($this->cat_products) && $this->cat_products) ? $this->cat_products : null,
            'id_category'          => (int)$this->category->id,
            'id_category_parent'   => (int)$this->category->id_parent,
            'return_category_name' => Tools::safeOutput($this->category->name),
            'path'                 => Tools::getPath($this->category->id),
            'add_prod_display'     => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
            'categorySize'         => Image::getSize(ImageType::getFormatedName('category')),
            'mediumSize'           => Image::getSize(ImageType::getFormatedName('medium')),
            'thumbSceneSize'       => Image::getSize(ImageType::getFormatedName('m_scene')),
            'homeSize'             => Image::getSize(ImageType::getFormatedName('home')),
            'allow_oosp'           => (int)Configuration::get('PS_ORDER_OUT_OF_STOCK'),
            'comparator_max_item'  => (int)Configuration::get('PS_COMPARATOR_MAX_ITEM'),
            'suppliers'            => Supplier::getSuppliers(),
            'body_classes'         => array($this->php_self.'-'.$this->category->id, $this->php_self.'-'.$this->category->link_rewrite)
        ));
    }

    /**
     * Assigns scenes template variables
     */
    protected function assignScenes()
    {
        // Scenes (could be externalised to another controller if you need them)
        $scenes = Scene::getScenes($this->category->id, $this->context->language->id, true, false);
        $this->context->smarty->assign('scenes', $scenes);

        // Scenes images formats
        if ($scenes && ($scene_image_types = ImageType::getImagesTypes('scenes'))) {
            foreach ($scene_image_types as $scene_image_type) {
                if ($scene_image_type['name'] == ImageType::getFormatedName('m_scene')) {
                    $thumb_scene_image_type = $scene_image_type;
                } elseif ($scene_image_type['name'] == ImageType::getFormatedName('scene')) {
                    $large_scene_image_type = $scene_image_type;
                }
            }

            $this->context->smarty->assign(array(
                'thumbSceneImageType' => isset($thumb_scene_image_type) ? $thumb_scene_image_type : null,
                'largeSceneImageType' => isset($large_scene_image_type) ? $large_scene_image_type : null,
            ));
        }
    }

    /**
     * Assigns subcategory templates variables
     */
    protected function assignSubcategories()
    {
        if ($sub_categories = $this->category->getSubCategories($this->context->language->id)) {
            $this->context->smarty->assign(array(
                'subcategories'          => $sub_categories,
                'subcategories_nb_total' => count($sub_categories),
                'subcategories_nb_half'  => ceil(count($sub_categories) / 2)
            ));
        }
    }

    /**
     * Assigns product list template variables
     */
    public function assignProductList()
    {
        $hook_executed = false;
        Hook::exec('actionProductListOverride', array(
            'nbProducts'   => &$this->nbProducts,
            'catProducts'  => &$this->cat_products,
            'hookExecuted' => &$hook_executed,
        ));

        // The hook was not executed, standard working
        if (!$hook_executed) {
            $this->context->smarty->assign('categoryNameComplement', '');
            $this->nbProducts = $this->category->getProducts(null, null, null, $this->orderBy, $this->orderWay, true);
            $this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts"
            $this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay);
        }
        // Hook executed, use the override
        else {
            // Pagination must be call after "getProducts"
            $this->pagination($this->nbProducts);
        }
        
        $this->addColorsToProductList($this->cat_products);

        Hook::exec('actionProductListModifier', array(
            'nb_products'  => &$this->nbProducts,
            'cat_products' => &$this->cat_products,
        ));

        foreach ($this->cat_products as &$product) {
            if (isset($product['id_product_attribute']) && $product['id_product_attribute'] && isset($product['product_attribute_minimal_quantity'])) {
                $product['minimal_quantity'] = $product['product_attribute_minimal_quantity'];
            }
        }
        
        $this->context->smarty->assign('nb_products', $this->nbProducts);
    }

    /**
     * Returns an instance of the current category
     *
     * @return Category
     */
    public function getCategory()
    {
        return $this->category;
    }
}

Link to comment
Share on other sites

Then there are many aspects that should be considered. First of all the theme may have done an override to your controller. So you should check the directory override/controllers/front/ for the file categoryController.php.

 

i would do a search to the whole file-system of the site to find where the variables  $p_req_ur  $requestPage are being set so I can back-trace the steps of the code and find the bug.

Link to comment
Share on other sites

$p_req_ur

does not appear in any file other than header.tpl.

$requestPage

appear in pagination.tpl (as well as in default template) and header.tpl.

 

Please note: The code this is all about is not from the theme. It is custom code, that I found on the internet to add the next and prev in the header.

 

 

/override/controllers/front/CategoryController.php

<?php
class CategoryController extends CategoryControllerCore
{
/*
	* module: pluginadder
	* date: 2015-08-17 22:54:34
	* version: 1
	*/
	public function initContent()
	{
		parent::initContent();
		
		if(method_exists('Product','getProductsImgs'))
		{
		$image_array=array();
		for($i=0;$i<count($this->cat_products);$i++)
		{
			if(isset($this->cat_products[$i]['id_product']))
				$image_array[$this->cat_products[$i]['id_product']]= Product::getProductsImgs($this->cat_products[$i]['id_product']);
		}
		$this->context->smarty->assign('productimg',(isset($image_array) AND $image_array) ? $image_array : NULL);
		}
		
		
	}
}

Link to comment
Share on other sites

requestPage

0373c13cbb61257ca4f543b908cbd495fb47a13b.file.pagination.tpl.php
35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php
ad971ff5c4e0d4ad9a0793ca153984796119d8ec.file.nbr-product-page.tpl.php
nbr-product-page.tpl
pagination.tpl
header.tpl
nbr-product-page.tpl
pagination.tpl

p_req_uri

35d58a2d58d944085dae0364f3d52a5271a27f9f.file.header.tpl.php
header.tpl



 

Link to comment
Share on other sites

the fact that there is not a php file included in the results means that the error is deeper in your code. the variables are not assigned anywhere and there will always output the notices because they are never assigned!

Link to comment
Share on other sites

  • 2 weeks later...
To solve these issues you must go to the header.tpl file and find the smarty variables that trigger the notice and handle them when they are not set.

 

 

 

So for example find the {$start} variable and replace it with something like 

 



{if isset($strart)}{$start}{/if}


 

do this for the variables and you are done

Edited by Knowband Plugins (see edit history)
Link to comment
Share on other sites

Thank you for your reply Knowband Plugins,

 

My code looks like this now:

		<!--Peg start-->
		{if isset($start) && isset($pages_nb)}
	        {if $start != $pages_nb AND $p != 1}
	            {assign var = 'p_previous' value = $p-1 }
	            <link rel="prev" href="{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_previous)}" />
	        {/if}
	        {if $pages_nb > 1 AND $p != $pages_nb}
	            {assign var='p_next' value= $p+1 }
	            <link rel="next" href="{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_next)}" />
	        {/if}
		{/if}
		<!--Peg end-->

This solve one problem in the errorlog, but it seems that I still need to declare the variable in PHP somewhere, can you help me with that?

Link to comment
Share on other sites

  • 2 weeks later...

Thank you for your reply Knowband Plugins,

 

My code looks like this now:

		<!--Peg start-->
		{if isset($start) && isset($pages_nb)}
	        {if $start != $pages_nb AND $p != 1}
	            {assign var = 'p_previous' value = $p-1 }
	            <link rel="prev" href="{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_previous)}" />
	        {/if}
	        {if $pages_nb > 1 AND $p != $pages_nb}
	            {assign var='p_next' value= $p+1 }
	            <link rel="next" href="{$base_dir_ssl}{$p_req_uri[0]}{$link->goPage($requestPage, $p_next)}" />
	        {/if}
		{/if}
		<!--Peg end-->

This solve one problem in the errorlog, but it seems that I still need to declare the variable in PHP somewhere, can you help me with that?

 

Hi,

 

There is a function named pagination() in /classes/controller/FrontController.php
 
The $start and $pages_nb variables are defined here. You can handle them accordingly in this variable.
 
Note: This function is called from multiple locations in PrestaShop, so please change the code such that no effect will be there on normal functionality.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...