Need Order id on Paypal Pro Thank you page

  • Posts: 14
  • Thank you received: 0
9 years 1 month ago #216649

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.3.6
-- Error-message(debug-mod must be tuned on) -- : Order id on paypal pro thank you page

How can i get order id of order after successful payment (order confirmation) on Paypal Pro credit card payment method thank you page (paypalpro_thanks.php)?
I tried to get order id using this code,

$app =JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');

But it is not giving any result.

Please can you help me with this.

Thank you.

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
9 years 1 month ago #216684

Hi,

That code looks just fine.
Did you also add a line like this ?
echo $order_id;

Otherwise, you won't see the order id in the $order_id variable.

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

  • Posts: 14
  • Thank you received: 0
9 years 1 month ago #216728

Yes i did add this line :)

echo $order_id;

But no order id is getting displayed.

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

  • Posts: 517
  • Thank you received: 8
  • Hikashop Business
9 years 1 month ago #216752

I'm also looking to do something like this although I have a re-direct to a thank page created as an article. Is it possible to display the order number on that page?

thanks

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
9 years 1 month ago #216842

I don't see why this wouldn't work.

And you can use that code in a Joomla article if you use the plugin called "sourcerer".

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

  • Posts: 517
  • Thank you received: 8
  • Hikashop Business
9 years 1 month ago #216870

Hi I am having the same problem as above, the number is not showing? below is the code I have used.

{source}
<?php
echo $order_id;
$app =JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');
?>
{/source}

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 1 month ago #216882

Hi,

If you display the value ($order_id) before that variable receive the content ; it's logical that you got nothing (because the variable does not have yet the content).

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: 517
  • Thank you received: 8
  • Hikashop Business
9 years 1 month ago #216933

Hi Ok got this to display using;
{source}

<?php
$app =JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');
echo $order_id;
?>
{/source}

but then realised that it's the order number I am after so changed the code to;

{source}

<?php
$app =JFactory::getApplication();
$order_number = $app->getUserState('com_hikashop.order_number');
echo $order_number;
?>
{/source}

and now it will not display the order number like it did with the order_id?

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 1 month ago #216940

Hi,

If you want to get access to information in the order, like the order_number, you need to load the order content.
You can just access to the "order_id" in the user state.. We won't store the entire order content into.

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: 517
  • Thank you received: 8
  • Hikashop Business
9 years 1 month ago #216975

Jerome, Your reply means absolutely nothing to me as I have very limited PHP skills along with the majority of your users.

When I first started to use Hikashop you could not do enough to assist users but now I can see from a lot of posts on here that help is now very vague unless you are proficient in PHP.

Considering I have been using your software for over 4 years a little assistance with the correct code would not go amiss.

rgds

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

  • Posts: 13201
  • Thank you received: 2322
9 years 1 month ago #216997

Hi,

The code to use to get the order content is:

<?php
$app =JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');

echo $order_id; // To display the order id

$orderClass = hikashop_get('class.order');
$fullOrder = $orderClass->get($order_id); // To get all the order

echo $fullOrder->order_number; // To display the order number
?>

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

  • Posts: 517
  • Thank you received: 8
  • Hikashop Business
9 years 1 month ago #217091

Hi Xavier, I have tried this code and all it does is to leave a blank page? I have tried various lines from the code and the only thing I can get to display correctly is the order id which I do not require.

My end goal is just to display the order number in a article using 'Sorcerer' as advised by Nicolas

thanks

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
9 years 1 month ago #217134

Reading your previous messages and mainly this one www.hikashop.com/forum/payment-methods/8...you-page.html#216933 it seems that you're using that code somewhere with specific tags, not in a HikaShop view file.
In that case, before you try using HikaShop functions, you need to load HikaShop itself if it isn't loaded.
It would explain why you get a blank page.
So you'll want to try something like that:

<?php
if(!defined('DS'))
	define('DS', DIRECTORY_SEPARATOR);	if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) return true;

$app =JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');

echo $order_id; // To display the order id

$orderClass = hikashop_get('class.order');
$fullOrder = $orderClass->get($order_id); // To get all the order

echo $fullOrder->order_number; // To display the order number
?>

PS: please remember that we provide user support. Not customization support. This is clearly out of the services you've been paying for the last 4 years. We've already got way above what we are supposed to do here. If you need someone to code something for you, please contact our partners or post on our commercial jobs forum.

The following user(s) said Thank You: mohairbears

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

  • Posts: 517
  • Thank you received: 8
  • Hikashop Business
9 years 1 month ago #217219

Hi Nicolas, Appreciate your comments and assistance.

Not being a programmer but a Hikashop user, I would not know what's in your remit or not, I was not advised to find assistance elsewhere for the information that I required to achieve my goal or else I would have done.

Anyway thank you for this as my goal has now been achieved.


.

Attachments:

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

Time to create page: 0.108 seconds
Powered by Kunena Forum