Jump to content

Switch template via url parameter


fxdesca

Recommended Posts

Hello,

 

I'd like to run a/b test on my website.

 

I have 2 different themes on my ftp:

 

-ThemaA

 

-ThemeB

 

 

To run the test i need the themeB to be displayed with a different url from themeA.

 

So i guess i have to insert url parameter for themeB, but i really dont know of to do that.

 

Any help please ?

 

 

Thanks

Link to comment
Share on other sites

HI

 

the only way that i could make it work on some websites is with the fallowing way

 

in your config/settings.inc.php

 

you will need to change:

 

 

define('_THEME_NAME_', 'prestashop');

 

to

 

 

if(isset($_GET['ab']))

{

define('_THEME_NAME_', 'prestashop_ab');

}else{

define('_THEME_NAME_', 'prestashop');

}

 

 

but in your url you always need to have the 'ab' paramater.

 

If you found another just let me know

Edited by Stanciu Valentin (see edit history)
  • Like 3
Link to comment
Share on other sites

HI

 

the only way that i could make it work on some websites is with the fallowing way

 

in your config/settings.inc.php

 

you will need to change:

 

 

define('_THEME_NAME_', 'prestashop');

 

to

 

 

if(isset($_GET['ab']))

{

define('_THEME_NAME_', 'prestashop_ab');

}else{

define('_THEME_NAME_', 'prestashop');

}

 

 

but in your url you always need to have the 'ab' paramater.

 

If you found another just let me know

 

 

First thank you so much for responding.

 

I changed the code as you mentionned. It worked ( you cant imagine how thankful i am for this )

 

Edit:

 

Now i can reach my "prestasho_ab" theme by adding "?ab" at the end of my url.

 

The thing is, say i type my url to reach theme B : www.myshop.com/furniture/wood-pen?ab

 

when i click a link and navigate away from the page, the ?ab parameter is lost so it comes back to normal template.

 

Is there anyway that when you reach a page with "?ab" parameter, it always keep the parameter and always display the same theme ?

 

I'll let you know if i come up with another solution

Edited by fxdesca (see edit history)
Link to comment
Share on other sites

One way to do it but that is a little hard is to override all the Links but that is not a good idea.

 

what else you can do is to use cookies or sessions that you can set and check what cookie is set and based on that to load your theme.

 

But I'm not sure if your cookie will also be deleted when the user will logout, but try it and let me know

  • Like 1
Link to comment
Share on other sites

One way to do it but that is a little hard is to override all the Links but that is not a good idea.

 

what else you can do is to use cookies or sessions that you can set and check what cookie is set and based on that to load your theme.

 

But I'm not sure if your cookie will also be deleted when the user will logout, but try it and let me know

 

oh ok thanks for the tip. Currently i have no idea of the code i should be using but ill try to figure that out and let you know

Link to comment
Share on other sites

  • 2 months later...

To keep the new template. Set a cookie if "get" finds the ab variable in the link. Than in than in the code above look for get or the cookie. If get or cookie exists change the theme.

 

This way the only way to change the theme to the original one would be by clearing thw cookies in the browser.

 

This way links dont have to be changed.

 

 

Link to comment
Share on other sites

  • 3 years later...
  • 3 months later...

Maybe you try create custom language and set lang1=theme1, lang2=theme2. Language and urls will be remembered (template as well).

hi !

 

it was a long time ago that i first post my issue on this topic. but still, thanks fort the tip. i might need to use that for my current job sometimes !

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...