Welcome, Guest. Please login or register.
Login with username, password and session length


Need help or want to talk to other developers? Join the VirtueMart Chat! Read more...

  Advanced search

247031 Posts in 67504 Topics- by 258313 Members - Latest Member: Matej.iStraxx
Pages: [1]   Go Down
Print
Author Topic: Using mambots for payment notification (and other events)  (Read 31023 times)
gregdev
Moderator
Hero Member
*
Posts: 969



WWW
« on: May 17, 2006, 16:57:41 pm »

I am considering using mambots to handle events within the Virtuemart workflow.

For example, you could hook into the payment notification process. The flow would go like this:
1. A user pays through a payment processor (for example, PayPal, PayFlow Link, etc).
2. The payment processor posts to notify.php.
3. Notify.php loads up the Joomla and Virtuemart code (to get a working environment).
4. Notify.php loads mambots in a custom mambot group.
5. Notifiy.php triggers events (for example, onOrderConfirmation) that call custom mambots.

You can then create custom mambots to do the following:

Notification
Notify particular users about particular products. For example, notify the person responsible for exhibitors that an exhibitor has made a payment; notify the person responsible for attendees that a person has registered for an event; notify the newsletter administrator that a newsletter subscription has been purchased.


Database updates
For newsletter subscriptions, update a table with the user_id, order_id, subscription start date, etc.

In general, I think this is a better way to handle payment notifications.

You could add event triggers anywhere within the Virtuemart workflow that would call mambots to do work. One good candidate would be inside ps_checkout to handle notifications there too (rather than call email_receipt). This would allow greater customization.

I'm almost done with a hack version for notify.php (Live project contraints have forced me to not be elegant in the coding yet).

I am wondering what others think of this idea.
Logged

gregdev
Moderator
Hero Member
*
Posts: 969



WWW
« Reply #1 on: May 20, 2006, 05:55:34 am »

Here is the mambot for handling sku-specific notifications when an order is added. I chose to trigger the event inside ps_checkout.php, for now, rather than inside notify.php. I still have to set up the right environment inside notify.php before I can do this there.

To use this mambot, you'll need to do the following:

1. Install and publish the mambot, using the standard Joomla mambot installer.

2. Add the following code to ps_checkout.php, right at the end of the add() function, but before the last "return True;"

Code:
global $_MAMBOTS;
$_MAMBOTS->loadBotGroup( 'virtuemart' );
$_MAMBOTS->trigger( 'onVMOrderAdd', array($order_id) );

3. Add your SKUs and email addresses to the parameters box inside the new notify mambot, formatted like this:

sku1,sku2,sku3:email1@domain.com,email2@domain.com
sku2,sku4:email1@domain.com,email44@domain.com


Any duplicate email addresses will be removed.

Disclaimer: This code is given WITHOUT WARRANTY. Anything breaks, oh well.

I'd appreciate your opinions on this approach.

* bot_vm_notify.zip (6.52 KB - downloaded 740 times.)
« Last Edit: May 21, 2006, 04:45:23 am by gregdev » Logged

gregdev
Moderator
Hero Member
*
Posts: 969



WWW
« Reply #2 on: May 23, 2006, 04:39:50 am »

Just a note to say that I'm using this notification mambot on a live site for product-specific notifications. It is working great. It has saved me a lot of time forwarding emails to different people depending on the product.

I also had a special case of needing to switch a new user's shopper group upon registration, based on specific information in the user's registration (unfortunate situation, but it is necessary). So, I triggered an event right after registration and created a mambot to switch the group for me. I'm liking the idea of using mambots.

Anyone thought about this?
Logged

gregdev
Moderator
Hero Member
*
Posts: 969



WWW
« Reply #3 on: June 15, 2006, 20:16:28 pm »

Although it is slightly embarrassing to hold on a conversation with myself, I do think it is valuable to continue this topic.

I have done more with mambots, please see my post in this thread started by Soeren:

http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=14456.0

Google Analytics
Also, another candidate for VirtueMart mambots is Google Analytics. See this topic:

http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=14590.45

Notification mambot
I am considering generalizing my notification mambot. It would be called at these points in the workflow:
  • Initial order confirm (so, right where the user clicks "Confirm order" and is then asked to pay). This could replace or supplement the built-in notification.
  • Inside the notification code (notify.php for PayPal, etc). This would happen when PayPal, PayFlow Link, or whoever notifies the site that a payment has been made.

