danizgod Posted November 12, 2011 Share Posted November 12, 2011 Hello, Just starting using PS and I'm using Catalog mode. I've made a module that hooks into ExtraRight and provides a link taken from the Location field of the corresponding product. However, URLs contain special chars such as = or have a length longer that 64 chars. I don't want to change the database or comment the validations code. Therefore my question: how can I add an extra field when adding a product, a field that will not be affected by updates or how can I associate a link to a product and display it using a module? Thank you. By the way If anyone is interested I provide my simple module which can display the price or any field that is not available while in catalog mode (since displaying price in catalog mode is not yet available): mymodule.php file: <?php if ( !defined( '_PS_VERSION_' ) ) exit; class MyModule extends Module { public function __construct() { $this->name = 'mymodule'; $this->tab = 'mymodule'; $this->version = 1.0; $this->author = 'mymodule'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l( 'mymodule' ); $this->description = $this->l( 'mymodule' ); } public function install() { if ( parent::install() == false OR !$this->registerHook( 'leftColumn' ) ) return false; return true; } public function uninstall() { if ( !parent::uninstall() ) Db::getInstance()->Execute( 'DELETE FROM `' . _DB_PREFIX_ . 'mymodule`' ); parent::uninstall(); } public function hookExtraRight( $params ) { global $smarty; return $this->display( __FILE__, 'mymodule.tpl' ); } public function hookExtraLeft( $params ) { return $this->hookExtraRight( $params ); } } ?> mymodule.tpl: <!-- Block mymodule --> <div id="mymodule_block_left" class="block"> <h4>mymodule</h4> <div class="block_content"> <ul> <li><a href="{$product->location}" title="Click this link" target="_blank">If you click this you will access the URL from the location field</a></li> </ul> </div> </div> <!-- /Block mymodule --> Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now