Empty cart URL translation - redirect handling

  • Posts: 86
  • Thank you received: 5
4 years 6 months ago #318227

-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.9.18
-- PHP version -- : 7.3

Hi, I tried the new feature of translation of empty cart URL redirect: it works but if that URL is a menu item and the user clicks on that menu item, we get a "too many redirects" error, probably ad additional check should be added to handle this case?
Thanks

Giuse

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
4 years 6 months ago #318243

Hi,

I don't see such problem, and the translation of that setting doesn't change anything about the redirection check.
What this means is that the URL you entered in that setting (or in the translation override) leads to a page which needs the cart and thus redirects to that URL again.
Like for example, if you enter the URL of your checkout in that setting, when the system has to use that URL, it will loop.
That should already have been the case before. We could add an extra check but it's not easy to detect if the URL that you enter in that field is a URL which needs the cart as it depends on the menu item, your SEF settings, etc.

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

  • Posts: 86
  • Thank you received: 5
4 years 6 months ago #318273

yes Nicolas, this is the exact case: I have a menu item that is the HikaShop cart I set the "empty cart" URL redirect to go to that menu item when the user empties its cart when he is in the checkout phase.
Now, if the user clicks on the Cart menu item, the site breaks for redirect loop. As you said, probably this is not related to the override feature, it was present also before, but I have seen this problem just with 4.3.0, since the empty cart URL override was not usable on a multilanguage site so its value was blank and the redirect went to a product category.
Can you confirm this?
thanks

Giuse

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
4 years 6 months ago #318277

Hi,

You would have seen the issue all the same before with that cart menu item URL set in that setting.
So it's not really a new thing.

But we'll try to do something to override the URL entered in that setting in case of a loop so that it would default to the generic cart empty URL.

The following user(s) said Thank You: Giuse

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

  • Posts: 86
  • Thank you received: 5
4 years 1 month ago #324350

Hi, I have seen that in v4.4 you added an improvement to avoid the redirect loop so I rushed to test it :)
What I see is that the redirect very weirdly works one every two times:
1) I add an item to the cart
2) I go to the checkout
3) I remove the item in the checkout page: the cart is emptied and I am redirected to the empty_cart URL override value. Fine.
4) I add again an item to the cart
5) I go to the checkout
6) I remove the item in the chekcout page: the cart is emptied but I am redirected to the first product page/menu item, not to the URL override value.
and again from step 1
Very strange, can you reproduce it?
thanks, best regards

Giuse

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
4 years 1 month ago #324359

Hi,

I cannot reproduce the issue.
I'll need you that you provide precise information on the situation.
What URL did you configure in that setting ?
What do you have configured in the force a menu on checkout setting ?
How is that menu item configured, and how is configured the menu item used in the URL of the empty cart redirect setting ?
And finally, in the process you describe in your previous message, we need that you provide the URL you have in your address bar for each step.
If you want to provide these privately, you can use our contact form:
www.hikashop.com/support/contact-us.html
Make sure you include a link to this thread for reference.

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

  • Posts: 86
  • Thank you received: 5
4 years 1 month ago #324365

Information sent via contact form.
thanks

Giuse

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

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
4 years 1 month ago #324373

Hello,

Yes we will need to access to your backend to better understand the situation please, and your provided references don't allow us to access it.

Regards

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

  • Posts: 86
  • Thank you received: 5
4 years 1 month ago #324391

yes, I sent you yesterday all the details through the contact form, didn't you receive them?
thanks

Giuse

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

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
4 years 1 month ago #324418

Hello,

We have received its, but these references don't allow us to access your back end.
Please double check its, or provide some new references that allow us to access to all your back ends configuration please.

Regards

Last edit: 4 years 1 month ago by Philip.

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

  • Posts: 86
  • Thank you received: 5
4 years 1 month ago #324449

resent, thanks

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

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
4 years 1 month ago #324468

Hi,

Thanks for the access.
I checked the situation and the code on our end and It's not a translation override issue as far as I can see.
If you reproduce the steps you provided before a third time, you'll see you'll get your URL again.
It's actually caused by a failsafe we have in the checkout system in order to avoid infinite redirects.
It happened several times in the past that shop owners would enter the checkout URL in that setting, thus creating an infinite loop of redirects.
So we built a system so that when a redirect to the cart empty URL is gonna be done, a flag is set in the session of the user.
Then, if the user access again the checkout pages with an empty cart, with that flag in the session, the empty cart URL is ignored and HikaShop automatically generates a URL where to redirect and resets the flag.
The issue you have is that if you go again to the checkout after a cart empty redirect, the flag will still be in the session when you empty the cart a second time and thus your empty cart URL will be ignored.

To fix that, we should reset the flag in the session whenever the checkout displays with a non empty cart.
Add the code:
$this->app->setUserState('com_hikashop.cart_empty_redirect', 0);
before the line:
hikaInput::get()->set('layout', 'show');
in the file components/com_hikashop/controllers/checkout.php and that should fix the problem.
Let us know how it goes so that we can include that fix on our end for the next release of HikaShop.

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

  • Posts: 86
  • Thank you received: 5
4 years 1 month ago #324543

Thanks Philip. With the patch it seems to work correctly, always redirecting to the empty cart URL
thanks

Giuse

The following user(s) said Thank You: Philip

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

Time to create page: 0.080 seconds
Powered by Kunena Forum