Author Topic: Payment methods depending on shipping - plugin (Free)  (Read 1662 times)


  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 448
    • Live Joomla! Template Builder
Payment methods depending on shipping - plugin (Free)
« on: March 28, 2016, 14:24:04 pm »
This plugin that limits the number of payment methods depending on the chosen shipping method. E.g. When customer chooses self pick up he should not be able to select PayPal etc...

1. Add new column to a table:
Code: [Select]
ALTER TABLE `#__virtuemart_paymentmethods` ADD `shipping` VARCHAR( 100 ) NOT NULL

2. Open: administrator/components/com_virtuemart/tables/paymentmethods.php
Find line: 62
Code: [Select]
var $shipping = '';
3. Open: administrator/components/com_virtuemart/models/paymentmethod.php

Find line: 218
Code: [Select]
Code: [Select]
4. Open: administrator/components/com_virtuemart/views/paymentmethod/tmpl/edit_edit.php
Code: [Select]
Code: [Select]
$db JFactory::getDbo(); 
$query "SELECT virtuemart_shipmentmethod_id,shipment_name FROM #__virtuemart_shipmentmethods_en_gb";
$shipping_tmp $db->loadObjectList();
$shipping = array();
foreach ($shipping_tmp as $s) {
$shipping[$s->virtuemart_shipmentmethod_id] = $s->shipment_name.' ['.$s->virtuemart_shipmentmethod_id.']';
echo VmHTML::row('selectList','VM_SHIPPING','shipping',explode('|',$this->payment->shipping),$shipping,2,"multiple=\"multiple\""); 
$doc =& JFactory::getDocument();
jQuery( document ).ready(function( $ ) {
$('#shipping').attr('name', 'shipping[]');

5. Install VM shipping plugin (see attached...)
The plugin must be published the last in the list!
6. Create new language override for "VM_SHIPPING"

This plugin is compatible with the Joomla 2.5+ version.


  • Beginner
  • *
  • Posts: 1
  • A beginner
Re: Payment methods depending on shipping - plugin (Free)
« Reply #1 on: February 12, 2017, 20:17:53 pm »
Thank you for nice plugin, but there is small problem
If you change the shipment method, the payment method is not changed until it is selected.