Jump to content

[SOLVED] Can the logo link be directed to a page according to the category ID and the related product page


Recommended Posts

We are selling shoes and handbags. One of our supplier is well known brand. They forbidden us when it is on their product and category page, to have our logo on the header be clicked and go to index page as we have new product block and on sell block that content non-them product. I have their category set up as category ID #11, 12, and 13. How can I make the logo be clicked when the customers are on their category and the related product pages, and will direct on a gbag.php for category #11 and the related produce pages, gshoes.php for category #12 and the related produce pages, accessory.php for category 13 and the related produce pages and the rest of the category and the related product pages will go to index.php?

Thank you very much for the help.

Link to comment
Share on other sites

The solution is similar to the other solutions I've given you. You need to modify line 46 of header.tpl in your theme's directory:




I'm not sure where the files gbag.php, gshoes.php and accessory.php are located. If they are located in the root directory of Prestashop, change the code above it to:

<a href="{$base_dir}{if $smarty.get.id_category == 11 OR $product->id_category_default == 11}gbag.php{elseif $smarty.get.id_category == 12 OR $product->id_category_default == 12}gshoes.php{elseif $smarty.get.id_category == 13 OR $product->id_category_default == 13}accessory.php{/if}" title="{$shop_name|escape:'htmlall':'UTF-8'}">

Link to comment
Share on other sites

It works, thank you very much.

One more question: Plus all of the situation above, when the customers click on the header logo of root/gbag.php, root/gshoes.php and root/accessory.php, it will bring them to cms14 which is delicate to the supplier's page? Thank you again for all o the help.

Link to comment
Share on other sites

Do the files gbag.php, gshoes.php and accessory.php include the Prestashop header? If they do, you can use the following code to change the link on these pages to CMS page 14:

<a href="{$base_dir}{if $smarty.get.id_category == 11 OR $product->id_category_default == 11}gbag.php{elseif $smarty.get.id_category == 12 OR $product->id_category_default == 12}gshoes.php{elseif $smarty.get.id_category == 13 OR $product->id_category_default == 13}accessory.php{elseif $page_name == 'gbag' OR $page_name == 'gshoes' OR $page_name == 'accessory'}cms.php?id_cms=14{/if}" title="{$shop_name|escape:'htmlall':'UTF-8'}">



This code assumes that you have friendly URLs disabled. If you have them enabled, you should change cms.php?id_cms=14 to something like content/14-title

Link to comment
Share on other sites

<?php

include(dirname(__FILE__).'/config/config.inc.php');
include(dirname(__FILE__).'/header.php');

$smarty->display(_PS_THEME_DIR_.'gbag.tpl');

include(dirname(__FILE__).'/footer.php');

?>



I used the above codes to make the pages. Am I doing it right? Do I add the codes that you just gave me plus the codes that you gave me a few thread ago? Or they are seperate? If they are, how can I make these 3 pages to have these commend instead of global commend since I am using golbal header for every page?

Link to comment
Share on other sites

You've almost got it right. I think you are missing one line. Here's what it should be:

<?php

include(dirname(__FILE__).'/config/config.inc.php');
include(dirname(__FILE__).'/init.php');
include(dirname(__FILE__).'/header.php');

$smarty->display(_PS_THEME_DIR_.'gbag.tpl');

include(dirname(__FILE__).'/footer.php');

?>

Link to comment
Share on other sites

You've almost got it right. I think you are missing one line. Here's what it should be:

<?php

include(dirname(__FILE__).'/config/config.inc.php');
include(dirname(__FILE__).'/init.php');
include(dirname(__FILE__).'/header.php');

$smarty->display(_PS_THEME_DIR_.'gbag.tpl');

include(dirname(__FILE__).'/footer.php');

?>



I got it. Thank you very much.
Link to comment
Share on other sites

×
×
  • Create New...