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.

 

Cannt get chameleon to remove menu item

Cannt get chameleon to remove menu item

I am using Chameleon to set times that a store order and delivery menu is available on a client's web site.
I finally got one time range working for Monday - Saturday, but, I need to have a different set of times for Sundays.
Is there any way to do this besides setting separate time rules for every day of the year?
Any help is appreciated.
Thanks

wahoshi
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Cannt get chameleon to remove menu item

Hi Wahoshi,

Yes, you can definitely do this easier all in 1 rule! I would do this with some PHP code that returns a "true" value whenever it's inside one of the time periods, and false otherwise.

I've just used some made up time periods below to show you one way of doing it. As usual in PHP there are many ways to achieve the same thing, but the method below is a good one.

Example: show from 09:00-11:30 and 13:00-1700 Mon-Fri, and 10:00-12:00 on Saturday and Sunday:

if (
    $core_genius->inTimeSpan("mon-fri")
    and
    (
      $core_genius->inTimeSpan("09:00-11:30")
      or
      $core_genius->inTimeSpan("13:00-17:00")
    )
  ) return true;

if (
    $core_genius->inTimeSpan("sat-sun")
    and
    $core_genius->inTimeSpan( "10:00-12:00" )
  ) return true;

// for all other times:
return false;


That should do it :-)
Just don't forget to use that extra set of parentheses ( ) around "or" conditions, as in the mon-fri condition,  otherwise you get unexpected results.
Best regards,
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
3319 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1675
Total Polls:
6
Total Posts:
5917
Total Posts Today:
1
User Info:
 
Total Users:
11558
Newest User:
pitbull911
Members Online:
2
Guests Online:
265


Forum Legend:

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