Author Topic: Enable Joomla Plugins on category page (product description hack)  (Read 1542 times)

Watto

  • Beginner
  • *
  • Posts: 34
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

  • Beginner
  • *
  • Posts: 34
Re: Enable Joomla Plugins on category page (product description hack)
« Reply #1 on: January 18, 2013, 01:36:30 am »
Got it working, yay!  I added this to view.html.php in category view:

Code: [Select]
// 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

  • Beginner
  • *
  • Posts: 34
Re: Enable Joomla Plugins on category page (product description hack)
« Reply #2 on: January 18, 2013, 01:56:13 am »
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

  • Beginner
  • *
  • Posts: 34
Re: Enable Joomla Plugins on category page (product description hack)
« Reply #3 on: January 19, 2013, 14:22:55 pm »
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

  • Jr. Member
  • **
  • Posts: 223
Re: Enable Joomla Plugins on category page (product description hack)
« Reply #4 on: January 19, 2013, 14:57:20 pm »
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  ;)