Activate payment module according to cart value

Ask the community for help and support.
Post Reply
Fetia
Posts: 6
Joined: Thu Oct 07, 2021 3:54 am
Has thanked: 2 times
Been thanked: 1 time

Activate payment module according to cart value

Post by Fetia »

Hello

Moving my old site from OsCommerce 2.3 to Phoenix I would like activate/deactivate moneyorder.php payment module depending of the cart value.

On OsCommerce the code was :

Code: Select all

if(MODULE_PAYMENT_MONEYORDER_STATUS == 'True'){
            if($_SESSION['cart']->total>299){
                $this->enabled = true;
            } else {
                $this->enabled = false;
            }
      } else {
            $this->enabled = false;
      }
But unfortunately it is not working with phoenix.

Any help will be welcome,

Thanks in advance,

Sandrine
User avatar
zipurman
PhoenixCart Developer
PhoenixCart Developer
Posts: 470
Joined: Tue Oct 13, 2020 5:20 pm
Has thanked: 84 times
Been thanked: 147 times

Re: Activate payment module according to cart value

Post by zipurman »

That code should work.

Where do you have it in your class?

Try moving it to a method as follows:

Code: Select all

public function update_status() {

            parent::update_status();


            if($_SESSION['cart']->total<300){
                $this->enabled = false;
            }
      
}
zipurman
aka Preston Lord
-----------
Happy to help where I can ;)

https://phoenixaddons.com
https://www.youtube.com/zipurman/ ** PHOENIX HOW-TO VIDEOS **
Image
Fetia
Posts: 6
Joined: Thu Oct 07, 2021 3:54 am
Has thanked: 2 times
Been thanked: 1 time

Re: Activate payment module according to cart value

Post by Fetia »

Hello Zipurman.

Thanks : It works great !

In my old current shop the code is in /module/payment/moneyorder.php

class constructor

Thanks again.

Sandrine
Post Reply