문제

I have custom checkbox in Magento cart. If user checked it, he goes to checkout (default one page) and on step 'Shipping Methods' where is block 'Do you have any gift items in your order?' and checkbox 'Add gift options' - it should be also checked. How can I do it?

I'm using Magento 1.12 Enterprise and gift wrapping default. Thanks in advance.

도움이 되었습니까?

해결책

Here is an idea I have. Attach an event for 'onclick' of the checkbox in your cart that sets a cookie with the value 1 when the checkbox is checked and deletes the cookie when the checkbox is not checked.
Then in the checkout form, if the cookie exists then check the 'Add gift options' checkbox. If not, do nothing.
If you take this approach, remember to delete the cookie when you place the order (or you can set the cookie lifetime for 10 minutes and you don't have to delete it, but this way there is a risk of not working correctly if the customer goes to checkout after more than 10 mintues).

An other approach is to make an AJAX request to the server when clicking on 'Do you have any gift items in your order?' and set a flag in the session and in the checkout check if that session flag exists.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top