Jump to content
HA!*!*Y

[Override] Friendly Urls Without Id Number For V1.5

Recommended Posts

Hi,

 

thanks for the work. I have installed the module on 1.5.6.0 and 1.6.0.9, and it works great.

 

I do have a problem though on the 1.5 version of Prestashop.

 

Starting from second level categories, all URLs are fine, displaying as www.mysite.com/cat1/subcat1/subcat2/product.html

 

However, the top categories must have "root" as a slug, displaying as www.mysite.com/root/cat1/ (URL without root www.mysite.com/cat1/ displays error message "this page doesn't exist)

 

I do not understand where this comes from- could anyone help? I obviously want to remove "root" for SEO reasons.

The only tweak I made is remove the info/ for CMS pages, but surely that cannot be the source of the problem?

Edited by Konyak666 (see edit history)

Share this post


Link to post
Share on other sites

Hey!

 

Thank you for the awesome module!

 

I have a little problem though. PS version: 1.5.6.0

 

Everything works fine, except the main categories, for example:

test.com/cars/ford/ford-fiesta.html : works

test.com/cars/ford/ : works

test.com/cars/ : page not exist error (but it should work, regarding to it's SEO friendly URL)

 

my config on SEO & URLs for product and categories:

Products: {category:/}{rewrite}.html

Categories: {categories:/}{rewrite}/

 

I played with these settings, but I cannot sort it out.

 

Can somebody advise?

It would be much appreciated.

 

Regards:

tUb26

I have the same problem, kinda sorted adding root/ ahead of the top categories (see my previous post).

Have you sorted your issue? I am looking for a solution, should anyone have one before I do, please post! ;)

Share this post


Link to post
Share on other sites

I have the same problem, kinda sorted adding root/ ahead of the top categories (see my previous post).

Have you sorted your issue? I am looking for a solution, should anyone have one before I do, please post! ;)

Not yet, still looking for the solution as well.

  • Like 1

Share this post


Link to post
Share on other sites

Not yet, still looking for the solution as well.

 

OK I found a way.

You should uninstall clean URL module following the instruction on the very first page of this topic.

 

Once this is done, install "very clean URL" module by lebodia on this link -I can't find his post in this topic but eternal gratitude to him XD

 

make sure your seo and url settings are as follows:

 

products: {categories:/}{rewrite} (no .html at the end)

categories: {parent_categories:/}{rewrite}/

 

I have customized my routes to cms and others so if you need help in these let me know (dispatcher under override/classes/ is your best friend)

 

Keep in mind to clear browser cache / PS cache under smarty/cache and smarty/compile

 

Good luck, contact me if you have any problem :) 

  • Like 2

Share this post


Link to post
Share on other sites

OK I found a way.

You should uninstall clean URL module following the instruction on the very first page of this topic.

 

Once this is done, install "very clean URL" module by lebodia on this link -I can't find his post in this topic but eternal gratitude to him XD

 

make sure your seo and url settings are as follows:

 

products: {categories:/}{rewrite} (no .html at the end)

categories: {parent_categories:/}{rewrite}/

 

I have customized my routes to cms and others so if you need help in these let me know (dispatcher under override/classes/ is your best friend)

 

Keep in mind to clear browser cache / PS cache under smarty/cache and smarty/compile

 

Good luck, contact me if you have any problem :)

Thank you, it works like a charm. :)

  • Like 1

Share this post


Link to post
Share on other sites

Hi, what is advice for shop using this free module in 1.4.0.9 that has been upgraded to 1.6.0.9.  It is currently disabled and front office cat/products all 404.

 

the version is 0.1

 

I currently have 'disable' prestashop overrides enabled.

 

thanks, el

Share this post


Link to post
Share on other sites

OK I found a way.

You should uninstall clean URL module following the instruction on the very first page of this topic.

 

Once this is done, install "very clean URL" module by lebodia on this link -I can't find his post in this topic but eternal gratitude to him XD

 

make sure your seo and url settings are as follows:

 

products: {categories:/}{rewrite} (no .html at the end)

categories: {parent_categories:/}{rewrite}/

 

I have customized my routes to cms and others so if you need help in these let me know (dispatcher under override/classes/ is your best friend)

 

Keep in mind to clear browser cache / PS cache under smarty/cache and smarty/compile

 

Good luck, contact me if you have any problem :)

 

yes that worked on 1.6.0.9 :) thank you, btw I did a fork on github which support url rewriting for smartblog module which was in conflict with the Dispatcher override 

Share this post


Link to post
Share on other sites

Hello All and Happy New Year.

 

I've tested in 1.6 and beside redirect everything looks fine. Does anyone encountered redirect issues?

 

Entered the old page .../6-name_of_products did not redirect to new one .../name_of_products

 

Thank you for in advance.

 

CC

Share this post


Link to post
Share on other sites

Hello, im having problem with the url of the insert images only on subcategories. I use 1.6.0.9 ( clean url - v0.42 ) 

 

Please help.

 

post-752260-0-88763700-1420460680_thumb.jpg

 

On the root category is working fine.

 

post-752260-0-41216300-1420460683_thumb.jpg

 

Thanks

Share this post


Link to post
Share on other sites

Hi all,

 

Just upgraded to PS 1.6.11 and the Lebioda-PrestaShop-modules-CleanURLs-7dd5383 does not work :(

Anybody got an idea how to fix this? I need the Category ID gone :)

Share this post


Link to post
Share on other sites

Hi all,

 

Just upgraded to PS 1.6.11 and the Lebioda-PrestaShop-modules-CleanURLs-7dd5383 does not work :(

Anybody got an idea how to fix this? I need the Category ID gone :)

Here the same i can't get it to remove the ID from the url

 

Paul

Share this post


Link to post
Share on other sites

you should uninstall Lebodia's module, which is specific for PS1.5, not 1.6. Get your settings back to normal after uninstalling, and clear PS cache/ browser cache.

Then you should install Clean URL V0.42 (see 1st page of this topic).

 

On another level, you should check your links if you use the horizontal menu module that comes native with PS1.6.

Share this post


Link to post
Share on other sites

I did all of that i have complete uninstall and install the Clean URL but stil the product and catagorie has a ID

 

Paul

Share this post


Link to post
Share on other sites

Hello i found two errors in the overrides:

 

First, if you want to change the Shop to Force SSL, the Category Link in the Topmenu, Breadrcumbs, and Blockcategory not right, only shows www not https://www.

 

Here the solution:

 

override/classes/Link.php

 

change line 41 to

 

$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);

 

 

Second issue: if everyone has problem with the root directory that not shows on Product URL  like

 

myshop.com/rootCategory/subcategory/product.html

 

try this:

 

override/classes/Dispatcher,php

change line 86 

 

'categories' => array('regexp' => '[/_a-zA-Z0-9-\pL]*'),

 

to

 

'categories' => array('regexp' => '[/_a-zA-Z0-9-\pL]*', 'param' => 'categories_rewrite'),

 

also change the rewrite rule on the line80 to

 

'rule' => '{categories:/}{rewrite}.html',

 

and in backend for the product rewrite in SEO to {categories:/}{rewrite} 

 

IMPORTANT: delete the classes_index.php in the cache. After that uncheck and check the mod _rewrite in the Backend And try it,

 

it works  ;)

Edited by m3442a (see edit history)

Share this post


Link to post
Share on other sites

Hello i found two errors in the overrides:

 

First, if you want to change the Shop to Force SSL, the Category Link in the Topmenu, Breadrcumbs, and Blockcategory not right, only shows www not https://www.

 

Here the solution:

 

override/classes/Link.php

 

change line 41 to

 

$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);

 

 

Second issue: if everyone has problem with the root directory that not shows on Product URL  like

 

myshop.com/rootCategory/subcategory/product.html

 

try this:

 

override/classes/Dispatcher,php

change line 86 

 

'categories' => array('regexp' => '[/_a-zA-Z0-9-\pL]*'),

 