Are there other points where more customizable notification is needed?

It could allow the following configuration for each point in the workflow:
  • Send notification to shopper (yes/no)
  • Send notification to shop owner (yes/no)
  • Send notification to storeadmins (yes/no plus select the specific admins?)
  • Send sku-specific notifications to specific people (like it does now)

What do you all think of this? Would it be helpful? Is it an appropriate use of mambots? Would it interfere with VirtueMart notification handling?
Logged

laukilicious
Newbie
*
Posts: 9



« Reply #4 on: June 16, 2006, 10:05:13 am »

Hi gregdev,

This is exactly what i'm looking for!!! I hope you will continue with this mambot..

Laura
Logged
Soeren
Administrator
Hero Member
*
Posts: 3106


VirtueMart Lead Developer


WWW
« Reply #5 on: June 20, 2006, 17:35:19 pm »

Yes, exactly. You're not talking to yourself...we are listening!
I'm sure this will someday be part of VirtueMart!

ciao, Soeren
Logged

The future of eCommerce: VirtueMart & Joomla!
http://virtuemart.net
--
The VirtueMart project needs your help! To be able to continue this project please contribute your skills. Read more.
asiby
Newbie
*
Posts: 1



« Reply #6 on: June 26, 2006, 17:57:48 pm »

Nice job gregdev,

I, myself, had created a custom event trigger for a new mambot group. I have used it to trigger mambots as soon as someone save a content. I did roughly the same thing. It worked fine. It's unfortunate that mambo does not have already a few mambot hooks in neat places that will make it possible to call used defined functions at any given "important" step of the process (e.g. Save, Edit, Apply, Access Database, Add/Edit/Delete/Update user, content, category, Section, etc.).

Regards

WebMaestro
« Last Edit: June 26, 2006, 18:05:10 pm by asiby » Logged
majortomm
Newbie
*
Posts: 2


« Reply #7 on: October 04, 2006, 03:34:23 am »

I am a VirtueMart newbie so I am still learning the ropes, but the community here ROCKS!

I think this maybe what I am looking for but again maybe not so I am hoping someone can tell me if this is possible using this script or another one.

I am looking for a mod/hack that would auto-assign a user to a shopper group when they purchase a particular product.  Essentially a customer would add a membership "item" to their cart and checkout like normal.  This would auto-assign them to a shopper group that gets a % discount off their next purchases.  Right now we have to manually assign them to a group on the backend, causing delays and possible lost sales because the customer is not able to take immediate action on the discounts.

Thanks for your help!
Logged
o2bteam
Newbie
*
Posts: 3


« Reply #8 on: January 04, 2007, 16:23:47 pm »

Hi,
I took gregs great mambot, and wrote a component to let it act this way:
  • Run plugins per order or item with a certain mf-id, vendor-id, sku or prefix of sku
  • Plugins are uploaded into the directory administrator/components/com_vmnotify/plugins
  • Plugins can have triggers configurated. Triggers contain a filter, a filter type, and a plugin-configuration which is a simple name=value{linebreak} textarea like known from mambots
  • The plugin Test.php will give you an impression right after install. To start your own plugin development, take a look at it's code.
  • VM preparation like gregs mambot, or you can get a prepared one here: http://joomsites.ch/index.php?option=com_remository&Itemid=29&func=select&id=9

besides the variables mentioned in Test.php, you have access on these globals in your plugins:
global $database, $sess, $ps_product, $VM_LANG, $CURRENCY_DISPLAY, $vmLogger,$mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_lang;

what do you think of it? usefull?

Have a nice Day!

* com_vmnotify.tar.gz (4.71 KB - downloaded 628 times.)
* bot_vmnotify.tar.gz (1.41 KB - downloaded 641 times.)
Logged
takeroyd
Newbie
*
Posts: 19



« Reply #9 on: March 06, 2007, 10:14:33 am »

Hi,
I think gregdev & o2bteam are really on to something here. The ability to trigger customised events at various stages of the purchasing process is a major step forward for VirtueMart, IMHO...

Do you have any more concrete examples of working plugins? I ask this 'cos I'm not really very good with PHP, but I can learn by example. I'm particularly interested in the whole "email confirmation" process, and how to get that to occur after payment is confirmed.

Keep up the good work!
Logged
Sebastian
Newbie
*
Posts: 9


« Reply #10 on: June 26, 2007, 10:14:57 am »

This post is very interesting for me, because I am looking for a solution of the following process:
- the customer orders via paypal: The notification is send after the paypal process.
- the customer orders via invoice: The notification is sent after pressing the confirmation button.
Does anybody have a solution for this very common problem?

Another problem in this case, btw: In the joomla-forum they recommend for security reasons, to protect the admin folder with htaccess. But, VMs notify script does not work with a protected folder. or is it possible to move it anywhere outside the folder?
Logged
aravot
Peter
Quality&Testing Team
Hero Member
*
Posts: 2921


WWW
« Reply #11 on: July 15, 2008, 21:41:30 pm »

Greg you should update this to work with VM 1.1
Logged

donmas
Newbie
*
Posts: 48



« Reply #12 on: August 16, 2009, 00:33:33 am »

Hi,
I took gregs great mambot, and wrote a component to let it act this way:
  • Run plugins per order or item with a certain mf-id, vendor-id, sku or prefix of sku
  • Plugins are uploaded into the directory administrator/components/com_vmnotify/plugins
  • Plugins can have triggers configurated. Triggers contain a filter, a filter type, and a plugin-configuration which is a simple name=value{linebreak} textarea like known from mambots
  • The plugin Test.php will give you an impression right after install. To start your own plugin development, take a look at it's code.
  • VM preparation like gregs mambot, or you can get a prepared one here: http://joomsites.ch/index.php?option=com_remository&Itemid=29&func=select&id=9

besides the variables mentioned in Test.php, you have access on these globals in your plugins:
global $database, $sess, $ps_product, $VM_LANG, $CURRENCY_DISPLAY, $vmLogger,$mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_lang;

what do you think of it? usefull?

Have a nice Day!

Hi all, i'm trying to get this one to work, but i'm not able to figure out how. Huh
Anyone has an example covering the setup for sending an email to one address for when one sku is ordered? Would be much appreciated.

It's also not clear to me, what part the mambot plays.. now that the component is there, do you still need any paramaters at all?

Cheers,
dimas
Logged
donmas
Newbie
*
Posts: 48



« Reply #13 on: August 16, 2009, 01:45:52 am »

Here is the mambot for handling sku-specific notifications when an order is added. I chose to trigger the event inside ps_checkout.php, for now, rather than inside notify.php. I still have to set up the right environment inside notify.php before I can do this there.

To use this mambot, you'll need to do the following:

1. Install and publish the mambot, using the standard Joomla mambot installer.

2. Add the following code to ps_checkout.php, right at the end of the add() function, but before the last "return True;"

Code:
global $_MAMBOTS;
$_MAMBOTS->loadBotGroup( 'virtuemart' );
$_MAMBOTS->trigger( 'onVMOrderAdd', array($order_id) );

3. Add your SKUs and email addresses to the parameters box inside the new notify mambot, formatted like this:

sku1,sku2,sku3:email1@domain.com,email2@domain.com
sku2,sku4:email1@domain.com,email44@domain.com


Any duplicate email addresses will be removed.

Disclaimer: This code is given WITHOUT WARRANTY. Anything breaks, oh well.

I'd appreciate your opinions on this approach.


ok, i went about testing the original hack and can't get this to work. i'm on vm 1.0.13a and heres my steps:

1/ install vmnotify mod

2/ activated mod and put the following in the parameter box:
ODG501WNR01:info@domain.com

3/ i've added the code after line 1043 in the ps_checkout.php (or see attached file):

Code:
$this->email_receipt($order_id);
global $_MAMBOTS;
$_MAMBOTS->loadBotGroup( 'virtuemart' );
$_MAMBOTS->trigger( 'onVMOrderAdd', array($order_id) );

any help/tips is much appreciated.

cheers!

* ps_checkout.txt (80.42 KB - downloaded 462 times.)
« Last Edit: August 16, 2009, 01:49:10 am by donmas » Logged
Pages: [1]   Go Up
Print
Jump to: