- Posts: 10
- Thank you received: 0
Define payment method for subscription plans
- Julian Gapp
- Topic Author
- Offline
- New Member
Less
More
11 years 9 months ago - 11 years 9 months ago #26217
by Julian Gapp
Define payment method for subscription plans was created by Julian Gapp
Hello,
I need help for two problems:
1. I have two kind of user-groups, normal users and business clients. The normal users should have the choice to pay with paypal, credit card, and via prepayment (offline payment). But the business clients should only be able to pay via invoice (offline payment).
So how can I define which payment plugin is availible for which subscription plan (or user joomla user-group)..?!
2. At the moment the offline payment plugin is used for the normal users as "prepayment" method. For the business clients I would need a second offline payment method which need for the "invoice" method. How can I copy it?
It's really important! Thanks for your help.
Julian
I need help for two problems:
1. I have two kind of user-groups, normal users and business clients. The normal users should have the choice to pay with paypal, credit card, and via prepayment (offline payment). But the business clients should only be able to pay via invoice (offline payment).
So how can I define which payment plugin is availible for which subscription plan (or user joomla user-group)..?!
2. At the moment the offline payment plugin is used for the normal users as "prepayment" method. For the business clients I would need a second offline payment method which need for the "invoice" method. How can I copy it?
It's really important! Thanks for your help.
Julian
Last edit: 11 years 9 months ago by Julian Gapp.
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
11 years 9 months ago #26249
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Define payment method for subscription plans
Hi Julian
1. At the moment, the system doesn't provide that feature. I think you can customize the code alitle to load the payment methods based on user access level. Look at the file components/com_osmembership/plugins/os_payments.php and you will see the code for loading payment methods. Try to customize the code from there.
2. You will need to write a new payment plugin in this case. Maybe you can start by copy the original os_offline payment plugin (two files os_offline.php, os_offline.xml in the components/com_osmembership/plugins folder) and customize it to meet your need.
Tuan
1. At the moment, the system doesn't provide that feature. I think you can customize the code alitle to load the payment methods based on user access level. Look at the file components/com_osmembership/plugins/os_payments.php and you will see the code for loading payment methods. Try to customize the code from there.
2. You will need to write a new payment plugin in this case. Maybe you can start by copy the original os_offline payment plugin (two files os_offline.php, os_offline.xml in the components/com_osmembership/plugins folder) and customize it to meet your need.
Tuan
The following user(s) said Thank You: Julian Gapp
Please Log in or Create an account to join the conversation.
- Julian Gapp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
11 years 9 months ago #26278
by Julian Gapp
Replied by Julian Gapp on topic Re: Define payment method for subscription plans
Hello Tuan,
thanks for your instruction!
I have created a new plugin for invoice payment and it works.
But can you help me a bit with the access level - can you give me a code example so that I can define the access level via the subscription plan categories. So that I can define that subscribers of subscription category (for example ID = 1) can use this kind of payment plugin.
Thanks - would be great!
Greetings
thanks for your instruction!
I have created a new plugin for invoice payment and it works.
But can you help me a bit with the access level - can you give me a code example so that I can define the access level via the subscription plan categories. So that I can define that subscribers of subscription category (for example ID = 1) can use this kind of payment plugin.
Thanks - would be great!
Greetings
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
11 years 9 months ago #26331
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Define payment method for subscription plans
Hi Julian
That would be easy if you know some Joomla programming (don't need to be an experienced Joomla developer, just some basic coding skill ). Please try the steps below :
1. Change database table of #__osmembership_plugins, add a new field called access
2. Edit the administrator/components/com_osmembership/views/plugin/tmpl/default.php, allows users to choose access level for the payment plugin.
3. Edit the file components/com_osmembership/plugins/os_payments.php, only load the payment methods which the current users can access to. Something like this:
Hope this help .
Tuan
That would be easy if you know some Joomla programming (don't need to be an experienced Joomla developer, just some basic coding skill ). Please try the steps below :
1. Change database table of #__osmembership_plugins, add a new field called access
2. Edit the administrator/components/com_osmembership/views/plugin/tmpl/default.php, allows users to choose access level for the payment plugin.
3. Edit the file components/com_osmembership/plugins/os_payments.php, only load the payment methods which the current users can access to. Something like this:
Code:
function getPaymentMethods($loadOffline = true, $onlyRecurring = false) {
static $methods ;
if (!$methods) {
$user = JFactory::getUser();
define('JPAYMENT_METHODS_PATH', JPATH_ROOT.'/components/com_osmembership/plugins/') ;
$db = JFactory::getDBO() ;
if ($loadOffline) {
$sql = 'SELECT * FROM #__osmembership_plugins WHERE published=1 AND `access` IN ('.implode(',', $user->getAuthorisedViewLevels()).')' ;
} else {
$sql = 'SELECT * FROM #__osmembership_plugins WHERE published=1 AND name != "os_offline" AND `access` IN ('.implode(',', $user->getAuthorisedViewLevels()).')' ;
}
if ($onlyRecurring) {
$sql .= " AND support_recurring_subscription = 1 ";
}
$sql .= " ORDER BY ordering " ;
$db->setQuery($sql) ;
$rows = $db->loadObjectList();
foreach ($rows as $row) {
if (file_exists(JPAYMENT_METHODS_PATH.$row->name.'.php')) {
require_once JPAYMENT_METHODS_PATH.$row->name.'.php';
$method = new $row->name(new JRegistry($row->params)) ;
$method->title = $row->title ;
$methods[] = $method ;
}
}
}
return $methods ;
}
Hope this help .
Tuan
Please Log in or Create an account to join the conversation.
Support
Documentation
Information
Copyright © 2024 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.