Page 1 of 1

Activate payment module according to cart value

Posted: Fri Oct 08, 2021 3:49 am
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

Re: Activate payment module according to cart value

Posted: Sat Oct 09, 2021 9:11 pm
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;
            }
      
}

Re: Activate payment module according to cart value

Posted: Sat Oct 09, 2021 10:16 pm
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