Jump to content

[Solved] Customize COD confirmation page


Amin Vatandoust

Recommended Posts

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 orderId 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 by Amin Vatandoust
Solved (see edit history)
Link to comment
Share on other sites

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:

  1. 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.
  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! :D

  • Thanks 1
Link to comment
Share on other sites

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 by Amin Vatandoust (see edit history)
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...