Redirect when checking out

  • Posts: 252
  • Thank you received: 1
6 years 8 months ago #289882

-- HikaShop version -- : 3.3.0
-- Joomla version -- : 3.7

Hi,
During checking out, when user click on Continue shopping button and the same situation but when user remove all the products in cart, we want ti to redirect to the previous page, Could you show me a way to achieve that?

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
6 years 8 months ago #289906

Hi,

I suppose that you're talking about the "continue shopping" button available in the checkout page.
That button is just a link with the URL you have configured in your HikaShop configuration.

Now, thanks to a view override, you can change how the button is acting and use a include JS code to perform a history back instead.
But that's not something we would recommend since you don't really know from where the customer is coming from and it might not send him to a product listing or product page.

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.
The following user(s) said Thank You: twscott

Please Log in or Create an account to join the conversation.

  • Posts: 252
  • Thank you received: 1
6 years 8 months ago #289979

Thanks for your help, I've modified the continue shopping as my user requested.
but there is another request about when user delete all the products in cart while in the checking out page, the system will redirect it to \check\listing page. we were asked to redirect it to a specific page, would you show me which view file should I modify or how o I achieve that?


best regards

Please Log in or Create an account to join the conversation.

  • Posts: 2143
  • Thank you received: 747
6 years 8 months ago #289980

twscott wrote: ... when user delete all the products in cart while in the checking out page, the system will redirect it to \check\listing page. we were asked to redirect it to a specific page ...


Hi,

No view needs to be modified for this.
See documentation: www.hikashop.com/support/documentation/5...onfig.html#main_cart
Field "URL where you will be redirected when the cart is empty"


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
The following user(s) said Thank You: twscott

Please Log in or Create an account to join the conversation.

  • Posts: 252
  • Thank you received: 1
6 years 8 months ago #290024

Got it, thanks.
I was asked to redirect to the related products that user just removed from the cart.
So I kept at product ID in session, but I still have problem to redirect the the proper page.
Could you tell me the view file name?

Thanks in advance

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
6 years 8 months ago #290033

Hi,

In that case, you want to create a small system plugin which would add some javascript to the header of the pages (or modify your template index.php to add that javascript).
The javascript to use:

if(window.Oby) {
window.Oby.registerAjax(["cart.updated","wishlist.updated"],function(params){
 window.location = 'URL where to redirect';
 return true;
}
}

The following user(s) said Thank You: twscott

Please Log in or Create an account to join the conversation.

  • Posts: 252
  • Thank you received: 1
6 years 8 months ago #290104

Hi,
I put the code into index.php, the result is not expected.
When click on 'buy' button , it jump to the page I specified. and no effect when deleted all the products in cart.
Could you please provide further support?

Best regards

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
6 years 8 months ago #290109

Hi,

Ho sorry, I thought that you wanted to redirect to the related products of the product you added to the cart.

For when the products are deleted, it kind of depends where you're deleting them from.
On the checkout, you will have to also register your javascript to the 'checkout.cart.updated'
Also, you need to have the "checkout legacy" setting turned off in order to use the new checkout of HikaShop 3 or it won't work.

The following user(s) said Thank You: twscott

Please Log in or Create an account to join the conversation.

  • Posts: 252
  • Thank you received: 1
6 years 8 months ago #290159

Thanks Nicolas,
My problem is almost solved but I need to know weather the cart is empty or not.
The params passed in did not have enough content the intimation.

Thanks in advance.
Best regards

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
6 years 8 months ago #290170

Hi,

The params parameter should contain a parameter empty with the value true when the cart is empty.

The following user(s) said Thank You: twscott

Please Log in or Create an account to join the conversation.

  • Posts: 252
  • Thank you received: 1
6 years 7 months ago #290571

Hi,
Sorry but I still have trouble redirect the page when cart is empty.

Following is the code I put into index.php :
$document->addScriptDeclaration('
if(window.Oby) {
window.Oby.registerAjax(["checkout.cart.updated"],function(params){
alert(JSON.stringify(params));
document.location.href=" www.google.com ";
return true;
})
}
');

There are two issues here:
1.
I can see the params is the alert message is like :
{"src":{"step":1,"workflow_step":0,"pos":0}}
dose the "pos" is the count of products in cart?

2. after the alert message, I redirect the page to www.google.com
but it actually goto /index.php/checkout/product/listing
What should I do to rediect it to the proper page?


Thanks in advance
Best regards

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
6 years 7 months ago #290592

Hi,

the pos parameter indicates the position of the view which did the triggering in the current step. So if you have 0 there, it indicates that you used the cart view placed in the first position of your checkout step.

That's because you must be deleting the last product. In that case, the system redirects to the URL you specified in the "URL where to redirect when the cart is empty" setting of the Hikashop configuration. If you get "/index.php/checkout/product/listing" it means that you must have left that setting empty as that's the default URL where the customer is redirected to upon deleting the last product of his cart.

Please Log in or Create an account to join the conversation.

Time to create page: 0.089 seconds
Powered by Kunena Forum