to

 

'categories' => array('regexp' => '[/_a-zA-Z0-9-\pL]*', 'param' => 'categories_rewrite'),

 

also change the rewrite rule on the line80 to

 

'rule' => '{categories:/}{rewrite}.html',

 

and in backend for the product rewrite in SEO to {categories:/}{rewrite} 

 

IMPORTANT: delete the classes_index.php in the cache. After that uncheck and check the mod _rewrite in the Backend And try it,

 

it works  ;)

 

Hi there m3442a,

 

Is this the solution for PS 1.6.11?

Share this post


Link to post
Share on other sites

hello everybody! I have a problem with cleanurl and i can t remove {ID} from URL on my site http://store.marciy.com . After installing i saw next errors:

 

Warning on line 1560 in file /home/c/cg28108/store/public_html/classes/controller/AdminController.php

[2] Cannot modify header information - headers already sent by (output started at /home/c/cg28108/store/public_html/override/classes/Link.php:237)

 

plz help me, . Prestashop v1.6.0.11

Share this post


Link to post
Share on other sites

"Hi there m3442a,


Is this the solution for PS 1.6.11?"


 


I try with 1.6.0.9 and also works ;)


Share this post


Link to post
Share on other sites

DEFINITIVE GUIDE PRESTASHOP 1.6.0.9. .

 

