Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » Chameleon / ChameleonLite
- » Chameleon
- » Support for redSHOP component using...
Support for redSHOP component using JomGenius engine
Support for redSHOP component using JomGenius engine
Hey there Stephen!
It's my first post in the MetaMod forums, but it's certainly not going to be the last. Just my luck that today of all days, when I came to see if there were any updates to MetaMod Pro and MetaTemplate Pro, I stumble across your awesome latest releases, and I'm most impressed by JomGenius. I can see that it's been designed with future component support in mind, and it's certainly going to help shave off a lot of time setting up MetaMod and MetaTemplate. (I love these extensions, btw
)
I'm wondering if I can assist in making a JomGenius script template for redSHOP, a new eCommerce extension for Joomla which is leaps and bounds ahead of VirtueMart and is steadily picking up pace in the eCommerce scene. (http://redcomponent.com/redshop) It's replaced VM for me and it's quickly doing the same for others. What I would ultimately want is for all the current support that VM has to be offered for redSHOP, as I'll be using it for all my eCommerce projects in the future.
In terms of structure, redSHOP has very similar variables, states and pages to VM, so making a redSHOP version of JomGenius's current VM template shouldn't be hard at all. I'd like to try my hand at it, but I'd like to do it with your guidance and supervision. I'll be going through the documentation that's currently available for JomGenius in the "About" and "Parameters" articles in the meantime, to get up to speed and learn more about how it works. Alternatively, if you'd prefer to create the template, I'd be more than happy to share the redSHOP component with you if it would help (the full version is subscription-based but the free version can be downloaded from here: http://redcomponent.com/free-downloads).
Of course, once a redSHOP template is in place, it'll be easy to start porting other components to use JomGenius too, but one step at a time...
Let me know what you think and we'll proceed from that point together.
Thanks again for these awesome essential additions to Joomla, without which my site building life would be much harder. And I look forward to hearing your feedback on this.
28-Jul-10 23:08:22
Re: Support for redSHOP component using JomGenius engine
Hi sklotsman,
Yes, JomGenius is designed to be extensible, so it's not too hard to write a new JomGenius backend file for any type of component you want.
Take a look at the files in the jomgenius folder in MetaTemplate. You'll see that basically you have to implement 3 methods:
shouldInstantiate(): return a true or false. For some components there's no need to instantiate the object if you're not actually viewing a page for that component, or if that component doesn't exist on the system at all (e.g. see the virtuemart.php file).
__construct(): this is a handy place to store away some of the URL parameters if you are likely to need them later. But you don't have to do this.
info( $type ): this is the guts of it. Basically you just have to check for all the different parameters that people might want to use to query your component, and return appropriate values. Mostly you want to return strings, or arrays of strings, or a boolean value (true or false), or a number. If you are going to return a boolean value, the parameter name should start with "is". e.g. "isfrontpage".
That's all there is to it, really. Just remember that the class declaration has to be like this:
class JomGeniusClassXxxxxx extends JomGeniusParent {
... where Xxxxxx is the name of your JomGenius, with capital letter at the beginning, and this has to match your filename.
e.g. in order to get JomGenius("virtuemart"), then you have to have a file in the jomgenius folder called "virtuemart.php", and the classname has to be "JomGeniusClassVirtuemart".
A very simple info() method could be:
function info( $task ) {
if ( $task == "random" ) return rand(1,10);
}
Then in MetaMod or MetaTemplate you could do this:
$genius = JomGenius("mygeniusname");
if ( $genius and $genius->check("random <= 5") ) return true;
It's really easy to set up as you can see.
All the best with the project - I'd love to include this in the release if it works out well.
Cheers,
Stephen
- Index
- » Chameleon / ChameleonLite
- » Chameleon
- » Support for redSHOP component using...
Board Info
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked