Skip to main content

eway hikashop payment code

More
12 years 7 months ago #143158 by Mat
-- 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.

More
12 years 7 months ago #143177 by Mohamed Thelji
Hi Mat,
Can you replace this line :
Code:
$order_text = "\r\n".JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE',$dbOrder->order_number,HIKASHOP_LIVE);
By :
Code:
$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.

More
12 years 7 months ago - 12 years 7 months ago #143586 by Mat
Replied by Mat on topic eway hikashop payment code
I replaced the line but still nothing.
Last edit: 12 years 7 months ago by Mat.

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

More
12 years 7 months ago #143750 by nicolas
Replied by nicolas on topic eway hikashop payment code
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.135 seconds
Powered by Kunena Forum