tumil Posted July 26, 2018 Share Posted July 26, 2018 Hello, the question might seem quite weird but I use customer's gender for personalizing the layout of the store. I want the user to be able to change gender by clicking a button which is located in the header of the site. Here is how it looks in tpl <span class="version-change version-{if $customer.gender.id < 2}full{else}lite{/if}" onclick="changeMode({$customer.id})">blah</span> Quite easy I guess. Here's the js code: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> {literal} <script type="text/javascript"> function changeMode(customer_id) { $.ajax({ data: customer_id, type: "post", url: "changeGender.php", success: function(data){ alert("data sent" + data); } } </script> {/literal} I don't know if it is okay as I don't know js much, not to mention the way this ajax part should be created. But the biggest problem is that changeGender.php which I need to create. I have no idea how it should be written. Can anybody give me a hand with that? It should work that way: if the id_gender is 1 or 0 then it should be set to 2. If it's 2 then it should be set to 1. I'll appreciate any help. Thanks! Link to comment Share on other sites More sharing options...
tumil Posted July 30, 2018 Author Share Posted July 30, 2018 bump Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now