- Posts: 64
- Thank you received: 0
What event fires when cart data moves to order?
- irfanhanfi
-
Topic Author
- Offline
-- Joomla version -- : 3.0.4
I am in a situation where I need to add custom data in order_product table.I need to know how can I add custom product details when order is created from cart data.
Thanks,
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- irfanhanfi
-
Topic Author
- Offline
- Posts: 64
- Thank you received: 0
I tried this-
But customfield column is blank.
Thanks,
Please Log in or Create an account to join the conversation.
Do you right have an item custom field with the namekey "customfield" ?
The orderProduct class filters the data stored in the "cart products" during the save, so your custom field have to exists and be accessible in the front-end.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Please Log in or Create an account to join the conversation.
- irfanhanfi
-
Topic Author
- Offline
- Posts: 64
- Thank you received: 0
Also I am not sure about accessibility how can we define that?
Regards,
Please Log in or Create an account to join the conversation.
What Jerome says is that this method will only work if you already created a custom field of the table "item" via the menu Display->Custom fields as the system only saves the columns that are either there by default or registered as custom item fields.
Note that this requires the Business edition.
If you don't have the Business edition, then, you need to do the query yourself in the onAfterOrderUpdate function and add the data directly for the order in the database.
Please Log in or Create an account to join the conversation.
- irfanhanfi
-
Topic Author
- Offline
- Posts: 64
- Thank you received: 0
But now I need to update product price.As per requirement I have a price field in product table and I need to use that value.Is there any trigger for cart similar to onBeforeCalculateProductPriceForQuantityInOrder.Or Is there any easy way to change the cart product price?
Regards,
Please Log in or Create an account to join the conversation.
www.hikashop.com/support/documentation/6...tation.html#override
You can find an example here:
demo.hikashop.com/index.php?option=com_hikashop&ctrl=product&task=show&cid=214
Please Log in or Create an account to join the conversation.
- irfanhanfi
-
Topic Author
- Offline
- Posts: 64
- Thank you received: 0
I need to update hikashop_order_product table using query.But not getting the way to do so.
Thanks,
Please Log in or Create an account to join the conversation.
Thanks to check if the $cart_product_id is not corresponding to the order_product_id, if it is not, you can get the order_product_id with a simple query based on the order_product_code.
Please Log in or Create an account to join the conversation.
- irfanhanfi
-
Topic Author
- Offline
- Posts: 64
- Thank you received: 0
Is there any alternative or any code changes that can help?
Thanks,
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- irfanhanfi
-
Topic Author
- Offline
- Posts: 64
- Thank you received: 0
I use this function as well but it does not save in order_product_price.
public function onBeforeCalculateProductPriceForQuantityInOrder(&$products){
$newPrice = $this->getNewPrice($products->order_product_id,$products->order_product_price);
$products->order_product_price = $newPrice;
}
Above function shows the currect price when we edit order but does not save in table.
Please let me know if not clear.
Thanks.
Please Log in or Create an account to join the conversation.
Here is the donation plugin, it use these functions so you can use it as example:
hikashop.com/en/component/updateme/ctrl-...plugin-donation.html
Please Log in or Create an account to join the conversation.