Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Show only once for a country

Show only once for a country

I tried searching this but could not find a recipe. I am using geoip and I would like a module to show only once when they visit from CA.

Any idea on how I should combine these two recipes?

if ($fromCountryId == "CA") return 704;

and

$c = JRequest::getInt('SeenIt', 0, 'cookie');
if ($c) return; /* if cookie was set, don't show anything, else... */
setcookie( 'SeenIt', 1, time()+60*60*24*365*10, '/' );
return 704; /* return module 704, but only the first time */

Thanks in advance!

Edited By: opwdecks
29-Mar-11 02:29:33

opwdecks
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Show only once for a country

One other recipe request:

I would like to show a module to Canada only and only during virtumard checkout pages:

I would need to combine these two:

if ($fromCountryId == "CA") return 707;

and

$vm = JomGenius("virtuemart"); // need this at the start of every rule
if ( $vm->check( "pagetype startswith shop.cart, shop.savedcart, checkout" ) ) return 707;

Thanks smile

opwdecks
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Show only once for a country

Hi opwdecks,

Try this:

$vm = JomGenius("virtuemart"); // need this at the start of every rule
if ( $fromCountryId == "CA"
  and $vm->check( "pagetype startswith shop.cart, shop.savedcart, checkout" )
) return 707;


Don't forget to configure GeoIP etc and have it turned on in your MetaMod module.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: Show only once for a country

Thanks for the help. For showing only once for a country, would this be correct?

$c = JRequest::getInt('SeenIt', 0, 'cookie');
if ($fromCountryId == "CA" and $c) return; /* if cookie was set, don't show anything, else... */
setcookie( 'SeenIt', 1, time()+60*60*24*365*10, '/' );
return 704; /* return module 704, but only the first time */

opwdecks
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Show only once for a country

I think I'd do this if you're only interested in showing once, and only to Canadians:

if ($fromCountryId != "CA") return; // bypass if guest NOT from Canada
$c = JRequest::getInt('SeenIt', 0, 'cookie');
if ($c) return; /* if cookie was set, don't show anything, else... */
setcookie( 'SeenIt', 1, time()+60*60*24*365*10, '/' );
return 704; /* return module 704, but only the first time */


Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1698
Total Polls:
6
Total Posts:
5945
Total Posts Today:
1
User Info:
 
Total Users:
5611
Newest User:
idim4
Members Online:
1
Guests Online:
151

Online: 
crooms68989

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked