Hello Guys!
My name is Georg.
Im Trying to create this store here where clients can buy Courses and etc. And im trying to give them this option like dollarshaveclub.com has. In their Get started page( https://www.dollarshaveclub.com/get-started/plan/options ) client has three options there and he can choose one two or three and based on that selection he will be redirected to another page where he product based on his selection.
This is the first page.
Here customer can choose either one two or three. Or two of them or three of them
I got some information that i can do it like that( below )
We can achieve this in two different ways, first, declaring a global variable, like, let selected then add an onClick function for each selection, for example when user clicks box1 you will have selected = ‘box1’
On your button event function you can add wixLocation.to () along with a switch or if statement that determines where to direct the user.
But im kinda new to this coding thing and i dont know how to write this code!
Can somone super smart and kind please help me with this? I have ebeen stuck here for months now!
It was helpful to show anyone reading this that you want to pattern your site after what Dollar Shave does. What would also be helpful is to tell us more about the logic that needs to govern the selection of courses for your site and perhaps show us where you are hung up in your code. We understand that you are relatively new to coding. We were all beginners at one point too.
I made my courses as plans that customer can subscribe. Where
dollarshave club has shaving option and shower and oral hygiene there should be my course1 course2 and course 3 plans.
If I understand correctly, you are trying to create a small e-com portal (with 3 or more items/services). You might also require a payment portal integrated in order to accept payments.
Georg, It definitely sounds like you need to spend some time perusing the information that Shan details in his post because you have some not-so-trivial coding ahead of you if want to get your site functioning anything like the way Dollar Shave does things.
To help you get over the hump with your initial hurdle of taking the user to the appropriate page, this code can act as an example. It uses a radiogroup whose label and value are the same for each option and is configured to have nothing selected by default; whereas it sounds like you may want to use separate images with an onClick event. For sake of this example, there are pages on your site whose url is “/course1”, “/course2”, and “/course3”. The import statement needs to be at the top of the page.
import wixLocation from ‘wix-location’;
export function radioGroup1_change(event) { let cChoice = $w(‘#radioGroup1’).value, cTo = “”;
switch (cChoice) { case ‘Course 1’:
cTo = “/course1” break ; case ‘Course 2’:
cTo = “/course2” break ; case ‘Course 3’:
cTo = “/course3” break ;
}
wixLocation.to(cTo);
}
The box/image click code for a button named “box1” would simply be
export function box1_click(event) {
wixLocation.to( “/course1”);
}
@skmedia
Hey David! Thank you for your reply. That looks almost exactly what we need. Is there a way to add this payment option there like dollar shave club has after selecting 1, 2 or 3 products ?
Thank you David!