help_hook() Is not Dispaying Help icon on Drupal 7 Module Menu - php

I am Trying To Add Help Button On Module Menu . I have Doing Lots Off R&D but Failed . BTW Here is My Code
my_first_module.info
name = My Module
description = embedded Video Comment
core = 7.x
my_first_module.module
<?php
/**
* Implements hook_help().
*/
function my_first_module_help($path, $arg) {
if ($path == 'admin/help#my_first_module') {
return t('A demonstration module.');
}
}
I have Cleared Cache But help link isn't appear

My best guess is that the help module (from Core) is not enabled.

Related

front controller won't load css and js from setMedia on a prestashop 1.7 module

I'm writing a prestashop module for prestashop 1.7.2.1.
I created a front controller for my module with the following code:
<?php
require_once (__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'php'.
DIRECTORY_SEPARATOR.'TuxInDb.php');
class TuxInModCarTypeCarTypeProductsModuleFrontController extends ModuleFrontController {
private $tuxDb;
public function initContent(){
parent::initContent();
$productIds = [];
$this->tuxDb = TuxInDb::getInstance();
$companyName = Tools::getValue('company_name');
$modelName = Tools::getValue('model_name');
$year = Tools::getValue('year');
$month = Tools::getValue('month');
$carType = Tools::getValue('car_type');
$carListCarTypeIds=$this->tuxDb->getCarListCarTypeIds($companyName,$modelName,$carType,$year,$month);
$productIds = $this->tuxDb->getProductIdsByCarListCarTypeIds($carListCarTypeIds);
$this->context->smarty->assign('product_ids',$productIds);
$this->setTemplate('module:tuxinmodcartype/views/templates/front/cartypeproducts.tpl');
}
public function setMedia() {
parent::setMedia();
$this->registerStylesheet('module-tuxinmodcartype-cartypeproducts-style','modules/'.$this->module->name.'/css/cartypeproducts.css');
$this->registerJavascript('module-tuxinmodcartype-cartypeproducts-js','modules/'.$this->module->name.'/js/cartypeproducts.js');
}
}
as you can see in setMedia() function I load a css and js files.
I even debugged it in xdebug and I noticed that those lines of code actually get executed, but when I try to browse my front controller with the following url:
http://prestashop.dev:8080/index.php?company_name=BMW&model_name=SERIA+1&year=2011&month=1&car_type=5+%D7%93%D7%9C%D7%AA%D7%95%D7%AA+%28%D7%94%D7%90%D7%A6%D7%B3%D7%91%D7%A7%29&fc=module&module=tuxinmodcartype&controller=cartypeproducts&id_lang=1
and I check the network tab of my google chrome browser I noticed that the js and css file I required do not get loaded.
any ideas?
I see no javascript errors or php errors (I also have DEV enabled in prestashop).
If an asset path is wrong then Prestashop won't even append it to the browser's <head> (or bottom depending on CCC settings) and won't throw out any errors.
Probably your path is incorrect, to get proper path use this:
$this->registerStylesheet('module-tuxinmodcartype-cartypeproducts-style', $this->module->getPathUri() . 'css/cartypeproducts.css');
$this->registerJavascript('module-tuxinmodcartype-cartypeproducts-js', $this->module->getPathUri() . 'js/cartypeproducts.js');
This works well with PrestaShop 1.7.x
Add this inside your ModuleFrontController:
public function setMedia()
{
parent::setMedia();
$this->addCSS($this->module->getPathUri().'views/css/style.css');
}
I hope this helps!

Error in checkout/onepage after Magento patch 6788

