vekia Posted May 2, 2016 Posted May 2, 2016 Free module to build and display list of products on CMS pages This is great and free addon that gives you possibility to use special shortcodes while you edit CMS page (preferences > CMS). These shortcodes will be replaced with products. With this feature you can use single product, build list of products and display them in any place of CMS page you want. download link to module - scroll down, you can find it at the end of this post :-) at the moment module is for PrestaShop 1.7x and 1.6.x How to use module? as i already mentioned, module is based on shortcodes. Shortcode is a special tiny text that will be replaced with product / products. Explanation of how you can use shortcodes: how to use cms products shortcodes {product:9} for example, to insert single product you have to use shortcode {product:9} where 9 is an ID number of product to display {products:9,3,2,5} to insert several products and build a list of products you have to use shortcode {products:9,3,2,5} where 9,3,2,5 are a ID numbers of products to display/ Just use these shortcodes while you will edit CMS page. And that's all! module will build list of products automatically. direct download links: cmsproducts17.zip cmsproducts.zip 8 1 Share this post Link to post Share on other sites More sharing options...
oh_prestashop Posted May 2, 2016 Posted May 2, 2016 awesome! will test it. Share this post Link to post Share on other sites More sharing options...
vekia Posted May 2, 2016 Posted May 2, 2016 awesome! will test it. let me know the result of tests please ;-) it's a fresh module so if something will not be okay i will have to update it :-) 1 1 Share this post Link to post Share on other sites More sharing options...
[email protected] Posted May 3, 2016 Posted May 3, 2016 Great looking module. Will deffinatly check it out Share this post Link to post Share on other sites More sharing options...
vekia Posted May 4, 2016 Posted May 4, 2016 how to install this module in PrestaShop 1.6.x 1 Share this post Link to post Share on other sites More sharing options...
امیر Posted May 21, 2016 Posted May 21, 2016 i need use this code in html i can Share this post Link to post Share on other sites More sharing options...
vekia Posted May 23, 2016 Posted May 23, 2016 hello i dont understand your request please shed some more light on what kind of feature you're looking for or maybe better: what you're trying to achieve Share this post Link to post Share on other sites More sharing options...
snehalmcse Posted May 23, 2016 Posted May 23, 2016 Hi thanks such a nice module but i am facing some issues with its display http://shopperbox.in/content/8-test the problem is that product does not show in proper manner as it should be seen Thanks Share this post Link to post Share on other sites More sharing options...
vekia Posted May 24, 2016 Posted May 24, 2016 hello i dont see there any list of products on page you linked Share this post Link to post Share on other sites More sharing options...
امیر Posted May 24, 2016 Posted May 24, 2016 (edited) tnx example : this is moudle cmsprouduct just display prouduct in page cms ........ok but i want display in other place exaple in page htmal or moudle htmlbox or i want dispaly in side page pls see this page www.puzel.ir Edited May 24, 2016 by امیر (see edit history) Share this post Link to post Share on other sites More sharing options...
vekia Posted May 24, 2016 Posted May 24, 2016 this module allows to display products on CMS pages only Share this post Link to post Share on other sites More sharing options...
snehalmcse Posted May 24, 2016 Posted May 24, 2016 hi sorry it was my mistake for pulling multiple products i was using {product:1,2,3,4} instead of {products:1,2,3,4} thanks for such a nice module Thanks shopperbox.in Share this post Link to post Share on other sites More sharing options...
امیر Posted May 25, 2016 Posted May 25, 2016 tnx for reply you can change your code for htmlbox Share this post Link to post Share on other sites More sharing options...
arkemis Posted May 26, 2016 Posted May 26, 2016 I write the short codes but the products doesn´t show, only the shortcode text is showed in the CMS page. Could you help me? Thank you. Share this post Link to post Share on other sites More sharing options...
arkemis Posted May 26, 2016 Posted May 26, 2016 Solved turning off "disable all overrides" in preferences > performance 1 Share this post Link to post Share on other sites More sharing options...
vekia Posted May 26, 2016 Posted May 26, 2016 that's right :-) in some cases this option is enabled module applies override to CMS controller, so it is necessary to disable this option to use this addon. 1 Share this post Link to post Share on other sites More sharing options...
LazyCircles Posted May 31, 2016 Posted May 31, 2016 (edited) Hello, Thanks for this powerfull module Vekia I'm having trouble installing the module, after uploading it to directory I click Install > Proceed with installation > but then it doesn't reedirect to the module configuration page nor the module is installed. I tried install other modules and had no problems, I'm running Prestashop version 1.6.0.14 Disable all overrides option is off. Thanks in advance! Best regards, Bruno Note: I tested with PS v1.6.1.4 and it works, but I'd like to be able to do this in v1.6.0.14 Edited May 31, 2016 by LazyCircles (see edit history) Share this post Link to post Share on other sites More sharing options...
vekia Posted May 31, 2016 Posted May 31, 2016 Hello, Thanks for this powerfull module Vekia I'm having trouble installing the module, after uploading it to directory I click Install > Proceed with installation > but then it doesn't reedirect to the module configuration page nor the module is installed. I tried install other modules and had no problems, I'm running Prestashop version 1.6.0.14 Disable all overrides option is off. Thanks in advance! Best regards, Bruno Note: I tested with PS v1.6.1.4 and it works, but I'd like to be able to do this in v1.6.0.14 can you turn on error reporting and then try to install module again do you see some notifications about installation problems? 1 Share this post Link to post Share on other sites More sharing options...
LazyCircles Posted June 1, 2016 Posted June 1, 2016 can you turn on error reporting and then try to install module again do you see some notifications about installation problems? Hello Vekia, Thanks for help! I turn on error reporting but no error messages. I have no clue why is this happening but it should be related with PS version, no? Best regards, Bruno Share this post Link to post Share on other sites More sharing options...
vekia Posted June 1, 2016 Posted June 1, 2016 module supports each available release of prestashop 1.6.x problem you have can be related to some environment settings. have you got an access to ftp? Share this post Link to post Share on other sites More sharing options...
LazyCircles Posted June 1, 2016 Posted June 1, 2016 (edited) module supports each available release of prestashop 1.6.x problem you have can be related to some environment settings. have you got an access to ftp? Yes! thanks for your help, I will send credentials via PM. Edit: Can't send you PM because of your account configuration. Thank you Edited June 1, 2016 by LazyCircles (see edit history) Share this post Link to post Share on other sites More sharing options...
vekia Posted June 1, 2016 Posted June 1, 2016 1) open module directory 2) rename directory name from "overrides" to "_overrides"3) try to install the module 4) copy modules/cmsproducts/override/controllers/front/CmsController.php to /override/controllers/front/CmsController.php 5) try to use the module Share this post Link to post Share on other sites More sharing options...
LazyCircles Posted June 1, 2016 Posted June 1, 2016 1) open module directory 2) rename directory name from "overrides" to "_overrides" 3) try to install the module 4) copy modules/cmsproducts/override/controllers/front/CmsController.php to /override/controllers/front/CmsController.php 5) try to use the module Nice! Module is installed! >4) copy modules/cmsproducts/override/controllers/front/CmsController.php to /override/controllers/front/CmsController.php >>Already have an override with the same name "CmsController.php" (I think this is what's causing the issue) that is used for another module, should I change name? Should I mix both codes into a single file "CmsController.php" ? Thank you! Best Regards, Bruno Share this post Link to post Share on other sites More sharing options...
vekia Posted June 1, 2016 Posted June 1, 2016 yes, and because of this override you: - dont see any information about problems because prestashop 1.6.0.14 handle this type of notification in a bad way so in effect - no information is visible in this case it is necessary to apply override manually. Share this post Link to post Share on other sites More sharing options...
LazyCircles Posted June 1, 2016 Posted June 1, 2016 yes, and because of this override you: - dont see any information about problems because prestashop 1.6.0.14 handle this type of notification in a bad way so in effect - no information is visible in this case it is necessary to apply override manually. Thank you! Everything is working now, I merged the codes, both modules seem to work ok Good Job! This module is really powerfull and easy to use! Best regards, Bruno Share this post Link to post Share on other sites More sharing options...
vekia Posted June 1, 2016 Posted June 1, 2016 thank you for report and for nice words about the module it's really nice to hear that someone enjoys the stuff that i develop :-) 1 Share this post Link to post Share on other sites More sharing options...
psxtavi Posted June 5, 2016 Posted June 5, 2016 (edited) Great module. I encountered the following issues: I changed the default view from grid to list on my website (I modified the code in product-list.tpl and in global.js), using this guide https://www.prestashop.com/forums/topic/323065-list-view-by-default/and when I use the module to place shortcodes on CMS page the products are not displayed correctly. If I use the module on a clean prestashop install, when I place shortcodes on CMS page everything is ok, the products are displayed correctly, but when I change the view from grid to list, the change affects the way products are displayed on CMS page also. How can I display products on CMS pages as boxes(like on homepage)? Edited June 6, 2016 by psxtavi (see edit history) Share this post Link to post Share on other sites More sharing options...
uamobile Posted June 13, 2016 Posted June 13, 2016 thanks, good modul. it's possible to add pagination to the module? Share this post Link to post Share on other sites More sharing options...
mimifred Posted June 13, 2016 Posted June 13, 2016 Hi, thanks, great idea. I have an installation problem because of a prior module override. I use a module called "pretty url" that already has an override of CmsController.php. How can I keep both ? merge code ? how ? Also, what is the limitation of the free module ? Thanks 1 Share this post Link to post Share on other sites More sharing options...
vekia Posted June 13, 2016 Posted June 13, 2016 Hi, thanks, great idea. I have an installation problem because of a prior module override. I use a module called "pretty url" that already has an override of CmsController.php. How can I keep both ? merge code ? how ? Also, what is the limitation of the free module ? Thanks in this case it is necessary to merge the code. case needs inspection of the code that pretty url applied to cms controller override Share this post Link to post Share on other sites More sharing options...
mimifred Posted June 13, 2016 Posted June 13, 2016 Thanks, that is what I thought. Tried it unsuccessfully but will try again. Thanks. And as for the limitations of the free version ? Share this post Link to post Share on other sites More sharing options...
Ilya_O Posted June 16, 2016 Posted June 16, 2016 Hello vekia. Please help! Right after the publication of items on the CMS page everything was good. But today I have a problem with the module - items are shown incorrectly (it is visible on the picture). I cleared a cache, but it did not help. Version 1.6.1.5. Share this post Link to post Share on other sites More sharing options...
Ilya_O Posted June 16, 2016 Posted June 16, 2016 Hello vekia. Please help! Right after the publication of items on the CMS page everything was good. But today I have a problem with the module - items are shown incorrectly (it is visible on the pictureproblem.png). I cleared a cache, but it did not help. Version 1.6.1.5. I have found the solution! If the products catalog in the "Grid" mode (), then products on СMS page is displayed correctly (). If the products catalog in the "List" mode (), then the problem appears. It occurs because on the CMS page there is no left column. How to realize so that when switching the catalog of products in the "List" mode, products on the CMS page were displayed correctly? Thank you! Share this post Link to post Share on other sites More sharing options...
vekia Posted June 16, 2016 Posted June 16, 2016 Thanks, that is what I thought. Tried it unsuccessfully but will try again. Thanks. And as for the limitations of the free version ? free version is the only one version available at the moment. i had plan to develop extended version but it will be released once ps 1.7 will be oficially ready Share this post Link to post Share on other sites More sharing options...
JRocamora Posted June 17, 2016 Posted June 17, 2016 Thanks Vekia for save my life! After search and search a ton of posts finally I see this post and incredible (free!)module. I installed it without problems, but I have some bugs that I hope you can help me to fix. 1. The images of the products don´t load. I get a blank space and inspecting it with Firebug it seems that nothing loads inside the <a> tag. 2. I think that some css go bad cause the row don´t work properly, I get only 1 colum for my 4 products. I tried to disable the "all overrides" option, but If I do this, the module not work, only shows the shortcode. Thanks in advance and for share your knowledge!! Share this post Link to post Share on other sites More sharing options...
vekia Posted June 23, 2016 Posted June 23, 2016 i dont know your module this free module uses own different way to display products based on other shortcodes Share this post Link to post Share on other sites More sharing options...
BeeZed Posted June 29, 2016 Posted June 29, 2016 Hi. Awesome module but when I activate your PrettyURL module together with this one I got the error about override (like the users above). How to workaround this issue? Thanks for all help. Share this post Link to post Share on other sites More sharing options...
vekia Posted June 29, 2016 Posted June 29, 2016 Hi. Awesome module but when I activate your PrettyURL module together with this one I got the error about override (like the users above). How to workaround this issue? Thanks for all help. in this case it is necessary to apply overrides manually it is a break-point of prestashop, but fortunately it is easy to solve Share this post Link to post Share on other sites More sharing options...
BeeZed Posted June 29, 2016 Posted June 29, 2016 in this case it is necessary to apply overrides manually it is a break-point of prestashop, but fortunately it is easy to solve I suspected this. Is there any chance to get a how-to instruction for this? ;-) Share this post Link to post Share on other sites More sharing options...
vekia Posted July 14, 2016 Posted July 14, 2016 it is described in post #22 1) open module directory 2) rename directory name from "overrides" to "_overrides"3) try to install the module 4) copy modules/cmsproducts/override/controllers/front/CmsController.php to /override/controllers/front/CmsController.php 5) try to use the module Share this post Link to post Share on other sites More sharing options...
ice552 Posted July 17, 2016 Posted July 17, 2016 Hi Guys, I have exactly same issue as few before me. I have installed something like Pretty URL and after try to install CMSonproducts its not possible. I tried solution with renaming folder in module to _overrides and yes I am able to install the module but unfornately merging the code is not working. Could you please somebody help me with merge? Files for merge of these codes in atttachment (PrettyURL was first installed). Thank you very much CmsController_afterinstallPrettyURL.php CmsController_fromCmsproducts.php Share this post Link to post Share on other sites More sharing options...
امیر Posted July 18, 2016 Posted July 18, 2016 HI tnx for import this moudle i can use this moudle for display list price prouduct in table i can remove image in moudle i need just name and price do i can edit this moudle?? Share this post Link to post Share on other sites More sharing options...
vekia Posted July 19, 2016 Posted July 19, 2016 Hi Guys, I have exactly same issue as few before me. I have installed something like Pretty URL and after try to install CMSonproducts its not possible. I tried solution with renaming folder in module to _overrides and yes I am able to install the module but unfornately merging the code is not working. Could you please somebody help me with merge? Files for merge of these codes in atttachment (PrettyURL was first installed). Thank you very much i have no possibilities to test it because you use some unknow pretty url module (definitely not mine: pretty clean urls) but i merged code of course from my point of view it should work :-) <?php /* * 2007-2016 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2016 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class CmsControllerCore extends FrontController { public $php_self = 'cms'; public $assignCase; public $cms; /** @var CMSCategory */ public $cms_category; public $ssl = false; public function canonicalRedirection($canonicalURL = '') { if (Tools::getValue('live_edit')) { return; } if (Validate::isLoadedObject($this->cms) && ($canonicalURL = $this->context->link->getCMSLink($this->cms, $this->cms->link_rewrite, $this->ssl))) { parent::canonicalRedirection($canonicalURL); } elseif (Validate::isLoadedObject($this->cms_category) && ($canonicalURL = $this->context->link->getCMSCategoryLink($this->cms_category))) { parent::canonicalRedirection($canonicalURL); } } /** * Initialize cms controller * @see FrontController::init() */ public function setMedia() { parent::setMedia(); if ($this->assignCase == 1) { $this->addJS(_THEME_JS_DIR_.'cms.js'); } $this->addCSS(_THEME_CSS_DIR_.'product_list.css'); $this->addCSS(_THEME_CSS_DIR_.'cms.css'); $this->addCSS(_PS_MODULE_DIR_.'cmsproducts/cmsproducts.css'); } /** * Assign template vars related to page content * @see FrontController::initContent() */ public function initContent() { parent::initContent(); $parent_cat = new CMSCategory(1, $this->context->language->id); $this->context->smarty->assign('id_current_lang', $this->context->language->id); $this->context->smarty->assign('home_title', $parent_cat->name); $this->context->smarty->assign('cgv_id', Configuration::get('PS_CONDITIONS_CMS_ID')); if ($this->assignCase == 1) { if (isset($this->cms->id_cms_category) && $this->cms->id_cms_category) { $path = Tools::getFullPath($this->cms->id_cms_category, $this->cms->meta_title, 'CMS'); } elseif (isset($this->cms_category->meta_title)) { $path = Tools::getFullPath(1, $this->cms_category->meta_title, 'CMS'); } $this->cms->content = $this->returnContent($this->cms->content); $this->context->smarty->assign(array( 'cms' => $this->cms, 'content_only' => (int)Tools::getValue('content_only'), 'path' => $path, 'body_classes' => array($this->php_self.'-'.$this->cms->id, $this->php_self.'-'.$this->cms->link_rewrite) )); if ($this->cms->indexation == 0) { $this->context->smarty->assign('nobots', true); } } elseif ($this->assignCase == 2) { $this->context->smarty->assign(array( 'category' => $this->cms_category, //for backward compatibility 'cms_category' => $this->cms_category, 'sub_category' => $this->cms_category->getSubCategories($this->context->language->id), 'cms_pages' => CMS::getCMSPages($this->context->language->id, (int)$this->cms_category->id, true, (int)$this->context->shop->id), 'path' => ($this->cms_category->id !== 1) ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '', 'body_classes' => array($this->php_self.'-'.$this->cms_category->id, $this->php_self.'-'.$this->cms_category->link_rewrite) )); } $this->setTemplate(_PS_THEME_DIR_.'cms.tpl'); } public static function getImagesByID($id_product, $limit = 0) { $id_image = Db::getInstance()->ExecuteS('SELECT `id_image` FROM `'._DB_PREFIX_.'image` WHERE cover=1 AND `id_product` = '.(int)$id_product.' ORDER BY position ASC LIMIT 0, '.(int)$limit); $toReturn = array(); if (!$id_image) { return NULL; } else { foreach ($id_image as $image) { $toReturn[] = $id_product.'-'.$image['id_image']; } } return $toReturn; } public function returnProduct($id_product) { $explode[] = $id_product; foreach ($explode as $tproduct) { if ($tproduct != '') { $x = (array)new Product($tproduct, true, $this->context->language->id); $productss[$tproduct] = $x; $productss[$tproduct]['id_product'] = $tproduct; $image = self::getImagesByID($tproduct, 1); $picture = explode('-', $image[0]); $productss[$tproduct]['id_image'] = $picture[1]; } } $products = Product::getProductsProperties($this->context->language->id, $productss); $this->context->smarty->assign('products', $products); $this->context->smarty->assign('feedtype', "cmsSingleProductFeed"); $contents = $this->context->smarty->fetch(_PS_MODULE_DIR_.'cmsproducts/products.tpl'); return $contents; } public function returnProducts($id_product) { $explode_products = explode(",", $id_product); foreach ($explode_products AS $idp) { $explode[] = $idp; foreach ($explode as $tproduct) { if ($tproduct != '') { $x = (array)new Product($tproduct, true, $this->context->language->id); $productss[$tproduct] = $x; $productss[$tproduct]['id_product'] = $tproduct; $image = self::getImagesByID($tproduct, 1); $picture = explode('-', $image[0]); $productss[$tproduct]['id_image'] = $picture[1]; } } } $products = Product::getProductsProperties($this->context->language->id, $productss); $this->context->smarty->assign('products', $products); $this->context->smarty->assign('feedtype', "cmsProductsFeed"); $contents = $this->context->smarty->fetch(_PS_MODULE_DIR_.'cmsproducts/products.tpl'); return $contents; } public function returnProductsHpp($block) { if (class_exists("Hpp")) { $hpp = new Hpp(); if (method_exists($hpp, 'returnProducts')) { return $this->displayHpp($hpp->returnProducts($block)); } else { return $this->noModuleMessage("Homepage Products Pro"); } } else { return $this->noModuleMessage("Homepage Products Pro"); } } public function returnProductsRpp($block) { if (class_exists("Ppb")) { $rpp = new Ppb(); if (method_exists($rpp, 'returnProducts')) { return $this->displayRpp($rpp->returnProducts($block)); } else { return $this->noModuleMessage("Related Products Pro"); } } else { return $this->noModuleMessage("Related Products Pro"); } } public function displayRpp($products) { if (count($products) <= 0) { $this->context->smarty->assign('feedtype', "noProducts"); } else { $this->context->smarty->assign('products', $products); $this->context->smarty->assign('feedtype', "rppfeed"); } $contents = $this->context->smarty->fetch(_PS_MODULE_DIR_.'cmsproducts/products.tpl'); return $contents; } public function displayHpp($products) { if (count($products) <= 0) { $this->context->smarty->assign('feedtype', "noProducts"); } else { $this->context->smarty->assign('products', $products); $this->context->smarty->assign('feedtype', "hppfeed"); } $contents = $this->context->smarty->fetch(_PS_MODULE_DIR_.'cmsproducts/products.tpl'); return $contents; } public function noModuleMessage($module) { $this->context->smarty->assign('products', $products); $this->context->smarty->assign('module', $module); $this->context->smarty->assign('feedtype', "error"); $contents = $this->context->smarty->fetch(_PS_MODULE_DIR_.'cmsproducts/products.tpl'); return $contents; } public function returnContent($contents) { /** PRODUCTS **/ preg_match_all('/\{products\:[(0-9\,)]+\}/i', $contents, $matches); foreach ($matches[0] as $index => $match) { $explode = explode(":", $match); $contents = str_replace($match, $this->returnProducts(str_replace("}", "", $explode[1])), $contents); } /** PRODUCT **/ preg_match_all('/\{product\:[(0-9\,)]+\}/i', $contents, $matches); foreach ($matches[0] as $index => $match) { $explode = explode(":", $match); $contents = str_replace($match, $this->returnProduct(str_replace("}", "", $explode[1])), $contents); } /** HOMEPAGE PRODUCTS PRO FEED **/ preg_match_all('/\{hpp\:[(0-9)]+\}/i', $contents, $matches); foreach ($matches[0] as $index => $match) { $explode = explode(":", $match); $contents = str_replace($match, $this->returnProductsHpp(str_replace("}", "", $explode[1])), $contents); } /** RELATED PRODUCTS PRO FEED **/ preg_match_all('/\{rpp\:[(0-9)]+\}/i', $contents, $matches); foreach ($matches[0] as $index => $match) { $explode = explode(":", $match); $contents = str_replace($match, $this->returnProductsRpp(str_replace("}", "", $explode[1])), $contents); } return $contents; } } Share this post Link to post Share on other sites More sharing options...
ice552 Posted July 19, 2016 Posted July 19, 2016 Hi, thank you very much much for your answer, unfornately this not help It's better than before my merge (I have Error 500 in whole site), with your merge I can see homepage, but when I click on randomly cms page for example myshop.cz/faq it's not working and I have there error PAge not exist . You can also find screenshot of URLs setting in attachment. Thank you Share this post Link to post Share on other sites More sharing options...
vekia Posted July 19, 2016 Posted July 19, 2016 before cms pages were loaded properly? Share this post Link to post Share on other sites More sharing options...
ice552 Posted July 19, 2016 Posted July 19, 2016 Yes, before CMS were loaded properly with settings in controller CmsController_afterinstallPrettyURL.php. Thank you Share this post Link to post Share on other sites More sharing options...
lambdaka Posted July 31, 2016 Posted July 31, 2016 Hi there I'm using your free module and it's great !! thanks I just wondering how to force the grid view display of the products on cms..? Do you have a clue on how to do that..? Thanks ! S. Share this post Link to post Share on other sites More sharing options...
jeromebis Posted August 31, 2016 Posted August 31, 2016 Hi, same question as lambdaka! Is there a way to force the grid view display of the products on cms? or to force the module to display the products in grid view? Otherwise, the products are not displayed correctly in list view. Thanks for your help! Share this post Link to post Share on other sites More sharing options...
Ziaur Rahman Posted September 4, 2016 Posted September 4, 2016 I can not install this module in Prestashop cloud. When I try to install it shows "You do not have permission to install this module" Share this post Link to post Share on other sites More sharing options...
vekia Posted September 7, 2016 Posted September 7, 2016 new version of this module to display products on cms pages is ready! - added support of PrestaShop 1.7 (currently in RC - release candidate - version) - added improvements to module usage on PrestaShop Cloud platform - added improvements to code - now it is based on psr-2 coding standards Share this post Link to post Share on other sites More sharing options...
vekia Posted September 7, 2016 Posted September 7, 2016 I can not install this module in Prestashop cloud. When I try to install it shows "You do not have permission to install this module" hello please update the module (download new version from mypresta website) and follow instructions (IMPORTANT) 1 - upload new module to modules directory 2 - go to shop back office 3 - go to preferences > performance 4 - clear cache 5 - go to modules -> modules 6 - try to install module 7 - if you cant, refresh page and try again point 6 Share this post Link to post Share on other sites More sharing options...
vekia Posted September 7, 2016 Posted September 7, 2016 Hi, same question as lambdaka! Is there a way to force the grid view display of the products on cms? or to force the module to display the products in grid view? Otherwise, the products are not displayed correctly in list view. Thanks for your help! Hi there I'm using your free module and it's great !! thanks I just wondering how to force the grid view display of the products on cms..? Do you have a clue on how to do that..? Thanks ! S. hello what theme you use? default bootstrap ? Share this post Link to post Share on other sites More sharing options...
jeromebis Posted September 7, 2016 Posted September 7, 2016 @vekia : yes, default bootstrap (prestashop 1.6). On this page for example: https://shop.vescape.com/en/blog/6-how-to-exercise-on-your-stationary-bike Share this post Link to post Share on other sites More sharing options...
infopigikaina Posted September 21, 2016 Posted September 21, 2016 @vekia hi, I just install this module ant it works perfectly, but I have one question. Maybe you can help and tell how we can make that product's in CMS show in Homepage? Because now it's show just the code like this: {products:13,28,47,49} Share this post Link to post Share on other sites More sharing options...
dirdi Posted September 22, 2016 Posted September 22, 2016 Hi @vekia, great module as all your extensions. Want to ask if you are planning soon a Pro version and what will inlcude. Any chance to show random products.... ? Share this post Link to post Share on other sites More sharing options...
vekia Posted September 22, 2016 Posted September 22, 2016 @vekia hi, I just install this module ant it works perfectly, but I have one question. Maybe you can help and tell how we can make that product's in CMS show in Homepage? Because now it's show just the code like this: {products:13,28,47,49} how you display cms page on homepage ?:-) Share this post Link to post Share on other sites More sharing options...
Swerace Posted October 4, 2016 Posted October 4, 2016 Looks like a wonderful module!In my cms page i not see the product, just the text "{product:1,2,3,4}". If I disable all overrides I can't enter the cms page, I just got the text (this page doesn't exit). Share this post Link to post Share on other sites More sharing options...
vekia Posted October 4, 2016 Posted October 4, 2016 Looks like a wonderful module! In my cms page i not see the product, just the text "{product:1,2,3,4}". If I disable all overrides I can't enter the cms page, I just got the text (this page doesn't exit). this means that you probably had previously some override for cms page, and this override causing errors. it is necessary to clean up shop from bad overrides, only then it will be okay. you can attach php file /overrides/controllers/cmsController.php file here, i will take a look on it. Share this post Link to post Share on other sites More sharing options...
Swerace Posted October 5, 2016 Posted October 5, 2016 Thanks for your reply! Here is the php file. <?php /** * PrestaShop module created by VEKIA, a guy from official PrestaShop community ;-) * * @author VEKIA https://www.prestashop.com/forums/user/132608-vekia/ * @copyright 2010-2016 VEKIA * @license This program is not free software and you can't resell and redistribute it * * CONTACT WITH DEVELOPER http://mypresta.eu * [email protected] */ class CmsController extends CmsControllerCore { /* * module: cmsproducts * date: 2016-10-04 10:16:04 * version: 1.4.1 */ public function init() { if ($id_cms = (int)Tools::getValue('id_cms')) { $this->cms = new CMS($id_cms, $this->context->language->id, $this->context->shop->id); } elseif ($id_cms_category = (int)Tools::getValue('id_cms_category')) { $this->cms_category = new CMSCategory($id_cms_category, $this->context->language->id, $this->context->shop->id); } if (Configuration::get('PS_SSL_ENABLED') && Tools::getValue('content_only') && $id_cms && Validate::isLoadedObject($this->cms) && in_array($id_cms, array( (int)Configuration::get('PS_CONDITIONS_CMS_ID'), (int)Configuration::get('LEGAL_CMS_ID_REVOCATION') )) ) { $this->ssl = true; } parent::init(); $this->canonicalRedirection(); if (Validate::isLoadedObject($this->cms)) { $adtoken = Tools::getAdminToken('AdminCmsContent' . (int)Tab::getIdFromClassName('AdminCmsContent') . (int)Tools::getValue('id_employee')); if (!$this->cms->isAssociatedToShop() || !$this->cms->active && Tools::getValue('adtoken') != $adtoken) { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); } else { $this->assignCase = 1; } } elseif (Validate::isLoadedObject($this->cms_category) && $this->cms_category->active) { $this->assignCase = 2; } else { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); } } /* * module: cmsproducts * date: 2016-10-04 10:16:04 * version: 1.4.1 */ public function setMedia() { parent::setMedia(); if ($this->assignCase == 1) { $this->addJS(_THEME_JS_DIR_ . 'cms.js'); } $this->addCSS(_THEME_CSS_DIR_ . 'product_list.css'); $this->addCSS(_THEME_CSS_DIR_ . 'cms.css'); $this->addCSS(_PS_MODULE_DIR_ . 'cmsproducts/cmsproducts.css'); } /* * module: cmsproducts * date: 2016-10-04 10:16:04 * version: 1.4.1 */ public function initContent() { parent::initContent(); $parent_cat = new CMSCategory(1, $this->context->language->id); $this->context->smarty->assign('id_current_lang', $this->context->language->id); $this->context->smarty->assign('home_title', $parent_cat->name); $this->context->smarty->assign('cgv_id', Configuration::get('PS_CONDITIONS_CMS_ID')); if ($this->assignCase == 1) { if (isset($this->cms->id_cms_category) && $this->cms->id_cms_category) { $path = Tools::getFullPath($this->cms->id_cms_category, $this->cms->meta_title, 'CMS'); } elseif (isset($this->cms_category->meta_title)) { $path = Tools::getFullPath(1, $this->cms_category->meta_title, 'CMS'); } $this->cms->content = $this->returnContent($this->cms->content); $this->context->smarty->assign(array( 'cms' => $this->cms, 'content_only' => (int)Tools::getValue('content_only'), 'path' => $path, 'body_classes' => array( $this->php_self . '-' . $this->cms->id, $this->php_self . '-' . $this->cms->link_rewrite ) )); if ($this->cms->indexation == 0) { $this->context->smarty->assign('nobots', true); } } elseif ($this->assignCase == 2) { $this->context->smarty->assign(array( 'category' => $this->cms_category, 'cms_category' => $this->cms_category, 'sub_category' => $this->cms_category->getSubCategories($this->context->language->id), 'cms_pages' => CMS::getCMSPages($this->context->language->id, (int)$this->cms_category->id, true, (int)$this->context->shop->id), 'path' => ($this->cms_category->id !== 1) ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '', 'body_classes' => array( $this->php_self . '-' . $this->cms_category->id, $this->php_self . '-' . $this->cms_category->link_rewrite ) )); } $this->setTemplate(_PS_THEME_DIR_ . 'cms.tpl'); } /* * module: cmsproducts * date: 2016-10-04 10:16:04 * version: 1.4.1 */ public static function getImagesByID($id_product, $limit = 0) { $id_image = Db::getInstance()->ExecuteS('SELECT `id_image` FROM `' . _DB_PREFIX_ . 'image` WHERE cover=1 AND `id_product` = ' . (int)$id_product . ' ORDER BY position ASC LIMIT 0, ' . (int)$limit); $toReturn = array(); if (!$id_image) { return null; } else { foreach ($id_image as $image) { $toReturn[] = $id_product . '-' . $image['id_image']; } } return $toReturn; } /* * module: cmsproducts * date: 2016-10-04 10:16:04 * version: 1.4.1 */ public function returnProduct($id_product) { $explode[] = $id_product; foreach ($explode as $tproduct) { if ($tproduct != '') { $x = (array)new Product($tproduct, true, $this->context->language->id); $productss[$tproduct] = $x; $productss[$tproduct]['id_product'] = $tproduct; $image = self::getImagesByID($tproduct, 1); $picture = explode('-', $image[0]); $productss[$tproduct]['id_image'] = $picture[1]; } } $products = Product::getProductsProperties($this->context->language->id, $productss); $this->context->smarty->assign('products', $products); $this->context->smarty->assign('feedtype', "cmsSingleProductFeed"); $contents = $this->context->smarty->fetch(_PS_MODULE_DIR_ . 'cmsproducts/products.tpl'); return $contents; } /* * module: cmsproducts * date: 2016-10-04 10:16:04 * version: 1.4.1 */ public function returnProducts($id_product) { $explode_products = explode(",", $id_product); foreach ($explode_products AS $idp) { $explode[] = $idp; foreach ($explode as $tproduct) { if ($tproduct != '') { $x = (array)new Product($tproduct, true, $this->context->language->id); $productss[$tproduct] = $x; $productss[$tproduct]['id_product'] = $tproduct; $image = self::getImagesByID($tproduct, 1); $picture = explode('-', $image[0]); $productss[$tproduct]['id_image'] = $picture[1]; } } } $products = Product::getProductsProperties($this->context->language->id, $productss); $this->context->smarty->assign('products', $products); $this->context->smarty->assign('feedtype', "cmsProductsFeed"); $contents = $this->context->smarty->fetch(_PS_MODULE_DIR_ . 'cmsproducts/products.tpl'); return $contents; } /* * module: cmsproducts * date: 2016-10-04 10:16:05 * version: 1.4.1 */ public function returnProductsHpp($block) { if (class_exists("Hpp")) { $hpp = new Hpp(); if (method_exists($hpp, 'returnProducts')) { return $this->displayHpp($hpp->returnProducts($block)); } else { return $this->noModuleMessage("Homepage Products Pro"); } } else { return $this->noModuleMessage("Homepage Products Pro"); } } /* * module: cmsproducts * date: 2016-10-04 10:16:05 * version: 1.4.1 */ public function returnProductsRpp($block) { if (class_exists("Ppb")) { $rpp = new Ppb(); if (method_exists($rpp, 'returnProducts')) { return $this->displayRpp($rpp->returnProducts($block)); } else { return $this->noModuleMessage("Related Products Pro"); } } else { return $this->noModuleMessage("Related Products Pro"); } } /* * module: cmsproducts * date: 2016-10-04 10:16:05 * version: 1.4.1 */ public function displayRpp($products) { if (count($products) <= 0) { $this->context->smarty->assign('feedtype', "noProducts"); } else { $this->context->smarty->assign('products', $products); $this->context->smarty->assign('feedtype', "rppfeed"); } $contents = $this->context->smarty->fetch(_PS_MODULE_DIR_ . 'cmsproducts/products.tpl'); return $contents; } /* * module: cmsproducts * date: 2016-10-04 10:16:05 * version: 1.4.1 */ public function displayHpp($products) { if (count($products) <= 0) { $this->context->smarty->assign('feedtype', "noProducts"); } else { $this->context->smarty->assign('products', $products); $this->context->smarty->assign('feedtype', "hppfeed"); } $contents = $this->context->smarty->fetch(_PS_MODULE_DIR_ . 'cmsproducts/products.tpl'); return $contents; } /* * module: cmsproducts * date: 2016-10-04 10:16:05 * version: 1.4.1 */ public function noModuleMessage($module) { $this->context->smarty->assign('products', $products); $this->context->smarty->assign('module', $module); $this->context->smarty->assign('feedtype', "error"); $contents = $this->context->smarty->fetch(_PS_MODULE_DIR_ . 'cmsproducts/products.tpl'); return $contents; } /* * module: cmsproducts * date: 2016-10-04 10:16:05 * version: 1.4.1 */ public function returnContent($contents) { preg_match_all('/\{products\:[(0-9\,)]+\}/i', $contents, $matches); foreach ($matches[0] as $index => $match) { $explode = explode(":", $match); $contents = str_replace($match, $this->returnProducts(str_replace("}", "", $explode[1])), $contents); } preg_match_all('/\{product\:[(0-9\,)]+\}/i', $contents, $matches); foreach ($matches[0] as $index => $match) { $explode = explode(":", $match); $contents = str_replace($match, $this->returnProduct(str_replace("}", "", $explode[1])), $contents); } preg_match_all('/\{hpp\:[(0-9)]+\}/i', $contents, $matches); foreach ($matches[0] as $index => $match) { $explode = explode(":", $match); $contents = str_replace($match, $this->returnProductsHpp(str_replace("}", "", $explode[1])), $contents); } preg_match_all('/\{rpp\:[(0-9)]+\}/i', $contents, $matches); foreach ($matches[0] as $index => $match) { $explode = explode(":", $match); $contents = str_replace($match, $this->returnProductsRpp(str_replace("}", "", $explode[1])), $contents); } return $contents; } } Share this post Link to post Share on other sites More sharing options...
vekia Posted October 5, 2016 Posted October 5, 2016 one last question, what is the version of your prestashop? (exact number like 1.6.x.y) Share this post Link to post Share on other sites More sharing options...
Swerace Posted October 5, 2016 Posted October 5, 2016 one last question, what is the version of your prestashop? (exact number like 1.6.x.y) 1.6.1.7 Share this post Link to post Share on other sites More sharing options...
vekia Posted October 5, 2016 Posted October 5, 2016 okay i checked the file and the overide in clean 1.6.1.7 installation module works well this means that problem is somewhere else please: - enable overrides in your shop - enable error reporting - try to open cms page share the error code here Share this post Link to post Share on other sites More sharing options...
Swerace Posted October 6, 2016 Posted October 6, 2016 okay i checked the file and the overide in clean 1.6.1.7 installation module works well this means that problem is somewhere else please: - enable overrides in your shop - enable error reporting - try to open cms page share the error code here Just got the 404 (page can not be found). Share this post Link to post Share on other sites More sharing options...
vekia Posted October 6, 2016 Posted October 6, 2016 Just got the 404 (page can not be found). so you probably use some friendly url module that does not work well in your shop, verify it. Just clean up the store from overrides that generating issues - check Dispatcher class (when you enable the override - you enable also the friendly url module that removes id from urls for example ) Share this post Link to post Share on other sites More sharing options...
Swerace Posted October 6, 2016 Posted October 6, 2016 so you probably use some friendly url module that does not work well in your shop, verify it. Just clean up the store from overrides that generating issues - check Dispatcher class (when you enable the override - you enable also the friendly url module that removes id from urls for example ) Thank you so much for your help! Humm... I use your pretty clean url, but after that I also installed seo booster for the canonical etc. Maybe seo booster making the problems with url. Cleaning up the store from overrides is way to high skills for me :-D Share this post Link to post Share on other sites More sharing options...
Nandos Posted October 14, 2016 Posted October 14, 2016 Hi Vekia! Thank you for this awesome module Listen, is there a chance to center align the products into the cms page? If so, can you tell me how to do that? I'd really appreciate the help Thanks in advance! Share this post Link to post Share on other sites More sharing options...
ZikmaSolutions Posted November 11, 2016 Posted November 11, 2016 Hi Vekia, I have sent you comment on your website about this module. I have problem with your module. Products display like a grid or something like that. In inspect element if I add class for "product list display" ,products are showed well. Look images: Share this post Link to post Share on other sites More sharing options...
vekia Posted November 15, 2016 Posted November 15, 2016 new version is available! - module fully supports PrestaShop 1.7 now - added minor improvements to module workflow - if you're on 1.6 you dont have to update the plugin (this upgrade is dedicated for PS 1.7 only) Share this post Link to post Share on other sites More sharing options...
oh_prestashop Posted November 15, 2016 Posted November 15, 2016 A module, that adds value works from scratch is free @vekia you're my hero of the day! :-) Share this post Link to post Share on other sites More sharing options...
Matte01990 Posted November 16, 2016 Posted November 16, 2016 thank you, it works perfectly. Share this post Link to post Share on other sites More sharing options...
oh_prestashop Posted November 25, 2016 Posted November 25, 2016 (edited) Hello Vekia, I'm using your module on CMS pages and there it works perfectly.Now I've tried to use it within our blog and the shortcode won't be resolved. I'm using the blog module which came with our template. I'm not a programmer... Can you maybe point me in the right direction what's needed to do to get it working there too? Thanks! Edited November 25, 2016 by oh_prestashop (see edit history) Share this post Link to post Share on other sites More sharing options...
vekia Posted November 26, 2016 Posted November 26, 2016 as module name says - its from "CMS" pages only blog page is not a "CMS" page, so its not possible to put products there with shortcodes. this requires modifications of your blog module, unfortunately - whole feature must be developed from scratch Share this post Link to post Share on other sites More sharing options...
Fred Fournier Posted December 2, 2016 Posted December 2, 2016 Is there any chance to make the module show products on cms through the list style mode instead of the grid mode? Anyway, great module, thank you! Share this post Link to post Share on other sites More sharing options...
vekia Posted December 2, 2016 Posted December 2, 2016 Is there any chance to make the module show products on cms through the list style mode instead of the grid mode? Anyway, great module, thank you! hello thank you for suggestions i will take a look on development possibilities of feature you suggested to build if it will be possible without large modifications - i will release update shortly. 1 Share this post Link to post Share on other sites More sharing options...
Fred Fournier Posted December 2, 2016 Posted December 2, 2016 (edited) hello thank you for suggestions i will take a look on development possibilities of feature you suggested to build if it will be possible without large modifications - i will release update shortly. Glad to "hear" this! Thank you again! Edited December 2, 2016 by Fred Fournier (see edit history) Share this post Link to post Share on other sites More sharing options...
Recommended Posts