vik* Posted December 20, 2011 Share Posted December 20, 2011 I am writing a module, let's call it base, which will show a button after vistor has clicked on buy+confirmed. That is the page uou usually the price you pay and eMail will be delivered. On that page, I would like to add my module with the button, which on-click sends product details to another web service. Now I have several questions: #1 Which hook can I use to place that button. #2 When I click this button, products.php is called, which refers base.php. But base.php exists, because _PS_VERSION is not defined. If I remove comment out the _PS_VERSION_ check, Module and Cart are not found. #3 what do you think in general of the code. Would getProducts() be the right method, just copied from another standard module. base.php (only important part of it) <?php if ( !defined( '_PS_VERSION_' ) ) exit; class Base extends Module { public function install() { return parent::install() && $this->registerHook('payment') && $this->registerHook('invoice') && $this->registerHook('leftColumn'); } public function uninstall() { parent::uninstall(); } public function getContent() { return '<h2>'.$this->displayName.'</h2> <div>nothing to configure</div>'; } public function hookPayment($params) { if (!$this->active) return; global $smarty; $smarty->assign('buttonText', $this->l('Send to my base')); return $this->display(__FILE__, 'base.tpl'); } public function ajaxCall($params) { if (Configuration::get('PS_CATALOG_MODE')) return "return;"; $products = $params['cart']->getProducts(true); global $smarty; $this->smartyAssigns($smarty, $params); return $this->display(__FILE__, 'products.tpl'); } } products.php global $cookie; include(dirname(__FILE__).'/base.php'); $cart = new Cart((int)($cookie->id_cart)); $cart->id_lang = (int)($cookie->id_lang); $itembase = new Itembase(); echo $base->hookAjaxCall(array('cookie' => $cookie, 'cart' => $cart)); Help is appreciated, thank you very much, vik 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