When I click on HOME in Prestashop I want to go to my main product page

When I click on HOME in Prestashop I want to go to my main product page

Thanks to Jon Lin I was able to Redirect my PRESTASHOP site to go to the PRODUCT page instead of the HOME page when someone clicks on my site URL.

As of now I have only 1 product on my site so I always want to go to that PRODUCT page.

However now, when someone is on my site and they are on some other page, maybe in the cart..., and they click on HOME I would like to have them go back to the main PRODUCT page. NOT the actual HOME page.

Thanks for your help.


In the configurations, in SEO and URLs, change the base uri to your product page.

PrestaShop 1.6 User Guide, Theme Installator's exporter: open the module's configuration page, then go to the "Export Once all the parameters are correctly set, click on "Generate the archive now". to have his or her shop be accessible to mobile devices: from the home page to the payment process, along with product pages and conversion funnel. As soon as you give your new product a name and click on the "Save and stay" button at the bottom, more buttons appear at the top of the product page: Preview. Displays the front office page of your product. This is very handy, as it works even if the product is disabled ("Information" tab). Duplicate. Creates an exact copy of the current product.


The redirect method is good if you absolutely must go to your category, however I have an alternative method. For SEO reasons I believe you should not do a redirect. What I would do is I would add homefeatured module to your homepage and add pagination to it, making it just like a category. First off I would make a backup of your homefeatured files in the core and your theme before testing, however this worked for me on 1.5.4 version.

You can do so by adding a file named paginationHomeFeatured.tpl to ./themes/yourtheme/modules/homefeatured/<HERE> with the following code..

{*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@prestashop.com 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 <contact@prestashop.com>
*  @copyright  2007-2012 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}
{if isset($no_follow) AND $no_follow}
{assign var='no_follow_text' value='rel="nofollow"'}
{else}
{assign var='no_follow_text' value=''}
{/if}
{if isset($p) AND $p}
  {assign var='requestPage' value=$base_dir|cat:'index.php'}
  {assign var='requestNb' value=$base_dir|cat:'index.php'}
{* {assign var='requestNb' value=$smarty.section.pagination.limits} *}

<!-- Pagination -->
<div id="pagination" class="pagination">
{if $start!=$stop}
  <ul class="pagination">
  {if $p != 1}
   {assign var='p_previous' value=$p-1}
   <li id="pagination_previous"><a {$no_follow_text} href="{$link->goPage($requestPage, $p_previous)}">&laquo;&nbsp;{l s='Previous'}</a></li>
  {else}
   <li id="pagination_previous" class="disabled"><span>&laquo;&nbsp;{l s='Previous'}</span></li>
  {/if}
  {if $start==3}
   <li><a {$no_follow_text}  href="{$link->goPage($requestPage, 1)}">1</a></li>
   <li><a {$no_follow_text}  href="{$link->goPage($requestPage, 2)}">2</a></li>
  {/if}
  {if $start==2}
   <li><a {$no_follow_text}  href="{$link->goPage($requestPage, 1)}">1</a></li>
  {/if}
  {if $start>3}
   <li><a {$no_follow_text}  href="{$link->goPage($requestPage, 1)}">1</a></li>
   <li class="truncate">...</li>
  {/if}
  {section name=pagination start=$start loop=$stop+1 step=1}
   {if $p == $smarty.section.pagination.index}
    <li class="current"><span>{$p|escape:'htmlall':'UTF-8'}</span></li>
   {else}
    <li><a {$no_follow_text} href="{$link->goPage($requestPage, $smarty.section.pagination.index)}">{$smarty.section.pagination.index|escape:'htmlall':'UTF-8'}</a></li>
   {/if}
  {/section}
  {if $pages_nb>$stop+2}
   <li class="truncate">...</li>
   <li><a href="{$link->goPage($requestPage, $pages_nb)}">{$pages_nb|intval}</a></li>
  {/if}
  {if $pages_nb==$stop+1}
   <li><a href="{$link->goPage($requestPage, $pages_nb)}">{$pages_nb|intval}</a></li>
  {/if}
  {if $pages_nb==$stop+2}
   <li><a href="{$link->goPage($requestPage, $pages_nb-1)}">{$pages_nb-1|intval}</a></li>
   <li><a href="{$link->goPage($requestPage, $pages_nb)}">{$pages_nb|intval}</a></li>
  {/if}
  {if $pages_nb > 1 AND $p != $pages_nb}
   {assign var='p_next' value=$p+1}
   <li id="pagination_next"><a {$no_follow_text} href="{$link->goPage($requestPage, $p_next)}">{l s='Next'}&nbsp;&raquo;</a></li>
  {else}
   <li id="pagination_next" class="disabled"><span>{l s='Next'}&nbsp;&raquo;</span></li>
  {/if}
  </ul>
{/if}
{if $nb_products > $products_per_page}
  <form action="{if !is_array($requestNb)}{$requestNb}{else}{$requestNb.requestUrl}{/if}" method="get" class="pagination">
   <p>
    {if isset($search_query) AND $search_query}<input type="hidden" name="search_query" value="{$search_query|escape:'htmlall':'UTF-8'}" />{/if}
    {if isset($tag) AND $tag AND !is_array($tag)}<input type="hidden" name="tag" value="{$tag|escape:'htmlall':'UTF-8'}" />{/if}
    <input type="submit" class="button_mini" value="{l s='OK'}" />
    <label for="nb_item">{l s='items:'}</label>
    <select name="n" id="nb_item">
    {assign var="lastnValue" value="0"}
    {foreach from=$nArray item=nValue}
         {if $lastnValue <= $nb_products}
          <option value="{$nValue|escape:'htmlall':'UTF-8'}" {if $n == $nValue}selected="selected"{/if}>{$nValue|escape:'htmlall':'UTF-8'}</option>
         {/if}
         {assign var="lastnValue" value=$nValue}
    {/foreach}
    </select>
    {if is_array($requestNb)}
         {foreach from=$requestNb item=requestValue key=requestKey}
          {if $requestKey != 'requestUrl'}
           <input type="hidden" name="{$requestKey|escape:'htmlall':'UTF-8'}" value="{$requestValue|escape:'htmlall':'UTF-8'}" />
          {/if}
         {/foreach}
    {/if}
   </p>
  </form>
{/if}
</div>
<!-- /Pagination -->
{/if}

Next, change homefeatured.tpl to..

{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@prestashop.com 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 <contact@prestashop.com>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}

<!-- MODULE Home Featured Products -->
<div id="featured-products_block_center" class="block products_block clearfix">
    <p class="title_block">{l s='Featured products' mod='homefeatured'}</p>
    {if isset($products) AND $products}
        <div class="block_content">
            {assign var='liHeight' value=250}
            {assign var='nbItemsPerLine' value=4}
            {assign var='nbLi' value=$products|@count}
            {math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines}
            {math equation="nbLines*liHeight" nbLines=$nbLines|ceil liHeight=$liHeight assign=ulHeight}
            <ul style="height:{$ulHeight}px;">
            {foreach from=$products item=product name=homeFeaturedProducts}
                {math equation="(total%perLine)" total=$smarty.foreach.homeFeaturedProducts.total perLine=$nbItemsPerLine assign=totModulo}
                {if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if}
                <li class="ajax_block_product {if $smarty.foreach.homeFeaturedProducts.first}first_item{elseif $smarty.foreach.homeFeaturedProducts.last}last_item{else}item{/if} {if $smarty.foreach.homeFeaturedProducts.iteration%$nbItemsPerLine == 0}last_item_of_line{elseif $smarty.foreach.homeFeaturedProducts.iteration%$nbItemsPerLine == 1} {/if} {if $smarty.foreach.homeFeaturedProducts.iteration > ($smarty.foreach.homeFeaturedProducts.total - $totModulo)}last_line{/if}">
                    <a href="{$product.link}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" />{if isset($product.new) && $product.new == 1}<span class="new">{l s='New' mod='homefeatured'}</span>{/if}</a>
                    <p class="s_title_block"><a href="{$product.link}" title="{$product.name|truncate:50:'...'|escape:'htmlall':'UTF-8'}">{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}</a></p>
                    <div class="product_desc"><a href="{$product.link}" title="{l s='More' mod='homefeatured'}">{$product.description_short|strip_tags|truncate:65:'...'}</a></div>
                    <div>
                        <a class="lnk_more" href="{$product.link}" title="{l s='View' mod='homefeatured'}">{l s='View' mod='homefeatured'}</a>
                        {if $product.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}<p class="price_container"><span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span></p>{else}<div style="height:21px;"></div>{/if}

                        {if ($product.id_product_attribute == 0 OR (isset($add_prod_display) AND ($add_prod_display == 1))) AND $product.available_for_order AND !isset($restricted_country_mode) AND $product.minimal_quantity == 1 AND $product.customizable != 2 AND !$PS_CATALOG_MODE}
                            {if ($product.quantity > 0 OR $product.allow_oosp)}
                            <a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product}" href="{$link->getPageLink('cart')}?qty=1&amp;id_product={$product.id_product}&amp;token={$static_token}&amp;add" title="{l s='Add to cart' mod='homefeatured'}">{l s='Add to cart' mod='homefeatured'}</a>
                            {else}
                            <span class="exclusive">{l s='Add to cart' mod='homefeatured'}</span>
                            {/if}
                        {else}
                            <div style="height:23px;"></div>
                        {/if}
                    </div>
                </li>
            {/foreach}
            </ul>
        </div>
    {else}
        <p>{l s='No featured products' mod='homefeatured'}</p>
    {/if}

    {* To add pagination - add three line below *}
    <div class="content_sortPagiBar homefeaturedPaged">
        {include file="./paginationHomeFeatured.tpl"}
    </div>

