Genie Posted July 17, 2014 Share Posted July 17, 2014 Hello. I am new to prestashop and i am creating my custom module following the suggestion given http://doc.prestashop.com/display/PS16/Creating+a+first+module. But in my dispaly page sourse the js links are absent.Those scripts are : <script type="text/javascript" src="/pestashop_test/js/jquery/jquery-1.11.0.min.js"></script> <script type="text/javascript" src="/pestashop_test/js/jquery/jquery-migrate-1.2.1.min.js"></script> <script type="text/javascript" src="/pestashop_test/js/jquery/plugins/jquery.easing.js"></script> <script type="text/javascript" src="/pestashop_test/js/tools.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/global.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/autoload/10-bootstrap.min.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/autoload/15-jquery.total-storage.min.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/autoload/15-jquery.uniform-modified.js"></script> <script type="text/javascript" src="/pestashop_test/js/jquery/plugins/fancybox/jquery.fancybox.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/products-comparison.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/category.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/modules/blockcart/ajax-cart.js"></script> <script type="text/javascript" src="/pestashop_test/js/jquery/plugins/jquery.scrollTo.js"></script> <script type="text/javascript" src="/pestashop_test/js/jquery/plugins/jquery.serialScroll.js"></script> <script type="text/javascript" src="/pestashop_test/js/jquery/plugins/bxslider/jquery.bxslider.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/tools/treeManagement.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/modules/blocklayered/blocklayered.js"></script> <script type="text/javascript" src="/pestashop_test/js/jquery/ui/jquery.ui.core.min.js"></script> <script type="text/javascript" src="/pestashop_test/js/jquery/ui/jquery.ui.widget.min.js"></script> <script type="text/javascript" src="/pestashop_test/js/jquery/ui/jquery.ui.mouse.min.js"></script> <script type="text/javascript" src="/pestashop_test/js/jquery/ui/jquery.ui.slider.min.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/modules/blocknewsletter/blocknewsletter.js"></script> <script type="text/javascript" src="/pestashop_test/js/jquery/plugins/autocomplete/jquery.autocomplete.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/modules/blocksearch/blocksearch.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/modules/blockwishlist/js/ajax-wishlist.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/modules/blocktopmenu/js/hoverIntent.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/modules/blocktopmenu/js/superfish-modified.js"></script> <script type="text/javascript" src="/pestashop_test/themes/default-bootstrap/js/modules/blocktopmenu/js/blocktopmenu.js"></script> One more question is that http://doc.prestasho...he front-office here i got that i have to create ModuleFrontController but no clear description how to crete it and what to write in that class. Please suggest a way how could i overocme these two problem. Link to comment Share on other sites More sharing options...
vekia Posted July 17, 2014 Share Posted July 17, 2014 can you show php code of your controller, please? Link to comment Share on other sites More sharing options...
Genie Posted July 17, 2014 Author Share Posted July 17, 2014 (edited) Hello Vekia Thanks for your reply. Actually I am new to prestashop and this one is my first module. There is no controller page. Is this necessary to make the controller page? One thing is that whenever i am following the rule for building module for 1.6 idf i am writing <?phpclass mymoduledisplayModuleFrontController extends ModuleFrontController{public function initContent(){parent::initContent();$this->setTemplate('display.tpl');}} in my modules display.php page it is showing Fatal error: Class 'ModuleFrontController' not found in C:\xampp\htdocs\pestashop_test\modules\mymodule\display.php on line 4 Please help. Edited July 17, 2014 by Genie (see edit history) Link to comment Share on other sites More sharing options...
Genie Posted July 17, 2014 Author Share Posted July 17, 2014 My main module page mymodule.php code is <?php/** 2007-2014 PrestaShop** NOTICE OF LICENSE** This source file is subject to the Academic Free License (AFL 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/afl-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-2014 PrestaShop SA* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)* International Registered Trademark & Property of PrestaShop SA*//** * @since 1.5.0 * @version 1.3 (2012-03-14) */if (!defined('_PS_VERSION_')) exit; class MyModule extends Module{ public function __construct() { $this->name = 'mymodule'; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->author = 'Firstname Lastname'; $this->need_instance = 0; $this->ps_versions_compliancy = array('min' => '1.6.0.4', 'max' => _PS_VERSION_); $this->dependencies = array('blockcart'); parent::__construct(); $this->displayName = $this->l('My module'); $this->description = $this->l('Description of my module.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('MYMODULE_NAME')) $this->warning = $this->l('No name provided'); } public function install() { if (Shop::isFeatureActive()) Shop::setContext(Shop::CONTEXT_ALL); return parent::install() && $this->registerHook('leftColumn') && $this->registerHook('displayTop2') && $this->registerHook('header') && Configuration::updateValue('MYMODULE_NAME', 'my friend'); } public function uninstall() { if (!parent::uninstall() || !Configuration::deleteByName('MYMODULE_NAME')) return false; return true; } /*public function hookDisplayLeftColumn($params) { $this->context->smarty->assign( array( 'my_module_name' => Configuration::get('MYMODULE_NAME'), 'my_module_link' => $this->context->link->getModuleLink('mymodule', 'display') ) ); return $this->display(__FILE__, 'mymodule.tpl'); }*/ public function hookDisplayLeftColumn($params) { $this->context->smarty->assign( array( 'my_module_name' => Configuration::get('MYMODULE_NAME'), 'my_module_link' => $this->context->link->getModuleLink('mymodules', 'display'), 'my_module_message' => $this->l('This is a simple text message') // Do not forget to enclose your strings in the l() translation method ) ); return $this->display(__FILE__, 'mymodule.tpl'); } public function hookDisplayRightColumn($params) { return $this->hookDisplayLeftColumn($params); } public function hookdisplayTop2() { echo "HELLO WORLD"; } public function hookDisplayHeader() { $this->context->controller->addCSS($this->_path.'css/mymodule.css', 'all'); } public function getContent() { $output = null; if (Tools::isSubmit('submit'.$this->name)) { $my_module_name = strval(Tools::getValue('MYMODULE_NAME')); if (!$my_module_name || empty($my_module_name) || !Validate::isGenericName($my_module_name)) $output .= $this->displayError( $this->l('Invalid Configuration value') ); else { Configuration::updateValue('MYMODULE_NAME', $my_module_name); $output .= $this->displayConfirmation($this->l('Settings updated')); } } return $output.$this->displayForm(); } public function displayForm() { // Get default Language $default_lang = (int)Configuration::get('PS_LANG_DEFAULT'); // Init Fields form array $fields_form[0]['form'] = array( 'legend' => array( 'title' => $this->l('Settings'), ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Configuration value'), 'name' => 'MYMODULE_NAME', 'size' => 20, 'required' => true ) ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'button' ) ); $helper = new HelperForm(); // Module, t oken and currentIndex $helper->module = $this; $helper->name_controller = $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; // Language $helper->default_form_language = $default_lang; $helper->allow_employee_form_lang = $default_lang; // Title and toolbar $helper->title = $this->displayName; $helper->show_toolbar = true; // false -> remove toolbar $helper->toolbar_scroll = true; // yes - > Toolbar is always visible on the top of the screen. $helper->submit_action = 'submit'.$this->name; $helper->toolbar_btn = array( 'save' => array( 'desc' => $this->l('Save'), 'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name. '&token='.Tools::getAdminTokenLite('AdminModules'), ), 'back' => array( 'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->l('Back to list') ) ); // Load current value $helper->fields_value['MYMODULE_NAME'] = Configuration::get('MYMODULE_NAME'); return $helper->generateForm($fields_form); } } ?> display.php page <?php// This file must be placed at the root of the module's folder.global $smarty;include('../../config/config.inc.php');include('../../header.php'); $smarty->display(dirname(__FILE__).'/display.tpl'); include('../../footer.php');?> display.tpl {l s='Welcome to this page!' mod='mymodule'} Link to comment Share on other sites More sharing options...
vekia Posted July 17, 2014 Share Posted July 17, 2014 you created display.php file in wrong section you have to create it exactly as i mentioned in other post where we discuss about it: http://www.prestashop.com/forums/topic/344800-what-shold-i-write-in-modulefrontcontroller-page-for-my-custom-module/ Link to comment Share on other sites More sharing options...
Recommended Posts