This post has been moved to the following LinkedIn article as I am not maintaining this blog here anymore.
https://www.linkedin.com/pulse/prestashop-how-create-custom-page-without-cms-iftakhar-hasan/
This post has been moved to the following LinkedIn article as I am not maintaining this blog here anymore.
https://www.linkedin.com/pulse/prestashop-how-create-custom-page-without-cms-iftakhar-hasan/
how to access that custom page ?
LikeLike
Try xyz.com/index.php?page=custom-page, replace xyz.com with the address of your site and custom-page with the name of your PHP file.
LikeLiked by 1 person
Hi,
I have creating custom page but now i want to add email on this page so please provide m some help. How can i add mail in this page
LikeLike
Hello I followed your tutorial, but when I hit the page index.php?page=custom-page nothing appear it brings the first page of the shop. Any advice? I use prestashop 1.6.0.9
LikeLike
If the file is there, it should load. Are you sure that you have uploaded the file in proper location and the file-names are okay?
LikeLike
Yes I put them in proper location. Can you help on how I should call CSS and JavaScript inside the {literal}{/literal}?
thank you
LikeLike
I mean is neccessary to add css and javascript so to see a “hello” message or is not?
LikeLike
So is your page showing up now or not?
Sorry, I didn’t understand your last question. What are you trying to do?
LikeLike
no my page doesn’t appear, I am not sure if css code is necessary, because I didnt use any. I am just try to display a “hello” message. My goal is to make a custom form. but first I need to see the page. thank you
LikeLike
The CSS part is optional, you’ll only need it if you are trying to incorporate some page specific styling that is not included in the global CSS.
I am not sure what causing you the trouble.
LikeLike
Finally my page is displayed. I just had to add it under SEO & URLS.
thank you
LikeLiked by 1 person
Great article. I used your code to create my custom prestashop pages and it works well but I’m struggling with a couple of things. My new page has . I think this might also be causing some scripts not to load. {HOOK_HEADER} does not get loaded on this page and I’m wondering if its all related to that body tag not being set properly. Any help would be appreciated.
LikeLike
Hello again. I saw that you also wanted to build a custom form. Could you help me on how I make it too. I know that is diffrent question from your post but I could not find any other tutorial for a custom form.
thank you.
LikeLike
There are lots of ways depending on the functionality of your form. Just work on the custom-page.tpl file, see my comments in the code, use HTML for form elements, CSS for styles and JavaScript for functionality.
LikeLike
Good post.
If I go directly to xyz.com/custom-page.php It shows the content but the javascript for the nav menu and other resources don’t get loaded.
And if i go to xyz.com/index.php?page=custom-page It shows the index page, and looks like the code in “CustomPageController” is not executed.
¿Why is repeated the part of include the custom-page.tpl in the Controller and in the custom-page,php?
-CustomPageController:
$this->setTemplate(_PS_THEME_DIR_.’custom-page.tpl’);
-custom-page.php:
$smarty->display(_PS_THEME_DIR_.’custom-page.tpl’);
LikeLike
I found something. changing the request parameters sent in the request it works.
index.php?controller=custom-page
LikeLiked by 1 person
Thanks, diegomtylop. I really appreciate your further research on the topic, good work!
LikeLike
Hi Iftakhar, I have a question maybe you could answer, I have been doing a lot of research but no luck. Y created a custom html landing page, for a campaign, that I will link to my product page. I can upload the file to the root folder, and no problem it loads. But because it loads with my domain, and I will have it in different languages, I’d like to be able to load it with the /fr or /it in the domain, for SEO purposes. What do you think I should do?
(I reached this post because I was looking at the possibility to fully customize a cms page, but I have not found a way to do it).
LikeLike
Hey sebacrispo, sorry for the late reply, haven’t been around here for quite a while. I haven’t worked with multi-language options before. But from your description, I would recommend you to do it with JavaScript. Write your code and then put it inside the script tag (enclosed by {literal}{/literal} tags of course) that I showed in the 3rd step. Good Luck!
LikeLike
Dear Seba,
Have you solved the problem of multilenguage, Let me know! I have the same issue
Thanks and regards
LikeLike
A vast and large THANKSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS to you…………..
LikeLiked by 1 person
You’re welcome Kazi. I’m glad that it came to your help. 🙂
LikeLike
Great article. I used your code to create my custom prestashop pages and it works well but I’m struggling with a couple of things. My new page has . I think this might also be causing some scripts not to load. {HOOK_HEADER} does not get loaded on this page and I’m wondering if its all related to that body tag not being set properly. Any help would be appreciated.
LikeLike
Hey jrstafford1, make sure your directory structure are okay and the template codes are properly written. Good Luck!
LikeLike
Looks like some of my comment was stripped out. The sentence that is cut off should say… The new page has class = page-not-found in the body tag.
LikeLike
hi i want to add recharge facility to my prestashop website, how do i do it? i am total numb at coding php and other things, i have sample php pages of recharge api from recharge company who is giving me api for their recharge system. how do i do this ? can you guide me for the same.
LikeLike
Hi I managed to create a new page and everything loads fine. But the problem with my html form is it has php POST in the input fields, which is also printed in the page. I understand that tpl will not allow using php code in it. Is there any other way i can accomplish this?
For example next to my username it prints this php statement.
Username :
Can i not show it on the php page?
LikeLike
Hi Shrilekha, I saw a forum post once that may come to your aid:
https://www.prestashop.com/forums/topic/282592-how-to-add-a-contact-form-to-a-cms-page/
But in that case, I’m afraid you have to cancel the work you have done so far with the method I showed here. Good luck!
LikeLike
Hello Iftakhar, Thank you for the wonderful post. I tried it the only problem that i am getting is that i am having the page title as “404 error” is there a way to fix the problem? thanx.
LikeLike
Hey suraj! Delete the current cache of your store and see if the problem still shows up. Here’s how to clear cache for 1.6:
http://www.psfever.com/2014/clear-cache-prestashop-1-6/
LikeLike
Hi Guys,
All works nicely
I have only one issue, how change the TITLE of the page.
Also because it’s a dynamic field.
I had already added the “custom-page”, in the SEO and URLs
Do you know how to fix it?
PS: Cache cleared
LikeLike
Hey Andrea! Sorry for the late reply. I was busy with a lot of other stuffs. Is that the meta title you are referring to? If so, here is an easy way. Instead of loading the original header, make a new file with everything copied from the main header file, but replacing the title loading part with a manual title, and include it in the first php file I made. Let me know if it works. And of course, if you do figure out a more elegant approach, do share it with us. Good luck!
LikeLike
Hi..looks like the codes mentioned in the post were stripped off..can anyone share it please?
LikeLike
Hi Iftakhar Hasan,
Thanks for the great tuts..Everything is working fine except for 2 things:
— The Title in the window tab still says 404 error even after clearing PS cache
— The columns on the left is no longer showing (using default theme)
LikeLike
Thanks for the great tutorial.
I followed through using my own file names but the result was a totally blank page.
So I went through again using the custom-page name without making changes to your code and ended up with the same result.
My V1.6.0.10 site uses friendly URLs so to call the page I just use http://www.site.com/custom-page
The page was linked in the Preferences->SEO & URLs
Any suggestions?
LikeLike
Adding this to the Controller Class helped me to get rid of the 404 Error. Also the left menu is now shown:
public $php_self = ‘custom-page’;
public $ssl = true;
LikeLiked by 1 person
Thanks, I have it working now. This is proving to be very useful. I also had a missing ‘>’ that caused an issue.
LikeLike
where should I add these lines? the page is working, only the title shows 404 error. Preferences->SEO & URLs does not fix the title name issue.
ps tutorial is great! helped a lot.
LikeLike
My custom page is working but every time I update the code I need to clear cache because the page will not show if I don’t clear. How can I fix that. Thanks!
LikeLike
How to leave only content of custom-page.tpl, without header, footer….. only custom page content
LikeLike
You mean omit the header and the footer? Just disable line 10 and 14 from custom-page.php.
LikeLike
Hi Iftakhar hasan
Thanks for your article 🙂
Its worked for me.
but its give error like page_name is not defined, and also in body tag id=”pagenotfound” ,so i missed page name
please give me solution
thanks in advance 🙂
LikeLike
I absolutely love your website.. Very nice colors
& theme. Did you make this amazing site yourself?
Please reply back as I’m trying to create my own personal blog and want to learn where
you got this from or just what the theme is called.
Many thanks!
LikeLike
Thanks Jim. I’m using Nucleare theme.
LikeLike
Hi Iftakhar,
Thanks for your article 🙂
I did like the steps you explained
but its gives 50 error , i added the page from BO -> seo and urls,
still shows the same error.
please give me solution
Thanks in advance.
LikeLike
1)
if you receive 500error you must change your environment to developer mode:
On your server, open the /config/defines.inc.php file.
Find this line: define(‘PS_MODE_DEV‘, false);
In this line, change “false” to “true”.
Save your changes.
2)
for controller you must Remove class_index.php
cache/class_index.php
LikeLiked by 1 person
sorry 500 Error*
LikeLike
Hi there! I’ve created my custom page following this tutorial. The only way to reach the page is the URL: https://mysite.com/index.php?controller=custompage. I can’t see the page’s name on breadcrumbs. I’ve added it under SEO&URLs and i’m using PrestaShop v. 1.6.1.11 Can you help me, please? Thanks!
LikeLike
Remove class_index.php in:
cache/class_index.php
LikeLiked by 1 person
Hi abdezakari! Thanks for your help. I’ve removed “class_index.php” from cache as you’ve suggested me, but the name of the page doesn’t appear. Any idea?
LikeLike
Hi tag Soup ,
under SEO&URLs you have :
page =Controllername Example(Users)
Title page= Welcome
URL= name example (user)
you can call mysite.com/name and not mysite.com/index.php?controller=custompage
LikeLike
[…] This above part is for the custom pages and thanks to https://iftakharhasa…age-without-cms […]
LikeLike
Part 2?
LikeLike
I follow your tutorials i have made a custom-page
double checked everthing is properly done according to your tutorial
but is not working for me.
can you please help….
LikeLike
Is there any different if we apply these steps using Prestashop 1.7? If there is different, please make a tutorial! Because I can’t find it anywhere. Thank u!
LikeLike
I already tried using version 1.7 but it didn’t work
LikeLike
Hello,
I have to browse to the file like this: domain.com/link.php how to browse to it like this: domain.com/link without the .php extension
LikeLike
And.. how send email from this custom page?
LikeLike