News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Enable Joomla Plugins on category page (product description hack)

Started by Watto, January 17, 2013, 18:47:02 PM

Previous topic - Next topic

Watto

Hi guys,

I've got a very unusual version of Virtuemart running here:

http://jamhouse.com.au/newsite/jamtracks

...which has the product details on the category page, hidden until DETAILS is clicked.

I'm really happy with it, but I can't get Joomla plugins to work - I've tried Rapid1Pixelout (which normally works, from what I've read) and jwplayer.  I'm wondering if it's got something to do with trying to run these plugins on the category page, rather than the product details page, and whether I need to add something to get them working?

I'm really struggling here, and pushed for time, so would love some code gurus to help out if possible :)

Watto

Got it working, yay!  I added this to view.html.php in category view:

// add content plugin //
           $dispatcher = & JDispatcher::getInstance();
           JPluginHelper::importPlugin('content');
           $product->text = $product->product_desc;
                jimport( 'joomla.html.parameter' );
                $params = new JParameter('');

                if(JVM_VERSION === 2 ) {
                        $results = $dispatcher->trigger('onContentPrepare', array('com_virtuemart.productdetails', &$product, &$params, 0));
                        // More events for 3rd party content plugins
                        // This do not disturb actual plugins, because we don't modify $product->text
                        $res = $dispatcher->trigger('onContentAfterTitle', array('com_virtuemart.productdetails', &$product, &$params, 0));
$product->event->afterDisplayTitle = trim(implode("\n", $res));

                        $res = $dispatcher->trigger('onContentBeforeDisplay', array('com_virtuemart.productdetails', &$product, &$params, 0));
$product->event->beforeDisplayContent = trim(implode("\n", $res));

                        $res = $dispatcher->trigger('onContentAfterDisplay', array('com_virtuemart.productdetails', &$product, &$params, 0));
                        $product->event->afterDisplayContent = trim(implode("\n", $res));
                } else {
                        $results = $dispatcher->trigger('onPrepareContent', array(& $product, & $params, 0));
                }
                $product->product_desc = $product->text;


...and it's all good :)

Watto

Argh, there's another problem - only one of them will load per page.  Tried with both Rapid1Pixelout and jwplayer.

I'll keep fiddling, but I'd love some ideas if anyone has one!

Watto

Hi guys,

I'm getting desperate here!  So close to being finished this site, but the player only working once on the page is doing my head in.

Can anyone help?  Why would the plugin only work once on the page?

  ???

Peter Pillen

Maybe your setup is not correct... I see in your code that the javascript is loaded for each product (http://jamhouse.com.au/newsite/plugins/content/rapid1pixelout/rapid1pixelout/audio-player.js), but the object which contains the player is only loaded once.

a logical loop to me would seem

1. load .js files
2. track1 with javascript object 1
3. track2 with javascript object 2
and so on

now your code goes
1. track1 + load  js file + make javascript object
2. track2 + load js file again + make javascript object again, but crash and burn

i'm no javascript guru  ;)