I am having a little problem with order update

  • Posts: 2
  • Thank you received: 0
9 years 6 months ago #175695

-- url of the page with the problem -- : Private site (local server via virtual machine)
-- HikaShop version -- : 2.3.3 Starter
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.3.14
-- Browser(s) name and version -- : Firefox 32.03

I'm creating a payment plugin for a local bank (FiBank). Haven't found one developed yet so, im having the honor of bashing my head in the wall reading *bank* documentation(dont ask why,please). Anyway my problem is that when i do :
$orderClass = hikashop_get('class.order');
$order = $orderClass->loadFullOrder($order_id, true, false); // im passing the current order_id
$order->cart->shipping_address->test= 'blalba; // test is a custom field that i have created thru hikashopp .. starter...
$orderClass->save($order);
And on the page where it should re-direct me to the payment gateway, I've disabled the auto-redirect, since i need to see if im correctly assigning the "fields" in the form that's going to be sent to the bank. So there i get this error.

"#1054 Unknown column 'order_subtotal' in 'field list' SQL=UPDATE `dsk2o_hikashop_order` SET `order_billing_address_id`='2',`order_shipping_address_id`='2',`order_user_id`='1',`order_status`='created',`order_type`='sale',`order_number`='D8Q3',`order_created`='1413380390',`order_modified`='1413380390',`order_invoice_id`='0',`order_invoice_number`='',`order_invoice_created`='0',`order_currency_id`='30',`order_full_price`='40',`order_tax_info`='a:1:{s:0:\"\";O:8:\"stdClass\":3:{s:11:\"tax_namekey\";s:0:\"\";s:8:\"tax_rate\";s:7:\"0.00000\";s:10:\"tax_amount\";d:0;}}',`order_discount_code`='',`order_discount_price`='0.00000',`order_discount_tax`='0.00000',`order_payment_id`='8',`order_payment_method`='fiBank',`order_payment_price`='0.00000',`order_payment_params`='',`order_shipping_id`='2',`order_shipping_method`='manual',`order_shipping_price`='5.00000',`order_shipping_tax`='0.00000',`order_shipping_params`='O:8:\"stdClass\":1:{s:6:\"prices\";a:1:{s:3:\"2@0\";O:8:\"stdClass\":2:{s:14:\"price_with_tax\";d:5;s:3:\"tax\";d:0;}}}',`order_partner_id`='0',`order_partner_price`='0.00000',`order_partner_paid`='0',`order_partner_currency_id`='0',`order_ip`='192.168.79.1',`order_site_id`='',`order_subtotal`='35',`order_subtotal_no_vat`='35' WHERE `order_id`='83' "

I am doing that in - function onAfterOrderConfirm(&$order,&$methods,$method_id) .
So i am wondering is there a way to edit specific part of the order and update it ?
Or what could be the cause for my problem, if you could enlighten me ?
Order_subtotal - the whole order class is supplied by you .. shouldn't it be able to save it ?

Last edit: 9 years 6 months ago by mystery.

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

  • Posts: 81513
  • Thank you received: 13067
  • MODERATOR
9 years 6 months ago #175747

Hi,

The object returned by the loadFullOrder function of the order class is not meant to be saved with all the data in it so that's normal that you get the error.
You should instead create a new order object with just the data to modify in the order table.
If you actually want to modify the address, then it's the class.address save function that you want to use on the $order->cart->shipping_address object.

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

  • Posts: 2
  • Thank you received: 0
9 years 6 months ago #175782

Shipping address is individual for each order isn't it ? What i mean is, if i modify that test field and save it via address class, it will save it only for the current order right ?

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

  • Posts: 13201
  • Thank you received: 2322
9 years 6 months ago #175825

Hi,

The change will be done for each orders made, so each new used shipping addresses.

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

Time to create page: 0.072 seconds
Powered by Kunena Forum