Smartblog Not Showing Content of the blogs - Prestashop


In some older version of Smartblog Prestashop module, sometimes you will not find your blog post content properly. It happens when you click on a blog post to see its contents it takes you to a URL that probably shows its id and its name or sometimes you will be redirected to 404 not found page.

To solve this problem you have to modify SmartBlogPost.php file inside /modules/smartblog/classes and then write a regular expression to extract the id that was wrongly being passed to the getPost function.

Step 1. Open SmartBlogPost.php in /modules/smartblog/classes
Step 2. Add a new line between lines 64 and 65 with this code:
preg_match('/^[\d]+/', $id_post, $id_post);

$id_post = $id_post[0];

Step 3. Those lines must be inserted right before line 65 (which starts with $sql = 'SELECT.........)
Step 4. Save the file
Step 5. This solution is working with friendly url's so check you have enabled you SEO friendly url under Preferances >> SEO & UERLs.

Post a Comment

1 Comments