Adding order information to after_end.php

  • Posts: 10
  • Thank you received: 0
10 years 7 months ago #125252

Hello,

I am trying to update the after_end.php and can successfully add text, but I would like to add the order details to the page also.

To see which variables exist, I put the following, but nothing is showing.

echo"<pre>";
print_r($this->order);
echo"</pre>";

I even tried
$this->order->order_id
but that too doesn't seem to display anything.

I am currently on Hikashop Business 2.2.1

Thanks.

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

  • Posts: 26019
  • Thank you received: 4005
  • MODERATOR
10 years 7 months ago #125275

Hi,

Are you editing the view for the right front-end tempplate ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 10
  • Thank you received: 0
10 years 7 months ago #125294

I am yes. I was able to add

<h2><?php echo JText::_( 'Thank you for your order!'); ?></h2>
<h3><?php echo JText::_( 'An email has been sent with your order information.'); ?></h3>
and that shows up correctly.

Thanks again!!!

Last edit: 10 years 7 months ago by munk38.

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

  • Posts: 10
  • Thank you received: 0
10 years 6 months ago #127658

This page pops up just after clicking the checkout and right before the final page. I have no idea where it's coming from or even how to remedy it. My guess is that it's breaking something so the after_end.php isn't displaying the info.

Thanks again!

Attachments:

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

  • Posts: 26019
  • Thank you received: 4005
  • MODERATOR
10 years 6 months ago #127665

Hi,

Did you read the error message displayed ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 10
  • Thank you received: 0
10 years 6 months ago #130219

We remedied the error that popped up on check out. Don't know if you want to create a separate resolved post just in case it happens to others. Evidently Authorize.net didn't like that our IP ended in .255 and that caused the error shown. Everything checks out now as far as processing the order.

The after_end.php page still is not showing any of the order information?!!?!?

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

  • Posts: 81604
  • Thank you received: 13083
  • MODERATOR
10 years 6 months ago #130221

The code that you added in after_end is the correct one.
Which means that the after_end file is probably not called at all as you must be using authorize.net in AIM. In that case, it's the "end" file that you want to edit. By default there are no variables in the "end" view file, but you can call it after_end to load the order like that:
<?php $this->after_end(); ?>

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

  • Posts: 10
  • Thank you received: 0
10 years 6 months ago #130424

Thanks Nicolas! It seems that the after_end.php file is loading last after checkout as it shows the H2 I added. But will not show:

echo"<pre>"; print_r($this->order); echo"</pre>";
.

Should I still add <?php $this->after_end(); ?> to the end.php file?

Thanks!

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

  • Posts: 13201
  • Thank you received: 2322
10 years 6 months ago #130487

Hi,

No you shouldn't have to add the code to the end.php file if your title is displayed.
Thanks to set the error reporting of Joomla to "Maximum" and enable the debug mode in order to see if any errors are returned.

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

  • Posts: 10
  • Thank you received: 0
10 years 6 months ago #130503

Thanks.
I receive:
Notice: Trying to get property of non-object in /mysitestructure/html/com_hikashop/checkout/after_end.php on line 32

Line 32:

echo $this->order->order_id;

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

  • Posts: 81604
  • Thank you received: 13083
  • MODERATOR
10 years 6 months ago #130550

In that case it means that the "order_id" is missing from $_SESSION. It is stored there by HikaShop when the order is created at the end of the checkout.
So you should definitely have access to it.
If you do:
$app = JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');
var_dump($order_id);

Do you get the id of the order displayed ? If yes, then you should definitely get the order data in $this->order since the after_end() function simply load the order in that attribute of $this for the order id stored in the session. If no, then maybe there is an issue with the session somehow.

By the way, how did you configure your payment method ? Could you do a screenshot (and remove the confidential data in it) ?

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

  • Posts: 10
  • Thank you received: 0
10 years 6 months ago #130580

Bingo! That worked. Attached is the screenshot.

Attachments:

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

  • Posts: 10
  • Thank you received: 0
10 years 6 months ago #130586

Being we are calling the order_id in the getUserState, if I want to call other variables do I need to call each one separately?

$order_total = $app->getUserState('com_hikashop.order_total');

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

  • Posts: 81604
  • Thank you received: 13083
  • MODERATOR
10 years 6 months ago #130598

