Author Topic: Joomla Plugins not showing in category description  (Read 5168 times)

ashp

  • Beginner
  • *
  • Posts: 21
Joomla Plugins not showing in category description
« on: December 22, 2011, 12:12:53 pm »
Hi Guys,

Firstly - nice work with VM2. I have been using virtuemart for just over 2 years now and I am very grateful with all the work that you have done!

I am trying VM2 out and trying to put an accordion plugin into the category description.

So far i have tried 3 different joomla plugins and none of them display in my virtuemart category description. The plugins are:

- Jkefel
- mooaccordion
- Core design Accordion Plugin

They all display correctly in a normal article.

I have ticked the 'enable Joomla plugins' box in the VM config.

I use Jkefel plugin in category descriptions on a VM1.1.8 site and it works fine there although I guess if the VM code is completely different this does not mean much!

Finally I have also changed the database field type for the description to MEDIUMTEXT to allow more than 8000 characters. My categories descriptions are quite big so thats why I am trying to use an accordion plugin to organise the content. I assume this should not effect the problem?


Thanks in advance


Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4062
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Joomla Plugins not showing in category description
« Reply #1 on: December 23, 2011, 10:11:24 am »
HI,
The joomla plugin are only implemented in product desc, i discute next with the other tema members if it's a will to add it for category.

it's very simple to add a basic plugin implementation

in

components\com_virtuemart\views\category\view.html.php
line 150 for eg.
add

Code: [Select]
// add content plugin //
$dispatcher =& JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
$category->text = $category->category_description;
$params = "";

$results = $dispatcher->trigger('onPrepareContent',
array (& $category, & $params, 0));
$category->category_description = $category->text;

ashp

  • Beginner
  • *
  • Posts: 21
Re: Joomla Plugins not showing in category description
« Reply #2 on: January 06, 2012, 12:06:40 pm »
Hi,

I will try this and let you know how I get on.

Will this feature be included in future versions or will I have to keep reapplying this code when I update?

thanks

walkyrie

  • Beginner
  • *
  • Posts: 16
Re: Joomla Plugins not showing in category description
« Reply #3 on: April 13, 2012, 15:46:52 pm »
Thanks for this help. As it doesn't seem to be implemented in VM 2.0.4, i haded this code to components\com_virtuemart\views\category\view.html.php on line 164, and it works fine with "Very simple image gallery plugin", for exemple.

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

       if(JVM_VERSION === 2 ) {
         $results = $dispatcher->trigger('onContentPrepare', array('com_virtuemart.category', &$category, &$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.category', &$category, &$params, 0));
         $category->event->afterDisplayTitle = trim(implode("\n", $res));

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

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


simbus82

  • Jr. Member
  • **
  • Posts: 109
    • Simbus82 Web & Tech
Re: Joomla Plugins not showing in category description
« Reply #4 on: April 13, 2012, 17:32:59 pm »
HI,
The joomla plugin are only implemented in product desc, i discute next with the other tema members if it's a will to add it for category.

+1 i need it too!
Joomla! 2.5.16 & VM 2.0.24b

James03

  • Beginner
  • *
  • Posts: 3
Re: Joomla Plugins not showing in category description
« Reply #5 on: July 07, 2012, 20:27:08 pm »
I'm trying to add your mod in VM 2.0.8c and Joomla 2.5.6 without any success.
I hope in some help.

I think that Joomla plugin are very usefull in category description as in product details.

Let me say just another important thing, VM is Amazing
Actually on Joomla 2.5.6 & V.M. 2.0.8c

esixtyone

  • Beginner
  • *
  • Posts: 16
Re: Joomla Plugins not showing in category description
« Reply #6 on: August 13, 2012, 15:42:44 pm »
+1

Was there VM 1.1.x for category descriptions. Should be in 2.0 as well.

esixtyone

  • Beginner
  • *
  • Posts: 16
Re: Joomla Plugins not showing in category description
« Reply #7 on: August 13, 2012, 16:23:27 pm »
I took a look at using the code above, but I couldn't get enough context to figure out exactly where this needs to go in 2.0.8e / svn trunk versions.

Can someone help me out by pointing me to where to insert the code above?

Thanks,

esixtyone

  • Beginner
  • *
  • Posts: 16
Re: Joomla Plugins not showing in category description
« Reply #8 on: August 20, 2012, 15:06:55 pm »
for anyone trying to get this working...
VM2.0.8e

I tried copying in the code above, but it didn't work for me (maybe the formatting was broken.) Anyway, I copied the code from the product description view, and modified it for category. Seems to work.

After this (line 164)
Code: [Select]
           
            $pagination = $productModel->getPagination($perRow);
            $this->assignRef('vmPagination', $pagination);

add this
Code: [Select]
           // add content plugin //
           $dispatcher = & JDispatcher::getInstance();
           JPluginHelper::importPlugin('content');
           $category->text = $category->category_description;
                jimport( 'joomla.html.parameter' );
                $params = new JParameter('');

                if(JVM_VERSION === 2 ) {
                        $results = $dispatcher->trigger('onContentPrepare', array('com_virtuemart.category', &$category, &$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.category', &$category, &$params, 0));
                        $category->event->afterDisplayTitle = trim(implode("\n", $res));

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

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

Could well be exactly the same code as above, (I didn't diff it) but at least now posted in code tags.  :)

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9997
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Joomla Plugins not showing in category description
« Reply #9 on: August 20, 2012, 17:05:46 pm »
thx, added.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

esixtyone

  • Beginner
  • *
  • Posts: 16
Re: Joomla Plugins not showing in category description
« Reply #10 on: August 21, 2012, 00:07:01 am »
Hi milbo,
I missed out the if statement so this will be turned on all the time. 

Check productdetails/view...

This (similar code) is wrapped by an if, which checks ( I think) if the Enable Plugins configuration is set.

This should be added if this it is going into Svn.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9997
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Joomla Plugins not showing in category description
« Reply #11 on: August 21, 2012, 02:32:59 am »
ah lol yes, I overlooked that, thanks.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Tobes

  • Beginner
  • *
  • Posts: 33
Re: Joomla Plugins not showing in category description
« Reply #12 on: July 16, 2013, 09:26:14 am »
Hi Maxim,

Please accept my apologies that I continue this thread, I can't get this to work for me, Im now wondering if I have Virtuemart set up correctly.

Im using VM 2.0.22 Joomla 2.5.11

The code is already implemented by the developer on line 174 (com_virtumart/views/catagory/view.html.php)

Code: [Select]
// add content plugin //
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
$category->text = $category->category_description;
if(!class_exists('JParameter')) require(JPATH_LIBRARIES.DS.'joomla'.DS.'html'.DS.'parameter.php');

$params = new JParameter('');

if(JVM_VERSION === 2 ) {
$results = $dispatcher->trigger('onContentPrepare', array('com_virtuemart.category', &$category, &$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.category', &$category, &$params, 0));
$category->event->afterDisplayTitle = trim(implode("\n", $res));

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

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


So I don't think I need to add any code? what do you think?

I have product category set to:

Category Template "Default"
Category Browse Page "Detailed"
Default Product Details Page "No Override"

So maybe I need to enable something? Im very sorry to keep pestering you, Virtuemart is a bit of a nightmare to get setup properly, too many options with no clear setup instructions.

Thanks for your help, its greatly appreciated.

Toby