</div>
<!-- /MODULE Home Featured Products -->

Lastly, edit homefeatured.php in your core directory.

<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@prestashop.com 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 <contact@prestashop.com>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/

if (!defined('_PS_VERSION_'))
    exit;

class HomeFeatured extends Module
{
    private $_html = '';
    private $_postErrors = array();

    function __construct()
    {
        $this->name = 'homefeatured';
        $this->tab = 'front_office_features';
        $this->version = '0.9';
        $this->author = 'PrestaShop';
        $this->need_instance = 0;

        parent::__construct();

        $this->displayName = $this->l('Featured products on the homepage.');
        $this->description = $this->l('Displays featured products in the middle of your homepage.');
    }

    function install()
    {
        if (!Configuration::updateValue('HOME_FEATURED_NBR', 8) || !parent::install() || !$this->registerHook('displayHome') || !$this->registerHook('header'))
            return false;
        return true;
    }

    public function getContent()
    {
        $output = '<h2>'.$this->displayName.'</h2>';
        if (Tools::isSubmit('submitHomeFeatured'))
        {
            $nbr = (int)(Tools::getValue('nbr'));
            if (!$nbr OR $nbr <= 0 OR !Validate::isInt($nbr))
                $errors[] = $this->l('An invalid number of products has been specified.');
            else
                Configuration::updateValue('HOME_FEATURED_NBR', (int)($nbr));
            if (isset($errors) AND sizeof($errors))
                $output .= $this->displayError(implode('<br />', $errors));
            else
                $output .= $this->displayConfirmation($this->l('Your settings have been updated.'));
        }
        return $output.$this->displayForm();
    }

    public function displayForm()
    {
        $output = '
        <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post">
            <fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend>
                <p>'.$this->l('To add products to your homepage, simply add them to the "home" category.').'</p><br />
                <label>'.$this->l('Define the number of products to be displayed.').'</label>
                <div class="margin-form">
                    <input type="text" size="5" name="nbr" value="'.Tools::safeOutput(Tools::getValue('nbr', (int)(Configuration::get('HOME_FEATURED_NBR')))).'" />
                    <p class="clear">'.$this->l('Define the number of products that you would like to display on homepage (default: 8).').'</p>

                </div>
                <center><input type="submit" name="submitHomeFeatured" value="'.$this->l('Save').'" class="button" /></center>
            </fieldset>
        </form>';
        return $output;
    }

    public function hookDisplayHeader($params)
    {
        $this->hookHeader($params);
    }

    public function hookHeader($params)
    {
        $this->context->controller->addCSS(($this->_path).'homefeatured.css', 'all');
    }

    public function hookDisplayHome($params)
    {
/*      $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
        $nb = (int)(Configuration::get('HOME_FEATURED_NBR'));
        $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10));

        $this->smarty->assign(array(
            'products' => $products,
            'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
            'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
        ));

        return $this->display(__FILE__, 'homefeatured.tpl');
*/



        $controller = new FrontController();
            $controller->productSort();
        $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
            $nbProducts = $category->getProducts(NULL, NULL, NULL, $controller->orderBy, $controller->orderWay, true);
        $controller->pagination($nbProducts);

        $this->smarty->assign('nb_products', $nbProducts);

        $products = $category->getProducts((int)Context::getContext()->language->id, (int)($controller->p),
                (int)($controller->n), $controller->orderBy, $controller->orderWay);

        $this->smarty->assign(array(
                'products' => $products,
                'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
                'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
                'id_category' => (int)($category->id),
                'id_category_parent' => (int)($category->id_parent),
                'return_category_name' => Tools::safeOutput($category->name),
                'path' => Tools::getPath((int)($category->id), $category->name)
                ));

        return $this->display(__FILE__, 'homefeatured.tpl');












    }
}

