- Posts: 217
- Thank you received: 1
Detect when checkout is empty and redirect
13 years 6 months ago #94469
by Mat
Detect when checkout is empty and redirect was created by Mat
Hi all,
When they delete a product from the checkout if it is the last product I want them to go to a specific page.
How can I detect when they delete a product and if it is the last redirect rather than display the current empty checkout.
'The cart is empty' message gets displayed so which code triggers that and I might work in my redirect there?
Thanks,
Mat
When they delete a product from the checkout if it is the last product I want them to go to a specific page.
How can I detect when they delete a product and if it is the last redirect rather than display the current empty checkout.
'The cart is empty' message gets displayed so which code triggers that and I might work in my redirect there?
Thanks,
Mat
Please Log in or Create an account to join the conversation.
13 years 6 months ago - 13 years 6 months ago #94470
by Mat
Replied by Mat on topic Detect when checkout is empty and redirect
found it: checkout / cart.php
Ok what seems to be happening is the checkout then goes to a product/listings page when it is empty ... where do I control that?
Ok what seems to be happening is the checkout then goes to a product/listings page when it is empty ... where do I control that?
Last edit: 13 years 6 months ago by Mat.
Please Log in or Create an account to join the conversation.
13 years 6 months ago - 13 years 6 months ago #94473
by Mat
Replied by Mat on topic Detect when checkout is empty and redirect
And I found this:
www.hikashop.com/en/forum/4-how-to/17893...turn-page.html#17894
I will edit the core hikashop file
Actually what I might do is set the redirect_url_when_cart_is_empty each time in my own code ... thoughts? Anyway I will see if I can do that
I will edit the core hikashop file
Actually what I might do is set the redirect_url_when_cart_is_empty each time in my own code ... thoughts? Anyway I will see if I can do that
Last edit: 13 years 6 months ago by Mat.
Please Log in or Create an account to join the conversation.
13 years 6 months ago #94476
by Mat
Replied by Mat on topic Detect when checkout is empty and redirect
Oh lol everyone updates that variable using the idea that i had ... might have to edit the core hikashop ....
Please Log in or Create an account to join the conversation.
13 years 6 months ago #94523
by Xavier
Replied by Xavier on topic Detect when checkout is empty and redirect
Hi,
Just use the option "URL where to redirect when the cart is empty" in Config > Checkout don't work ?
Because it redirect the customer when the cart is empty, so last product removed.
Just use the option "URL where to redirect when the cart is empty" in Config > Checkout don't work ?
Because it redirect the customer when the cart is empty, so last product removed.
Please Log in or Create an account to join the conversation.
13 years 6 months ago #94652
by Mat
Replied by Mat on topic Detect when checkout is empty and redirect
I want it to go back to the page that went to the check out when the last item is removed. This varies a lot.
Please Log in or Create an account to join the conversation.
13 years 6 months ago #94675
by Xavier
Replied by Xavier on topic Detect when checkout is empty and redirect
Hi,
You can maybe add the following line:
In the view "product / cart". This should set the return url dynamically. I don't tried it..
You can maybe add the following line:
Code:
<?php $config = hikashop_config(); $config->set('redirect_url_when_cart_is_empty', urlencode(base64_encode(hikashop_currentURL('url',false)))); ?>
In the view "product / cart". This should set the return url dynamically. I don't tried it..
Please Log in or Create an account to join the conversation.
13 years 6 months ago #95401
by Mat
Replied by Mat on topic Detect when checkout is empty and redirect
Hi Xavier - that would work per user and not actually update the config table right? Thanks, Mat
Please Log in or Create an account to join the conversation.
13 years 6 months ago #95402
by Mat
Replied by Mat on topic Detect when checkout is empty and redirect
and what does this function do : hikashop_currentURL('url',false)?
Please Log in or Create an account to join the conversation.
13 years 6 months ago #95405
by Mat
Replied by Mat on topic Detect when checkout is empty and redirect
Anyway it was simpler to modify the core files.
Please Log in or Create an account to join the conversation.
13 years 6 months ago #95559
by Xavier
Replied by Xavier on topic Detect when checkout is empty and redirect
Hi,
The code given is per user, and don't change anything in config.
The hikashop_currentURL() function take the current page url.
So, because the code is in the produt page, the redirect url when empty will be this page.
The customer will not move out this page when emptying the cart.
The code given is per user, and don't change anything in config.
The hikashop_currentURL() function take the current page url.
So, because the code is in the produt page, the redirect url when empty will be this page.
The customer will not move out this page when emptying the cart.
Please Log in or Create an account to join the conversation.
Time to create page: 0.288 seconds