vik* Posted December 21, 2011 Share Posted December 21, 2011 I would like to place my plugin on on the confirm page, when user ordered products. Which hook can I use? Any examples? I get all product data from the cart object. $cart->getProducts(true); Is there a way to get all the ordered products from an order? And I also would like to have some user data, like the email of the user. Examples would be a great help. Thank you! Link to comment Share on other sites More sharing options...
bellini13 Posted December 21, 2011 Share Posted December 21, 2011 you want to hook orderConfirmation. You see the following function in a lot of payment modules. $params['objOrder'] is the actual Order object. You can use that to access anything about the order (products, customer etc..) public function hookOrderConfirmation($params) { global $smarty; if ($params['objOrder']->module != $this->name) return; if ($params['objOrder']->getCurrentState() != Configuration::get('PS_OS_ERROR')) $smarty->assign(array('status' => 'ok', 'id_order' => intval($params['objOrder']->id))); else $smarty->assign('status', 'failed'); return $this->display(__FILE__, 'hookorderconfirmation.tpl'); } Link to comment Share on other sites More sharing options...
Kokkekniven Posted December 29, 2011 Share Posted December 29, 2011 Bellini - could you express it a little more clear to me? After payment (using danish gateway), my users get to a page, designed by the module maker and in that tpl file i have: {$HOOK_ORDER_CONFIRMATION} what should i do, to show a mesage to the user along wit eventually a order detail. I tried to add an include file order-detail.tpl, but that doesnt work.... Any ideas? Happy new year Link to comment Share on other sites More sharing options...
bellini13 Posted December 29, 2011 Share Posted December 29, 2011 can you send me the payment gateway module that you are referring to, you can send it via a PM. the payment module can hook orderConfirmation, if it's not already, but it assumes the module redirects to order confirmation page correctly. so let me take a look at how it was implemented, and then I can advise you better. Link to comment Share on other sites More sharing options...
Kokkekniven Posted December 31, 2011 Share Posted December 31, 2011 Hey Bellini and happy new year, The module can be downloaded here: http://quickpay.net/modules/prestashop/ and im using the newest module available. I look at how to send it to you on pb, but guess my brain was outta work that day. Link to comment Share on other sites More sharing options...
bellini13 Posted January 1, 2012 Share Posted January 1, 2012 in the quickpay module, there is a file complete.tpl. You can update that file to include a different message to the borrower. Also instead of putting the order detail in the confirmation page, I would just include a link to the actual order history, let them click on the link. Link to comment Share on other sites More sharing options...
Kokkekniven Posted January 1, 2012 Share Posted January 1, 2012 Thank you very much bellini, Was looking at that file and there must be a way to include shoppers email address on that page. Thank you again :-) Link to comment Share on other sites More sharing options...
bellini13 Posted January 1, 2012 Share Posted January 1, 2012 there are some changes required to complete.php and complete.tpl to get the email. since you are altering a template file, you will need to enable force compile after making these changes. 1) update complete.php to get the customer and place the email address in the smarty engine. this line will create the customer object. place this around line 20, just before the $smarty->assign line $customer = new Customer((int)($order->id_customer)); then update the smarty assignment to include the email address $smarty->assign(array( 'order' => $id_order, 'email' => $customer->email, 'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation(intval($id_order)), )); 2) update the complete.tpl (template) to display it. All you need to do is place {$email} where you want the email address to display. So you could do something like... Your email address is {$email} Link to comment Share on other sites More sharing options...
Kokkekniven Posted January 1, 2012 Share Posted January 1, 2012 Bellini - You are my life saver. It works perfectly. I know im asking a lot here - and just let me know, if this requieres payed help, ok? Is it possible on that page, to allow that costumer to either view or download the invoice? I ask, because i dont use / allow people to register on the page and therfore, they cant see or use history.php Best regards, Kristian Link to comment Share on other sites More sharing options...
bellini13 Posted January 2, 2012 Share Posted January 2, 2012 the format of the pdf invoice is like this... http://domain/pdf-invoice.php?id_order=<order_number> since smarty already has the order number, it should be very simple... do the following http://domain/pdf-invoice.php?id_order={$order} Link to comment Share on other sites More sharing options...
Kokkekniven Posted January 2, 2012 Share Posted January 2, 2012 I tried that using: {<a href="{$base_dir}pdf-invoice.php?id_order={$order}">See your invoice here</a> However, it "reopens" an authentication file, an empty one, that is :/ Link to comment Share on other sites More sharing options...
bellini13 Posted January 2, 2012 Share Posted January 2, 2012 The first thing pdf-invoice.php does is check if the user is logged in. What customizations have you made that prevent this? if (!$cookie->isLogged() AND !Tools::getValue('secure_key')) Tools::redirect('authentication.php?back=pdf-invoice.php'); If you have done some type of customization, then you will need to create a custom pdf-invoice.php file that removes those authentication checks, but I would highly advise not doing that, since anyone will be able to view any invoice. Link to comment Share on other sites More sharing options...
Kokkekniven Posted January 2, 2012 Share Posted January 2, 2012 include(dirname(__FILE__).'/config/config.inc.php'); include(dirname(__FILE__).'/init.php'); $cookie = new Cookie('ps'); if (!$cookie->isLogged() AND !Tools::getValue('secure_key')) Tools::redirect('authentication.php?back=pdf-invoice.php'); if (!(int)(Configuration::get('PS_INVOICE'))) die(Tools::displayError('Invoices are disabled in this shop.')); if (isset($_GET['id_order']) AND Validate::isUnsignedId($_GET['id_order'])) $order = new Order((int)($_GET['id_order'])); if (!isset($order) OR !Validate::isLoadedObject($order)) die(Tools::displayError('Invoice not found')); elseif ((isset($cookie->id_customer) AND $order->id_customer != $cookie->id_customer) OR (Tools::isSubmit('secure_key') AND $order->secure_key != Tools::getValue('secure_key'))) die(Tools::displayError('Invoice not found')); elseif (!OrderState::invoiceAvailable($order->getCurrentState()) AND !$order->invoice_number) die(Tools::displayError('No invoice available')); else PDF::invoice($order); That is what my pdf-invoice.php looks like. I havent done any customization to that file. Link to comment Share on other sites More sharing options...
bellini13 Posted January 2, 2012 Share Posted January 2, 2012 understood, but apparently you have made other customizations to your shop, which is preventing the pdf invoice from working properly. previously you said ... I ask, because i dont use / allow people to register on the page and therfore, they cant see or use history.php how do you accomplish that? Link to comment Share on other sites More sharing options...
Kokkekniven Posted January 2, 2012 Share Posted January 2, 2012 I see what you mean. The site in question is www.uni-media.dk/devsantoku Im using 5 step checkout, modified, so there is no payment option(only creditcard) and no carrier selection, because im only using 1 carrier. i only use the shoppin-cart - authentication - popup payment window - and at the end you get the complete.tpl file from the payment gateway :-) Hope that made sense. Link to comment Share on other sites More sharing options...
bellini13 Posted January 2, 2012 Share Posted January 2, 2012 however the 5 step checkout was modified, seems to have prevented the pdf-invoice from functioning. difficult to troubleshoot without knowing what was done. Link to comment Share on other sites More sharing options...
Kokkekniven Posted January 3, 2012 Share Posted January 3, 2012 Yes sir, youre right again. Well - I will keep it the way it is then. Thank you so much for your time and help. Really apriciated :-) 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