|
This page covers JomGenius for Joomla 1.5 as well as Joomla 1.6/1.7. There are some differences in support between the two versions, and these are clearly marked below.
On this page:
JomGenius “core” object
Methods
The “core” object responds to three methods: inTimeSpan(), info(), and check().
inTimeSpan( string ) method
The inTimeSpan() method makes it easy to calculate whether the local time and/or day of the week and/or day of the month is between two days/dates and times. It’s great for timing parts of your site to be active at certain times on certain days.
You just need to give it a single string argument ñ the time period. It also needs to know the current time zone. This defaults to the current Joomla time zone, but you can set an alternative time zone in Chameleon "Parameters", that respects daylight savings time in the chosen locale.
You can even stack more than one time period into the same call, separated with semicolons (;).
The time period can be in any of the following forms:
| use | form | example | description |
| Single day of the week |
DDD |
mon |
Returns "true" from 00:00:00 to 23:59:59 on the chosen day. Day names are the 1st 3 letters in English, lower case. |
| Several consecutive days of the week |
DDD - DDD |
sat - mon |
Returns "true" from 00:00:00 on the first day to 23:59:59 on the second day. The second day can be in the next week (it rolls over). |
| A certain time on one day of the week, to a certain time on another day of the week |
DDD hh:mm - DDD hh:mm |
mon 09:00 - wed 13:30 |
Returns "true" from the given time on the first day, to the given time on the second day. You can specify just the day name, or the day and hour, or the day, hour and minutes. |
|
DDD hh:mm:ss - DDD hh:mm:ss |
mon 09:00:30 - wed 13:30:30 |
| An entire month |
MMM |
aug |
Returns "true" for the entire calendar month (midnight at the beginning of the first day, to midnight at the end of the last day). The month name is lower case, 1st 3 letters of English month name. |
| A day of the month |
MMM jj |
aug 2 |
Returns "true" for the exact day of the month, from midnight to midnight. The day of the month must not have a leading 0. |
| Several months |
MMM - MMM |
jan - mar |
Returns "true" for the entire months, from midnight at the end of the first to midnight at the end of the last. |
| Days of the month with optional times |
MMM jj hh:mm - MMM jj |
jan 3 14:30 - mar 3 13:30 |
Returns "true" between the dates and times specified. |
|
MMM jj hh:mm:ss - MMM jj hh:mm:ss |
jan 3 14:30:30 - mar 3 13:30:30 |
|
MMM jj - MMM jj hh:mm:ss |
jan 3 - mar 3 13:30:30 |
| Times of the day (repeated every day) |
hh:mm |
14:01 |
Returns "true" for the exact minute given. |
|
hh:mm:ss |
14:01:29 |
Returns "true" for the exact second given. [would anyone use that?] |
|
hh:mm - hh:mm |
23:30 - 01:00 |
Returns "true" for the time period given, and operates every day of the week. The period can span midnight. The "seconds" value is optional on both the "from" and "to" times. All times are in the 24-hour clock. All hours are 2-digit. |
|
hh:mm - hh:mm:ss |
00:10 - 00:15:30 |
|
hh:mm:ss - hh:mm:ss |
00:10:30 - 00:15:30 |
Examples:
if ($core_genius->inTimeSpan( "mon; wed; fri") ) echo "It's either Mon, Wed or Fri";
if ($core_genius->inTimeSpan( "tue; thur" ) ) echo "It's either Tue or Thu";
if ($core_genius->inTimeSpan( "sat - sat 12:00") ) echo "It's Sat morning";
if ($core_genius->inTimeSpan( "sat 12:00 - sun" ) ) echo "It's Sat afternoon or anytime Sun";
info() and check() methods for “core”
The following parameters can be used to get information from the JomGenius “core” object.
e.g. $core_genius->info( "parameter" ) or $core_genius->check( "parameter = value")
| parameter | version | description | type | return values |
| pagetype |
1.5, 1.6+ |
This parameter knows about all of the major page types in an out-of-the-box Joomla site. It’s not just restricted to component types, either. e.g. it knows the difference between the search page, and the search results page (after someone has initiated a search). |
string |
This is the full list of page types recognised in Joomla 1.5:
Content:
- frontpage, article, articleedit, articlesubmit, sectionblog, sectionlist, categoryblog, categorylist, archive
Users:
- reset, remind, register, login, user
Contacts:
Web Links:
- weblinkscategories, weblinkscategory, weblinkform
Polls:
Search:
News Feeds:
- newsfeedscategories, newsfeedscategory, newsfeed
This is the full list of page types recognised in Joomla 1.6:
Content:
- featured, article, articleedit, articlenew, categoryblog, categorylist, categories, archive
Users:
- reset, remind, registration, login, profileedit, profile
Contacts:
- contact, contactcategory, contactcategories
Web Links:
- weblinkedit, weblinknew, weblinkscategories, weblinkscategory, weblinkform, weblink
Search:
News Feeds:
- newsfeed, newsfeedscategory, newsfeedscategories
|
| browser |
1.5, 1.6+ |
Contains the browser type (lower case), and in some cases the major version number. |
string |
This is the full list of possible results:
Browsers with version numbers (X signifies the version number):
- firefoxX, ieX, chromeX, operaX, omniwebX, safariX
All others:
- ipod, iphone, ipad, android, googlebot, google mediapartners, yahoo slurp, msnbot, teoma, playstation, wii
|
| categorizr |
1.6+ |
Detects the broad category of device viewing the page. Contains one of the strings: mobile, desktop, tablet, tv. Bots and crawlers are classified as desktop. Categorizr uses a "mobile-first" algorithm. |
string |
mobile |
| browsertype |
1.5, 1.6+ |
Contains only the browser type, and not any version numbers. |
string |
This is the full list of possible results:
- firefox, ie, chrome, opera, omniweb, ipod, iphone, ipad, android, googlebot, google mediapartners, yahoo slurp, msnbot, teoma, playstation, wii, safari
|
| browserversion |
1.5, 1.6+ |
The entire version number of the browser, as well as can be detected. i.e. it's not just the major version number as given in "browser", and may contain "dot" versions. |
string |
JomGenius can detect version numbers for the following browsers only:
- IE, Firefox, Opera, Chrome, OmniWeb, Safari (not including iPod, iPhone, iPad)
Example of output on IE 5.5:
5.5
|
| browseros |
1.5, 1.6+ |
The operating system of the platform running the browser, where possible to determine |
string |
This is the full list of possible results:
- windows, mac, linux, bot, console (i.e. gaming console)
|
| referrer |
1.5, 1.6+ |
The refer(r)er of the currently-viewed web page. Note: this can be spoofed. |
string |
http://www.example.com/some/page |
| domain |
1.5, 1.6+ |
The domain name used to obtain the current page. |
string |
www.example.com |
| url (also avalable as uri) |
1.5, 1.6+ |
The full URL used to obtain the current page |
string |
http://www.example.com/this/page.html |
| clientip |
1.5, 1.6+ |
IP address of the client. JomGenius attempts to detect the IP address used when the client is behind a proxy. As a side-effect of this, this value can be spoofed. |
string |
12.34.56.78 |
| issecure |
1.5, 1.6+ |
Whether HTTPS has been used to get the current page. |
boolean |
true (if https is used) false (if http is used) |
| browserlanguage |
1.5, 1.6+ |
The language code given by the browser as the preferred language. Can be in the form xx-xx or just xx. |
string |
en |
| frontendlanguage |
1.5, 1.6+ |
The front-end language of the site. If using JoomFish or similar, the user may have the option of changing this. Always in the form xx-xx. |
string |
en-gb |
| userid |
1.5, 1.6+ |
The user id of the user, if logged-in. Otherwise 0. |
string |
62 |
| userfullname |
1.5, 1.6+ |
Full name of the user, if logged in. Otherwise empty string. |
string |
Joe Bloggs |
| userloginname |
1.5, 1.6+ |
Login name of the user, if logged in. Otherwise empty string. |
string |
joeb |
| useremail |
1.5, 1.6+ |
E-mail address of the user, if logged in. Otherwise empty string. |
string |
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
|
| isloggedin |
1.5, 1.6+ |
true if user is logged in, otherwise false |
boolean |
true |
| isnotloggedin |
1.5, 1.6+ |
false if user is logged in, otherwise true |
boolean |
true |
| isguest |
1.5, 1.6+ |
same as "isnotloggedin" |
boolean |
true |
| userlastvisitdate |
1.5, 1.6+ |
The date-time stamp for the user's last visit |
string |
2010-07-25 20:55:08 |
| userregisterdate |
1.5, 1.6+ |
The date-time stamp for when the user registered |
string |
2010-07-19 03:56:04 |
| minutessincelastvisit |
1.5, 1.6+ |
Number of minutes since this user last visited (only applicable once user has logged in) |
integer |
31 |
| minutessinceregistration |
1.5, 1.6+ |
Number of minutes since this user registered (only applicable once user has logged in) |
integer |
24601 |
| dayssincelastvisit |
1.5, 1.6+ |
Number of days since this user last visited (only applicable once user has logged in) |
integer |
0 |
| dayssinceregistration |
1.5, 1.6+ |
Number of days since this user registered (only applicable once user has logged in) |
integer |
17 |
| group |
1.5 only |
User group the the user is in. 3rd-party ACL extensions may add additional group names ñ standard Joomla! groups are listed here. |
string |
All standard Joomla groups:
- Registered, Author, Editor, Publisher, Manager, Administrator, Super Administrator
|
| groups |
1.6+ |
A list (array) of all the user groups that the user is in, or none if they are not logged in. |
array |
By default, contains all the standard Joomla groups, but if you add your own groups then these can appear too. |
| groupids |
1.6+ |
A list (array) of all the ids of the user groups that the user is in, or none if they are not logged in. |
array |
By default, contains all the standard Joomla group ids, but if you add your own groups then these can appear too. |
Examples:
if ( $core_genius->check( "dayssincelastvisit > 30" ) )
echo "Welcome back, haven't seen you for a while";
if ( $core_genius->check( "browserlanguage starts with fr" ) )
echo "Bonjour!";
if ( $core_genius->check( "browser = ie" )
and $core_genius->check( "browserversion <= 6" ) )
echo "Please upgrade your browser!";
if ( $core_genius->info( "isloggedin" ) == true )
echo "Welcome " . $core_genius->info( "userfullname");
JomGenius “menu” object
Methods
The “menu” object responds to two main public methods: info(), and check().
info() and check() methods for “menu”
The following parameters can be used to get information from the JomGenius “menu” object.
e.g. in $menu_genius->info( "parameter" ) or in $menu_genius->check( "parameter = value")
| parameter | version | description | type | return values |
| itemid |
1.5, 1.6+ |
The "Itemid" of the current menu item, or empty string if none can be detected. |
string |
e.g. 5 |
| menutype |
1.5, 1.6+ |
The menu type for the menu of the currently-active item. |
string |
e.g. mainmenu
e.g. topmenu
|
| name |
1.5 only |
The name of the menu item |
string |
e.g. Contact Us |
| title |
1.6+ |
The title of the menu item (equivalent to "name" in Joomla 1.5) |
string |
e.g. Contact Us |
| alias |
1.5, 1.6+ |
The alias of the menu item. This is often used (e.g. in standard Joomla SEF) as the SEF slug for the page. |
string |
e.g. contact-us |
| route |
1.6+ |
The SEF path of the menu item, made up of the alias stubs for all parent menu items. SEF URLs do not need to be turned on in order to get this information. There is no leading or trailing "/". Note: the route of the home page is not "/" ñ it is the alias for that page, e.g. "homepage" |
string |
e.g. info/contact-us |
| language |
1.6+ |
The language set for this menu item, or "*" for all languages |
string |
e.g. * (all languages) e.g. en-GB |
| templatestyleid |
1.6+ |
The template style id chosen for this menu item, or "0" if no specific template style is chosen. |
string |
e.g. 114 |
| type |
1.5, 1.6+ |
The type of item that this menu links to. The complete set of values is listed on the right. |
string |
This is the full list of possible results:
- component, menulink, separator, url
|
| level |
1.5, 1.6+ |
The level of menu item.
Joomla 1.5: 0 refers to an item at the top level of a menu; 1 is 1st level below that, etc. Joomla 1.6: 1 refers to an item at the top level of a menu, 2 is the next level below that, etc.
|
string |
e.g. 1 |
| parentitemid |
1.5, 1.6+ |
The Itemid of the "parent" menu item for the current page. In Joomla 1.6, all top-level items have a parent of "1", the "Menu Item Root". |
string |
14 |
| parentitemids |
1.5, 1.6+ |
An array of all the "parent" menu items for the current page, up to the top level. This can be used to find out if the current page is beneath/within a particular parent menu item. In Joomla 1.6, the first item in the array is always "1" which is the Menu Item Root. |
array of strings |
array("1", "14", "16", "30") |
| ispublished |
1.5+ |
Is the menu item corresponding to the current Itemid actually published? This is not available for Joomla 1.6, as an error page will be displayed if the requested page/menu is not published. |
boolean |
true |
| isdefault |
1.5, 1.6+ |
Is the menu item corresponding to the current Itemid the "default" menu item for the site? i.e. the default menu item is the one displayed when no other page is requested, e.g. www.example.com |
boolean |
true |
| param_* |
1.5, 1.6+ |
This allows you to get hold of any menu parameter set for the page. Each type of menu item will have a different set of parameters, so you need to know what these are in order to use them.
Here are some examples:
param_show_title param_show_author param_page_title
|
string |
|
Examples:
if ( $menu_genius->check( "level = 0" ) )
echo "We are on a top level menu item";
if ( $menu_genius->check( "menutype = some of mainmenu, topmenu" ) )
echo "We're on a page on the main menu or top menu";
echo "The current menu item name is " . $menu_genius->info( "name" );
if ( $menu_genius->check( "some of parentitemids = 14" ) )
echo "The current menu item is beneath menu item #14";
if ( $menu_genius->check( "parentitemid = 14" ) )
echo "The current menu item is a direct child of menu item #14";
JomGenius “content” object
Methods
The “content” object responds to two main public methods: info(), and check().
info() and check() methods for “content”
The following parameters can be used to get information from the JomGenius “content” object. This object contains a lot of information about the currently-displayed article, category or section, when articles/categories/sections are being displayed.
e.g. in $content_genius->info( "parameter" ) or in $content_genius->check( "parameter = value")
| parameter | version | description | type | return values |
| pagetype |
1.5, 1.6+ |
Contains information about the current page type, but only when it's article-related |
String |
This is the full list of possible results:
- frontpage, article, articleedit, articlesubmit, sectionblog, sectionlist, categoryblog, categorylist, archive
|
| page_number |
1.5, 1.6+ |
The page number of a multi-page article or section/category list/blog page. 0= first page. This is useful for targetting the 1st page of a paginated webpage. |
string |
0 |
| article_id |
1.5, 1.6+ |
The article id (article view pages only) |
string |
123 |
| article_title |
1.5, 1.6+ |
The article title (article view pages only) |
string |
Welcome to Joomla |
| article_alias |
1.5, 1.6+ |
The article alias (article view pages only) |
string |
welcome-to-joomla |
| article_hits |
1.5, 1.6+ |
The number of hits the article has received (if this is being tracked) (article view pages only) |
string |
234 |
| article_version |
1.5, 1.6+ |
The version number of the article. Each time an article is edited, 1 is added to this number for that article. (article view pages only) |
string |
1 |
| article_created_by |
1.5, 1.6+ |
The user id of the user who first created the article (article view pages only) |
string |
62 |
| article_modified_by |
1.5, 1.6+ |
The user id of the user who last modified the article (article view pages only) |
string |
62 |
| article_introtext |
1.5, 1.6+ |
The full intro text of the article (article view pages only) |
string |
"This is the intro text of the article..." |
| article_fulltext |
1.5, 1.6+ |
The fulltext of the article, as retrieved from the database. i.e. it does not have any plugins applied to this text. (article view pages only) |
string |
"The full text of the article..." |
| article_created |
1.5, 1.6+ |
The date/time of the creation of the article (article view pages only) |
string |
2004-08-10 06:30:34 |
| article_modified |
1.5, 1.6+ |
The date/time of the last modification of the article (article view pages only) |
string |
2007-11-08 12:19:35 |
| article_publishup |
1.5, 1.6+ |
The date/time that the article should begin publishing. "0000-00-00 00:00:00" is used for "no start date". (article view pages only) |
string |
2009-10-25 22:06:47 |
| article_publishdown |
1.5, 1.6+ |
The date/time that the article should stop publishing. "0000-00-00 00:00:00" is used for "no end date". (article view pages only) |
string |
0000-00-00 00:00:00 |
| article_metakeywords |
1.5, 1.6+ |
The meta-keywords for an article, as given in the database. i.e. not added by any 3rd-party component for this page (article view pages only) |
string |
list,of,keywords |
| article_metadescription |
1.5, 1.6+ |
The meta-description for an article, as given in the database. i.e. not added by any 3rd-party component for this page (article view pages only) |
boolean |
"This is the metadescription for this article..." |
| article_created_age |
1.5, 1.6+ |
The age of the currently-displayed article IN MINUTES since article creation (article view pages only) |
string |
24601 |
| article_modified_age |
1.5, 1.6+ |
The age of the currently-displayed article IN MINUTES since last modification (article view pages only) |
string |
61 |
| article_frontpage |
1.5 only |
Has the currently-displayed article been assigned to the FrontPage view? (article view pages only) |
boolean |
true |
| article_featured |
1.6+ |
Has the currently-displayed article been assigned to the Featured view? (article view pages only) |
boolean |
true |
| article_language |
1.6+ |
The language set for the article, or "*" for all languages |
string |
e.g. * (all languages) e.g. en-GB |
| category_id |
1.5, 1.6+ |
The category id of the article, when viewing an article, or the category id of the page for category blog/list pages. |
string |
5 |
| category_title |
1.5, 1.6+ |
The title of the category. On category blog/list pages, this is the title of the category displayed; on article pages, it's the category title of the article displayed. |
string |
The News |
| category_alias |
1.5, 1.6+ |
The alias/slug of the category. On category blog/list pages, this is the alias of the category displayed; on article pages, it's the category alias of the article displayed. |
string |
the-news |
| category_count |
1.5 only |
unknown (just gives the value from the database category table) |
string |
|
| category_description |
1.6+ |
The HTML category description from the category manager |
string |
<p>Content modules display article and other information from the content component.</p> |
| category_note |
1.6+ |
The text note added to the category in the category manager |
string |
|
| category_language |
1.6+ |
The language set for the category, or "*" for all languages |
string |
e.g. * (all languages) e.g. en-GB |
| ancestor_category_titles |
1.6+ |
An array of titles of all the categories from the current item/category up to the top level. If the current view is a category view, this includes the current category. If the current view is an article view, this includes the category the item is in. |
array of strings |
array("Sprinting", "Track & Field", "Sports") |
| ancestor_category_ids |
1.6+ |
An array of ids of all the categories from the current item/category up to the top level. If the current view is a category view, this includes the current category. If the current view is an article view, this includes the category the item is in. |
array of ids |
array("15","12","2") |
The following "section" parameters only apply to Joomla 1.5, because Joomla 1.6+ no longer has sections. Instead, from Joomla 1.6+, use the ancestor_category_ids and ancestor_category_titles to detect if the current article descends from a particular category or set of categories. |
| section_id |
1.5 only |
The section id of the article, when viewing an article, or the section id of the page for category blog/list pages. |
string |
6 |
| section_title |
1.5 only |
The title of the section. On Section blog/list pages, this is the title of the section displayed; on article pages, it's the category of the article displayed. |
string |
General |
| section_alias |
1.5 only |
The alias/slug of the section. On section blog/list pages, this is the alias of the section displayed; on article pages, it's the section alias of the article displayed. |
string |
general |
| section_count |
1.5 only |
unknown (just gives the value from the database category table) |
string |
|
Examples:
if ( $content_genius->check( "pagetype = frontpage" ) )
echo "Welcome to our site";
if ( $content_genius->check( "article_created_age > " . 60*24*365 ) )
echo "This article may be out of date";
// Chameleon rule to show different template for categories 3, 4, 5 and 7
if ( $content_genius->check( "category_id = 3, 4, 5, 7" ) ) return true;
if ( $content_genius->check( "article_hits > 1000" ) )
echo "POPULAR";
// Chameleon rule to use different template for articles with certain keyword
if ( $content_genius->check( "article_metakeywords contains MYKEYWORD" ) )
return true;
// Chameleon rule to use different template after the 1st page of an article
if ( $content_genius->check( "pagetype = article" )
and $content_genius->check( "page_number > 0" ) )
return true;
if ( $content_genius->info( "article_created_by" ) ==
$core_genus->info( "userid" ) )
echo "Welcome, article author!";
JomGenius “virtuemart” object
Methods
The “virtuemart” object responds to two main public methods: info(), and check().
info() and check() methods for “virtuemart”
The following parameters can be used to get information from the JomGenius “virtuemart” object. This object contains a lot of information about the currently-displayed product and/or category, all of the different page types in VirtueMart, information about the contents of the shopping cart, and about any vouchers that may have been redeemed.
The VirtueMart object is not automatically created for you in MetaMod/Chameleon. You have to create it yourself, then check to see that it exists before you use it. This is because it won't allow itself to be created if VirtueMart is not installed in Joomla.
Note: There are some "gotchas" about some of these parameters when used by Chameleon (as opposed to MetaMod). Chameleon works at a very early stage of the generation of a page in Joomla. They operate before VirtueMart itself has had a chance to process the request. Therefore, some parameters such as those requesting the contents of the shopping cart, or whether or not a voucher has been redeemed, will not be updated by VirtueMart in time for these parameters to be calculated by JomGenius.
What happens then, is that JomGenius will appear to "lag" behind the actions of the shopper by one page view. The shopper may redeem a voucher, but on the page that appears directly afterwards, JomGenius will not have detected the voucher. One page later, JomGenius will detect the voucher for the first time.
MetaMod (and any other module using JomGenius) will not have this problem, because the modules get run only after VirtueMart has processed the form input.
Example of creation and usage:
$vm = JomGenius("virtuemart")
if ( $vm ) {
echo "The VM page type is " . $vm->info("page_type");
}
The following parameters can be used in the VirtueMart "info" and "check" methods: e.g. $vm->info( "parameter" ) or in $vm->check( "parameter = value")
JomGenius for Virtuemart 1.x (see here for VM2.x)
| parameter | description | type | return values |
| pagetype |
Contains information about the current page type, but only when it's vm-related |
string |
This is the full list of possible results for VirtueMart 1.x
- frontpage, account.billing, account.index, account.order_details, account.orders, account.shipping, account.shipto, checkout.2Checkout_result, checkout.epay_result, checkout.ipayment_result, checkout.paysbuy, checkout.result, checkout.thankyou, shop.browse, shop.ask, shop.cart, shop.infopage, shop.manufacturer_page, shop.product_details, shop.registration, shop.savedcart, shop.search, shop.waiting_list, shop.waiting_thanks
- checkout.index#1, checkout.index#2, checkout.index#3, checkout.index#4
|
| product_id |
The product ID of a product being displayed on a shop.product_details page |
string |
5 |
| category_name |
The name of the product’s immediate category. If the product is in more than 1 category, this will only return 1 (at random). |
string |
Power Tools |
| category_names |
The full list (array) of names of the immediate categories that this product is in (particularly if the product is in more than one category). |
array of strings |
array("Power Tools", "Outdoor Tools") |
| category_id |
The id of the product's immediate category. If the product is in more than 1 category, this will only return 1 (at random). |
string |
2 |
| category_ids |
The full list (array) of ids for the immediate categories that this product is in (particularly if the product is in more than one category). |
array of strings |
array( "2", "4") |
| ancestor_category_ids |
The full list (array) of all categories that this product is in, and their parent categories, all the way to the top level. (added v6, 29 Nov 2010) |
array of strings |
array( "2", "4", "5", "6" ) |
| number_cart_products |
Number of different products in the cart |
integer |
5 |
| number_cart_items |
Number of items in the cart |
integer |
2 |
| is_cart_populated |
Does the cart have anything in it? |
boolean |
true |
| is_cart_empty |
Is the cart empty? |
boolean |
false |
| cart_product_ids |
A list (array) of all product ids for the products in the cart |
array of strings |
array( "3","4","37" ) |
| cart_category_ids |
A list (array) of all the category ids for products in the cart. Note: only one category is given per product, so if a product is in more than one category you can't tell which category you will be given. |
array of strings |
array( "2","2","3") |
| shopper_group |
The shopper group id. Some of the built-in groups are 5 (default), 6 (gold) and 7 (wholesale). |
string |
5 |
| coupon_code |
The coupon code, once the shopper has entered it. |
string |
MY_COUPON |
| is_coupon_redeemed |
Has a coupon been redeemed in this session? |
boolean |
true |
| coupon_discount |
The amount of the discount, whether as a percentage or flat rate. This always returns a number, never with a currency symbol or "%" symbol. |
string |
30 |
| coupon_type |
Either "gift" or "permanent" depending on what kind of coupon the user entered. |
string |
gift
|
| Ship To parameters: as a user can have more than one Ship To address, these parameters all return lists (arrays) of information, with one element per address. |
| shipto_country3s |
A list of the upper-case 3-letter country codes of the countries in the User’s Ship To addresses. If both addresses are in the same country, then both elements of the array may be the same (and that’s ok). |
array of strings |
array( "USA","USA") |
| shipto_country2s |
A list of the upper-case 2-letter country codes of the countries in the User’s Ship To addresses. |
array of strings |
array( "US", "US" ) |
| shipto_country_names |
A list of the names of the countries in the User’s Ship To addresses. |
array of strings |
array( "United States", "United State" ) |
| shipto_states |
A list of the states in the User’s Ship To addresses. |
array of strings |
array( "CA","CA"); |
| shipto_citys |
A list of the cities in the User’s Ship To addresses. |
array of strings |
array( "Los Angeles", "Los Angeles" ); |
| shipto_zips |
A list of the zip codes in the User’s Ship To addresses. |
array of strings |
array( "90210", "90211" ); |
| shipto_emails |
A list of the e-mail addresses in the user’s Ship To addresses. |
array of strings |
array( "
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
", "
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
") |
| Bill To parameters: users can only have 1 Bill To address, therefore each of these parameters returns a simple element. |
| billto_country3 |
The upper-case 3-letter country code of the country in the user’s Bill To addresses. |
string |
USA |
| billto_country2 |
The upper-case 2-letter country code of the country in the user’s Bill To address. |
string |
US |
| billto_country_name |
The name of the country in the user’s Bill To address. |
string |
United States |
| billto_state |
The state in the user’s Bill To address. |
string |
CA |
| billto_city |
The city in the user’s Bill To address. |
string |
Los Angeles |
| billto_email |
The e-mail address in the user’s Bill To address. |
string |
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
|
The following parameters were introduced on 6 September 2010, in MetaMod 2.5, MetaTemplate 1.6 and MetaTemplate Pro 1.6. Unless otherwise noted, the following parameters are only relevant when the user is viewing a “product” or product query page. |
| manufacturer_id |
The manufacturer id, when on a product page, product query page, manufacturer page or when browsing products by manufacturer |
integer |
1 |
| manufacturer_name |
The manufacturer name, when on a product page, product query page, manufacturer page or when browsing products by manufacturer |
string |
ACME Industries |
| manufacturer_category_id |
The manufacturer category id, when on a product page, product query page, manufacturer page or when browsing products by manufacturer |
integer |
2 |
| manufacturer_category_name |
The manufacturer category name, when on a product page, product query page, manufacturer page or when browsing products by manufacturer |
string |
Widget Manufacturers |
| vendor_id |
The vendor id |
integer |
3 |
| product_parent_id |
The product parent id |
integer |
5 |
| product_sku |
The product SKU |
string |
P03 |
| product_short_desc |
The product short description |
string |
Drill through anything. This drill has the power you need for those demanding hole boring duties. |
| product_desc |
The product long description |
string |
High power motor and double gear reduction for increased durability and improved performance
Mid-handle design and two finger trigger for increased balance and comfort
Variable speed switch with lock-on button for continuous use
Includes: Chuck key & holder
Specifications 4.0 AMPS 0-1,350 RPM Capacity: 3/8" Steel, 1" Wood
High Power Motor
lorem ipsum...
|
| is_product_published |
true/false for whether or not the product details requested in the URL refer to a published product. |
boolean |
true |
| product_weight |
The product weight |
string |
10.0000 |
| product_weight_unit |
Units for product_weight |
string |
pounds |
| product_width |
The product width |
string |
20.0000 |
| product_height |
The product height |
string |
20.0000 |
| product_length |
The product length |
string |
20.0000 |
| product_measurement_unit |
The measurement unit for width/length/height |
string |
inches |
| product_in_stock |
The number of units in stock |
integer |
23 |
| is_product_special |
true/false for whether the displayed product is on “special” |
boolean |
true |
| product_discount_id |
The product discount id |
integer |
1 |
| product_ship_code_id |
The product ship code id |
integer |
0 |
| product_name |
The product name |
string |
High Power Drill |
| product_sales |
The total number of sales of the product |
integer |
324 |
| product_attributes |
The product attributes |
string |
Size,XL[+1],M,S[-2];Power,strong,middle, poor[=24] |
| product_tax_id |
The product Tax id |
integer |
1 |
| product_unit |
The product’s “Unit” type as specified in the back end. Equal to “download” if it’s a downloadable product. |
string |
box |
| units_in_box |
Number of units of this product per box |
integer |
100 |
| units_in_package |
Number of units of this product per package |
integer |
16 |
| child_options |
(exact use in VM unknown) |
string |
N,N,N,N,N,Y,,, |
| quantity_options |
(exact use in VM unknown) |
string |
none,0,0,1 |
| The following parameters were introduced in September 2011, in Chameleon 1.19/2.22 and MetaMod 2.11/3.7. |
| previous_purchase_product_ids |
An array of product ids that the customer has already purchased |
array of strings |
|
| previous_purchase_product_skus |
An array of product SKUs that the customer has already purchased |
array of strings |
|
| previous_purchase_product_names |
An array of product names that the customer has already purchased |
array of strings |
|
| previous_purchase_quantity_of_product_nnn |
The number of items of product id nnn that the customer has already purchased. Replace nnn with the product id you want to search for. |
integer |
3 |
JomGenius for Virtuemart 2.x (see here for VM1.x)
| parameter | description | type | return values |
| pagetype |
Contains information about the current page type, but only when it's vm-related |
string |
This is the full list of possible results for VirtueMart 2.x
- account.billing, account.index, account.order_details, account.orders, account.shipping, account.shipto
- cart, cart.editpayment, cart.editshipment, cart.thankyou
- category, searchresults
- checkout.2Checkout_result, checkout.editbillto, checkout.editshipto, checkout.epay_result, checkout.ipayment_result, checkout.paysbuy, checkout.result
- frontpage, order.view, orders, plugin.response
- manufacturer, manufacturer.products (i.e. list of products from a manufacturer)
- productdetails, productdetails.ask, productdetails.mailquestion, productdetails.notify (i.e. when asking for notification when product is available), productdetails.recommend (i.e. when e-mailing page to others)
- shop.ask, shop.infopage, shop.registration, shop.savedcart, shop.search, shop.waiting_list, shop.waiting_thanks
- user, user.editaddresscheckout, user.editbillto, user.editshipto, user.editshipto
|
| is_search_results |
Returns 'true' if the current page is a search results page |
boolean |
either true or false
|
| product_id |
The product ID of a product being displayed on a shop.product_details page |
string |
5 |
| category_name |
The name of the product’s immediate category. If the product is in more than 1 category, this will only return 1 (at random). |
string |
Power Tools |
| category_names |
The full list (array) of names of the immediate categories that this product is in (particularly if the product is in more than one category). |
array of strings |
array("Power Tools", "Outdoor Tools") |
| category_id |
The id of the product's immediate category. If the product is in more than 1 category, this will only return 1 (at random). |
string |
2 |
| category_ids |
The full list (array) of ids for the immediate categories that this product is in (particularly if the product is in more than one category). |
array of strings |
array( "2", "4") |
| ancestor_category_ids |
The full list (array) of all categories that this product is in, and their parent categories, all the way to the top level. (added v6, 29 Nov 2010) |
array of strings |
array( "2", "4", "5", "6" ) |
| number_cart_products |
Number of different products in the cart |
integer |
5 |
| number_cart_items |
Number of items in the cart |
integer |
2 |
| is_cart_populated |
Does the cart have anything in it? |
boolean |
true |
| is_cart_empty |
Is the cart empty? |
boolean |
false |
| cart_product_ids |
A list (array) of all product ids for the products in the cart |
array of strings |
array( "3","4","37" ) |
| cart_category_ids |
A list (array) of all the category ids for products in the cart. Note: only one category is given per product, so if a product is in more than one category you can't tell which category you will be given. |
array of strings |
array( "2","2","3") |
| shopper_group |
The shopper group id. Some of the built-in groups are 5 (default), 6 (gold) and 7 (wholesale). |
string |
5 |
| coupon_code |
The coupon code, once the shopper has entered it. |
string |
MY_COUPON |
| is_coupon_redeemed |
Has a coupon been redeemed in this session? |
boolean |
true |
| coupon_discount |
The amount of the discount, whether as a percentage or flat rate. This always returns a number, never with a currency symbol or "%" symbol. |
string |
30 |
| coupon_value |
The total monetary value of the coupon, not including the currency type or symbol. |
string |
30.99
|
| Ship To parameters: as a user can have more than one Ship To address, these parameters all return lists (arrays) of information, with one element per address. |
| shipto_country3s |
A list of the upper-case 3-letter country codes of the countries in the User’s Ship To addresses. If both addresses are in the same country, then both elements of the array may be the same (and that’s ok). |
array of strings |
array( "USA","USA") |
| shipto_country2s |
A list of the upper-case 2-letter country codes of the countries in the User’s Ship To addresses. |
array of strings |
array( "US", "US" ) |
| shipto_country_names |
A list of the names of the countries in the User’s Ship To addresses. |
array of strings |
array( "United States", "United State" ) |
| shipto_states |
A list of the states in the User’s Ship To addresses. |
array of strings |
array( "CA","CA"); |
| shipto_citys |
A list of the cities in the User’s Ship To addresses. |
array of strings |
array( "Los Angeles", "Los Angeles" ); |
| shipto_zips |
A list of the zip codes in the User’s Ship To addresses. |
array of strings |
array( "90210", "90211" ); |
| shipto_emails |
A list of the e-mail addresses in the user’s Ship To addresses. |
array of strings |
array( "
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
", "
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
") |
| Bill To parameters: users can only have 1 Bill To address, therefore each of these parameters returns a simple element. |
| billto_country3 |
The upper-case 3-letter country code of the country in the user’s Bill To addresses. |
string |
USA |
| billto_country2 |
The upper-case 2-letter country code of the country in the user’s Bill To address. |
string |
US |
| billto_country_name |
The name of the country in the user’s Bill To address. |
string |
United States |
| billto_state |
The state in the user’s Bill To address. |
string |
CA |
| billto_city |
The city in the user’s Bill To address. |
string |
Los Angeles |
| billto_email |
The e-mail address in the user’s Bill To address. |
string |
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
|
| billto_zip |
The zip code in the user’s Bill To address. |
string |
90210 |
| Unless otherwise noted, the following parameters are only relevant when the user is viewing a “product” or product query page. |
| manufacturer_id |
The manufacturer id, when on a product page, product query page, manufacturer page or when browsing products by manufacturer |
integer |
1 |
| manufacturer_name |
The manufacturer name, when on a product page, product query page, manufacturer page or when browsing products by manufacturer |
string |
ACME Industries |
| manufacturer_category_id |
The manufacturer category id, when on a product page, product query page, manufacturer page or when browsing products by manufacturer |
integer |
2 |
| manufacturer_category_name |
The manufacturer category name, when on a product page, product query page, manufacturer page or when browsing products by manufacturer |
string |
Widget Manufacturers |
| vendor_id |
The vendor id |
integer |
3 |
| product_parent_id |
The product parent id |
integer |
5 |
| product_sku |
The product SKU |
string |
P03 |
| product_short_desc |
The product short description |
string |
Drill through anything. This drill has the power you need for those demanding hole boring duties. |
| product_desc |
The product long description |
string |
High power motor and double gear reduction for increased durability and improved performance
Mid-handle design and two finger trigger for increased balance and comfort
Variable speed switch with lock-on button for continuous use
Includes: Chuck key & holder
Specifications 4.0 AMPS 0-1,350 RPM Capacity: 3/8" Steel, 1" Wood
High Power Motor
lorem ipsum...
|
| is_product_published |
true/false for whether or not the product details requested in the URL refer to a published product. |
boolean |
true |
| product_weight |
The product weight |
string |
10.0000 |
| product_weight_unit |
Units for product_weight |
string |
pounds |
| product_width |
The product width |
string |
20.0000 |
| product_height |
The product height |
string |
20.0000 |
| product_length |
The product length |
string |
20.0000 |
| product_measurement_unit |
The measurement unit for width/length/height |
string |
inches |
| product_in_stock |
The number of units in stock |
integer |
23 |
| is_product_special |
true/false for whether the displayed product is on “special” |
boolean |
true |
| product_discount_id |
The product discount id |
integer |
1 |
| product_name |
The product name |
string |
High Power Drill |
| product_tax_id |
The product Tax id |
integer |
1 |
| product_unit |
The product’s “Unit” type as specified in the back end. Equal to “download” if it’s a downloadable product. |
string |
box |
| units_in_box |
Number of units of this product per box |
integer |
100 |
| units_in_package |
Number of units of this product per package |
integer |
16 |
| quantity_options |
(exact use in VM unknown) |
string |
none,0,0,1 |
| previous_purchase_product_ids |
An array of product ids that the customer has already purchased |
array of strings |
|
| previous_purchase_product_skus |
An array of product SKUs that the customer has already purchased |
array of strings |
|
| previous_purchase_product_names |
An array of product names that the customer has already purchased |
array of strings |
|
| previous_purchase_quantity_of_product_nnn |
The number of items of product id nnn that the customer has already purchased. Replace nnn with the product id you want to search for. |
integer |
3 |
Examples: (see also: Recipes for JomGenius and VirtueMart)
$vm = JomGenius("virtuemart"); // initialise object
if ( $vm->check( "pagetype = frontpage" ) )
echo "Welcome to the front page of VirtueMart";
if ( $vm->check( "manufacturer_name = ACME Industries" ) )
return 101; // in MetaMod: use module 101 for all ACME's products
// Chameleon rule to show different template products on special
if ( $vm->check( "is_product_special = true" ) ) return true;
// Chameleon rule to use different template when stock is low
if ( $vm->check( "product_in_stock < 10" ) ) return true;
// Chameleon rule to use particular template for products in cats 3-5
if ( $vm->check( "category_ids = 3,4,5" ) ) return true;
|