We are building a coldfusion ecommerce solution (for a shopping cart solution provider). The system开发者_Go百科 uses client variables. The user registration, login and cart functionality will be on client's domain (ex: abc.com which is an non SSL) and the user should be transferred to our eshop domain (which is entirely different domain and is on SSL, ex: https://www.xyz.com) during checkout. How should I handle the client variables in this case? When the user is redirected from to abc.com to xyz.com, I should not loose any of the settings (the client.userid, client.cart, and other variables). For users who are logged in, the cart items will be stored in table 'CartTemp'. For customer who choose 'checkout without crating an account', the cart items will be stored in a structure client.Cart.
Where are you storing your client variables? If in a database, then you might be able to work by passing the user's CFID & CFTOKEN values in the link that takes them to the eshop. (Then, when CF looks up the client variables that correspond to those identifiers, it will find the records previously stored by the client domain's code.) This would require both sites to use the same client variables database, though, which may or may not be feasible for you.
If you're using cookie or (god help you) registry storage for the client variables, though, you're going to need to come up with some other mechanism to transfer this information. (You could, say, pack up all of the information into a WDDX string, store it into a database table for this purpose, pass the record's ID in the link to the shop, and have the shop's code unpack to the WDDX.)
I wouldn't rely on CFID and CFTOKEN. Instead, when the user wants to process their order, you would create an UUID cart id on abc.com and then redirect to xyz.com with the cart id.
The easiest way to share the data is using a shared central database but if that is impossible for some reason you could set up abc.com to return an XML dataset when queried by xyz.com, as in:
user browses through store at abc.com
user clicks on "Check out" -- cart record is created and user is redirected to xyz.com with cart uuid
- once on xyz.com, the server takes the cart id and queries abc.com using cfhttp or equivalent
- abc.com returns xyz.com server an xml document containing cart details
- xyz.com creates order record based on cart contents and returns order processing form to customer
Thanks Everyone. We use database for client storage. UUID seems more reliable and is useful for logged in customers; But, CFID & CFTOKEN might help in the case where customer chooses 'checkout without crating an account' option. Which one do you think is the best solution in both the cases? Please see both the scenarios below.
"For users who are logged in, the cart items will be stored in table 'CartTemp'. For customer who choose 'checkout without crating an account', the cart items will be stored in a structure client.Cart."
Serjii,
Just saw the code from the page you provided and looks like #CLIENT.urltoken# will help in both the scenarios. Thank you. I'll give it a try and let you know.
精彩评论