News:

Looking for documentation? Take a look on our wiki

Main Menu

Documentation for plugin development

Started by _oscar_, February 07, 2011, 16:32:49 PM

Previous topic - Next topic

Dokho

QuoteHi,

No, i am actually doing it.

The xxxplgVmOnSelectPayment is an obsolete function. I will remove it now .

Hi, that means, you are working on the credit card extra fields ?

I like VM but I'm new on that, I'm try to add extra fields for Credit Card payment but I don't know how.  My question it's : Are you guys working on the credit card extra fields ?

d0ublezer0

Hi all!
I began to study the VM plugin system, to begin developing a payment plug-in .
I really do not have enough information to develop - the wiki describes only a few moments. That's not enough, unfortunately.
I could understand, how to install plug-in from the example of existing VM plugin package. But VM comes only with a component AIO, but does not have the installation file for the plugin (in pure form). I find it difficult to understand, from what I can get rid of the installer, and what is worth keeping.

Can you give me an example?
Thank you!

d0ublezer0

#17
Here's a question: saving plugin settings in the database - this is a mandatory requirement?
In my plugin i want only display printable order form (html)

juanma70

In 'description' text field of vm 1.x payment methods where we did can insert the php code was a very practical way for personalized payment methods. ¿This way do not will be implemented in VM2 ? :-( i love VM but i do not very well in advance programation as to built a payment plugin from zero.

Now i am in a terrible dilemma: i want use J1.7 because its great multilanguage system, but if i can´t implemented the personalized payment plugin i´m in troubles. In my country (Colombia) paypal is not very popular and the only online accepted method is owned by a especific payment platform.

Any ideas?

IceMan-101

I looked at the wiki provided and it does not supply enough information to write a custom payment plugin for my needs. I also look at the standard payment method and paypal method for guidance but I am having no luck.

Here is what I would like to do:

I want to create a payment method that reads the "User's" available credits from a web service (API) and if the user has the correct amount of credits available, it will deduct the credits via the API and process the order and if the user does not have the correct amount it will return an error to the user and decline the order.

If anybody could supply me with a guide, tutorial or documentation on how to create a payment method from scratch, it would be highly appreciated.
Master of Web disaster!

brendonhatcher

Hi

The wiki page does not explain how to redirect the user back from the payment gateway provider to the VirtueMart site in order to display a thank you page and update the order to "confirmed".

Can someone provide some guidance on this?

Thanks
Brendon

webcompass

Hi I read the informations here: http://dev.virtuemart.net/projects/virtuemart/wiki/Plugin_system

So I need to develope a Shipper plugin and I tried to do as was described in the wiki but I can not find vmShipperPlugin, and vmPaymentPlugin in the /components/com_virtuemart/helpers/.... dir! Can anyone say a few words about that why these abstract classes have been removed, and how to use the plugin system without these?

Thanks!

Alejandro Kurczyn

#22
So how exactly should I code a plugin that runs when an order is confirmed as PAID?  I have tried several "events" but just can't get it right. I -know- how to code plugins, but I don't see how to call one on such event by looking at Virtuemart2 code or wiki docs. Perhaps I'm missing something?

It surely is a big miss if this is not possible without hacking VM2 PHP code, as many stores may need to trigger customized tasks when an order is paid like managing 3rd party stock reordering, 3rd party accounting records, not to mention online analytics information.

VM2 is quite the beast to tame if you want to develop for it.  My 2 cents.

lbear

Quote from: juanma70 on February 29, 2012, 23:48:13 PM
In 'description' text field of vm 1.x payment methods where we did can insert the php code was a very practical way for personalized payment methods. ¿This way do not will be implemented in VM2 ? :-( i love VM but i do not very well in advance programation as to built a payment plugin from zero.

Now i am in a terrible dilemma: i want use J1.7 because its great multilanguage system, but if i can´t implemented the personalized payment plugin i´m in troubles. In my country (Colombia) paypal is not very popular and the only online accepted method is owned by a especific payment platform.

Any ideas?

Check this post for Dineromail in Colombia http://forum.virtuemart.net/index.php?topic=103885.0

BrownSystems

Would it be possible to have some additional events/hooks added?

I'd like to create some plugins that would allow the use of third party shopping carts in conjunction with virtue mart. To do this I would need an event/hook on the product details page.

Anyone have any suggestions for how I should proceed?

alatak

Hello,

there is already a hook for the product page. It has been implemented in the version 2.0.8.

The hook is
function plgVmOnProductDisplayPayment ($product, &$productDisplay)
$product: is the product object
$productDisplay: the display that should be added in the product page

You have an example of how to use it with the Klarna plugin payment.

themhz

I have managed to create a plugin with the following code


<?php

// no direct access
defined('_JEXEC') or die;

if (!
class_exists('vmCustomPlugin')) require(JPATH_VM_PLUGINS DS 'vmcustomplugin.php');

class 
plgAftercheckout extends vmCustomPlugin
{
 public function __construct (&$subject$config=array()) {
  echo "ok";
         
parent::__construct($subject$config);
         
$this->_path JPATH_PLUGINS.DS.$this->getName();
         
JPlugin::loadLanguage('plg_vmextended_'.$this->getName());
     }
 
   public function 
plgVmOnDisplayProductFE$field$param$product$idx){
   
echo "plgVmOnDisplayProductFE fired";
die();
   } 
 
   public function 
plgVmOnAddToCart(&$product)
{
    echo "plgVmOnAddToCart fired";
die();

}

public function plgVmConfirmedOrder($cart$order)
{
echo "plgVmConfirmedOrder fired";
die();
}

}

?>


I also created the xml file like this


<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="vmcustom">
        <name>plg_aftercheckout</name>
        <author>themhz</author>
        <creationDate>June 18th, 2012</creationDate>
        <copyright>CodeCraft.gr</copyright>
        <license>GNU General Public License</license>
        <authorEmail>themhz@codecraft.gr</authorEmail>
        <authorUrl>http://www.codecraft.gr</authorUrl>
        <version>1.0</version>
        <description>Some description.</description>
        <files>
                <filename plugin="aftercheckout">aftercheckout.php</filename>
                <filename>index.html</filename>
        </files>
</extension>


I packed them up into a zipfile named aftercheckout.zip and I installed the plugin succesffully.
However the methods do not seem to trigger when I add something to the cart or when i confirm the order. Is it something that I am missing here?
Thank you

themhz

Quote from: themhz on October 12, 2012, 16:03:38 PM
I have managed to create a plugin with the following code


<?php

// no direct access
defined('_JEXEC') or die;

if (!
class_exists('vmCustomPlugin')) require(JPATH_VM_PLUGINS DS 'vmcustomplugin.php');

class 
plgAftercheckout extends vmCustomPlugin
{
 public function __construct (&$subject$config=array()) {
  echo "ok";
         
parent::__construct($subject$config);
         
$this->_path JPATH_PLUGINS.DS.$this->getName();
         
JPlugin::loadLanguage('plg_vmextended_'.$this->getName());
     }
 
   public function 
plgVmOnDisplayProductFE$field$param$product$idx){
   
echo "plgVmOnDisplayProductFE fired";
die();
   } 
 
   public function 
plgVmOnAddToCart(&$product)
{
    echo "plgVmOnAddToCart fired";
die();

}

public function plgVmConfirmedOrder($cart$order)
{
echo "plgVmConfirmedOrder fired";
die();
}

}

