Activate payment module according to cart value

Open to all! Ask other shopowners for help.
Post Reply
Fetia

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


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
zipurman
Builder
Posts: 540
Joined: Tue Oct 13, 2020 5:20 pm
Phoenix Version: v
Has thanked: 93 times
Been thanked: 162 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
-----------
Fetia

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


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply