This document is copyright Vince Wooll/Woollyinwales IT, 2011. All rights reserved.
This plugin is designed to be a tool for non-Jomres Component Developers to help them interact with Jomres.
At the time of writing, this plugin is designed to make it easy to pull the property list and property details pages through a few lines of code.
Let's say that you are a Joomla developer and you want to pull some pages from Jomres. This a relatively straightforward thing to do, if you're familiar with Jomres, but what if you're not?
Enter the Internal API plugin! It does some magic so you don't have to.
Ok, hypothetically speaking, you're a developer with your own component. Now, you know a property uid and you want to display Jomres' property details page without having to figure out Jomres to do it.
First, you'll need to install the alt_init plugin, then the internal_api plugin. Once that's done, you're ready to use the following lines of code :
This is a little bit more complicated because you have a couple of options that we didn't see in the previous example, the showheaders option, and the jomsearch_sortby option.
The jomsearch_sortby argument refers to the options that are set by the Sort Order dropdown in the property list. In the example above we've set it to 2, which means to sort by property name. If you'd like to see the other sort options, open j01009a_filterproperties.class.php in your favourite editor and see the available options.
Note : The sortby option may produce seemingly misleading property lists if any of the property uids in the list are configured to be featured properties.This is because the 010009 scripts will re-order the results based on whether or not properties are considered featured. Featured properties are bumped to the top of the list, regardless of the sort order chosen.
Note : Any links in the pages passed back will resolve to the Jomres component, meaning if a user clicks on a link they'll be taken from your component to the Jomres component.
// Information about the booking items in the cart
An object will be returned, which looks something like
An object will be returned
Object sample :
public 'currency_code' => string 'EUR' (length=3)
public 'total' => float 310.66084280321
public 'deposit' => float 164.54012649299
public 'jsid' => string 'HpTtVtpLtgUUmqLpMQLltwUIYDPLYJBmYCVzFBWHnjIlIgnPNw' (length=50)
public 'number_of_bookings' => int 2
public 'items' =>
'total' => float 148.3044913474
'deposit' => float 148.3044913474
'total' => float 162.35635145581
'deposit' => float 16.235635145581
Get information about the items in the Jomres cart. Regardless of the currency of the booking all figures are converted to the Global Currency code before being returned in this object.
Whilst you're given the total, you're not expected to act on it, that's for your own information/use. Instead you're expected to act on the $obj->deposit sum, taking payment for that.
Don't take another figure in your payment gateway and expect Jomres to adapt accordingly. When the time comes to mark the booking paid and the bookings are created, Jomres will mark the deposit it expected as paid so if you're taking a different figure then your user's records may become confused.
Your script will need to make a note of jsid, as you'll be using that later when you want to create the bookings (until payment is made they're still not created, they're only created in the next step).
We're assuming that your own component has handled payment, so there will be no checking on Jomres' part that payment has been taken, you're simply telling Jomres that it's been paid and that Jomres should create the bookings in it's system.
We'll re-use $obj here, normally you would be generating the object/data yourself after you've processed payment