(This not works on 1.6.0.11 go to next page and follow #537 and #539 messages for that new version)

 

REMOVE ID ON URL, CLEAN URL, PRETTY URL, SEO.

 

Thanks, I reuse your information
 

 

 

If you have old module, you should uninstall clean URL module following the instruction on the very first page of this topic.

 

I attach the module compressed down

Install the module. It is "very clean URL" module by lebodia

 

 

Make sure your seo and url settings are as follows:

 

This is MANDATORY

products:          {category:/}{rewrite} (no .html at the end OBLIGATORY)

categories:       {parent_categories:/}{rewrite}/

manufacturers: manufacturer/{rewrite}

CMS:                "WHAT YOU WANT"/{rewrite}

 

{rewrite}/filter{selected_filters}

supplier/{rewrite}

module/{module}{/:controller}

 

Keep in mind to clear browser cache / PS cache under smarty/cache and smarty/compile

 

 

FAQ:

 

If you have another version of prestashop, I don't know if it's works. It would works on all 1.5 -1.6.

cleanurls 1.6.0.9 lebodia.zip

Edited by maximo88 (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Hello maximo88

Thanks for your reaction. I have testet it but the problem is i cant save it without the {id} in the url (presta 1.6.0.11)

Share this post


Link to post
Share on other sites

Hi PaulNLD,

 

try this:

{category:/}{rewrite}   not {categories:/}{rewrite}

{parent_categories:/}{rewrite}

{rewrite}/filter{selected_filters}

supplier/{rewrite}

manufacturer/{rewrite}

info/{rewrite}

info/{rewrite}

module/{module}{/:controller}

 

Cheers

Whiley

  • Like 1

Share this post


Link to post
Share on other sites

Hello Whiley,

 

Thanks for the fast answer but when i change the lines i get an error ( see below) i can't get to save it normaly

 

Keyword "{id}" required for route "product_rule" (rule: "{category:/}{rewrite}")

 

Paul

Share this post


Link to post
Share on other sites

 

Thanks for the fast answer but when i change the lines i get an error ( see below) i can't get to save it normaly

 

Keyword "{id}" required for route "product_rule" (rule: "{category:/}{rewrite}")

Paul,

 

this is the normal error-message if you don't have installed mod clenurls.

 

So let's check your installation (PS 1.6.0.11):

1. unzip the file "cleanurls 1.6.0.11 lebodia.zip"

2. Inside you found a folder "cleanurls, copy this whole folder to your server /modules

3 In the backoffice go to Modules-->modules,  select clenurls click on install

4. BO -->preferences -->SEO&URLs  "Friendly Urls" click on "NO" --> save

5. BO -->Advanced Parameters -->performance clean cache and also "force compilation (later you can change this back)

6. BO -->preferences -->SEO&URLs  "Friendly Urls" click on "yes" --> save

7. BO -->preferences -->SEO&URLs  "Friendly Urls" make the above changes for the paths

 

 

Hope this helps.

Cheers

Whiley

cleanurls 1.6.0.11 lebodia.zip

Edited by Whiley (see edit history)
  • Like 2

Share this post


Link to post
Share on other sites

Whiley,

 

I get same errors for all 7 lines who need a rewrite without the ID

 

Paul

Share this post


Link to post
Share on other sites

mod_rewrite is activ on your server ?

can you look if the the .htaccess in your shopfolder is new-created (same date/time of point 6 above)

Edited by Whiley (see edit history)

Share this post


Link to post
Share on other sites

Whiley,

 

The htaccess is new and mod rewrite is enabled. it alway's worked. til the upgrade

 

The problem is i can't save a rewrite rule without the {id}

 

Can i change it in the database or so ??

Share this post


Link to post
Share on other sites

 

Can i change it in the database or so ??

of couse, open the table ps(or whatever)_configuration and look for PS_ROUTE_product_rule

 

But i think that the override of cleanurl is not working!

 

Cheers

Whiley

Share this post


Link to post
Share on other sites

DEFINITIVE GUIDE PRESTASHOP 1.6.0.9.

 

REMOVE ID ON URL, CLEAN URL, PRETTY URL, SEO.

 

 

 

 

If you have old module, you should uninstall clean URL module following the instruction on the very first page of this topic.

 

I attach the module compressed down

Install the module. It is "very clean URL" module by lebodia

 

 

Make sure your seo and url settings are as follows:

 

This is MANDATORY

products:          {categories:/}{rewrite} (no .html at the end OBLIGATORY)

categories:       {parent_categories:/}{rewrite}/

manufacturers: {rewrite}

CMS:                "WHAT YOU WANT"/{rewrite}

 

Keep in mind to clear browser cache / PS cache under smarty/cache and smarty/compile

 

 

FAQ:

 

If you have another version of prestashop, I don't know if it's works. It would works on all 1.5 -1.6.

tnx. it works

  • Like 1

Share this post


Link to post
Share on other sites

I use Prestashop 1.6.0.11.

And after i installed this Module the URLs looks pretty, without IDs, but I have an other error.

 

If I go to checkout (onepage) and klick SAVE (first step), i have this error. 

TECHNICAL ERROR: unable to save account Details: Error thrown: [object Object] Text status: error
Edited by prest9 (see edit history)

Share this post


Link to post
Share on other sites

Hi there,

 

With Prestashop 1.6.11 it keeps giving me the error that an {id} is required in the link structure.

It wont save the rewrite if I dont put a {id} in it.

 

Uninstalled as written here and installed new version. Wont help :(

Share this post


Link to post
Share on other sites

Hi, thanks for the module!

 

When installing I'm getting the following:

 

 

"The modules were not installed properly:

 

cleanurls:

 

Unable to install override: The method init in the class ProductController is already overriden."

 

 

How can I add this override to the already overridden controller?

 

I'm using prestashop 1.6.0.9

 

Thank you!

Edited by Egocefalo (see edit history)

Share this post


Link to post
Share on other sites

Hi, 

 

Somebody help me with this?

 

Module cleanurls 1.6.0.11 lebodia.zip doesnt work for me on Prestashop 1.6.0.11. All my URL's working fine (product, categories, cms), but URL's in my cart does'nt work, still giving me the "404 not found".

 

When I click on the "login page" or "add to cart" or "order-history", I get back "404 not found".

 

Any solutions?

 

Sorry for my english and thanks for help 

Edited by okibobo (see edit history)

Share this post


Link to post
Share on other sites

Hi, 

 

Somebody help me with this?

 

Module cleanurls 1.6.0.11 lebodia.zip doesnt work for me on Prestashop 1.6.0.11. All my URL's working fine (product, categories, cms), but URL's in my cart does'nt work, still giving me the "404 not found".

 

When I click on the "login page" or "add to cart" or "order-history", I get back "404 not found".

 

Any solutions?

 

Sorry for my english and thanks for help 

 

Same error...  :(  :(  :(  :(

Share this post


Link to post
Share on other sites

Hi, 

 

Somebody help me with this?

 

Module cleanurls 1.6.0.11 lebodia.zip doesnt work for me on Prestashop 1.6.0.11. All my URL's working fine (product, categories, cms), but URL's in my cart does'nt work, still giving me the "404 not found".

 

When I click on the "login page" or "add to cart" or "order-history", I get back "404 not found".

 

Any solutions?

 

Sorry for my english and thanks for help 

just for clarification purposes that lebodia 1.6.0.11 zip is the same as the lebodia 1.6.0.9 zip and I guess is the same exact file which is hosted on github here http://lebioda.githu...ules-CleanURLs/ what is not the same is prestashop 1.6.0.11 changed in some way that makes the override not working anymore on cart pages, login, paginations so if you want to use this clean url I recommend for the time being to stick on 1.6.0.9

I did a fork here which is the most "up-to-date" version of cleanurl on github https://github.com/wayann/PrestaShop-modules-CleanURLs/

 

I'm fiddling since a few days on it... and still couldn't find a solution for 1.6.0.11, if I found I solution I'll let you know.

Edited by wayann (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Ok I think I found the culprit the regexp in Dispatcher method addRoute has been changed to

$regexp = '#^/'.$regexp.'$#u';

fixed on my fork on github https://github.com/wayann/PrestaShop-modules-CleanURLs

 

this is working on 1.6.0.11 and the 1.6.0.12 beta

 

or download the attachment below, test throughly before use in production.

 

EDIT

doing so we still have the utf8 url encoded chars bug, which was the one who broke cleanurl -> http://forge.prestashop.com/browse/PSCSX-3635

1.6.0.12-cleanurl-inrg.zip

Edited by wayann (see edit history)
  • Like 3

Share this post


Link to post
Share on other sites

Thanks for help Wayan, 

 

 

when I can try your updated module upload to my prestashop, nothings happend.  Admin show, the module is downloaded, but I dont see it in my modules list and via ftp is the same. Module isnt there.

 

Have any idea, what is the problem?

Share this post


Link to post
Share on other sites

Thanks for help Wayan, 

 

 

when I can try your updated module upload to my prestashop, nothings happend.  Admin show, the module is downloaded, but I dont see it in my modules list and via ftp is the same. Module isnt there.

 

Have any idea, what is the problem?

ops yes I just uploaded the zip file from github, I reuploaded the attachment so now you can add it thru the back office, please re-download attachment.

  • Like 1

Share this post


Link to post
Share on other sites
Good job Wayan,

 

cart already works, all the steps the same and then I go to the end, I choose bankwire transfer, display it a confirmation page, but when I have to confirm the order, show this:

"500 Server Error

Oops, something went wrong.

Try to refresh this page or feel free to contact us if the problem persists."

 

Thank you for trying, but I let it go because it does not work well with module Smartblog that I would use.

 

Thank you for your effort.

Share this post


Link to post
Share on other sites
Sorry,

 

my mistake, the error 500 problem was not caused by this module. But it is not working together with the module smartblog. There is a main page of blog with url: http://mypage.com/blog.html and this url give back "404 page not found". But url of the blog posts are working fine. Only blog category and blog archive and main page of blog not working.

Possibly it would be necessary to make changes in module smartblog too.

Share this post


Link to post
Share on other sites

how to make smartblog work with cleanurl

 

1 - replace all content of smarblog > controllers > front > details.php  file with this 

<?php

include_once(dirname(__FILE__).'/../../classes/controllers/FrontController.php');
class  smartblogDetailsModuleFrontController extends smartblogModuleFrontController
{
    public $ssl = true;
    public $_report = '';
    private $_postsObject;

	public function init()
	{ 
		parent::init();
	}
	public function initContent()
	{
		
           parent::initContent();
		   $id_post = $this->getIdPost($_GET['slug']);
		   Hook::exec('actionsbsingle', array('id_post' => $id_post));
           $blogcomment = new Blogcomment();
           $SmartBlogPost = new SmartBlogPost();
           $BlogCategory = new BlogCategory();
           // $id_post = $id_post;
           $id_lang = $this->context->language->id;
           $id_lang_defaut = Configuration::get('PS_LANG_DEFAULT');
           $post = $SmartBlogPost->getPost($id_post,$id_lang);
           $tags = $SmartBlogPost->getProductTags($id_post);
           $comment = $blogcomment->getComment($id_post);
           $countcomment = $blogcomment->getToltalComment($id_post);
           $id_cate = $post['id_category'];
           $title_category = $BlogCategory->getNameCategory($id_cate);
            if (file_exists(_PS_MODULE_DIR_.'smartblog/images/' . $id_post . '.jpg') )
                {
                   $post_img =  $id_post;
                }else{
                    $post_img = 'no';
                }
           
	   SmartBlogPost::postViewed($id_post);
           
           $this->context->smarty->assign(array(
                                            'post'=>$post,
                                            'comments'=>$comment,
                                            'tags'=>$tags,
                                            'title_category'=>$title_category[0]['meta_title'],
                                            'cat_link_rewrite'=>$title_category[0]['link_rewrite'],
                                            'meta_title'=>$post['meta_title'],
                                            'post_active'=>$post['active'],
                                            'content'=>$post['content'],
                                            'id_post'=>$post['id_post'],
                                            'smartshowauthorstyle'=>Configuration::get('smartshowauthorstyle'),
                                            'smartshowauthor'=>Configuration::get('smartshowauthor'),
                                            'created'=>$post['created'],
                                            'firstname'=>$post['firstname'],
                                            'lastname'=>$post['lastname'],
                                            'smartcustomcss' => Configuration::get('smartcustomcss'),
                                            'smartshownoimg' => Configuration::get('smartshownoimg'),
                                            'comment_status'=>$post['comment_status'],
                                            'countcomment'=>$countcomment,
                                            'post_img'=>$post_img,
                                            '_report'=>$this->_report,
                                            'id_category'=>$post['id_category']
                                            ));
	   $this->context->smarty->assign('HOOK_SMART_BLOG_POST_FOOTER',
					  Hook::exec('displaySmartAfterPost'));
           $this->setTemplate('posts.tpl');		
	}
	
	// return all vars for socialsharing 
	
	public function getPostVars($id_post, $slug)
	{
		
		
	   Hook::exec('actionsbsingle', array('id_post' => $id_post));
	    $blog_url = smartblog::GetSmartBlogLink('smartblog');
		$img_url =  'smartblog/images/' . $id_post . '.jpg';
		$uri = $blog_url.'/'.$slug;
        $blogcomment = new Blogcomment();
        $SmartBlogPost = new SmartBlogPost();
        $BlogCategory = new BlogCategory();
        $id_lang = $this->context->language->id;
        $id_lang_defaut = Configuration::get('PS_LANG_DEFAULT');
        $post = $SmartBlogPost->getPost($id_post,$id_lang);
        $tags = $SmartBlogPost->getProductTags($id_post);
        $comment = $blogcomment->getComment($id_post);
        $countcomment = $blogcomment->getToltalComment($id_post);
        $id_cate = $post['id_category'];
        $title_category = $BlogCategory->getNameCategory($id_cate);
		$cat_uri = $blog_url.'/motif/'.$title_category[0]['link_rewrite'];
		
		return array( 'post'=>$post,
					  'slug'=>$slug,
					  'uri'=>$uri,
					  'cat_uri'=>$cat_uri,
					  'img_url'=>$img_url,
                      'comments'=>$comment,
                      'tags'=>$tags,
                      'title_category'=>$title_category[0]['meta_title'],
                      'meta_title'=>$post['meta_title'],
                      'post_active'=>$post['active'],
                      'content'=>$post['content'],
                      'id_post'=>$post['id_post'],
                      'created'=>$post['created'],
                      'firstname'=>$post['firstname'],
                      'lastname'=>$post['lastname'],
                      'comment_status'=>$post['comment_status'],
                      'countcomment'=>$countcomment,
                      '_report'=>$this->_report,
                      'id_category'=>$post['id_category']
                    );
	}
	
	// get id_post from slug
	public function getIdPost($slug)
	{		
		if ($slug === '') {
			return 1;
		}
		$sql = 'SELECT `id_smart_blog_post` FROM `'._DB_PREFIX_.'smart_blog_post_lang`
				WHERE `link_rewrite` = \''.$slug.'\' AND `id_lang` = '. Context::getContext()->language->id;
		if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP)
		{
			$sql .= ' AND `id_shop` = '.(int)Shop::getContextShopID();
		}
		
		$id_post = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);	

		return $id_post;
	}
	
     public function _posts(){
           
            $SmartBlogPost = new SmartBlogPost();
         
            if(Tools::isSubmit('addComment')){
                $id_lang = $this->context->language->id;
                $id_post = $id_post;
                $post = $SmartBlogPost->getPost($id_post,$id_lang);
                if($post['comment_status'] == 1){
                $blogcomment = new Blogcomment();
                $name = Tools::getValue('name');
                $comment = Tools::getValue('comment');
                $mail = Tools::getValue('mail');
                if(Tools::getValue('mail') == '')
                {
                    $website = '#';
                }else{
                    $website = Tools::getValue('website');
                }

                $id_parent_post = (int)Tools::getValue('id_parent_post');
                
                if(empty($name)){
                    $this->_report .= '<p class="error">'.$this->module->l('Name is required').'</p>';
                }
                elseif(empty($comment)){
                    $this->_report .= '<p class="error">'.$this->module->l('Comment is required').'</p>';
                }
                elseif(!filter_var($mail,FILTER_VALIDATE_EMAIL)){
                    $this->_report .= '<p class="error">'.$this->module->l('E-mail is not valid').'</p>';
                }
                else
                {
                    $comments['name'] = $name;
                    $comments['mail'] = $mail;
                    $comments['comment'] = $comment;
                    $comments['website'] = $website;
                    if(!$id_parent_post = Tools::getvalue('comment_parent'))
                    {
                        $id_parent_post = 0;
                    }
                    $value = Configuration::get('smartacceptcomment');
                    if(Configuration::get('smartacceptcomment') != '' && Configuration::get('smartacceptcomment') != null){
                       $value = Configuration::get('smartacceptcomment');
                    }else{
                        $value = 0;
                    }
                        $bc = new Blogcomment();
                        $bc->id_post = (int)$id_post;
                        $bc->name = $name;
                        $bc->email = $mail;
                        $bc->content = $comment;
                        $bc->website = $website;
                        $bc->id_parent = (int)$id_parent_post;
                        $bc->active = (int)$value;
                        if($bc->add()){
						   $this->_report.='<p class="success">'.$this->module->l('Comment added !').'</p>';
						   Hook::exec('actionsbpostcomment', array('bc' => $bc));
						   $this->smartsendMail($name,$mail,$comment);
                        }
                }
               }
        }
        }
	private function smartsendMail($sname,$semailAddr,$scomment,$slink = null)
    {
			$name =  Tools::stripslashes($sname);
			$e_body ='You have Received a New Comment In Your Blog Post From '. $name . '. Comment: '.$scomment.' .Your Can reply Here : '.$slink.'';
			$emailAddr =  Tools::stripslashes($semailAddr);
			$comment =  Tools::stripslashes($scomment);
			$subject =  'New Comment Posted';
			$id_lang = (int)Configuration::get('PS_LANG_DEFAULT');	
			$to =  Configuration::get('PS_SHOP_EMAIL');
			$contactMessage =  
				"
				$comment 
				Name: $name
				IP: ".((version_compare(_PS_VERSION_, '1.3.0.0', '<'))?$_SERVER['REMOTE_ADDR']:Tools::getRemoteAddr());
				if(Mail::Send($id_lang,
					'contact',
					$subject,
					array(
						'{message}' => nl2br($e_body),
						'{email}' =>  $emailAddr,
					),
					$to,
					null,
					$emailAddr,
					$name
				))
				return true;
    }
}

2 - replace all content of smarblog > controllers > front > category.php  file with this 

<?php

include_once(dirname(__FILE__).'/../../classes/controllers/FrontController.php');
class smartblogCategoryModuleFrontController extends smartblogModuleFrontController
{
    public $ssl = true;
    public $smartblogCategory;

    public function init(){
            parent::init();
    }
    public function initContent(){
           parent::initContent();
           $category_status = '';
           $totalpages = '';
           $cat_image = 'no';
           $categoryinfo = '';
           $title_category = '';
           $cat_link_rewrite = '';
            $blogcomment = new Blogcomment();
            $SmartBlogPost = new SmartBlogPost();
            $BlogCategory = new BlogCategory();
            $BlogPostCategory = new BlogPostCategory();
			$sluggish = '';
			if (isset($_GET['slug'])) {
				$slugissh = 1;
			} else {
				$sluggish = isset($_GET['slug']);
			}
            $id_category = $this->getIdCategory($sluggish);
                $posts_per_page = Configuration::get('smartpostperpage');
                $limit_start = 0;
                $limit = $posts_per_page;
                if(!$id_category = $this->getIdCategory($sluggish))
                {
                        $total = $SmartBlogPost->getToltal($this->context->language->id);
                }else{
                        $total = $SmartBlogPost->getToltalByCategory($this->context->language->id,$id_category);
                        Hook::exec('actionsbcat', array('id_category' => $this->getIdCategory($sluggish)));
                }
                if($total != '' || $total != 0)
                    $totalpages = ceil($total/$posts_per_page);
                if((boolean)Tools::getValue('page')){
                $c = Tools::getValue('page');
                    $limit_start = $posts_per_page * ($c - 1);
            }
                if(!$id_category = $this->getIdCategory($sluggish))
                {
                    $allNews = $SmartBlogPost->getAllPost($this->context->language->id,$limit_start,$limit);
                }else{
                    if (file_exists(_PS_MODULE_DIR_.'smartblog/images/category/' . $id_category. '.jpg'))
                    {
                       $cat_image =   $id_category;
                    }
                    else
                    {
                       $cat_image = 'no';
                    }
                    $categoryinfo = $BlogCategory->getNameCategory($id_category);
                    $title_category = $categoryinfo[0]['meta_title'];
                    $category_status = $categoryinfo[0]['active'];
                    $cat_link_rewrite = $categoryinfo[0]['link_rewrite'];
                    if($category_status == 1){
                    $allNews = $BlogPostCategory->getToltalByCategory($this->context->language->id,$id_category,$limit_start,$limit);
                    }
                    elseif($category_status == 0)
                    {
                    $allNews = '';
                    }
                }
            $i = 0;
            if(!empty($allNews)){
                foreach($allNews as $item){
                    $to[$i] = $blogcomment->getToltalComment($item['id_post']);
                   $i++;
                }
                $j = 0;
                foreach($to as $item){
                    if($item == ''){
                        $allNews[$j]['totalcomment'] = 0;
                    }else{
                        $allNews[$j]['totalcomment'] = $item;
                    }
                    $j++;
                }
            }
            
            $this->context->smarty->assign( array(
                                            'postcategory'=>$allNews,
                                            'category_status'=>$category_status,
                                            'title_category'=>$title_category,
                                            'cat_link_rewrite'=>$cat_link_rewrite,
                                            'id_category'=>$id_category,
                                            'cat_image'=>$cat_image,
                                            'categoryinfo'=>$categoryinfo,
                                            'smartshowauthorstyle'=>Configuration::get('smartshowauthorstyle'),
                                            'smartshowauthor'=>Configuration::get('smartshowauthor'),
                                            'limit'=>isset($limit) ? $limit : 0,
                                            'limit_start'=>isset($limit_start) ? $limit_start : 0 ,
                                            'c'=>isset($c) ? $c : 1,
                                            'total'=>$total,
                                            'smartblogliststyle' => Configuration::get('smartblogliststyle'),
                                            'smartcustomcss' => Configuration::get('smartcustomcss'),
                                            'smartshownoimg' => Configuration::get('smartshownoimg'),
                                            'smartdisablecatimg' => Configuration::get('smartdisablecatimg'),
                                            'smartshowviewed' => Configuration::get('smartshowviewed'),
                                            'post_per_page'=>$posts_per_page,
                                            'pagenums' => $totalpages - 1,
                                            'totalpages' =>$totalpages
                                            ));
            
       $template_name  = 'postcategory.tpl';
               
            $this->setTemplate($template_name );        
    }
	// get id_post from slug
	public function getIdCategory($slug)
	{		
		if ($slug === '') {
			return 1;
		}
		$sql = 'SELECT `id_smart_blog_category` FROM `'._DB_PREFIX_.'smart_blog_category_lang`
				WHERE `link_rewrite` = \''.$slug.'\' AND `id_lang` = '. Context::getContext()->language->id;
		if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP)
		{
			$sql .= ' AND `id_shop` = '.(int)Shop::getContextShopID();
		}
		
		$id_category = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);	

		return $id_category;
	}
 }

3 - download the attachment below 1.6.0.12-cleanurl-smartblog-hack-inrg.zip

 

that should get you in the path I think, don't remember if it needs more tweaks.... it's quick and dirt.

 

 

 

 

 

1.6.0.12-cleanurl-smartblog-hack-inrg.zip

Share this post


Link to post
Share on other sites

Hi, has this plugin affect the eshop speed and stability? Or is it same as before installation?

Share this post


Link to post
Share on other sites

It doesn't affect, please think before post.

 

What is the difference for a computer writing www.google.com/125-cooking or www.google.com/cooking.

 

NONE!

 

-----------------------------

 

@wayann I really appreciate your work. You are a crack on prestashop! (Muchas gracias compañero!)

Edited by maximo88 (see edit history)

Share this post


Link to post
Share on other sites

Chill out :-) I told the same to my client, but someone persuade him otherwise :-) So now I've got another argument from another source :-) Thanks

Share this post


Link to post
Share on other sites

Hi, has this plugin affect the eshop speed and stability? Or is it same as before installation?

 

I wouldn't care about speed. There are many other things that can slow your site. For stability, see your 404 and 500 error logs.

Share this post


Link to post
Share on other sites

how to make smartblog work with cleanurl

 

1 - replace all content of smarblog > controllers > front > details.php  file with this 

<?php

include_once(dirname(__FILE__).'/../../classes/controllers/FrontController.php');
class  smartblogDetailsModuleFrontController extends smartblogModuleFrontController
{
    public $ssl = true;
    public $_report = '';
    private $_postsObject;

	public function init()
	{ 
		parent::init();
	}
	public function initContent()
	{
		
           parent::initContent();
		   $id_post = $this->getIdPost($_GET['slug']);
		   Hook::exec('actionsbsingle', array('id_post' => $id_post));
           $blogcomment = new Blogcomment();
           $SmartBlogPost = new SmartBlogPost();
           $BlogCategory = new BlogCategory();
           // $id_post = $id_post;
           $id_lang = $this->context->language->id;
           $id_lang_defaut = Configuration::get('PS_LANG_DEFAULT');
           $post = $SmartBlogPost->getPost($id_post,$id_lang);
           $tags = $SmartBlogPost->getProductTags($id_post);
           $comment = $blogcomment->getComment($id_post);
           $countcomment = $blogcomment->getToltalComment($id_post);
           $id_cate = $post['id_category'];
           $title_category = $BlogCategory->getNameCategory($id_cate);
            if (file_exists(_PS_MODULE_DIR_.'smartblog/images/' . $id_post . '.jpg') )
                {
                   $post_img =  $id_post;
                }else{
                    $post_img = 'no';
                }
           
	   SmartBlogPost::postViewed($id_post);
           
           $this->context->smarty->assign(array(
                                            'post'=>$post,
                                            'comments'=>$comment,
                                            'tags'=>$tags,
                                            'title_category'=>$title_category[0]['meta_title'],
                                            'cat_link_rewrite'=>$title_category[0]['link_rewrite'],
                                            'meta_title'=>$post['meta_title'],
                                            'post_active'=>$post['active'],
                                            'content'=>$post['content'],
                                            'id_post'=>$post['id_post'],
                                            'smartshowauthorstyle'=>Configuration::get('smartshowauthorstyle'),
                                            'smartshowauthor'=>Configuration::get('smartshowauthor'),
                                            'created'=>$post['created'],
                                            'firstname'=>$post['firstname'],
                                            'lastname'=>$post['lastname'],
                                            'smartcustomcss' => Configuration::get('smartcustomcss'),
                                            'smartshownoimg' => Configuration::get('smartshownoimg'),
                                            'comment_status'=>$post['comment_status'],
                                            'countcomment'=>$countcomment,
                                            'post_img'=>$post_img,
                                            '_report'=>$this->_report,
                                            'id_category'=>$post['id_category']
                                            ));
	   $this->context->smarty->assign('HOOK_SMART_BLOG_POST_FOOTER',
					  Hook::exec('displaySmartAfterPost'));
           $this->setTemplate('posts.tpl');		
	}
	
	// return all vars for socialsharing 
	
	public function getPostVars($id_post, $slug)
	{
		
		
	   Hook::exec('actionsbsingle', array('id_post' => $id_post));
	    $blog_url = smartblog::GetSmartBlogLink('smartblog');
		$img_url =  'smartblog/images/' . $id_post . '.jpg';
		$uri = $blog_url.'/'.$slug;
        $blogcomment = new Blogcomment();
        $SmartBlogPost = new SmartBlogPost();
        $BlogCategory = new BlogCategory();
        $id_lang = $this->context->language->id;
        $id_lang_defaut = Configuration::get('PS_LANG_DEFAULT');
        $post = $SmartBlogPost->getPost($id_post,$id_lang);
        $tags = $SmartBlogPost->getProductTags($id_post);
        $comment = $blogcomment->getComment($id_post);
        $countcomment = $blogcomment->getToltalComment($id_post);
        $id_cate = $post['id_category'];
        $title_category = $BlogCategory->getNameCategory($id_cate);
		$cat_uri = $blog_url.'/motif/'.$title_category[0]['link_rewrite'];
		
		return array( 'post'=>$post,
					  'slug'=>$slug,
					  'uri'=>$uri,
					  'cat_uri'=>$cat_uri,
					  'img_url'=>$img_url,
                      'comments'=>$comment,
                      'tags'=>$tags,
                      'title_category'=>$title_category[0]['meta_title'],
                      'meta_title'=>$post['meta_title'],
                      'post_active'=>$post['active'],
                      'content'=>$post['content'],
                      'id_post'=>$post['id_post'],
                      'created'=>$post['created'],
                      'firstname'=>$post['firstname'],
                      'lastname'=>$post['lastname'],
                      'comment_status'=>$post['comment_status'],
                      'countcomment'=>$countcomment,
                      '_report'=>$this->_report,
                      'id_category'=>$post['id_category']
                    );
	}
	
	// get id_post from slug
	public function getIdPost($slug)
	{		
		if ($slug === '') {
			return 1;
		}
		$sql = 'SELECT `id_smart_blog_post` FROM `'._DB_PREFIX_.'smart_blog_post_lang`
				WHERE `link_rewrite` = \''.$slug.'\' AND `id_lang` = '. Context::getContext()->language->id;
		if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP)
		{
			$sql .= ' AND `id_shop` = '.(int)Shop::getContextShopID();
		}
		
		$id_post = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);	

		return $id_post;
	}
	
     public function _posts(){
           
            $SmartBlogPost = new SmartBlogPost();
         
            if(Tools::isSubmit('addComment')){
                $id_lang = $this->context->language->id;
                $id_post = $id_post;
                $post = $SmartBlogPost->getPost($id_post,$id_lang);
                if($post['comment_status'] == 1){
                $blogcomment = new Blogcomment();
                $name = Tools::getValue('name');
                $comment = Tools::getValue('comment');
                $mail = Tools::getValue('mail');
                if(Tools::getValue('mail') == '')
                {
                    $website = '#';
                }else{
                    $website = Tools::getValue('website');
                }

                $id_parent_post = (int)Tools::getValue('id_parent_post');
                
                if(empty($name)){
                    $this->_report .= '<p class="error">'.$this->module->l('Name is required').'</p>';
                }
                elseif(empty($comment)){
                    $this->_report .= '<p class="error">'.$this->module->l('Comment is required').'</p>';
                }
                elseif(!filter_var($mail,FILTER_VALIDATE_EMAIL)){
                    $this->_report .= '<p class="error">'.$this->module->l('E-mail is not valid').'</p>';
                }
                else
                {
                    $comments['name'] = $name;
                    $comments['mail'] = $mail;
                    $comments['comment'] = $comment;
                    $comments['website'] = $website;
                    if(!$id_parent_post = Tools::getvalue('comment_parent'))
                    {
                        $id_parent_post = 0;
                    }
                    $value = Configuration::get('smartacceptcomment');
                    if(Configuration::get('smartacceptcomment') != '' && Configuration::get('smartacceptcomment') != null){
                       $value = Configuration::get('smartacceptcomment');
                    }else{
                        $value = 0;
                    }
                        $bc = new Blogcomment();
                        $bc->id_post = (int)$id_post;
                        $bc->name = $name;
                        $bc->email = $mail;
                        $bc->content = $comment;
                        $bc->website = $website;
                        $bc->id_parent = (int)$id_parent_post;
                        $bc->active = (int)$value;
                        if($bc->add()){
						   $this->_report.='<p class="success">'.$this->module->l('Comment added !').'</p>';
						   Hook::exec('actionsbpostcomment', array('bc' => $bc));
						   $this->smartsendMail($name,$mail,$comment);
                        }
                }
               }
        }
        }
	private function smartsendMail($sname,$semailAddr,$scomment,$slink = null)
    {
			$name =  Tools::stripslashes($sname);
			$e_body ='You have Received a New Comment In Your Blog Post From '. $name . '. Comment: '.$scomment.' .Your Can reply Here : '.$slink.'';
			$emailAddr =  Tools::stripslashes($semailAddr);
			$comment =  Tools::stripslashes($scomment);
			$subject =  'New Comment Posted';
			$id_lang = (int)Configuration::get('PS_LANG_DEFAULT');	
			$to =  Configuration::get('PS_SHOP_EMAIL');
			$contactMessage =  
				"
				$comment 
				Name: $name
				IP: ".((version_compare(_PS_VERSION_, '1.3.0.0', '<'))?$_SERVER['REMOTE_ADDR']:Tools::getRemoteAddr());
				if(Mail::Send($id_lang,
					'contact',
					$subject,
					array(
						'{message}' => nl2br($e_body),
						'{email}' =>  $emailAddr,
					),
					$to,
					null,
					$emailAddr,
					$name
				))
				return true;
    }
}

2 - replace all content of smarblog > controllers > front > category.php  file with this 

<?php

include_once(dirname(__FILE__).'/../../classes/controllers/FrontController.php');
class smartblogCategoryModuleFrontController extends smartblogModuleFrontController
{
    public $ssl = true;
    public $smartblogCategory;

    public function init(){
            parent::init();
    }
    public function initContent(){
           parent::initContent();
           $category_status = '';
           $totalpages = '';
           $cat_image = 'no';
           $categoryinfo = '';
           $title_category = '';
           $cat_link_rewrite = '';
            $blogcomment = new Blogcomment();
            $SmartBlogPost = new SmartBlogPost();
            $BlogCategory = new BlogCategory();
            $BlogPostCategory = new BlogPostCategory();
			$sluggish = '';
			if (isset($_GET['slug'])) {
				$slugissh = 1;
			} else {
				$sluggish = isset($_GET['slug']);
			}
            $id_category = $this->getIdCategory($sluggish);
                $posts_per_page = Configuration::get('smartpostperpage');
                $limit_start = 0;
                $limit = $posts_per_page;
                if(!$id_category = $this->getIdCategory($sluggish))
                {
                        $total = $SmartBlogPost->getToltal($this->context->language->id);
                }else{
                        $total = $SmartBlogPost->getToltalByCategory($this->context->language->id,$id_category);
                        Hook::exec('actionsbcat', array('id_category' => $this->getIdCategory($sluggish)));
                }
                if($total != '' || $total != 0)
                    $totalpages = ceil($total/$posts_per_page);
                if((boolean)Tools::getValue('page')){
                $c = Tools::getValue('page');
                    $limit_start = $posts_per_page * ($c - 1);
            }
                if(!$id_category = $this->getIdCategory($sluggish))
                {
                    $allNews = $SmartBlogPost->getAllPost($this->context->language->id,$limit_start,$limit);
                }else{
                    if (file_exists(_PS_MODULE_DIR_.'smartblog/images/category/' . $id_category. '.jpg'))
                    {
                       $cat_image =   $id_category;
                    }
                    else
                    {
                       $cat_image = 'no';
                    }
                    $categoryinfo = $BlogCategory->getNameCategory($id_category);
                    $title_category = $categoryinfo[0]['meta_title'];
                    $category_status = $categoryinfo[0]['active'];
                    $cat_link_rewrite = $categoryinfo[0]['link_rewrite'];
                    if($category_status == 1){
                    $allNews = $BlogPostCategory->getToltalByCategory($this->context->language->id,$id_category,$limit_start,$limit);
                    }
                    elseif($category_status == 0)
                    {
                    $allNews = '';
                    }
                }
            $i = 0;
            if(!empty($allNews)){
                foreach($allNews as $item){
                    $to[$i] = $blogcomment->getToltalComment($item['id_post']);
                   $i++;
                }
                $j = 0;
                foreach($to as $item){
                    if($item == ''){
                        $allNews[$j]['totalcomment'] = 0;
                    }else{
                        $allNews[$j]['totalcomment'] = $item;
                    }
                    $j++;
                }
            }
            
            $this->context->smarty->assign( array(
                                            'postcategory'=>$allNews,
                                            'category_status'=>$category_status,
                                            'title_category'=>$title_category,
                                            'cat_link_rewrite'=>$cat_link_rewrite,
                                            'id_category'=>$id_category,
                                            'cat_image'=>$cat_image,
                                            'categoryinfo'=>$categoryinfo,
                                            'smartshowauthorstyle'=>Configuration::get('smartshowauthorstyle'),
                                            'smartshowauthor'=>Configuration::get('smartshowauthor'),
                                            'limit'=>isset($limit) ? $limit : 0,
                                            'limit_start'=>isset($limit_start) ? $limit_start : 0 ,
                                            'c'=>isset($c) ? $c : 1,
                                            'total'=>$total,
                                            'smartblogliststyle' => Configuration::get('smartblogliststyle'),
                                            'smartcustomcss' => Configuration::get('smartcustomcss'),
                                            'smartshownoimg' => Configuration::get('smartshownoimg'),
                                            'smartdisablecatimg' => Configuration::get('smartdisablecatimg'),
                                            'smartshowviewed' => Configuration::get('smartshowviewed'),
                                            'post_per_page'=>$posts_per_page,
                                            'pagenums' => $totalpages - 1,
                                            'totalpages' =>$totalpages
                                            ));
            
       $template_name  = 'postcategory.tpl';
               
            $this->setTemplate($template_name );        
    }
	// get id_post from slug
	public function getIdCategory($slug)
	{		
		if ($slug === '') {
			return 1;
		}
		$sql = 'SELECT `id_smart_blog_category` FROM `'._DB_PREFIX_.'smart_blog_category_lang`
				WHERE `link_rewrite` = \''.$slug.'\' AND `id_lang` = '. Context::getContext()->language->id;
		if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP)
		{
			$sql .= ' AND `id_shop` = '.(int)Shop::getContextShopID();
		}
		
