Jump to content
goyan

Disable particular payment module depend on chosen shipping module and Total value

Recommended Posts

How can I disable COD (Cache on Delivery) payment module if shipping is not equal SPU (Store Pickup) or Total is greater then $500 for example?

 

 

 

 

Share this post


Link to post
Share on other sites

@@goyan,

 

first condition can be achieved with the ship2pay add-on:

http://addons.oscommerce.com/info/8419

 

Or could be custom coded into the COD module.

The second condition would need to be custom coded to the COD module.

 

Have a look into the module.

You could define the additional conditions in this section:

// disable the module if the order only contains virtual products
      if ($this->enabled == true) {
        if ($order->content_type == 'virtual') {
          $this->enabled = false;
        }
      }

rgds

Rainer

Share this post


Link to post
Share on other sites

Thanks @@raiwa,

 

 

I know that condition should look something like this:

 

if ($total > 500) or ($shipping_id != spu_id) $this->enabled = false;

 

​but I have a problem in locating those variables.

 

​I have found:

 

$order->info['shipping_method']​  - which contain a string with description of shipping module;

$shipping['id']​ - contains a string "spu_spu" for Store Pickup, "flat_flat" for Flat Rate shipping.

 

​but I don't think they are appropriate for this condition.

 

​Which variables should I use instead?

Edited by goyan

Share this post


Link to post
Share on other sites

Dobar dan @@goyan,

 

First you need to add $shipping to the global list:

    function update_status() {
      global $order, $shipping;

Then the conditions looks like this:

      if ($this->enabled == true) {
        if ($order->content_type == 'virtual' || $shipping['id'] != 'spu_spu' || $order->info['subtotal'] > 500 ) {
          $this->enabled = false;

pozdrav

Rainer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×