Jump to content

cms page as homepage and other newb questions


Berik

Recommended Posts

Hi, I'm a total prestashop newb so sorry if these questions seem stupid :)

I'm seriously considering using PS for an small upcoming client site mainly for it's simple multilanguage support.

What I'm trying to achieve is to have a cms page as the homepage by default, a few subsequent cms pages and finally the store itself. If you were to look at the navigation it would look something like this:

Home | About | News | Store

• So my first question obviously is: how do i set a static cms page as homepage?


• Second issue I'm trying to figure out is how to remove the "/content/" part of the SEF url for the cms pages?


• Last issue: what plugin/module could I use to have a simple news/blog-like system? Doesn't need to be a full blown wordpress type of thing, just a simple way for my client to post news articles and let visitors comment them, and have a way of displaying them as a list on a page. I already tried Eihwaz's free news modules (found here) but that's already too complicated as I don't need categories and there is no tab in the backoffice.
My client is not tech-saavy and really needs something simple and straigthforward. I'm not necessarelly searching for a free system (althought I wouldn't mind^^). It just needs to work without me having to spend countless hours hacking it!

Thanks in advance for any help you can bring!

Link to comment
Share on other sites

For the first question: Copy cms.php into index.php and then adding the ID of the CMS page to the top should work. Replace index.php in the root directory of PrestaShop with the following:

<?php

$_GET['id_cms'] = 3;

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

//will be initialized bellow...
if(intval(Configuration::get('PS_REWRITING_SETTINGS')) === 1)
   $rewrited_url = null;

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

if (($id_cms = intval(Tools::getValue('id_cms'))) AND $cms = new CMS(intval($id_cms), intval($cookie->id_lang)) AND Validate::isLoadedObject($cms))
{
   /* rewrited url set */
   $rewrited_url = $link->getCmsLink($cms, $cms->link_rewrite);

   include(dirname(__FILE__).'/header.php');
   $smarty->assign(array(
       'cms' => $cms,
       'content_only' => intval(Tools::getValue('content_only'))
   ));

   $smarty->display(_PS_THEME_DIR_.'cms.tpl');
   include(dirname(__FILE__).'/footer.php');
}
else
   Tools::redirect('404.php');

?>



Change 3 at the top to the ID of the CMS page.

For the second question: You can't remove /content/ since PrestaShop requires it to distingish between categories and CMS pages. You can, however, change it from "content" to something else. To do that, edit your .htaccess file and change "content" to something else like "page", then edit the getCMSLink() function in classes/Link.php and change "content" to "page" there too.

Link to comment
Share on other sites

  • 3 months later...
  • 2 months later...

@Rocky,

Could you be slightly more elaborate? Do I understand it correctly if :

I take the code from root/cms.php and paste this above the code in root/index.php ?
Then take your code and paste this in root/index.php and overwrite it, I really don't get it....


Or should I just paste your code and overwrite the index.php?

Cheers,

Steven

Link to comment
Share on other sites

Copy the entire cms.php file into index.php, replacing everything in that file, then add the following below the <?php:

$_GET['id_cms'] = 3;



Change 3 to the ID of the CMS page you want displayed as the homepage.

  • Like 1
Link to comment
Share on other sites

I get it. Works like a charm! In fact I'm looking for the same solution as Berik does.

Home | About | News | Store
So start of with some CMS pages (I get that now) but when you click on Store you should see the page with featured products and stuff, like the "normal" frontpage. Any tips?
Thanks again.

Steven
Link to comment
Share on other sites

  • 2 years later...

For the first question: Copy cms.php into index.php and then adding the ID of the CMS page to the top should work. Replace index.php in the root directory of PrestaShop with the following:

 

<?php

$_GET['id_cms'] = 3;

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

//will be initialized bellow...
if(intval(Configuration::get('PS_REWRITING_SETTINGS')) === 1)
$rewrited_url = null;

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

if (($id_cms = intval(Tools::getValue('id_cms'))) AND $cms = new CMS(intval($id_cms), intval($cookie->id_lang)) AND Validate::isLoadedObject($cms))
{
/* rewrited url set */
$rewrited_url = $link->getCmsLink($cms, $cms->link_rewrite);

include(dirname(__FILE__).'/header.php');
$smarty->assign(array(
	'cms' => $cms,
	'content_only' => intval(Tools::getValue('content_only'))
));

$smarty->display(_PS_THEME_DIR_.'cms.tpl');
include(dirname(__FILE__).'/footer.php');
}
else
Tools::redirect('404.php');

?>

 

Change 3 at the top to the ID of the CMS page.

 

For the second question: You can't remove /content/ since PrestaShop requires it to distingish between categories and CMS pages. You can, however, change it from "content" to something else. To do that, edit your .htaccess file and change "content" to something else like "page", then edit the getCMSLink() function in classes/Link.php and change "content" to "page" there too.

 

I Have a Query

 

How do i get shop page (old hom page) if i change default index.php?

  • Like 1
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...