Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Daniel Iser

    (@danieliser)

    @sobhinho – Likely your gonna have to set a cookie manually via JS when they click the link. Then on page loads of the non french version check for that cookie and redirect either in PHP or JS.

    I can get you started but that is way beyond our typical scope. If your interested in our priority support I could likely get it done for you.

    Thread Starter sobhinho

    (@sobhinho)

    Yes sir, that would be great if you can get me started and even help me achieve this. I have tried several things out but i think i am over complicating things, and just need to simplify my onclick functions and ensure it works well with the plugin.

    If you can please let me know how i can get your priority support, that would be great too.

    thanks

    Plugin Author Daniel Iser

    (@danieliser)

    @sobhinho – Here is info on our priority support.

    jQuery('.french-button').on('click', function () {
    	jQuery.pm_cookie('redirect_to_french', true, '1 year', '/');
    });
    if (jQuery.pm_cookie('redirect_to_french') === true) {
    	window.location = 'someotherurl.com';
    }

    The above is what your after, you need to add it to your footer inside a <script> tag or in your themes JS file. You also need to change the first part jQuery(‘.french-button’) to target your specific button.

    If you opt for priority support I can go in and complete the entire setup for you.

    Hope this helps.

    Thread Starter sobhinho

    (@sobhinho)

    Hey Daniel,

    Thanks for your support and help. That set me on the right path and I was able to achieve what i wanted. I have posted the JQuery i used in case someone else faces the same issue:

    $("#french-button").click(function() {
            $.cookie("lang", "fr");
        });
        if ($.cookie('lang')) {
            window.location = 'yoururl';
    	};

    One small thing though, whenever someone clicks on the ‘English’ translation in the French website, it always redirects back to the french, regardless of what page they are on. Is there anyway to override the cookie or override that re-direct.

    Thanks a million and I do love this plugin.

    Plugin Author Daniel Iser

    (@danieliser)

    Do you mean on your menus or in a popup?

    Sounds like you need to make your JS a little more efficient with a click event on the english button that clears the french cookie.

    Also is your theme already using jQuery Cookie? If not our pm_cookie is similar but has a few enhancements and saves you having to load an additional JS file.

    Thread Starter sobhinho

    (@sobhinho)

    Perfect, works great. Yes, I have done just that with your plugin and it works great. Thank you for all your help.

    One Satisfied customer ??
    Thanks

    Plugin Author Daniel Iser

    (@danieliser)

    @sobhinho – Awesome glad you got it working correctly.

    @danieliser Did you add this functionality into your plugin?

    What I am looking to achieve is that when a user comes to my site they immediately encounter a pop up that says are you a man or a woman or other (choose x or y or z) then once they choose they go to that part of the site (and no it isn’t a adult site ;). A cookie then remembers their choice and each time they return they are automatically redirected to their choice.

    Is this something your plugin does currently?
    Let me know and thanks so much.

    Plugin Author Daniel Iser

    (@danieliser)

    @geodgeod – What your after can be achieved but not out of the box, that is such a unique situation I’m not sure we could build a featureset that would be useful for more than just that 1/5000 use cases and fit your needs.

    I will say what your after too also sounds more like a welcome gate as that is what they are made for, though you can imitate it with a popup there is no functionality to redirect to a url if they have done an action in the past.

    I can definitely help you get started but it would require custom PHP & JS code which you would need to be comfortable with.

    Hope that helps.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘cookies to remember language url redirect’ is closed to new replies.