Hello!
I'm trying to use short code in order to use a mp3 plugin in the short description. I'm in Joomla! 2.5.28, Virtuemart 2.0.26d.
Before this version I used this hack :
<?php
if (!empty($product->product_s_desc)) {
?>
<p class="product_s_desc">
<?php
echo JHTML::_('content.prepare', $product->product_s_desc);
echo shopFunctionsF::limitStringByWord($product->product_s_desc, 400, '...')
?>
</p>
But now it's not working.
Does somebody know how to activate plugin in short description ?
Note: In my description it's OK, but I want to have a mp3 sample in the category page.
Thanks.
Alexandre
Hi,
If your code not work, then check here for the "long" version style.
Better to give the link to Joomla doc https://docs.joomla.org/Triggering_content_plugins_in_your_extension
Do not forget that now you have context verified in some plugin. You need to check the plugin code to know if you need to set a context.
Thanks for the link.
That is working when I did not put the limitStringByWord line.
<?php // Product Short Description
if(!empty($product->product_s_desc)) { ?>
<p><span class="product_s_desc">
<?php echo JHTML::_('content.prepare', $product->product_s_desc) ?>
</span></p>
<?php } ?>
The loading of my page is taking more time but I have now my mp3 sample on the category page : http://bols-chantants.com/fr/boutique/bol-chantant-tibetain
If you need to speedup your call you can add your own plugin type and add a function for this case only.
You can use the code in your template /html/com_virtuemart/category/default.php without adding any hacks in Virtuemart.
JPluginHelper::importPlugin('mp3');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onMusicPrepare', array($product));
echo $product->product_s_desc;
YOu need to do you own plugin and add to the plugins/mp3 folder.
eg. for plugin audio.php
class plgMp3Audio extends JPlugin
{
/**
* add mp3 player/sound script and html
*/
public function onMusicPrepare(&$product)
{
// your code here to modify short desc
}
}