I am a newbie in the Magento programming and I have the following problem:
When I applied the Magento Patch 6788 I can't reach the www.siteurl.com/checkout/onepage/ anymore.
I think it has something to do with the following:
<?php
class MW_Ddate_Model_Ddate extends Mage_Core_Model_Abstract
{
private $inexedDdates = null;
public function _construct()
{
parent::_construct();
$this->_init('ddate/ddate');
}
public function getNumberOrderFromNow() {
if(is_null($this->inexedDdates)) {
$timeFilter = strtotime('- 1 day');
$collection = $this->getCollection()
->addFieldToFilter('UNIX_TIMESTAMP(ddate)', array('gteq' => $timeFilter));
$ddateArray = array();
foreach ($collection as $ddate) {
$ddateArray[$ddate->getDtime()][$ddate->getDdate()] = $ddate;
}
$this->inexedDdates = $ddateArray;
}
return $this->inexedDdates;
}
}
?>
In the logfile there was something said about ->addFieldToFilter('UNIX_TIMESTAMP(ddate)'
I think the UNIX_TIMESTAMP is deprecated when I did the patch.
Does anyone knows how I can solve this problem?
EDIT:
The plugin which I use on the onepage is the Delivery Date from MageWorld
Contact MageWorld and ask them? If they don't support it anymore; test the module with SUPEE-6788 developer toolbox. The toolbox can also fix compatibility issues with modules and the SUPEE-6788 patch. Also have a look at the technical details of the SUPEE-6788 patch at the "APPSEC-1063, addressing possible SQL injection" section.

Override Prestashop Module Changes not Visible

I am attempting to override a module in Prestashop but the changes are just not appearing.
I have overridden a template file and a controller so I have added the following files:
\override\modules\blockwishlist\views\templates\front\mywishlist.tpl
\override\modules\blockwishlist\controllers\front\mywishlist.php
These are very simple changes where I add another column to a table that contains a button. When the button is clicked the controller generates a CSV file.
Any idea why these changes are just not being shown?
Note: I have turned on 'Force Compile' and turned of caching.
Edit:
Re overridding a controller is it:
class BlockWishListMyWishListModuleFrontController extends BlockWishListMyWishListModuleFrontControllerCore // extends ModuleFrontController
or
class BlockWishListMyWishListModuleFrontControllerOverride extends BlockWishListMyWishListModuleFrontController
okay, I did some code research (maybe thre is exists easiest way, not sure), so:
in code Dispatcher class we have
// Dispatch module controller for front office
case self::FC_MODULE :
$module_name = Validate::isModuleName(Tools::getValue('module')) ? Tools::getValue('module') : '';
$module = Module::getInstanceByName($module_name);
$controller_class = 'PageNotFoundController';
if (Validate::isLoadedObject($module) && $module->active) {
$controllers = Dispatcher::getControllers(_PS_MODULE_DIR_.$module_name.'/controllers/front/');
if (isset($controllers[strtolower($this->controller)])) {
include_once(_PS_MODULE_DIR_.$module_name.'/controllers/front/'.$this->controller.'.php');
$controller_class = $module_name.$this->controller.'ModuleFrontController';
}
}
$params_hook_action_dispatcher = array('controller_type' => self::FC_FRONT, 'controller_class' => $controller_class, 'is_module' => 1);
break;
where we see that controllers loaded without overrides, but from other side below in code we see hook execution:
// Loading controller
$controller = Controller::getController($controller_class);
// Execute hook dispatcher
if (isset($params_hook_action_dispatcher)) {
Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
}
so one of possible solution (without overriding core class) :
how to override module and hope you have core version >= 1.6.0.11
in blockwishlist.php in install() method add
this->registerHook('actionDispatcher')
to condition with other hooks, so it will looks like ... !this->registerHook('actionDispatcher') || ... because this hook not registered by default and we can't just place module there.
create method (can't beautify code here)
public function hookActionDispatcher($params)
{
if ('blockwishlistmywishlistModuleFrontController' == $params['controller_class']) {
include_once(_PS_OVERRIDE_DIR_ . 'modules/' . $this->name . '/controllers/front/mywishlist.php');
$controller = Controller::getController('BlockWishListMyWishListModuleFrontControllerOverride');
}
}
you already have override/modules/blockwishlist/controllers/front/mywishlist.php file by this path
reinstall module.
it works!
more about overriding some behaviors in docs
Turns out that to override a module you dont place your files in:
~/overrides/module/MODULE_NAME
Instead you place it in:
~/themes/MY_THEME/modules/MODULE_NAME
Now the changes are exhibiting themselves.
Does anyone know if/when the module is auto-updated, will my changes get lost/overrwritten?

How set module view for custom searcher in prestashop 1.6

I'm trying to integrate Fotolia Api with Prestashop 1.6.0.9.
I already make module with custom tab, but I have no idea how set view from module folder for this tab. Sorry to say, but "documentation for developers" SUCKS.
I can't find any working solution.
public function install() {
if (!parent::install()
|| !$this->registerHook('backOfficeHeader')
|| !$this->registerHook('header')
) return false;
$tab = new Tab();
$tab->class_name = 'AdminFotoliaSelector';
$tab->id_parent = 0;
$tab->module = $this->name;
$tab->name[(int)(Configuration::get('PS_LANG_DEFAULT'))] = 'Fotolia Selector';
$tab->add();
return true;
}
I had big problem with make proper controller, and now I just can't load anything/ I have no idea how do this.
<?php
if (!defined('_PS_VERSION_'))
exit;
class AdminFotoliaSelectorController extends ModuleAdminController {
public $name;
public function __construct() {
$this->lang = (!isset($this->context->cookie) || !is_object($this->context->cookie)) ? intval(Configuration::get('PS_LANG_DEFAULT')) : intval($this->context->cookie->id_lang);
parent::__construct();
}
public function initContent() {
parent::initContent();
$this->renderForm();
}
public function renderForm() {
$path = _MODULE_DIR_."fotoliaselector";
$more = $this->module->display($path, 'views/templates/admin/fotoliaselector.tpl');
return $more.parent::renderForm();
}
When I try die($more) it gives me content of .tpl, anyway when I click tab in back office it's still empty.
I have debug options on, compiling on, cache off.
So just enlight me please, how am I supose to show ANYTHING there?
I think the problem is that you don't display tab's content at all.
I don't know what module->display method does, but I think you should change in initContent() method line:
$this->renderForm();
into
echo $this->renderForm();
If it won't help you should look at this documentation and try to do it without external classes - only try to use Smarty to display simple content without using Tab class or AdminFotoliaSelector
Well i know it will sounds weird but you need to take some similar modules, and read his code and will see some methods names are the same in each module.
Then copy that, install and play with some changes etc.
Imho you miss standard method getContent() form where you need to pass some data for smarty:
public function getContent()
{
global $smarty, $cookie;
......
//some code
......
$this->_html .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>';
$this->_html .= '<h1>My module title or stuff</h1>';
$this->_html .= $this->getMyCoolFormOrConfig();
$smarty->assign('errors', $this->errors);
$smarty->assign('message', $this->message);
$this->_html .= $this->display(__FILE__, 'name_of_tpl_file.tpl');
return $this->_html;
}
to simple add tab in BackOffice code like this:
$id_tab=Tab::getIdFromClassName('AdminPayment');
$newtab=new Tab();
$newtab->id_parent=$id_tab;
$newtab->module=$this->name;
$newtab->class_name='MyClassName'; //will be same like MyClassName.php in folder of you module where you need to create you class and extend the AdminTab and from there with function you need to echo you name module
$newtab->position=Tab::getNbTabs($id_tab)+1;
$newtab->name[$cookie->id_lang]=$this->l("Name of you stuff");
$newtab->name[Configuration::get('PS_LANG_DEFAULT')]=$this->l("Name of you stuff");
$newtab->add();
Study this file there /controllers/admin/AdminModulesController.php
and you see what methods are using in each module
Take a look greater feature to generate you module structure (register requeired) https://validator.prestashop.com/generator

Fatal error in joomla component

i just installed a new component in my site but when i click on component settings button in the backend i am getting this message:
Fatal error: Call to a member function loadByOption() on a non-object in /mysite.com/administrator/components/com_sigpro/models/settings.php on line 32
the file contains this code:
defined('_JEXEC') or die ;
class SigProModelSettings extends SigProModel
{
protected $extensionID = null;
public function getForm()
{
$option = $this->getState('option');
if (version_compare(JVERSION, '2.5.0', 'ge'))
{
$component = JComponentHelper::getComponent($option);
$this->extensionID = $component->id;
JForm::addFormPath(JPATH_ADMINISTRATOR.'/components/'.$option);
$form = JForm::getInstance($option.'.settings', 'config', array('control' => 'jform'), false, '/config');
$form->bind($component->params);
}
else
{
$component = JTable::getInstance('component');
$component->loadByOption($option);
$this->extensionID = $component->id;
$form = new JParameter($component->params, JPATH_ADMINISTRATOR.DS.'components'.DS.$option.DS.'config.xml');
}
return $form;
}
PS my site is running Joomla 1.7.5 stable version and i cant upgrade it to 2.5 because the site is online and productive some components dont works on version 2.5 .
So i will appreciate it if someone can help me fix this error.
Thanks in advance
you 1.6 needs 1.6 specific modules, components & plugins. You'll need to find a 1.6 compatible version or alternative or check the permissions on /configuration.php
Looks like the table class is not present in your file system. It should have been there in the /mysite.com/administrator/components/com_sigpro/tables folder , somewhere ( may vary depending on the code, but looks like they have not included a custom path ). The class should extends JTable class.

Categories