?>


I also created the xml file like this


<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="vmcustom">
        <name>plg_aftercheckout</name>
        <author>themhz</author>
        <creationDate>June 18th, 2012</creationDate>
        <copyright>CodeCraft.gr</copyright>
        <license>GNU General Public License</license>
        <authorEmail>themhz@codecraft.gr</authorEmail>
        <authorUrl>http://www.codecraft.gr</authorUrl>
        <version>1.0</version>
        <description>Some description.</description>
        <files>
                <filename plugin="aftercheckout">aftercheckout.php</filename>
                <filename>index.html</filename>
        </files>
</extension>


I packed them up into a zipfile named aftercheckout.zip and I installed the plugin succesffully.
However the methods do not seem to trigger when I add something to the cart or when i confirm the order. Is it something that I am missing here?
Thank you

I also found this plugin that already works, in the vmcustom stockable and I found this method "public function plgVmOnAddToCart(&$product){" than fires when ever I add something into the cart. I copied that method to my class plugin but its does not fire from my class :(.

themhz

Quote from: themhz on October 12, 2012, 18:12:22 PM
Quote from: themhz on October 12, 2012, 16:03:38 PM
I have managed to create a plugin with the following code


<?php

// no direct access
defined('_JEXEC') or die;

if (!
class_exists('vmCustomPlugin')) require(JPATH_VM_PLUGINS DS 'vmcustomplugin.php');

class 
plgAftercheckout extends vmCustomPlugin
{
 public function __construct (&$subject$config=array()) {
  echo "ok";
         
parent::__construct($subject$config);
         
$this->_path JPATH_PLUGINS.DS.$this->getName();
         
JPlugin::loadLanguage('plg_vmextended_'.$this->getName());
     }
 
   public function 
plgVmOnDisplayProductFE$field$param$product$idx){
   
echo "plgVmOnDisplayProductFE fired";
die();
   } 
 
   public function 
plgVmOnAddToCart(&$product)
{
    echo "plgVmOnAddToCart fired";
die();

}

public function plgVmConfirmedOrder($cart$order)
{
echo "plgVmConfirmedOrder fired";
die();
}

}

?>


I also created the xml file like this


<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="vmcustom">
        <name>plg_aftercheckout</name>
        <author>themhz</author>
        <creationDate>June 18th, 2012</creationDate>
        <copyright>CodeCraft.gr</copyright>
        <license>GNU General Public License</license>
        <authorEmail>themhz@codecraft.gr</authorEmail>
        <authorUrl>http://www.codecraft.gr</authorUrl>
        <version>1.0</version>
        <description>Some description.</description>
        <files>
                <filename plugin="aftercheckout">aftercheckout.php</filename>
                <filename>index.html</filename>
        </files>
</extension>


I packed them up into a zipfile named aftercheckout.zip and I installed the plugin succesffully.
However the methods do not seem to trigger when I add something to the cart or when i confirm the order. Is it something that I am missing here?
Thank you

I also found this plugin that already works, in the vmcustom stockable and I found this method "public function plgVmOnAddToCart(&$product){" than fires when ever I add something into the cart. I copied that method to my class plugin but its does not fire from my class :(.

Ok I found the solution. The problem was the class name. In the joomla 1.5 documentation http://docs.joomla.org/Creating_a_Plugin_for_Joomla_1.5 it mentions that the class name must follow this rule: class plg extends JPlugin But this is not mentiond in any joomla 2.5 documentation, since it is probably considered " an already known rule ". So my solution was to change the class name from

class plgVmAftercheckout extends vmCustomPlugin {

to

class plgVmCustomAftercheckout extends vmCustomPlugin {

"Custom" because the plugin belongs to a specific group called Custom. So we need to mention the group name in order to make those hook methods observe the events.

theodore88

Is it possible to add some custom parameters in the admin view without hacking the core?
My goal is to call an SQL query for active payment methods

Something like this http://docs.joomla.org/SQLMultiSelectX