VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: johnyDev on February 03, 2014, 00:07:33 AM

Title: Product plugin development
Post by: johnyDev on February 03, 2014, 00:07:33 AM
Hello,

I want to start developing plugins for VirtueMart,  I have an idea about general Joomla plugin development, and also I have read some documentation about virtueMart development, I want to start by a simple plugin to display some html in product details veiw so here is what I found and correct me if I am wrong.


1/ the first possibility is to create product plugins, which are custom fields, but in this case user should assign the custom field to his products one by one, but I want to display html in all products.

2/ The second possibility is to create an ordinary Joomla plugin and put the code in onContentPrepare($context, &$row, &$params, $page = 0)


Please any help.
Title: Re: Product plugin development
Post by: alatak on February 03, 2014, 09:31:21 AM
Hello

The best is that you look at the example provided in the core in the vmcustom folder.
Title: Re: Product plugin development
Post by: johnyDev on February 03, 2014, 17:13:14 PM
Quote from: alatak on February 03, 2014, 09:31:21 AM
Hello

The best is that you look at the example provided in the core in the vmcustom folder.

Thank you fo your answer, but I have already take a look at the plugins in vmcustom folder and I don't have a problem to create a plugin.

let's take an example, I have 10000 products, I want to create a plugin that allows to me to display the like button in the details view of all the prodcuts, all what I found is to create a custom field plugin and add the custom field in my 10000 products !!
Title: Re: Product plugin development
Post by: alatak on February 03, 2014, 18:24:09 PM
Hello
You can create a parent product which will be your pattern.
and then 1000 child product. You don't have in this case to add the custom field to each product.
Title: Re: Product plugin development
Post by: johnyDev on February 03, 2014, 19:42:52 PM
Quote from: alatak on February 03, 2014, 18:24:09 PM
Hello
You can create a parent product which will be your pattern.
and then 1000 child product. You don't have in this case to add the custom field to each product.

1/ What if the 1000 products already existes ? Anyway, you suggest that I go ahead with the "product plugin" ather than the classic joomla (onContentPrepare) ?

2/ Another question, the custom field plugin have parameters , but it seems that it can't be stored ... should I implement "plgVmOnProductEdit" , it means that when I create a new custom field of type plugin and then put the parameters of the plugin, the data is not stored I have checked that inside plgVmOnDisplayProductFE with :

$this->getCustomParams($group);
var_dump($group);

thank you for your help
Title: Re: Product plugin development
Post by: AH on February 03, 2014, 19:44:09 PM
if you are doing this on every product, just customise your product view

There is little point in creating a custom field using a plugin
Title: Re: Product plugin development
Post by: johnyDev on February 03, 2014, 19:51:20 PM
Quote from: Hutson on February 03, 2014, 19:44:09 PM
if you are doing this on every product, just customise your product view

There is little point in creating a custom field using a plugin

Thank you for your answer, but you know I want this to be installable plugin to put it in the JED...
Title: Re: Product plugin development
Post by: johnyDev on February 05, 2014, 19:06:27 PM
I have moved to Joomla ordinary content plugin and I was able to display html after product description in onContentPrepare function and then $row->text .= $myhtml;
but the limitation is that I can only display html after description, there is no other available position.

if you have another solution please help.
Title: Re: Product plugin development
Post by: johnyDev on February 09, 2014, 10:48:51 AM
can you help ?