BV Commerce Forum
»
BV Commerce Support
»
General Support
»
Entering site using affiliate theme requires page refresh
Rank: Member
Joined: 1/26/2007(UTC) Posts: 57
|
We are having a problem with one of our sites using affiliate themes. The site works fine when entering using the default theme, but entering via the affiliate (using the normal affid querystring), the home page is displayed with the default theme. If you refresh the page then the correct affiliate theme appears.
Between each test, I have been deleting the cookie and we have also tested it on several PCs to make sure there is nothing on the PC that could be affecting it.
I have temporarily fixed the problem by adding some code to reload the home page when entering via an affiliate, but this is not a very nice solution.
Am I doing something wrong or is this a bug?
Thanks,
Jenny |
|
|
|
|
Rank: Member
Joined: 3/1/2006(UTC) Posts: 1,142
|
It appears to be a bug... in your website under www/App_Code there is a file called BaseStorePage.vb. In this file there is an event that starts with this
Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
You want to move the content of this method to the method that looks like this
Private Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
The contents of the PreInit method will then end up looking like this (In SP2) it may vary slightly in SP1... You just want to add the contents of Page_Init to the top of Page_PreInit. It appears that the assigning the affiliate was simply happening after the master page had already been loaded (which needs to happen in the PreInit stage)
Private Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit 'log affiliate request If Not Request.Params(WebAppSettings.AffiliateQueryStringName) Is Nothing Then Dim affid As String = String.Empty Try affid = Request.Params(WebAppSettings.AffiliateQueryStringName) Contacts.Affiliate.RecordReferral(affid) Catch ex As Exception EventLog.LogEvent("BaseStorePage - Page_Init", "Error loading affiliate " & ex.Message, Metrics.EventLogSeverity.Warning) End Try End If
Anthem.Manager.Register(Me) 'If this is a private store, force login before showing anything. If WebAppSettings.IsPrivateStore = True Then If SessionManager.IsUserAuthenticated = False Then Dim nameOfPage As String = Request.AppRelativeCurrentExecutionFilePath ' Check to make sure we're not going to end up in an endless loop of redirects If Not nameOfPage.ToLower.StartsWith("~/login.aspx") Then Response.Redirect("~/Login.aspx?ReturnUrl=" & HttpUtility.UrlEncode(Me.Request.RawUrl)) End If End If End If End Sub |
Justin Etheredge Senior Software Engineer BVSoftware |
|
|
|
Rank: Member
Joined: 1/26/2007(UTC) Posts: 57
|
Great. That works.
Thank you very much for your quick response.
Jenny |
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.