- Posts: 42
- Thank you received: 3
Additional Parameter in Cart
3 years 3 months ago #353005
by JF
Additional Parameter in Cart was created by JF
-- url of the page with the problem -- :
lazykitchen.satumalaysiahosting.com/checkout
Hi,
May I know Is there any way to save the additional parameter in cart but not override?
I would like to append additional parameter on every add to cart.
Hi,
May I know Is there any way to save the additional parameter in cart but not override?
I would like to append additional parameter on every add to cart.
Please Log in or Create an account to join the conversation.
3 years 3 months ago #353016
by nicolas
Replied by nicolas on topic Additional Parameter in Cart
Hi,
If you check the save function of class.cart, you can see that the data in $element->additional is moved to $element->cart_params->additional before the event onBeforeCartSave is called. And after the event, the content of $element->cart_params is json_encode
So you can do it in onBeforeCartSave, but you need to add it to $element->cart_params->additional yourself so that it is taken into account.
If you check the save function of class.cart, you can see that the data in $element->additional is moved to $element->cart_params->additional before the event onBeforeCartSave is called. And after the event, the content of $element->cart_params is json_encode
So you can do it in onBeforeCartSave, but you need to add it to $element->cart_params->additional yourself so that it is taken into account.
Please Log in or Create an account to join the conversation.
3 years 2 months ago #353815
by JF
Replied by JF on topic Additional Parameter in Cart
Hi,
I tried use $element->cart_params->additional = $additional; but the discount not loaded also.
I tried use $element->cart_params->additional = $additional; but the discount not loaded also.
Please Log in or Create an account to join the conversation.
3 years 2 months ago #353833
by nicolas
Replied by nicolas on topic Additional Parameter in Cart
Hi,
Ah yes. You need to move the additional from $element->cart_params->additional to $element->additional yourself when the cart is being loaded. For example with the event onAfterCartLoad(&$element, &$options)
Ah yes. You need to move the additional from $element->cart_params->additional to $element->additional yourself when the cart is being loaded. For example with the event onAfterCartLoad(&$element, &$options)
Please Log in or Create an account to join the conversation.
Time to create page: 0.189 seconds