		$id_category = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);	

		return $id_category;
	}
 }

3 - download the attachment below 1.6.0.12-cleanurl-smartblog-hack-inrg.zip

 

that should get you in the path I think, don't remember if it needs more tweaks.... it's quick and dirt.

 

Hi Wayann, 

 

I'll try it and let you know how it works. Thank you much for your spending time with my problem. I appreciate it. 

Share this post


Link to post
Share on other sites

Hi I tried installing the module and follow the fixes, it works on some pages, the problem is on my product page and category page some images are question marked

Share this post


Link to post
Share on other sites

Ok I think I found the culprit the regexp in Dispatcher method addRoute has been changed to

$regexp = '#^/'.$regexp.'$#u';

fixed on my fork on github https://github.com/wayann/PrestaShop-modules-CleanURLs

 

this is working on 1.6.0.11 and the 1.6.0.12 beta

 

or download the attachment below, test throughly before use in production.

 

EDIT

doing so we still have the utf8 url encoded chars bug, which was the one who broke cleanurl -> http://forge.prestashop.com/browse/PSCSX-3635

 

Yay, looks like this works for my 1.6.0.11. Thank you very much, I will test it thoroughly and let you guys know if I encounter problems ;)

Edited by khejit68 (see edit history)

Share this post


Link to post
Share on other sites

Solution for smartblog doesn't work on my 1.6.0.11. I followed insctructions strictly :(

Share this post


Link to post
Share on other sites

Nice module but I get many errors on PS1.606

 

1. Top horizontal menu does not adjust the links of subcategories.

2. CMS links cause white/green screen of error.

3. Uninstalling is a pain. Must be very careful not to delete or override an existing override.

 

 

Looking forward a fully functional module.

 

CHeers,

/Alex

Share this post


Link to post
Share on other sites

Module works on 1.6.0.9.

 

It adjusts subcategories link

 

For uninstall you only have to restore classes folder.

Share this post


Link to post
Share on other sites

Hi,

 

My subcategory links in the menu do not follow the rule: main_category/subcategory. They only show as: domain/subcategory.  This result to a page that shows the link has moved click here to go to the new link.

 

The CMS links do not work on my PS 1.606.

 

THanks!

Share this post


Link to post
Share on other sites

I've just tried the wayann module and it runs perfect.

 

I have only a problem with the old urls. There are not redirected to the new url scheme and I have a 404 error.

 

Redirection is not enabled? I would need this redirection because there are links from other websites and I don't want to lose this traffic and link juice.

 

Any direction please?

Share this post


Link to post
Share on other sites

have you checked in BO > Preferences > SEO & URLs  the section SET UP URLS the label "Redirect to the canonical URL" should be 301 or 302 depending if you're in production or developing

  • Like 1

Share this post


Link to post
Share on other sites

Hi,

 

I'm using this module on PS 1.6.0.11 and for the most part if seems to be working great

 

However I noticed the top horizontal menu and the layered block navigation output urls dom not reflect the correct url format and are redirected to the correct url, I've tried clearing caches / rebuilding url cache for layered nav block but to no avail.

 

Is there any way to ensure the url's rendered for these blocks are the correct ones (i.e the final urls that the customer will land on)?

Share this post


Link to post
Share on other sites

not sure if I understand correctly what you're trying to say, but from what I understand you want layered block navigation url look pretty, and that's something you will have to code on your own afaik

Share this post


Link to post
Share on other sites

Hi, Thanks for the reply

 

The category links in the layered block navigation and the top horizontal menu are clean, however they are missing a parent category.

 

For example, the correct url is:

http://mysite/flavours/e-liquids/

 

but the two modules will output them as:

http://mysite/e-liquids/

 

So it looks they are clean urls but missing the "/flavours/" parent category.

 

As a result, when I click the link I receive the following message when debug mode is enabled:

[Debug] This page has moved
Please use the following URL instead: http://192.168.0.2/flavours/e-liquids/

 

So i'm wondering if there's a way to output the correct url in the first place? as this would eliminate the need for a intermediate redirect

Share this post


Link to post
Share on other sites

have you checked in BO > Preferences > SEO & URLs  the section SET UP URLS the label "Redirect to the canonical URL" should be 301 or 302 depending if you're in production or developing

 

Yes, I have a 301 redirect. But I get a 404 managed by Prestashop.

 

The webserver is nginx. But previously this module, I didn't have problems with canonical redirects.

 

I'm going to do more tests. Any ideas welcome... :)

Share this post


Link to post
Share on other sites

Hi, Thanks for the reply

 

The category links in the layered block navigation and the top horizontal menu are clean, however they are missing a parent category.

 

For example, the correct url is:

http://mysite/flavours/e-liquids/

 

but the two modules will output them as:

http://mysite/e-liquids/

 

So it looks they are clean urls but missing the "/flavours/" parent category.

 

As a result, when I click the link I receive the following message when debug mode is enabled:

[Debug] This page has moved

Please use the following URL instead: http://192.168.0.2/flavours/e-liquids/

 

So i'm wondering if there's a way to output the correct url in the first place? as this would eliminate the need for a intermediate redirect

this looks like some incompatible route in the prefs..

 

Have you looked at the setting instructions in the readme at github? https://github.com/wayann/PrestaShop-modules-CleanURLs

Share this post


Link to post
Share on other sites

Yes, I have a 301 redirect. But I get a 404 managed by Prestashop.

 

The webserver is nginx. But previously this module, I didn't have problems with canonical redirects.

 

I'm going to do more tests. Any ideas welcome... :)

 

I tested on a classic Apache webserver.. that said I think it should work on nginx too...

 

have you followed the setting instructions? https://github.com/wayann/PrestaShop-modules-CleanURLs

Edited by wayann (see edit history)

Share this post


Link to post
Share on other sites

this looks like some incompatible route in the prefs..

 

Have you looked at the setting instructions in the readme at github? https://github.com/wayann/PrestaShop-modules-CleanURLs

 

Thanks and yes, instructions were followed and the product urls appear to be working fine, it looks like it's the category urls which have an intermediate redirect only.

 

Double checked the route to category, which is set to:

{parent_categories:/}{rewrite}/

 

If it helps I can pm you full site access to help you find the cause.

Share this post


Link to post
Share on other sites

I tested on a classic Apache webserver.. that said I think it should work on nginx too...

 

have you followed the setting instructions? https://github.com/wayann/PrestaShop-modules-CleanURLs

 

Yes, I did.

 

But no problem. I solved it creating a new manual rewrites on nginx configuration file like this:

 

rewrite ^/en/([0-9]+)-[a-zA-Z0-9-]*$ /index.php?id_category=$1&controller=category&id_lang=1 last;

 

And after that, the url is redirected to the clean url.

 

Thanks

Share this post


Link to post
Share on other sites

Hi there,

 

Just downloaded the lastest version from Github and uninstalled the previous version following the instructions on the Github Page.

 

After installing the new clean URLS module (PS 1.6.12) I cannot save the rewrite URL in the BO without the {id} string in the URL.

What to do? Please some help. Thanks!

Share this post


Link to post
Share on other sites

Thanks and yes, instructions were followed and the product urls appear to be working fine, it looks like it's the category urls which have an intermediate redirect only.

 

