News:

Support the VirtueMart project and become a member

Main Menu

Product plugin development

Started by johnyDev, February 03, 2014, 00:07:33 AM

Previous topic - Next topic

johnyDev

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.

alatak

Hello

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

johnyDev

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 !!

alatak

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.

johnyDev

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

AH

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
Regards
A

Joomla 4.4.5
php 8.1

johnyDev

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...

johnyDev

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.

johnyDev