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.

 

Make some VM products only available at certain times

Make some VM products only available at certain times

I received the following question, and thought I would share it and the answer with everyone:

I use joomla 3.4.1 with virtuemart 3.0.8.
I need this settings:
I have a special category, the products are can be ordered only on weekdays only during a specific period of time.
This module is suitable for this?

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

Re: Make some VM products only available at certain times

Answer:

Using Chameleon, which has better facilities for this than MetaMod, there's a great approach to this.

That is, you could do it with Shopper groups, because Chameleon allows you to switch shopper group for the shopper, depending on things like time/date.

(1) Set up a shopper group called LimitedHours, and edit all the products in your specified category to put them into that shopper group.

(2) Make a rule in Chameleon that detects the hours that your shop is open, and sets the shopper group to LimitedHours during those times. The rest of the time the shopper group will be guest (for non logged in users) or Default Shopper Group for logged in users.

This means that during your limited hours, it will look like all users are in the LimitedHours shopper group. Thus if they view a normal product, it will display normally because most products are set to display for ANY shopper group. For any products in your special category, they will display too because they are set to display ONLY for shoppers in that shopper group.

Outside of those hours however, the shopper group will either be Default or Guest. Normal products will display as normal, but "LimitedHours" items won't display because they will only show for that shopper group.

(2a) To detect the particular hours of the day you can use the following code in the PHP box in the Chameleon rule:

if ( $core_genius->inTimeSpan('11:00 - 22:00') ) return true;

(2b) In the Chameleon "Succeed Action" you use the dropdown to set the shopper group to LimitedHours.

(2c) In the Fail Action you use the dropdown to set the shopper group to Default. You need to do this otherwise if someone has viewed your site before 22:00 then their shopper group will be remembered for the rest of their session, and Chameleon won't reset it back to "default" unless you do that here.

I tested this out on a test site and it seems to work really well. The products are completely hidden when "out of hours".

Extending this

You can use the same approach to toggle the visibility of products using lots of other conditions/factors as well:

  • by browser (show products for desktop but not mobile)
  • by platform (you might want to show some additional Windows-specific software products when viewed from Windows)
  • by country using the GeoIP detection
  • by domain (www.example1.com and www.example2.com show different products even though they are the same VM site)
  • to different Joomla groups (effectively tying together Joomla groups and shopper groups)
  • according to the user's previous purchase history (there may be certain products that should not be displayed if the user has previously purchased certain other products)
  • by referrer (show certain products to visitors being referred from a particular other site)

If you want your entire VirtueMart shop to be in Catalogue mode during certain hours, then see this post for how to achieve that with Chameleon:

http://www.metamodpro.com/forums/topic?id=2323

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

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10789
Newest User:
parus6
Members Online:
1
Guests Online:
211

Online: 
parus6

Forum Legend:

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