Once you have the order_id, you can use such code to load all the data from the order:
$orderClass = hikashop_get('class.order');
$order = $orderClass->loadFullOrder($order_id);

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

  • Posts: 10
  • Thank you received: 0
10 years 6 months ago #130605

Thanks!! I use:

$app = JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');
$orderClass = hikashop_get('class.order'); 
$order = $orderClass->loadFullOrder($order_id);
var_dump($order);

and it comes back NULL :( I must be forgetting something. Thanks again for you help on this!!!

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

  • Posts: 81604
  • Thank you received: 13083
  • MODERATOR
10 years 6 months ago #130650

This means that you must be in guest checkout mode. Users don't have access to the data of the order in guest checkout and thus, at the end of the checkout, the user goes out of the guest mode and can't access the order data.
To force the access of the data, you need to change the line:
$order = $orderClass->loadFullOrder($order_id);

to:
$order = $orderClass->loadFullOrder($order_id,false,false);

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

  • Posts: 10
  • Thank you received: 0
10 years 6 months ago #130939

Bingo!!

Worked like a charm. Thanks!

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

  • Posts: 13
  • Thank you received: 0
10 years 1 week ago #153097

I use this code:

munk38 wrote: Thanks!! I use:

$app = JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');
$orderClass = hikashop_get('class.order'); 
$order = $orderClass->loadFullOrder($order_id);
var_dump($order);

and it comes back NULL :( I must be forgetting something. Thanks again for you help on this!!!


I'm testing the cart so i'm using a free coupon vs. processing a payment i've modified end.php and it returns the following

Thank you for your purchase.object(stdClass)#619 (40) { ["order_id"]=> string(2) "11" ["order_billing_address_id"]=> string(1) "3" ["order_shipping_address_id"]=> string(1) "3" ["order_user_id"]=> string(1) "3" ["order_status"]=> string(9) "confirmed" ["order_type"]=> string(4) "sale" ["order_number"]=> string(3) "M11" ["order_created"]=> string(10) "1398173803" ["order_modified"]=> string(10) "1398173803" ["order_invoice_id"]=> string(2) "11" ["order_invoice_number"]=> string(3) "M11" ["order_invoice_created"]=> string(10) "1398173803" ["order_currency_id"]=> string(1) "2" ["order_full_price"]=> string(7) "0.00000" ["order_tax_info"]=> string(0) "" ["order_discount_code"]=> string(9) "freeforme" ["order_discount_price"]=> string(7) "8.95000" ["order_discount_tax"]=> string(7) "0.00000" ["order_payment_id"]=> string(1) "0" ["order_payment_method"]=> string(0) "" ["order_payment_price"]=> string(7) "0.00000" ["order_payment_params"]=> string(0) "" ["order_shipping_id"]=> string(0) "" ["order_shipping_method"]=> string(0) "" ["order_shipping_price"]=> string(7) "0.00000" ["order_shipping_tax"]=> string(7) "0.00000" ["order_shipping_params"]=> string(0) "" ["order_partner_id"]=> string(1) "0" ["order_partner_price"]=> string(7) "0.00000" ["order_partner_paid"]=> string(1) "0" ["order_partner_currency_id"]=> string(1) "0" ["order_ip"]=> string(13) "98.217.140.46" ["customer"]=> object(stdClass)#777 (29) { ["user_id"]=> string(1) "3" ["user_cms_id"]=> string(3) "355" ["user_email"]=> string(16) "This email address is being protected from spambots. You need JavaScript enabled to view it." ["user_partner_email"]=> string(0) "" ["user_params"]=> string(0) "" ["user_partner_id"]=> string(1) "0" ["user_partner_price"]=> string(7) "0.00000" ["user_partner_paid"]=> string(1) "0" ["user_created_ip"]=> string(13) "98.217.140.46" ["user_unpaid_amount"]=> string(7) "0.00000" ["user_partner_currency_id"]=> string(1) "0" ["user_created"]=> string(10) "1398098645" ["user_currency_id"]=> string(1) "0" ["user_partner_activated"]=> string(1) "0" ["id"]=> string(3) "355" ["name"]=> string(11) "Jason Brown" ["username"]=> string(6) "edocif" ["email"]=> string(16) "This email address is being protected from spambots. You need JavaScript enabled to view it." ["password"]=> string(34) "$P$DFEWGxOfq7jJMQJOcsyK6ZYyBcFbJ41" ["block"]=> string(1) "0" ["sendEmail"]=> string(1) "0" ["registerDate"]=> string(19) "2014-04-21 16:44:05" ["lastvisitDate"]=> string(19) "2014-04-22 13:12:38" ["activation"]=> string(0) "" ["params"]=> string(124) "{"site_language":"en-GB","language":"en-GB","admin_style":"","admin_language":"","editor":"jce","helpsite":"","timezone":""}" ["lastResetTime"]=> string(19) "0000-00-00 00:00:00" ["resetCount"]=> string(1) "0" ["otpKey"]=> string(0) "" ["otep"]=> string(0) "" } ["order_subtotal"]=> float(8.95) ["shipping_address"]=> object(stdClass)#627 (19) { ["address_id"]=> string(1) "3" ["address_user_id"]=> string(1) "3" ["address_title"]=> string(2) "Mr" ["address_firstname"]=> string(5) "Jason" ["address_middle_name"]=> NULL ["address_lastname"]=> string(5) "Brown" ["address_company"]=> NULL ["address_street"]=> string(15) "46 Ridgewood St" ["address_street2"]=> string(0) "" ["address_post_code"]=> string(5) "03103" ["address_city"]=> string(10) "manchester" ["address_telephone"]=> string(10) "6033611142" ["address_telephone2"]=> NULL ["address_fax"]=> NULL ["address_state"]=> NULL ["address_country"]=> NULL ["address_published"]=> string(1) "1" ["address_vat"]=> NULL ["address_default"]=> string(1) "1" } ["fields"]=> array(7) { ["address_title"]=> object(stdClass)#637 (19) { ["field_id"]=> string(1) "1" ["field_table"]=> string(7) "address" ["field_realname"]=> string(5) "Title" ["field_namekey"]=> string(13) "address_title" ["field_type"]=> string(14) "singledropdown" ["field_value"]=> array(5) { ["Mr"]=> object(stdClass)#758 (2) { ["value"]=> string(13) "HIKA_TITLE_MR" ["disabled"]=> string(1) "0" } ["Mrs"]=> object(stdClass)#757 (2) { ["value"]=> string(14) "HIKA_TITLE_MRS" ["disabled"]=> string(1) "0" } ["Miss"]=> object(stdClass)#756 (2) { ["value"]=> string(15) "HIKA_TITLE_MISS" ["disabled"]=> string(1) "0" } ["Ms"]=> object(stdClass)#755 (2) { ["value"]=> string(13) "HIKA_TITLE_MS" ["disabled"]=> string(1) "0" } ["Dr"]=> object(stdClass)#754 (2) { ["value"]=> string(13) "HIKA_TITLE_DR" ["disabled"]=> string(1) "0" } } ["field_published"]=> string(1) "1" ["field_ordering"]=> string(1) "1" ["field_options"]=> string(107) "a:5:{s:12:"errormessage";s:0:"";s:4:"cols";s:0:"";s:4:"rows";s:0:"";s:4:"size";s:0:"";s:6:"format";s:0:"";}" ["field_core"]=> string(1) "1" ["field_required"]=> string(1) "1" ["field_default"]=> string(0) "" ["field_access"]=> string(3) "all" ["field_categories"]=> string(3) "all" ["field_with_sub_categories"]=> string(1) "0" ["field_frontcomp"]=> string(1) "1" ["field_backend"]=> string(1) "1" ["field_backend_listing"]=> string(1) "0" ["field_display"]=> string(0) "" } ["address_firstname"]=> object(stdClass)#634 (19) { ["field_id"]=> string(1) "2" ["field_table"]=> string(7) "address" ["field_realname"]=> string(9) "Firstname" ["field_namekey"]=> string(17) "address_firstname" ["field_type"]=> string(4) "text" ["field_value"]=> string(0) "" ["field_published"]=> string(1) "1" ["field_ordering"]=> string(1) "2" ["field_options"]=> string(107) "a:5:{s:12:"errormessage";s:0:"";s:4:"cols";s:0:"";s:4:"rows";s:0:"";s:4:"size";s:0:"";s:6:"format";s:0:"";}" ["field_core"]=> string(1) "1" ["field_required"]=> string(1) "1" ["field_default"]=> string(0) "" ["field_access"]=> string(3) "all" ["field_categories"]=> string(3) "all" ["field_with_sub_categories"]=> string(1) "0" ["field_frontcomp"]=> string(1) "1" ["field_backend"]=> string(1) "1" ["field_backend_listing"]=> string(1) "0" ["field_display"]=> string(0) "" } ["address_lastname"]=> object(stdClass)#633 (19) { ["field_id"]=> string(1) "4" ["field_table"]=> string(7) "address" ["field_realname"]=> string(8) "Lastname" ["field_namekey"]=> string(16) "address_lastname" ["field_type"]=> string(4) "text" ["field_value"]=> string(0) "" ["field_published"]=> string(1) "1" ["field_ordering"]=> string(1) "4" ["field_options"]=> string(107) "a:5:{s:12:"errormessage";s:0:"";s:4:"cols";s:0:"";s:4:"rows";s:0:"";s:4:"size";s:0:"";s:6:"format";s:0:"";}" ["field_core"]=> string(1) "1" ["field_required"]=> string(1) "1" ["field_default"]=> string(0) "" ["field_access"]=> string(3) "all" ["field_categories"]=> string(3) "all" ["field_with_sub_categories"]=> string(1) "0" ["field_frontcomp"]=> string(1) "1" ["field_backend"]=> string(1) "1" ["field_backend_listing"]=> string(1) "0" ["field_display"]=> string(0) "" } ["address_street"]=> object(stdClass)#632 (19) { ["field_id"]=> string(1) "6" ["field_table"]=> string(7) "address" ["field_realname"]=> string(6) "Street" ["field_namekey"]=> string(14) "address_street" ["field_type"]=> string(4) "text" ["field_value"]=> string(0) "" ["field_published"]=> string(1) "1" ["field_ordering"]=> string(1) "6" ["field_options"]=> string(107) "a:5:{s:12:"errormessage";s:0:"";s:4:"cols";s:0:"";s:4:"rows";s:0:"";s:4:"size";s:0:"";s:6:"format";s:0:"";}" ["field_core"]=> string(1) "1" ["field_required"]=> string(1) "1" ["field_default"]=> string(0) "" ["field_access"]=> string(3) "all" ["field_categories"]=> string(3) "all" ["field_with_sub_categories"]=> string(1) "0" ["field_frontcomp"]=> string(1) "1" ["field_backend"]=> string(1) "1" ["field_backend_listing"]=> string(1) "0" ["field_display"]=> string(0) "" } ["address_post_code"]=> object(stdClass)#631 (19) { ["field_id"]=> string(1) "8" ["field_table"]=> string(7) "address" ["field_realname"]=> string(9) "Post code" ["field_namekey"]=> string(17) "address_post_code" ["field_type"]=> string(4) "text" ["field_value"]=> string(0) "" ["field_published"]=> string(1) "1" ["field_ordering"]=> string(1) "8" ["field_options"]=> string(107) "a:5:{s:12:"errormessage";s:0:"";s:4:"cols";s:0:"";s:4:"rows";s:0:"";s:4:"size";s:0:"";s:6:"format";s:0:"";}" ["field_core"]=> string(1) "1" ["field_required"]=> string(1) "0" ["field_default"]=> string(0) "" ["field_access"]=> string(3) "all" ["field_categories"]=> string(3) "all" ["field_with_sub_categories"]=> string(1) "0" ["field_frontcomp"]=> string(1) "1" ["field_backend"]=> string(1) "1" ["field_backend_listing"]=> string(1) "0" ["field_display"]=> string(0) "" } ["address_city"]=> object(stdClass)#630 (19) { ["field_id"]=> string(1) "9" ["field_table"]=> string(7) "address" ["field_realname"]=> string(4) "City" ["field_namekey"]=> string(12) "address_city" ["field_type"]=> string(4) "text" ["field_value"]=> string(0) "" ["field_published"]=> string(1) "1" ["field_ordering"]=> string(1) "9" ["field_options"]=> string(107) "a:5:{s:12:"errormessage";s:0:"";s:4:"cols";s:0:"";s:4:"rows";s:0:"";s:4:"size";s:0:"";s:6:"format";s:0:"";}" ["field_core"]=> string(1) "1" ["field_required"]=> string(1) "1" ["field_default"]=> string(0) "" ["field_access"]=> string(3) "all" ["field_categories"]=> string(3) "all" ["field_with_sub_categories"]=> string(1) "0" ["field_frontcomp"]=> string(1) "1" ["field_backend"]=> string(1) "1" ["field_backend_listing"]=> string(1) "0" ["field_display"]=> string(0) "" } ["address_telephone"]=> object(stdClass)#629 (19) { ["field_id"]=> string(2) "10" ["field_table"]=> string(7) "address" ["field_realname"]=> string(9) "Telephone" ["field_namekey"]=> string(17) "address_telephone" ["field_type"]=> string(4) "text" ["field_value"]=> string(0) "" ["field_published"]=> string(1) "1" ["field_ordering"]=> string(2) "10" ["field_options"]=> string(107) "a:5:{s:12:"errormessage";s:0:"";s:4:"cols";s:0:"";s:4:"rows";s:0:"";s:4:"size";s:0:"";s:6:"format";s:0:"";}" ["field_core"]=> string(1) "1" ["field_required"]=> string(1) "1" ["field_default"]=> string(0) "" ["field_access"]=> string(3) "all" ["field_categories"]=> string(3) "all" ["field_with_sub_categories"]=> string(1) "0" ["field_frontcomp"]=> string(1) "1" ["field_backend"]=> string(1) "1" ["field_backend_listing"]=> string(1) "0" ["field_display"]=> string(0) "" } } ["billing_address"]=> object(stdClass)#635 (19) { ["address_id"]=> string(1) "3" ["address_user_id"]=> string(1) "3" ["address_title"]=> string(2) "Mr" ["address_firstname"]=> string(5) "Jason" ["address_middle_name"]=> NULL ["address_lastname"]=> string(5) "Brown" ["address_company"]=> NULL ["address_street"]=> string(15) "46 Ridgewood St" ["address_street2"]=> string(0) "" ["address_post_code"]=> string(5) "03103" ["address_city"]=> string(10) "manchester" ["address_telephone"]=> string(10) "6033611142" ["address_telephone2"]=> NULL ["address_fax"]=> NULL ["address_state"]=> NULL ["address_country"]=> NULL ["address_published"]=> string(1) "1" ["address_vat"]=> NULL ["address_default"]=> string(1) "1" } ["products"]=> array(1) { [0]=> object(stdClass)#659 (19) { ["order_product_id"]=> string(2) "14" ["order_id"]=> string(2) "11" ["product_id"]=> string(2) "20" ["order_product_quantity"]=> string(1) "1" ["order_product_name"]=> string(43) "11. Managing Up: Asking the Right Questions" ["order_product_code"]=> string(43) "11__Managing_Up__Asking_the_Right_Questions" ["order_product_price"]=> string(7) "8.95000" ["order_product_tax"]=> string(7) "0.00000" ["order_product_tax_info"]=> array(0) { } ["order_product_options"]=> string(0) "" ["order_product_option_parent_id"]=> string(1) "0" ["order_product_wishlist_id"]=> string(1) "0" ["order_product_shipping_id"]=> string(0) "" ["order_product_shipping_method"]=> string(0) "" ["order_product_shipping_price"]=> string(7) "0.00000" ["order_product_shipping_tax"]=> string(7) "0.00000" ["order_product_shipping_params"]=> string(0) "" ["order_product_total_price_no_vat"]=> float(8.95) ["order_product_total_price"]=> float(8.95) } } ["additional"]=> array(0) { } ["order_subtotal_no_vat"]=> float(8.95) }

How do i get this to show the order in a graphical format? my code for end.php is as follows :

<?php
/**
* @package HikaShop for Joomla!
* @version 2.2.3
* @author hikashop.com
* @copyright (C) 2010-2013 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
if(empty($this->html)){
echo JText::_('THANK_YOU_FOR_PURCHASE');
$app = JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');
$orderClass = hikashop_get('class.order');
$order = $orderClass->loadFullOrder($order_id);
var_dump($order);

}else{
echo $this->html;

}
$this->nextButton = false;

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

  • Posts: 13
  • Thank you received: 0
10 years 1 week ago #153100

i just want the cart to show thank you for your order and what you would see when you go to the view orders screen and then into the order i.e. hikashop-menu-for-user-control-panel/order/show/cid-11.

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

  • Posts: 81604
  • Thank you received: 13083
  • MODERATOR
10 years 1 week ago #153104

In that case, you should rather redirect the user to that page like that:

$app = JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');
$app->redirect('http://mywebsite.com/hikashop-menu-for-user-control-panel/order/show/cid-'.$order_id);

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

Time to create page: 0.114 seconds
Powered by Kunena Forum