eway hikashop payment code

  • Posts: 217
  • Thank you received: 1
11 years 5 months ago #143158

-- url of the page with the problem -- : mywebsite.com/mypage
-- HikaShop version -- : 1.5 i think
-- Joomla version -- : 2.5
-- PHP version -- : 5.3

Hi guys,

In the code I have for a successful transaction there is this line

$order_text = "\r\n".JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE',$dbOrder->order_number,HIKASHOP_LIVE);

but I dont think it works because I can't get the order number from it. How can I get the order number for the just created order?

Thanks,

Mat

full case code: function onBeforeOrderCreate
case EWAY_TRANSACTION_OK:
$order->history->history_reason=JText::sprintf('AUTOMATIC_PAYMENT_NOTIFICATION');
$order->history->history_notified=0;
$order->history->history_amount= round($order->cart->full_total->prices[0]->price_value_with_tax,2).'USD';
$order->history->history_payment_id = $order->order_payment_id;
$order->history->history_payment_method =$order->order_payment_method;
$order->history->history_data = '';
$order->history->history_type = 'payment';
$order->order_status = $method->payment_params->verified_status;


$mailer =& JFactory::getMailer();
$config =& hikashop_config();
$sender = array(
$config->get('from_email'),
$config->get('from_name') );
$mailer->setSender($sender);
$mailer->addRecipient(explode(',',$config->get('payment_notification_email')));
$url = HIKASHOP_LIVE.'administrator/index.php?option=com_hikashop&ctrl=order&task=listing';
$order_text = "\r\n".JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE',$dbOrder->order_number,HIKASHOP_LIVE);
$order_text .= "\r\n".str_replace('<br/>',"\r\n",JText::sprintf('ACCESS_ORDER_WITH_LINK',$url));
$mailer->setSubject(JText::sprintf('PAYMENT_NOTIFICATION','eWAY','Accepted'));
$body = str_replace('<br/>',"\r\n",JText::sprintf('PAYMENT_NOTIFICATION_STATUS','eWAY','Accepted')).' '.JText::sprintf('ORDER_STATUS_CHANGED',$order->order_status)."\r\n\r\n".$order_text;
$mailer->setBody($body);
$mailer->Send();
break;

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

  • Posts: 12953
  • Thank you received: 1778
11 years 5 months ago #143177

Hi Mat,
Can you replace this line :

$order_text = "\r\n".JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE',$dbOrder->order_number,HIKASHOP_LIVE);
By :
$order_text = "\r\n".JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE',$order->order_number,HIKASHOP_LIVE);
And try it again ?

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

  • Posts: 217
  • Thank you received: 1
11 years 5 months ago #143586

I replaced the line but still nothing.

Last edit: 11 years 5 months ago by Mat.

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

  • Posts: 84142
  • Thank you received: 13647
  • MODERATOR
11 years 5 months ago #143750

Hi,

It's actually normal that you don't get the order number here since the order is not yet created. It is created just after that by HikaShop and it's at that point that the order number is generated.
So you won't be able to use the order number in that function.
You would have to add a new onAfterOrderCreate function in that file and send the email in that function.

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

Time to create page: 0.089 seconds
Powered by Kunena Forum