Jump to content

[Module Developer] Problem transplant a module


Recommended Posts

Hello all,

 

I'm have made a module but only works fine on left column, if I try to transplate it to right column doesn't  work as expected :/

 

I'm not able either to move my module on live edit, either on left or right column.

 

My final functions, on this class, are:


class cttTracking extends Module
{

public function hookDisplayLeftColumn($params) { $shopUrl = $_SERVER['SERVER_NAME']; $this->context->smarty->assign( array( 'myModuleName' => Configuration::get('MYMODULE_NAME'), 'myModuleLink' => $this->context->link->getModuleLink('cttTracking', 'display'), 'shopUrl' => $shopUrl ) ); return $this->display(__FILE__, 'cttTracking.tpl'); } public function hookDisplayRightColumn($params) { return $this->hookDisplayLeftColumn($params); } public function hookDisplayHeader() { $this->context->controller->addCSS($this->_path.'css/style.css', 'all'); $this->context->controller->addCSS(($this->_path).'css/colorbox.css'); $this->context->controller->addJquery(); $this->context->controller->addJS(($this->_path).'js/handleResponse.js'); $this->context->controller->addJS(($this->_path).'js/jquery.colorbox-min.js'); } }

 

Off course I have my own functions inside this class on other file outside this class using ajax agent and some other stuf.

Here you can see what happen:
http://www.prestashop.bijouart.pt/index.php

I
 have just transplate it to right column.

 

 

Thanks in advance.

Marcelo

Link to comment
Share on other sites

and where is code for right column ? hookDisplayRightColumn ?

 

Hello,

 

thanks for your reply. 

 

This is not enough?

 

 hookDisplayRightColumn($params) { return $this->hookDisplayLeftColumn($params); }

I thought this was to do a copy of hookDisplayLeftColumn...Am I thinking wrong?

 

Thanks

Edited by deepshoot (see edit history)
Link to comment
Share on other sites

hello, sure i can, i just missed your reply

 

your code is OK.

but

IlzEx1p.png

 

 

the problem is with js files,

you use this module in two positions, js scripts are based on ID of element, this is why first works, second not.

you have to use it only one time.

Link to comment
Share on other sites

So easy, my bad :)

It's working good.

 

I marked as solved.

 

I mean, I'm still not able to use live edit to move my module down/up or to the left/right column. Can you please advise me wich is better to avoid this happen? 

 

And there's some option to, if I hook to right column, automatically remove it from left or maybe, some option to only allow one hook at once.

 

 

Thanks for your precious help :)

 

Best regards,

Marcelo

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...