How to update a custom field value using code ?
12 years 2 months ago #162361
by buzibuzi
How to update a custom field value using code ? was created by buzibuzi
-- HikaShop version -- : 2.3.0
-- Joomla version -- : Joomla! 3.3.1
-- PHP version -- : 5.4.29
Hi,
i created an order table custom field called "firstpayment". (text type) attached screen capture.
i want to update its value (according to some calculations im doing in the payment plugin) and save to the order table when order is saved.
here is the relevant part of the code from my payment plugin im using to achieve this.
for some reason the value is not saved to the order and its not showing up in the back-end order display.
i checked the $order->firstpayment before the modifyOrder function and it contains the value.
can anyone explain why ?
perhaps im not using the modifyOrder function correctly ?
(i couldnt find documentation on this function usage)
also, i tried adding a default value.same result.
Thanks
-- Joomla version -- : Joomla! 3.3.1
-- PHP version -- : 5.4.29
Hi,
i created an order table custom field called "firstpayment". (text type) attached screen capture.
i want to update its value (according to some calculations im doing in the payment plugin) and save to the order table when order is saved.
here is the relevant part of the code from my payment plugin im using to achieve this.
Code:
class plgHikashoppaymentMyPayment extends hikashopPaymentPlugin
{
function onAfterOrderConfirm(&$order,&$methods,$method_id){
$order->firstpayment = 100;
.....
$this->modifyOrder($order,$order_status,$history,$email);
}
}
for some reason the value is not saved to the order and its not showing up in the back-end order display.
i checked the $order->firstpayment before the modifyOrder function and it contains the value.
can anyone explain why ?
perhaps im not using the modifyOrder function correctly ?
(i couldnt find documentation on this function usage)
also, i tried adding a default value.same result.
Thanks
Please Log in or Create an account to join the conversation.
12 years 2 months ago #162386
by buzibuzi
Replied by buzibuzi on topic How to update a custom field value using code ?
Hi,
after reviewing this post
www.hikashop.com/forum/payment-methods/8...m-fields.html#160883
i moved the code assigning new values to $order->firstpayment custom fields ,
to be triggered under onBeforeOrderCreate function.
it solved it.
Thanks
after reviewing this post
www.hikashop.com/forum/payment-methods/8...m-fields.html#160883
i moved the code assigning new values to $order->firstpayment custom fields ,
to be triggered under onBeforeOrderCreate function.
it solved it.
Thanks
Please Log in or Create an account to join the conversation.
Time to create page: 0.146 seconds