Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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?

 

 

 

 

Link to comment
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

Link to comment
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?

Link to comment
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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...