Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions

You are not logged in.

Announcement

#1 2015-05-04 06:48:15

eduardogt
Member
Registered: 2015-05-04
Posts: 1

Browse offer Random?

Hello, good day, thank you for the excellent work they are doing.
They wanted to say something there is a possibility that the browser offers are random?
"LHCBROWSEOFFER"

I have several offers and I need these out randomly as could be done?
In advance thank you very much!

"In short I want to put the random deals: P"
We apologize for any spell fails, not much English.

Last edited by eduardogt (2015-05-04 07:27:56)

Offline

#2 2015-05-05 07:48:43

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: Browse offer Random?

Sorry, but this function does not exists at the moment. If you want it fill github feature request.

Offline

#3 2016-03-14 18:25:58

zet
Member
From: Lehrte, Germany
Registered: 2016-03-05
Posts: 18
Website

Re: Browse offer Random?

If you can arrange with a small hardcoded hack without comfortable webinterface ... yikes

you may replace line#18+19 (referring to 2.40v) of modules/lhbrowseroffer/getstatus.php with this code

// process identifier before making database request
$identifier = (string)$Params['user_parameters_unordered']['identifier']; // get identifier from widget
if ($identifier && $identifier[0] == 'r') {  // if widget passed identifier that starts with 'r' (like random)
	$random_number = rand(1, 2);			 // pool of random numbers between 1 and 2, change upper value according to number of your offers
	$identifier = $identifier . (string)$random_number;  // add random number to end of identifier
}
if ( $ignorable_ip == '' || !erLhcoreClassIPDetect::isIgnored(erLhcoreClassIPDetect::getIP(),explode(',',$ignorable_ip))) {
	$matched = erLhAbstractModelBrowseOfferInvitation::processInvitation(array('l' => $location,'r' => $referer, 'identifier' => $identifier));

Now, if you want to display ... let's say 2 different videos randomly
save video offer no.1 with identifier "rvid1"
save video offer no.2 with identifier "rvid2"

generate widget html with identifier "rvid" <-- without number, because it will be added by getstatus.php now.

compatibility with original code is kept:
1.) as long as you're using no identifier at all
2.) as log as your identifier doesn't begin with letter 'r'

expand the pool of random numbers to your needs: if you want to display video 4 to 13 replace the code with rand(4, 13);

Basically it's working this way.
But to keep the hack safe from Livehelper updates, the correct way would be to create your own extension or make it part of the unbrand extension.

Last edited by zet (2016-03-14 18:32:36)

Offline

Board footer