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
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
// 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;
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
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;
Quote from: Electrocity 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.
+1 i need it too!
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
+1
Was there VM 1.1.x for category descriptions. Should be in 2.0 as well.
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,
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)
$pagination = $productModel->getPagination($perRow);
$this->assignRef('vmPagination', $pagination);
add this
// 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. :)
thx, added.
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.
ah lol yes, I overlooked that, thanks.
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)
// 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