Custom save order code can not paid later

  • Posts: 567
  • Thank you received: 11
  • Hikashop Business
4 years 4 months ago #321392

-- HikaShop version -- : 4.3
-- Joomla version -- : 3.9.12
-- PHP version -- : 5.6

Hi Dear

We are able to save order into hikashop in another integration, but we turn on "paid later" option, the payment button is not shown in order listing

The normal checkout order can show this button for payment

We suspect because we didn't set payment detail properly in order class

Can you advise what is missing or what is wrong here?

$order = new stdClass();

			$order->order_full_price = $product->product_sort_price;

			$order->order_currency_id = 96;

			$order->order_user_id = $hika_user_id;

			$order->order_status = $status;
                       
                       //we checked database this two field are still empty, suspect we write the wrong format
			$order->cart->order_payment_id = '1';
			$order->cart->order_payment_method = 'Online Banking / Credit Card';
			
			$order->cart->products = array($order_product);
	 
			$orderClass = hikashop_get('class.order');

			$orderClass->save($order);

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
4 years 4 months ago #321426

Hi,

I don't think it comes from that code.
Did you activate the order status you want to have the button for under the "unpaid" column of the System>Order statuses menu ?

The following user(s) said Thank You: ler@singmuiheng.com

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

  • Posts: 567
  • Thank you received: 11
  • Hikashop Business
4 years 4 months ago #321481

The problem indeed related to order status

One more question

we have a variable $addressfield want to write into order as well

but did not manage to get it, any example for us to reference to save address into order?

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
4 years 4 months ago #321493

Hi,

Normally, there are several fields, and you save that in the hikashop_address table and then you just take the address_id and use it in the $order object with the attributes order_shipping_address_id and order_billing_address_id.
Now if you only have one field for the whole address, then either you want to split the address before doing what I just wrote above, or you want to create a custom field of the table "order" and of the type "text area", and save that address text in the custom field.

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

Time to create page: 0.044 seconds
Powered by Kunena Forum