Categories > TinyButStrong general >

Get TBS Joomla plugin to run within Virtuemart component

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: wobe
Date: 2009-04-30
Time: 12:05

Get TBS Joomla plugin to run within Virtuemart component

Hi,

I have a setup with Joomla 1.5.10, Virtuemart 1.1.3 and the TBS plugin for Joomla using TBS3.4.0. Having used TBS successfully in Joomla articles, I have now tried to get TBS to work within Virtuemart product descriptions. Virtuemart does allow Joomla content plugins to be run in its product and category descriptions.

However, it seems that within Virtuemart product descriptions, an "onAfterDisplayContent" event is never triggered. I have therefore changed the TBS Joomla plugin to be triggered by "onPrepareContent" (by simply editing line 28 in the tinybutstrong.php file). Everything seems to work fine, but here comes the question:

1.) Will this hack screw up other functionality of the TBS Joomla plugin?
2.) Can I somehow get TBS to run in non-content elements, such as e.g. the Name and Short Description elements of a Virtuemart product?

Thanks for your help,

wobe
By: wobe
Date: 2009-04-30
Time: 14:23

Re: Get TBS Joomla plugin to run within Virtuemart component

I have actually found the answer to the second question myself (not fully tested):

1.) administrator/components/com_virtuemart/html/shop.browse.php, line 396: inserted
$product_s_desc = vmCommonHTML::ParseContentByPlugins( $product_s_desc );
$product_name = vmCommonHTML::ParseContentByPlugins( $product_name );
Purpose: Allow that TBS is triggered in Virtuemart Product Short Descriptions and Product Names (on the shop browse page)

2.) administrator/components/com_virtuemart/html/shop.product_details.php, after line 104: inserted
else  {
    $product_name = vmCommonHTML::ParseContentByPlugins( $product_name );
}
Purpose: Allow that TBS is triggered in Virtuemart Products Names (on the product flypage)

3.) administrator/components/com_virtuemart/html/basket.php, in line 79: replace
. shopMakeHtmlSafe($ps_product->get_field($_SESSION['cart'][$i]["product_id"], "product_name"))
with
. vmCommonHTML::ParseContentByPlugins( shopMakeHtmlSafe($ps_product->get_field($_SESSION['cart'][$i]["product_id"], "product_name")))
Purpose: Allow that TBS is triggered in Virtuemart Products Names (on the shopping cart page)

4.) administrator/components/com_virtuemart/html/shop.basket_short.php, in line 99: replace
$minicart[$ci]['product_name'] = shopMakeHtmlSafe($ps_product->get_field($_SESSION['cart'][$i]["product_id"], "product_name"));
with
$minicart[$ci]['product_name'] = vmCommonHTML::ParseContentByPlugins( shopMakeHtmlSafe($ps_product->get_field($_SESSION['cart'][$i]["product_id"], "product_name")));
Purpose: Allow that TBS is triggered in Virtuemart Products Names (in the small shopping cart module)
By: wobe
Date: 2009-04-30
Time: 15:06

Re: Get TBS Joomla plugin to run within Virtuemart component

... some more found:

   6.  administrator/components/com_virtuemart/classes/ps_product, in line 2335: replace
     
$tpl->set( 'product_name', $db->f("product_name") );
      with
     
$tpl->set( 'product_name', vmCommonHTML::ParseContentByPlugins( $db->f("product_name")) );
      Purpose: Allow that TBS is triggered in Virtuemart Product Name (in the product snapshot function)
   7. administrator/components/com_virtuemart/classes/ps_product, in line 2347: replace
     
$tpl->set( 'product_thumb_image', $db->f("product_thumb_image"), "alt=\"".$db->f("product_name")."\"");
      with
     
$tpl->set( 'product_thumb_image', $db->f("product_thumb_image"), "alt=\"".vmCommonHTML::ParseContentByPlugins($db->f("product_name"))."\"");
      Purpose: Allow that TBS is triggered in Virtuemart Product Name (in the product snapshot function)
   8. administrator/components/com_virtuemart/classes/ps_product, in line 2608: replace
     
$featured_products[$i]['product_name'] = $db->f("product_name");
      with
     
$featured_products[$i]['product_name'] = vmCommonHTML::ParseContentByPlugins($db->f("product_name"));
      Purpose: Allow that TBS is triggered in Virtuemart Product Name (in the featured products function)
   9. administrator/components/com_virtuemart/classes/ps_product, in line 2732: replace
     
$recent[$k]['product_name'] = shopMakeHtmlSafe($recent[$k]['product_name']);
      with
     
$recent[$k]['product_name'] = vmCommonHTML::ParseContentByPlugins(shopMakeHtmlSafe($recent[$k]['product_name']));
      Purpose: Allow that TBS is triggered in Virtuemart Product Name (in the recent products function)
By: Skrol29
Date: 2009-04-30
Time: 23:40

Re: Get TBS Joomla plugin to run within Virtuemart component

Hi Wobe,

Interesting work of yours!

> 1.) Will this hack screw up other functionality of the TBS Joomla plugin?

Probably not. The onPrepareContent event is recommended by Joomla for a plugin that should modify data. The onAfterDisplayContent is for another purpose but can also edit the data.
The reason I choosed onAfterDisplayContent  was to unsure that TBS is the last content plug-in to be run. But I'm not sure today it is that important.