Skip to main content

Trying to add Order Number / Total to after_end.php

More
9 years 3 weeks ago #277598 by Dardwizzle
Hi,

Per everything i have read, in order to add the Order Number and Paid Amount to the after_end.php page that displays once an order is complete, I have added the code per the past replies but I am still just seeing the default return page that provides a link to the receipt.

Here is the after_end.php
Code:
<?php $app =JFactory::getApplication(); $order_id = $app->getUserState('com_hikashop.order_id'); $orderClass = hikashop_get('class.order'); $currencyClass = hikashop_get('class.currency'); $fullOrder = $orderClass->get($order_id); $this->order = $orderClass->loadFullOrder($order_id,true,false); $this->order->order_full_price + $this->order->order_discount_price - $this->order>order->order_shipping_price - $this->order->order_payment_price; $app->enqueueMessage( JText::_('THANK_YOU_FOR_PURCHASE'); echo $fullOrder->order_number; $url = hikashop_completeLink('order&task=show&cid='.$this->order->order_id); $app->enqueueMessage(JText::sprintf('YOU_CAN_NOW_ACCESS_YOUR_ORDER_HERE',$url)); $user = JFactory::getUser(); if(!$user->guest){ $url = hikashop_completeLink('order&task=show&cid='.$this->order->order_id); $app->enqueueMessage(JText::sprintf('YOU_CAN_NOW_ACCESS_YOUR_ORDER_HERE',$url)); }

Thus far, no combination of any of the example code to have the amount and order number display changes the page from the default page return to include these entries. It is making less and less sense since I have followed every example available. :(

(HikaShop Business 3.2.0 [1709061916])

Please Log in or Create an account to join the conversation.

More
9 years 3 weeks ago - 9 years 3 weeks ago #277604 by kyratn
Hi,

You are doing it wrong. Remove all your added code and try again.

To show order number:
Code:
echo $this->order->order_number;

To show full order amount you need to load currency.
Code:
$currencyClass = hikashop_get('class.currency');

then
Code:
echo $currencyClass->format($this->order->order_full_price,$this->order->order_currency_id);

This does work in end.php so should work and for the after_end.php


Hope that helps.

Kind Regards
Last edit: 9 years 3 weeks ago by kyratn.
The following user(s) said Thank You: Dardwizzle

Please Log in or Create an account to join the conversation.

More
9 years 3 weeks ago #277615 by Dardwizzle
Well, I finally got it! Thank you!

It sucks when your a novice at coding but with the help you all provide, I am learning very quickly! :)

It works perfect now. The code I was trying to use was from other threads with a similar theme and sadly they only tell a small part of the story, not to mention that the bigger problem was I needed to make these changes to the checkout / end.php instead, when the threads I looked up suggested the other.

Thanks a bunch!

(HikaShop Business 3.2.0 [1709061916])
The following user(s) said Thank You: kyratn

Please Log in or Create an account to join the conversation.

More
9 years 3 weeks ago #277641 by nicolas
Hi,

Editing end or after_end are both valid. It actually depends on the payment method you're using.
If you're using a payment method which redirects the customer to the payment gateway for the payment and then back after it, it's "after_end", if not, then it's the "end" one you want to edit.
So the other threads are probably correct because the user there uses payment methods redirecting to the payment gateway and that's why it didn't work for you.

Please Log in or Create an account to join the conversation.

More
9 years 3 weeks ago #277644 by Dardwizzle
Ok, That makes a lot of sense hen. I use Stripe, and it accepts the payment right in the plugin and not redirecting to their gateway, but rather the plugin uses their API, so it's all done right in HikaShop.

The good news is it works beautifully now :) If only everything worked as well! :)

(HikaShop Business 3.2.0 [1709061916])

Please Log in or Create an account to join the conversation.

Time to create page: 0.174 seconds
Powered by Kunena Forum