Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Show only once for a country
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!
29-Mar-11 02:29:33
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
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
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 */
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
- Index
- » MetaMod
- » MetaMod General Support
- » Show only once for a country
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5944
- Posts this week:
- 2
- User Info:
- Total Users:
- 7667
- Newest User:
- humble2601
- Members Online:
- 0
- Guests Online:
- 220
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked