Amin Vatandoust Posted June 30, 2019 Share Posted June 30, 2019 (edited) Hi I want to customize the COD module confirmation page (The last page which is showing to the customer) So it can show the reference order, Id order, and total order payment. In my inline payment module, I have these parameters by default so I don't need to code them, but in Cash on delivery module, I'm not able to add these. For example, If I add something like {reference_order} I will get 500 with "unknown tag" error., which is obvious I should get it. My question is, how can I give the module this SQL access so it can read them from the database? In which file should I dit and what code should I add? What I need is adding those parameters to COD confirmation page Best Regards. Edited July 7, 2019 by Amin Vatandoust Solved (see edit history) Link to comment Share on other sites More sharing options...
George Bazz Posted July 3, 2019 Share Posted July 3, 2019 Hello @Amin Vatandoust, You should always state which PrestaShop version you're using. Also, are you talking about the core COD module or a downloaded one? Link to comment Share on other sites More sharing options...
Amin Vatandoust Posted July 3, 2019 Author Share Posted July 3, 2019 Hi George Yes, sorry about that. I'm using PrestaShop 1.6.1.23 and the default Cash on delivery (COD) v1.0.0 Link to comment Share on other sites More sharing options...
George Bazz Posted July 3, 2019 Share Posted July 3, 2019 Great! Let's try and fix it: 1. On your cashondelivery.php file change your last method hookPaymentReturn from public function hookPaymentReturn($params) { if (!$this->active) return ; return $this->display(__FILE__, 'confirmation.tpl'); } to public function hookPaymentReturn($params) { if (!$this->active) return ; global $smarty; $order = $params['objOrder']; $smarty->assign(array( 'order' => $order, )); return $this->display(__FILE__, 'confirmation.tpl'); } BE CAREFUL to replace it correctly. You said you got a 500 error so you probably were changing the correct file. However let's make sure we are using the correct one! Check first if your theme has already overriden the file: Check [your-theme-name]/modules/cashondelivery/views/templates/hooks/confirmation.tpl. If it exists THIS is the file you will be changing. If it does not, go to step 2. Check your [root]/modules/cashondelivery/views/templates/hooks/confirmation.tpl file. This definetely exists. You can add your changes here The three variables you asked can be written in the .tpl as: {$order->id} {$order->reference} {$order->total_paid} Here is also a list with all the parameters we added in case you want to use some more (same logic {$order->[name-of-variable]} ) ->id_address_delivery ->id_address_invoice ->id_shop_group ->id_shop ->id_cart ->id_currency ->id_lang ->id_customer ->id_carrier ->current_state ->secure_key ->payment ->module ->conversion_rate ->recyclable =L ->gift =L ->gift_message ->mobile_theme ->shipping_number ->total_discounts ->total_discounts_tax_incl ->total_discounts_tax_excl ->total_paid ->total_paid_tax_incl ->total_paid_tax_excl ->total_paid_real ->total_products ->total_products_wt ->total_shipping ->total_shipping_tax_incl ->total_shipping_tax_excl ->carrier_tax_rate ->total_wrapping ->total_wrapping_tax_incl ->total_wrapping_tax_excl ->invoice_number ->delivery_number ->invoice_date ->delivery_date ->valid ->date_add ->date_upd ->reference ->round_mode ->round_type ->id ->id_shop_list ->force_id DO NOT FORGET TO CLEAR CACHE AFTER CHANGES ARE IMPLEMENTED! 1 Link to comment Share on other sites More sharing options...
George Bazz Posted July 5, 2019 Share Posted July 5, 2019 Hello @Amin Vatandoust, I'd love to know if you managed to implement the solution with my guidlines! If you did, please add [SOLVED] at the beginning of the title in order to help the community! Link to comment Share on other sites More sharing options...
Amin Vatandoust Posted July 7, 2019 Author Share Posted July 7, 2019 (edited) Hi @George Bazz Thanks for your complete guidelines and sorry if I responded late. I tested it right now and it's working properly (Thank you and I will add solved to the Title) I have another problem here. The Total Paid value adds six 0 in decimals (like 5000.000000 IRT) which should be 5000 IRT. I guess it's related to my currency because I had this problem with an SQL query too. In that query, I changed o.total_paid_tax_excl 'Total' to Format(SUM(o.total_paid_tax_excl),0) 'Total' Then it removed the decimals. Now I'm wondering if there is an option to use such code in our TPL file of COD module? Best Regards. Edited July 7, 2019 by Amin Vatandoust (see edit history) Link to comment Share on other sites More sharing options...
George Bazz Posted July 7, 2019 Share Posted July 7, 2019 I am pretty sure {$order->total_paid|floatval} is what you're looking for! Check it, and tell me! Link to comment Share on other sites More sharing options...
Amin Vatandoust Posted July 8, 2019 Author Share Posted July 8, 2019 Yes George, it worked. Also, I needed something to separate every 3 number so I searched for it and found number_format so I replace it with floatval and now it's working properly. Thanks. 1 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