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.

 

Menu changing by time and day

Menu changing by time and day

Hi, I hope I purchased the right component. I installed Chameleon thinking it could handle this problem but now I'm stuck. I have a restaurant site that wants to take online orders only between 11 am to 4 p.m. Tuesdays through Sundays (so, every day but Monday), I am using Joomla! 3.6.2. Chameleon v. 2-61

Ignoring the day of the week problem, I  set the initial time rule:
Using the pre-installed recurring time slot rule I left everything the same but I changed the hours to start at 11:00:00 and end at 16:00:00 and under actions to unpublish the Virtuemart menu items if the rule has failed. I am not changing the template at all. So, this seems to work except now I can't figure out how to  set it to ignore Mondays altogether. Do I need to purchase Metamod to set the day of the week or is that also configured in Chameleon?

AprilPh
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Menu changing by time and day

Hi AprilPh,

You can do this with Chameleon - no need for MetaMod.

You can use 2 rules to do this.
Use the rule you already have as the 2nd rule.
Create a new rule which you will move to position #1 so it occurs before the existing rule.
In the new rule, enter the start time as "monday 00:00" and end time as "monday 23:59", and in the Succeed action unpublish the menu item.

So in the 1st rule you are saying "on Mondays, remove the menu item"
In the 2nd rule you are saying "on any other day of the week, if it's not between 11:00 and 16:00 then remove the menu item"

That should do it!

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
3314 Posts
User info in posts
Administrator has disabled public posting

Re: Menu changing by time and day

Stephan,
I apologize for my late reply. This is exactly what I needed. Thank you so much for your product and time.
April

AprilPh
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Menu changing by time and day

You're welcome - I'm glad this is working for you. Thanks for reporting back.

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
3314 Posts
User info in posts
Administrator has disabled public posting

Re: Menu changing by time and day

Stephen,

I realize now that I misspelled your name. I am sorry. I had one more question, is it possible to take Virtuemart offline when it is not within that time frame? I see that I can disable plugins, but I'd like to set it to offline so that if someone is referred to a virtuemart page, either by search engine or other link, they get the offline message. Or, if that's not possible that they could get redirected to a page that says that the store is only online from 11 to 4 p.m. Thank you again for your help.

AprilPh
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Menu changing by time and day

Hi,

One of the Chameleon actions for VM is that you can set VM to "Catalog mode". This removes all cart functionality but keeps the products on display. Could that be a useful option?

In order to provide an "offline" message you could either use MetaMod to display a module for the given time frame, or with Chameleon you could do a "find and replace" action on the page to add some Offline text.

E.g. you could make a module that contains the text {offlinetext}, then in Chameleon you do a find-and-replace for {offlinetext} and replace it with a blank string if it's within the opening hours, or "Sorry we're offline" (with appropriate HTML if required) if it's not within opening hours. You will be able to put these in the existing succeed and fail actions alongside the other actions performed during those periods.

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
3314 Posts
User info in posts
Administrator has disabled public posting

Re: Menu changing by time and day

Hi Stephen,

Thanks, I selected catalog mode (in the fail column), but am unsure about how to do the offline message, because only the virtuemart area is offline. The rest of the website is actively selling tickets and showing upcoming events (through Ohanah), as well as displaying videos and other items. So, I'd need to have the offline message display only if the visitor tries to visit a virtuemart page.  Is there a way to do that?

I did create a separate template that calls a completely different menu and layout so that there is no reference to the online store during off hours, so hopefully and created a special 404 page that gives the hours of the store.

Many thanks for your help,

April

AprilPh
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Menu changing by time and day

Hi,

you can easily make a Chameleon rule (actually pair of rules) similar to your existing ones, that in addition to checking the time, also uses the "Components" section in a Chameleon rule to detect com_virtuemart. In the Succeed and Fail actions for each rule, do the find-and-replace to show/hide the warning message as described earlier.

Actually an improvement on the original idea would be instead of putting a token like {offlinetext} into the module, use an HTML comment like <!-- offlinetext --> and do the search and replace on that. Then you don't need to put in a Fail action to convert it to a blank, as it won't show up in the output anyway since it's an HTML comment.

So your 4 rules would be:

1 - Is it a Monday? If so remove menu item. Continue to next rule.
2 - Is it between 11-16:00? If NOT, remove the menu item. Continue to next rule.
3 - Is it a Monday AND com_virtuemart page? If so, replace <!-- offlinetext --> with some actual offline text. Continue to next rule.
4 - Is it between 0:00-11:00 AND com_virtuemart page? If so, replace <!-- offlinetext --> with some actual offline text.
5 - Is it between 16:00-23:59:59 AND com_virtuemart page? If so, replace <!-- offlinetext --> with some actual offline text.

I think that should work as expected.

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
3314 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1685
Total Polls:
6
Total Posts:
5912
Total Posts Today:
4
User Info:
 
Total Users:
11510
Newest User:
david5871
Members Online:
1
Guests Online:
179

Online: 
david5871

Forum Legend:

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