Double checked the route to category, which is set to:

{parent_categories:/}{rewrite}/

 

If it helps I can pm you full site access to help you find the cause.

 

Hey mzfp,right now I'm deploying a store to production, so I'm sorry but I can't look in to it...

 

a screenshot of your seo prefs maybe would give a hint..

 

also I guess you checked the obvious e-liquids is a parent category of flavours right?

Share this post


Link to post
Share on other sites

Yes, I did.

 

But no problem. I solved it creating a new manual rewrites on nginx configuration file like this:

 

rewrite ^/en/([0-9]+)-[a-zA-Z0-9-]*$ /index.php?id_category=$1&controller=category&id_lang=1 last;

 

And after that, the url is redirected to the clean url.

 

Thanks

Great! I'm thinking also to go over nginx, you're on digital ocean?

Share this post


Link to post
Share on other sites

Hey mzfp,right now I'm deploying a store to production, so I'm sorry but I can't look in to it...

 

a screenshot of your seo prefs maybe would give a hint..

 

also I guess you checked the obvious e-liquids is a parent category of flavours right?

 

Yes, the category structure is correct.  

 

I will debug the module and let you know if I find the cause and solution.

Share this post


Link to post
Share on other sites

Hi there,

 

Just downloaded the lastest version from Github and uninstalled the previous version following the instructions on the Github Page.

 

After installing the new clean URLS module (PS 1.6.12) I cannot save the rewrite URL in the BO without the {id} string in the URL.

What to do? Please some help. Thanks!

 

that was related to a PS bug in the BO have you tried this fix? https://github.com/PrestaShop/PrestaShop/commit/5a0d4c90ff95332d8a03df84c5821c730a95087d

Share this post


Link to post
Share on other sites

Yes, the category structure is correct.  

 

I will debug the module and let you know if I find the cause and solution.

yes, please, thank you

Share this post


Link to post
Share on other sites

Great! I'm thinking also to go over nginx, you're on digital ocean?

 

No, on OVH, dedicated server.

 

Thanks for the module.

Share this post


Link to post
Share on other sites

Thanks and yes, instructions were followed and the product urls appear to be working fine, it looks like it's the category urls which have an intermediate redirect only.

 

Double checked the route to category, which is set to:

{parent_categories:/}{rewrite}/[/size]

 

If it helps I can pm you full site access to help you find the cause.[/size]

That' so strange or I am so lucky. If you enter in my web

 

www.comercialandalucia.es

 

You see that top menu (It's MegaMenu) catchs well the URL with his parent categories. I am on 1.6.0.9

You are in 1.6.0.11?

 

Solution DOWN. Multilanguage shop problem.

Edited by maximo88 (see edit history)

Share this post


Link to post
Share on other sites

BAD NEWS if you're on a shop with multilanguage there's a bug where blockmultilanguages will parse the wrong link when in a category page.

 

don't worry there's also the other side

 

GOOD NEWS

 

it's fixed on my github repo

 

or look for this code at line 74:

foreach ($category->getParentsCategories() as $cat)

and replace it with:

foreach ($category->getParentsCategories($id_lang) as $cat)
  • Like 1

Share this post


Link to post
Share on other sites

HTCACCESS REWRITE RULES FOR SAVE SEO WITH NO ID ON URL.(lebioda module)

 

Some examples, you can learn and include in your htcacces

 

#********
#Manufacturer:  www.midominio.es/menaje/7-pujadas to www.midominio.es/fabricante/pujadas
#--------------------------------------------------------------------------------
RedirectMatch 301 /menaje/([0-9]+)-([a-zA-Z_-]+)$   http://www.midominio.es/fabricante/$2


#********
#Category www.midominio.es/451-manteles-y-servilletas to www.midominio.es/manteles-y-servilletas
#--------------------------------------------------------------------------------
RedirectMatch 301 /([0-9]+)-([a-zA-Z_-]+)$   http://www.midominio.es/$2/

 #********
#Products www.midominio.es/duniletto/981-servilleta-40x40-canguro-50u-negra.html a www.midominio.es/duniletto/servilleta-40x40-canguro-50u-negra
#Product has numbers and letters
#--------------------------------------------------------------------------------
RedirectMatch 301 /([a-zA-Z_-]+)/([0-9]+)-([0-9a-zA-Z_-]+).html$   http://www.midominio.es/$1/$3

#Products without category.
#www.midominio.es/5734-cubeta-gn-melamina-1-2-p65-blanca.html a www.midominio.es/cubeta-gn-melamina-1-2-p65-blanca.html

# You don't have in this old URL the category,then it will invoque a rewrite_url and it will add the category, you will have a product rewrite on the URL
# So similar to category, the only diference is .html
#--------------------------------------------------------------------------------
RedirectMatch 301 /([0-9]+)-([0-9a-zA-Z_-]+).html$   http://www.midominio.es/$2

 

 

To learn more:

http://www.desarroll...s-htaccess.html

http://www.netandsof...a-guia-completa

Edited by maximo88 (see edit history)

Share this post


Link to post
Share on other sites

Dont work on prestashop 1.6.0.14 -/ dunno whats wrong i cant safe rewrite rules on seo and urls page...

Share this post


Link to post
Share on other sites

After this all work:


 

Q: I added an override file but it seems to be ignored by PrestaShop
A: You need to trigger the regeneration of the /cache/class_index.php file. This is done simply by deleting the file. It is the same when manually removing an override: in order to reinstate the default behavior, you must delete the /cache/class_index.php file.
  • Like 1

Share this post


Link to post
Share on other sites

I need help, how can i do that:

catalog/{parent_categories:/}{rewrite}

 

With products that work:

 

goods/{rewrite}, but with categories no....can some one help me with categories?

 

Also this is not work for cms page:

page/{rewrite}

Edited by Kerm (see edit history)

Share this post


Link to post
Share on other sites

I need help, how can i do that:

 

catalog/{parent_categories:/}{rewrite}

 

With products that work:

 

goods/{rewrite}, but with categories no....can some one help me with categories?

 

Also this is not work for cms page:

 

page/{rewrite}

Are you using the last cleanURL ? -> https://github.com/wayann/PrestaShop-modules-CleanURLs

Share this post


Link to post
Share on other sites

Check your setting carefully module it's working.

 

 

Make sure your seo and url settings are as follows:

This is MANDATORY

  • products: {category:/}{rewrite} (no .html at the end OBLIGATORY)
  • categories: {parent_categories:/}{rewrite}/
  • manufacturers: {rewrite}
  • CMS: "WHAT YOU WANT"/{rewrite} ex info/{rewrite}

Keep in mind to clear browser cache / PS cache under smarty/cache and smarty/compile

  • Like 1

Share this post


Link to post
Share on other sites

Hi;

 

just a question, your module can redirect an old url (with id) to the new one ?

 

Thanks

Share this post


Link to post
Share on other sites

Hi,

 

I installed wayann's verion of module and I have the same problem as https://www.prestashop.com/forums/topic/365702-url-structure/

 

I have multiple subcategories with the same name, and rewrite does't work OK.

 

- Room1

-- Kitchen

- Room2

-- Kitchen

 

Anyone?

 

Regards, G

I have the same problem.

Edited by SebastianS. (see edit history)

Share this post


Link to post
Share on other sites

I have the same problem.

This is not a problem. If you remove the number YOU CAN'T HAVE TWO OR MORE SUBCATEGORIES with the same name.

 

Why? Because www.hello.com/thesame is = www.hello.com/thesame although before there were 32-the same and 54-thesame

 

If you don't understand, you don't know the basics about html code.

Share this post


Link to post
Share on other sites

Hi;

 

just a question, your module can redirect an old url (with id) to the new one ?

 

Thanks

 

No, you have to use manual Redirect301in htcaccess, and I have put the rules some posts before. READ A bit before WRITE.

Share this post


Link to post
Share on other sites