leeburridge 9 Posted October 6, 2011 (edited) ** UPDATED - Version 1.1 now attached **This is my first PrestaShop module. Only took a few hours and I'm quite pleased with it.Basically this will allow you to incorporate WordPress posts into your PrestaShop in the easiest possible way. Screenshots are attached of what it looks like. Please enjoy and if you use and like this module why not donate using PayPal to lee@leeandgrace.co.uk to keep me making new modules Installation Install WordPress and configure - Store the tables in the same database as PrestaShop Upload the attached .ZIP file Configure the Module Transplant the module DocumentationThere are only a few options that you can set in the Configure section :Module Display TitleThis is what is shown at the top of your module eg. Latest News or Blog Posts etc.WordPress Posts TableSpecify the name of the table that contains your WordPress posts. By default WordPress installs to wp_posts however you can change the prefix from wp when installing.QtyNumber of posts to display.CMS IDThe ID number of the CMS page you want to appear at the header of this moduleCMS ClassDIV Class for the headerWordPress ClassDIV class for the WordPress segmentCMS Footer IDThe ID number of the CMS page you want to appear at the foot of this moduleCMS Footer ClassDIV Class for the footerPrerequisitesPrestaShop 1.4.xWordPressIf anyone has any issues or has any feature requests post here ChangeLogv1.1 Added some CMS integration for header and footer which will remain static Added class settings for CMS header and footer v1.0 First iteration Database ChangesAdds 3 fields to Configuration :PS_WPBTITLEPS_WPBTABLEPS_WPBQTYPS_WPBCMSIDPS_WPBCMSCLASSPS_WPBWPCLASSPS_WPBCMSFOOTCLASSPS_WPBCMSFOOTIDYou can get the files from Github here : https://github.com/leeburridge/modwordpress modwordpress.zip Edited June 19, 2015 by leeburridge (see edit history) 2 1 Share this post Link to post Share on other sites
Snade 125 Posted October 6, 2011 Nice work ! something really needed for presta ! Can it be placed in CMS page ? I think this will be the main usage, since shop owners will just need to create cms page called "blog" I'm seriosly considering donating if it really does the job Is it possible to use this module, without having the actual worpress working alone where it is installed ? I guess it will be installed in yourdomain.com/blog, so when you go to that adress will it load the wordpress alone? I'll want to see any wordpress content only through your module, so it will be something like a news module. or maybe the idea is to have separated blog for your shop, and just show articles from in in the wordpress install, and when you click on them to go to the blog ? Share this post Link to post Share on other sites
leeburridge 9 Posted October 6, 2011 Hi, thanks for the reply. I haven't looked at placing it on a CMS page yet. Mine is placed on the front page of my store which you can hook into without any problems. I'll test the CMS stuff and get back to you. You need a working WordPress install for this to work - by that I mean that you would have a /wordpress folder or /blog or whatever however there is nothing stopping you from removing the main WordPress display pages so you only get a back end to it. I think you can remove the files from the root of your WordPress installation to do this but I would test it first Essentially I am using only the backend of WordPress in order to quickly create news articles on my site which I think is what you are wanting. Share this post Link to post Share on other sites
crea34 5 Posted October 6, 2011 Nice works, but when i try to insert image to a wordpress article, html codes appairs in prestashop any idea ? PS Xcuse my bad english....... Share this post Link to post Share on other sites
leeburridge 9 Posted October 6, 2011 It's because the [caption] tag is not a recognized HTML tag. Some of the extended WordPress features will not work with the module at present and I do not know if it's worth implementing them at this point. Share this post Link to post Share on other sites
crea34 5 Posted October 6, 2011 It's now working by the "import" function of images in wordpress, was a bad way by myself, sorry Share this post Link to post Share on other sites
leeburridge 9 Posted October 6, 2011 I've linked to my site to show a demo of it running - also next release will have more features (See the original post for more info on what is coming later on today). 1 Share this post Link to post Share on other sites
leeburridge 9 Posted October 6, 2011 Updated to v1.1 - this gives some CMS abilities for static content to wrap around your WordPress "blog" - Download and details in the first post. 3 Share this post Link to post Share on other sites
mathius 1 Posted October 8, 2011 Thanks, works well. Can you include an option to display only blog posts and not pages please? Also what are the CMS header and footer settings for? Will definately be donating, cheers Share this post Link to post Share on other sites
RAD-X 10 Posted October 9, 2011 Installation Install WordPress and configure - Store the tables in the same database as PrestaShop Upload the attached .ZIP file Configure the Module Transplant the module Hi, I have problem. I've: - installed fresh wordpress - uploaded and installed your module - used the default configuration of yoru module Where can I see in Prestashop a Wordpress content? I can't see anything new at Prestashop homepage. Thanks, Radek Share this post Link to post Share on other sites
crea34 5 Posted October 10, 2011 You need to transplant the module on homepage to see it Share this post Link to post Share on other sites
RAD-X 10 Posted October 10, 2011 Thanks, how transplant? I do not know what to imagine under it. Share this post Link to post Share on other sites
RAD-X 10 Posted October 10, 2011 Aaaa, now i see. I've google this. And now i know what is presta transplantation. http://www.prestasho...anting_Modules/ Okay. Thanks. Share this post Link to post Share on other sites
RAD-X 10 Posted October 10, 2011 Hi leeburridge, Nice work. Thanks. I made a few modifications of your module. 1) Module shows beside wordpress post also wordpress pages. I want to show wordpress post only (without pages). Modification: change in modwordpress.php this: $sql = "SELECT * FROM ".$wpbtable." where `post_status`='publish' ORDER BY ID DESC"; to this: $sql = "SELECT * FROM ".$wpbtable." where `post_status`='publish' AND `post_type`='post' ORDER BY ID DESC"; 2) If is in wordpress saved only eg: 2 posts and you have configured in this module "Qty" to higher number than 2 (eg: 5), then you got in this case 3 empty headings in Prestashop. Fix in modwordpress.php: add after: foreach($_cms as $cms) { $news[$i] = $cms['post_title']; $ndata[$i] = $cms['post_content']; $pdate[$i] = date("d.m.Y", strtotime($cms['post_date'])); $i++; } this code at new line: $wpbqty = (Db::getInstance()->Affected_Rows() < $wpbqty) ? Db::getInstance()->Affected_Rows() : $wpbqty; Cheers, Radek 1 Share this post Link to post Share on other sites
leeburridge 9 Posted October 10, 2011 Hi Radek, I spotted the Pages issue over the weekend. As I don't use them it completely slipped my mind And nice fix too. For the life of me I couldn't see how I could do that in a more graceful way. Cheers, Lee Share this post Link to post Share on other sites
acateon 0 Posted October 10, 2011 Just want to give say thanks for a great initiative! Havent had a chance to give it a go yet but I sure will. Share this post Link to post Share on other sites
acateon 0 Posted October 10, 2011 Is it posible to call the news/blog under a link instead of the frontpage? domain.com/blog or domain.com/blog.php for example? Share this post Link to post Share on other sites
acateon 0 Posted October 10, 2011 A really nice feature would be pagination if posible? Share this post Link to post Share on other sites
leeburridge 9 Posted October 11, 2011 I like this suggestion. Will look at implementing in the next version. Share this post Link to post Share on other sites
SCAMPAI 74 Posted October 17, 2011 Hi, 1/ I install Prestashop 1.4.5.1 on localhost. 2/ Wordpress is already installed. 3/ Install module modwordpress OK 4/ hook module on the home page OK What did you mean by: Install WordPress and configure - Store the tables in the same database as PrestaShop I have 2 database: 1 for Presta, 1 for WP I must re-install WP with the table wp_posts ? I don't really understand, can you explain me. Thank you Share this post Link to post Share on other sites
deuxplustrois 2 Posted October 17, 2011 Very nice plugin. It works like a charm. I just want to know if it is possible to have an excerpt with a "read more" button instead of all the post text without using a Wordpress plugin because I only want to show the excerpt on my Prestashop Homepage. Thanks. @Graphileom : Il faut que ce soit la même base de données pour Prestashop et Wordpress car si tu regardes bien le module, il ne fait pas appel à une base de données externe pour l'import des posts de Wordpress. Ça utilise les paramètres de connexion du settings.inc.php de Prestashop au final. Il faut que Wordpress soit installé sur la même base que Prestashop si tu veux que le module communique avec Wordpress donc il te faut une base avec tes tables ps_ et tes tables wp_ dedans. Share this post Link to post Share on other sites
SCAMPAI 74 Posted October 17, 2011 OK compris merci. Very nice plugin. It works like a charm. I just want to know if it is possible to have an excerpt with a "read more" button instead of all the post text without using a Wordpress plugin because I only want to show the excerpt on my Prestashop Homepage. Thanks. @Graphileom : Il faut que ce soit la même base de données pour Prestashop et Wordpress car si tu regardes bien le module, il ne fait pas appel à une base de données externe pour l'import des posts de Wordpress. Ça utilise les paramètres de connexion du settings.inc.php de Prestashop au final. Il faut que Wordpress soit installé sur la même base que Prestashop si tu veux que le module communique avec Wordpress donc il te faut une base avec tes tables ps_ et tes tables wp_ dedans. Share this post Link to post Share on other sites
deuxplustrois 2 Posted October 25, 2011 I just want to know if it is possible to have an excerpt with a "read more" button instead of all the post text without using a Wordpress plugin because I only want to show the excerpt on my Prestashop Homepage. Modify $ndata[$i] = $cms['post_content']; by $ndata[$i] = $cms['post_excerpt]; in modwordpress.php You have to write manually an excerpt or use a wordpress plugin to show the excerpt on Prestashop. --OR-- Modify {$ndata[$i++]} by {$ndata[$i++]|truncate:128:'...'} in modwordpress.tpl You can choose the truncate value you want... I use this solution. Sorry for my bad english Share this post Link to post Share on other sites
colinng 1 Posted November 12, 2011 It's a nice module. I just want to know if the Module Display Title can be in multilingual....as I see in the source code that it can be but there's not exist in the Translation tab in BO. Thanks a lot. Share this post Link to post Share on other sites
leeburridge 9 Posted November 12, 2011 I am so glad so many people are making use of my little module I'm afraid it isn't multilingual at the moment. I may look into adding this in the future but at the moment you can only choose the one title. Share this post Link to post Share on other sites
Dim Dukov 1 Posted November 17, 2011 can you explain step by step please. for lame's like me Share this post Link to post Share on other sites
Philly.fuk 0 Posted November 21, 2011 Hi, Im not much of a coder, but I managed to add a 'Read full story...' link to each blog entry. What I did first was what deuxplustrois suggested and truncated the size of each post to 428 characters(perfect for my layout). Then in modwordpress.php I changed $_cms = Db::getInstance()->ExecuteS($sql); $i=0; foreach($_cms as $cms) { $news[$i] = $cms['post_title']; $ndata[$i] = $cms['post_content']; $pdate[$i] = date("d/m/Y", strtotime($cms['post_date'])); $i++; } to $_cms = Db::getInstance()->ExecuteS($sql); $i=0; foreach($_cms as $cms) { $news[$i] = $cms['post_title']; $ndata[$i] = $cms['post_content']; $pdate[$i] = date("d/m/Y", strtotime($cms['post_date'])); $id[$i] = $cms['ID']; $i++; } Then further down the page where it has all the smarty variables($smarty->assign('news', $news); etc) I added: $smarty->assign('id', $id); Then I opened up modwordpress.tpl and changed: <div id="wordpress_content" class="{$wpbwpclass}"> <hr> <h1>{l s={$wpbtitle} mod='modwordpress'}</h1> {$i=0} {foreach from=$count item=product name=product} <h4 class="greydark">{$pdate[$i]} - {$news[$i]}</h4> <P ALIGN="right"> {$ndata[$i++]|truncate:428:'...'} </P> to <div id="wordpress_content" class="{$wpbwpclass}"> <hr> <h1>{l s={$wpbtitle} mod='modwordpress'}</h1> {$i=0} {foreach from=$count item=product name=product} <a href="lab/archives/{$num[$i]}"><h4 class="greydark">{$pdate[$i]} - {$news[$i]}</h4></a> <P ALIGN="right"><a href="lab/archives/{$num[$i]}">Read full story...</a></p><br> {$ndata[$i++]|truncate:428:'...'} </P> you will need to change /lab/archives to your installation folder. Im not sure if this will work for others but its working just fine on my server. And sorry for the messy way of doing things, like I said, Im not a coder Share this post Link to post Share on other sites
Bhasha Technologies 0 Posted November 22, 2011 Dont need so many mods in prestashop and wordpress, super simple integration between them Check out http://www.bhasha.co.cc/blog/?p=34 Share this post Link to post Share on other sites
ymajoros 0 Posted November 28, 2011 @Bhasha: from what I understood, you changed Prestashop code and are saying that you don't need a module with this solution. Well, that's the point of having modules: you can leave Prestashop unchanged (which also means you can upgrade etc.). Share this post Link to post Share on other sites
neastea18 1 Posted December 5, 2011 Hello everybody, I have been playing with this module. I tried to add the possibility to have a separate databse for Prestashop and WordPress Can someone review my code because, I have a few problem's sincerely, update: I found my error !! It works but it needs some tweaks I think .... modwordpress.zip Share this post Link to post Share on other sites
SonnyBoyII 5 Posted December 6, 2011 Hi , im getting this error: ....... Smarty error: [in C:\xampp\xampp\htdocs\mysite/modules/modwordpress/modwordpress.tpl line 11]: syntax error: unrecognized tag: $i=0 Share this post Link to post Share on other sites
Nickless 6 Posted February 5, 2012 Hello everybody, I have been playing with this module. I tried to add the possibility to have a separate databse for Prestashop and WordPress Can someone review my code because, I have a few problem's sincerely, update: I found my error !! It works but it needs some tweaks I think .... Hi neastea, did you manage to get the two databases working? I'm a little bit cautious with my Prestashop database so I would also like to use a separate Wordpress database. Very interesting so could you please let me know? cheers -Dave Share this post Link to post Share on other sites
Ggaivg 0 Posted June 20, 2012 Hello everybody, I have been playing with this module. I tried to add the possibility to have a separate databse for Prestashop and WordPress Can someone review my code because, I have a few problem's sincerely, update: I found my error !! It works but it needs some tweaks I think .... I'd like to include my wp-blog on my site but not in the same database and am happy you are trying with these modules, thank you! If I'd get them working I'd be happy to donate. I keep getting the error "The database selection cannot be made", so I guess the settings are incorrect. But I checked with the Wordpress installation and set base to "wp_" and table to "wp_posts". I tried many different configurations but can't get this working. Any ideas? Share this post Link to post Share on other sites
viktor89 0 Posted November 12, 2012 I just successfully installed this on a 1.5 installation of prestashop (and with wordpress 3.4.2). No problem - works perfekt. I did some small modifications to have it exclude pages from the loop and put permalinks and excerpts instead of full post-content. If anybody want the slightly modified version I put it on my bitbucket - https://bitbucket.org/Viktor89/modwordpress . Anyway, gotta give thanks to the author for this - couldn't have figured it out myself (and I tried). Share this post Link to post Share on other sites
mystica 0 Posted January 24, 2013 hi, i installed the plugin on 1.5.3.1 prestashop version, but when i try to transplant the hook i always get "This module cannot be transplanted to this hook." whaterer hook i select i'm using the default theme for prestashop any advise on that? thanks Share this post Link to post Share on other sites
vidorado 0 Posted February 21, 2013 (edited) hi, i installed the plugin on 1.5.3.1 prestashop version, but when i try to transplant the hook i always get "This module cannot be transplanted to this hook." whaterer hook i select i'm using the default theme for prestashop any advise on that? thanks This is a common problem of the module hook system of prestaShop. It has a very simple solution: Imagine that you want to transplant the module to the rightColumn Hook, but the module throws you aun error sayint thet you can't, because the module only let's you transplant to the leftColumn hook. The only thing you have to do is to add the proper hook function redirecting to the other function in the <name_of_the_module>.php file: public function hookRightColumn($params){ return $this->hookLeftColumn($params); } After that, you can happily transplant he module to right column Edited February 21, 2013 by vidorado (see edit history) Share this post Link to post Share on other sites
pepeprotos 1 Posted March 15, 2013 Thanks a lot for the module. It was just what I was looking for, but I'm stuck at database settings. I can't get link with DB. What should I write at "WordPress Post Host"? Blog URL, or server's, or WP admin? I've tried several things but always get 'Link to databasa cannot be established'. Both databases PS and WP are in the same server. And, "WordPress Posts User" and password is the same we use for entering WP backoffice? I'd appreciate any help. Thanks in advance. Share this post Link to post Share on other sites
gorllzz 0 Posted April 11, 2013 What should I write at "WordPress Post Host"? Blog URL, or server's, or WP admin? In Wordpress Host you put your server's connection to the database. In most cases is 'localhost'. It's the same value as the field "_DB_SERVER_" on your settings.inc.php file in prestashop or "DB_HOST" on your wp-config file in wordpress. Share this post Link to post Share on other sites
papich 35 Posted June 14, 2013 Thanks for this module it's work in ps 1.5.4.1? Can i display two blog? Share this post Link to post Share on other sites
Banack 1 Posted June 27, 2013 Very nice! Thanks a lot Lee Burrige Share this post Link to post Share on other sites
redtango2 8 Posted July 8, 2013 Hi i have a problem with parameters on PS1.4.10 Link to database cannot be established. I put my prefix-databe in the module create a table as indicated, but it's doesnt work Where is teh mistake ? thanks for your help ! Main Settings Module Display Title WordPress Posts Host WordPress Posts User WordPress Posts Password WordPress Posts Base WordPress Posts Table Qty Share this post Link to post Share on other sites
BWT 27 Posted August 7, 2013 The demo on first post doesn't work would love to see a working demo of this before I try but maybe i'll do a fresh install just to see it! Thanks for the mod this is going in the right direction! Share this post Link to post Share on other sites
chamanx 0 Posted August 27, 2013 Hello and congrats for this great and simple module. I have installed it on my PS 1.5.3.1 and works great, and i also included some tweaks posted by the users on this post. However i'd like to know, if possible, how can i do to show only the first image, or not showing any of the images related to the post. Thank you in advance! Share this post Link to post Share on other sites
Hajtosek 0 Posted November 29, 2013 Hello, I have a littleproblem with showing the news on my prestashop. I have uploaded and installed the module, after that i hooked it up to HomePage and selected index for the showing. I'm a little bit newbie. Share this post Link to post Share on other sites
filipstudio 2 Posted February 15, 2014 Hello, I keep on getting this message while trying to make it work: This module cannot be transplanted to this hook. What am I doing wrong? If I transplant it to the main page (the only one which allows me to do this, I get an error message while loading the page. My version is 1.5.4.1 Thank you Share this post Link to post Share on other sites
dominpad 0 Posted August 13, 2014 Hello, I keep on getting this message while trying to make it work: This module cannot be transplanted to this hook. What am I doing wrong? If I transplant it to the main page (the only one which allows me to do this, I get an error message while loading the page. My version is 1.5.4.1 Thank you Look at this: http://www.prestashop.com/forums/topic/135334-modulefree-wordpress-bridge/page-2?do=findComment&comment=1117026 Share this post Link to post Share on other sites
Mephivio 10 Posted August 17, 2014 Any update to be compliant with PS 1.6 ? 1 Share this post Link to post Share on other sites
leeburridge 9 Posted June 19, 2015 Been a while but thought I would revisit this. I've moved the code to Github in case anyone is interested in picking this up. https://github.com/leeburridge/modwordpress Share this post Link to post Share on other sites
madhuban 0 Posted June 21, 2015 Hi leeburridge, I have a website http://www.scooponpets.com where I use WordPress as a CMS installed in the root directory. And I also have prestashop in a subfolder at http://scooponpets.com/shop/ I want the users that are logged in on my site on the WordPress part, to be able to log in the shop (prestashop part) and vice versa, with one password - without having to create two different accounts and logins. Is this possible? If yes, what would be the best approach to take. Thank you for your time. Share this post Link to post Share on other sites
Shashikant N Sharma 6 Posted October 18, 2015 Tried and tested.. it is working fine. Share this post Link to post Share on other sites
gyula21 10 Posted October 6, 2016 Thank you for this addon. Uploaded to my wordpress, but I can't see on the modules page. Why? Share this post Link to post Share on other sites
antonione77 1 Posted October 21, 2016 I don't know if it's ok but I just bought an hosting (keliweb) where I want to install wordpress and prestashop. So, I should create 2 different forlders inside the hosting to install both the softwares right? Share this post Link to post Share on other sites
bazrco.ir 0 Posted April 22, 2017 Any update to be compliant with PS 1.6 ? Share this post Link to post Share on other sites
leeburridge76 0 Posted April 25, 2017 Any update to be compliant with PS 1.6 ? I am looking into it at the moment. Been a while since I did any PS work but hopefully will be updated shortly to work up to 1.7. Share this post Link to post Share on other sites