Setting partner_id first

  • Posts: 22
  • Thank you received: 0
10 years 4 months ago #136671

Hi,

I have run into an unforeseen problem.

My site is geared towards affiliate sales, only showing discounts if a partner_id is present.
Problem is, the discounts will not show on the initial page a viewer visits.

It seems the partner_id is set after the prices has been rendered, so it will only come into effect for the next page a user visits.
I can see that the order of the hikashop plugins, including the affiliate plugin are set to 0. Will it help reordering all others to 1?

A crude solution would be to check it there is a partner_id, and reload the page if this is the case.
-Not a great solution...

Hope to hear from you soon,

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 0
10 years 4 months ago #136684

I apologize for my impatience (time is short right now..).

If you have a better solution than doing this (when the document is loaded, hiding the initial results and replacing them with an updated version), I am all ears.
(This ajax call takes approximately 1.5s and does not reload the page, so it is workable)
var partner = window.location.href.indexOf('partner_id')
if(partner>-1){
$('.component-pad').hide() // hide the hikashop listings without discounts
$('.component-pad').load(window.location.href+'/tmpl-component .component-pad',function(){
$('.component-pad').show()
})
}

Please Log in or Create an account to join the conversation.

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
10 years 4 months ago #136776

Hi,

The partner_id is in the cookies of the browser of the user so of course, the user has to first display the page once so that the browser knows about the cookie before it can send it to the server.
So the best solution in your case would be to show the discounts only if the partner_id is in the cookies sent by the browser OR if it is in the GET. That way, you can avoid the redirect.

Last edit: 10 years 4 months ago by nicolas.

Please Log in or Create an account to join the conversation.

Time to create page: 0.061 seconds
Powered by Kunena Forum