| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Making the Skin Swap mod more temporary... | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
Making the Skin Swap mod more temporary...
The CartLab skinswap mod is very useful for changing the look of your site by triggering the skin swap with a variable in your URL. However, since it uses a cookie, you have trouble with the swapped skin showing up the next time your users visit your web site, regardless of whether the skinswap variable is in your URL. Instead, it would be nice if the SkinSwap did not use cookies with specific expiration dates, but instead had cookies that expired whenever the user closes his browser window, so that the next time he visits the site he will see the default skin unless it's specifically swapped again via another variable in the URL. I tried several methods of messing with the cookie expiration times and then realized how much easier it would be to do this using sessions instead of cookies. All you have to do is take the Skin Swap version of your smarty.php file and make the following changes.
Replace this: Code:
Code:
Since there's no expiration set for the session, it expires automagically when the browser window is closed or after the default PHP session expiration time, depending in which happens first. Notice that we're using basic PHP session handling here because we do not have access to the xcart sessions until later in the x-cart code since x-cart sessions are started way after the smarty.php file is included and we need access to sessions before that happens. That's why I've simply started a new session so we can use that skinswap data before the x-cart sessions overwrite the skinswap session data in memory. Oh, and I also replaced the crusty old $HTTP_GET_VARS syntax with shiny new $_GET superglobal syntax because I'm cool like that. Enjoy.
__________________
www.brettbrewer.com Getting back into x-cart dev after a long hiatus. Modded lots of x-carts from version 3.1.x to 4.1.x. Developer of ImageScaler mod, Pre-login per user coupon mod, Wordpress feed mod, DigitalSubscriptions mod, Phonetic bulk download keys addon for DownloadExpander mod, Serial Number Generator for ESD products, Custom CMS/LMS integrations, external products mod, and more. |
|||||||||
#2
|
|||||||||
|
|||||||||
I've found a better way to do this...I think.
Disregard my previous method. It causes problems if you have hardcoded links that add products directly to your cart without going through the storefront. I have set up a different method that requires no modification to the skinswap mod itself. Instead modify your /customer/auth.php file by adding the following lines somewhere...it doesn't really matter where...
Code:
The purpose of this mod is to keep the customer from being locked into the same skin each time they return to your store under a different session. With my modification, the skin swapping will stop if a user closes their browser window and revisits your site without going through your specific skinswap URLs. Enjoy.
__________________
www.brettbrewer.com Getting back into x-cart dev after a long hiatus. Modded lots of x-carts from version 3.1.x to 4.1.x. Developer of ImageScaler mod, Pre-login per user coupon mod, Wordpress feed mod, DigitalSubscriptions mod, Phonetic bulk download keys addon for DownloadExpander mod, Serial Number Generator for ESD products, Custom CMS/LMS integrations, external products mod, and more. |
|||||||||
#3
|
|||||||
|
|||||||
Any chance you could update this code to work with 4.0.12?
__________________
NO LONGER USING X-CART - NOT ACTIVE IN THESE FORUMS |
|||||||
#4
|
|||||||||
|
|||||||||
Nope, sorry, not in the near future. The code should only require minor tweaking to work with the 4.x branch if you'd like to take a stab at it yourself though.
__________________
www.brettbrewer.com Getting back into x-cart dev after a long hiatus. Modded lots of x-carts from version 3.1.x to 4.1.x. Developer of ImageScaler mod, Pre-login per user coupon mod, Wordpress feed mod, DigitalSubscriptions mod, Phonetic bulk download keys addon for DownloadExpander mod, Serial Number Generator for ESD products, Custom CMS/LMS integrations, external products mod, and more. |
|||||||||
|
|||
X-Cart forums © 2001-2020
|