That would be my solution to avoid a redirect on the homepage. Hope that helps.

Ebook PrestaShop v1.6 User-Guide: Ebook PrestaShop v1.6, Click on the 'edit' icon at the right in order to add text that fits your shop's trust features. Once this value is saved, go into the configuration page ofa product of your Repeat for all of the products that you want to place on the home page. PrestaShop is an efficient and innovative e-commerce solution with all the features you need to create an online store and grow your business. Customize your store Choose your colors, your logo and a design from among a selection of professional-looking themes .


It is easy to fix. Lets consider your product product id is 5 and also ignore the SEO friendly urls at the moment. Open the file controllers/front/IndexController.php and add the following code somewhere in the only initContent function.

Tools::redirect('index.php?id_product=5&controller=product');

Now when ever some comes to home page of the site, that user will be redirected to the product page. If SEO friendly urls are enabled, then prestashop will automatically display SEO url in the address bar of the prestashop for that particular product.

Mode dev must be set to false

Please change id_product 5 to your product id.

Hope this will help you.

Home featured products: how to change? - General , How can I select which products to view in home-featured block? you can go to the "Modules and Services" tab and then click the "Configure" Otherwise, you'll have to manually edit the module, find the ID 2 and change it  In order to change the homepage meta tags, you simply need to open the "SEO & URLs" page, open the "index" page's settings, and there you can freely edit some important SEO information. A few tips: The default homepage title is the name of the store, and therefore the index' title field is empty.


It worked for me. In my case, I changed the home page to another URL which is mine. Other product pages still work normal. To do that, go to controllers/front/IndexController.php and change add the following code somewhere in the initContent function.

Tools::redirect('http://newwebsiteurl.com/');

That is you will delete all the contents in the function below

{
    parent::initContent();
    $this->addJS(_THEME_JS_DIR_.'index.js');

    $this->context->smarty->assign(array('HOOK_HOME' => Hook::exec('displayHome'),
        'HOOK_HOME_TAB' => Hook::exec('displayHomeTab'),
        'HOOK_HOME_TAB_CONTENT' => Hook::exec('displayHomeTabContent')
    ));
    $this->setTemplate(_PS_THEME_DIR_.'index.tpl');
}

and replace it with something like this:

 {
    parent::initContent();

    Tools::redirect('http://newwebsiteurl.com/');

}

It worked for me on my website Soup Embassy and I hope does for you too. If you check the URL on Soup Category here, you will see that it is in a directory /buy-online/ and when you click on the home link or logo, it will redirect you to a URL without the extension. I hope you find this helpful.

[Solved] Home Page Product Display - Addons , Now all product show in my home page is oldest product cry. add those products to category "Home" that you want them to be displayed at home page click configure and set Number of product displayed and save it Go to the Preferences > Products tab and change the "Order way" to "Descending". Free product reviews module for new PrestaShop 1.7.x this addon is a modification of old productcomments module that we have by default in each installation of prestashop 1.6.x / 1.5.x. Now it fully supports new releases of PS 1.7.x. Module has exactly the same features as previous versions with


Products - Image click redirect to link - Configuring and , I wanna make a simple website with links to my main website. the "More" button link to go to a separate website with it's own product page. However now we have a new problem: Going into Catalogue->Products->Product page our Product page will not display any content. Print screen attached: Any one know any work around for this? Thanks. PS: Forgot to add the version of Prestashop used: Server information. Server information: Linux #1 SMP Tue Mar 27 11:42:17 MSD 2012 x86_64


featured products on homepage in prestashop 1.6, I have this showing twice in my home page. settings in the back office in Preferences - Themes, then click on the edit button for your theme. Prestashop CMS page gallery with easy short code implementation. Prestashop CMS Shortcode Gallery module comes with one click installation and gives flexibility to place these short codes anywhere in your CMS pages.


How to Display Popular Products as a Home page , My prestashop version is 1.6 and I am using spare parts theme. help me that how can I display popular products as a home content in prestashop. click on transplant button I need to implement this for product and manufacturer both. module named popular products come along with the prestashop. Few stumble upon the home page, and this is why it should be tailored to new users. Product listing pages. Categories, tags, manufacturers, suppliers, search, specials page, best sellers page or new products page: PrestaShop has many paths to a product, but in the end the customers is given a familiar listing of products, within the chosen context.