Ship2pay in Phoenix

Ask the community for help and support.
Omar_one
VIP Member
VIP Member
Posts: 481
Joined: Fri Oct 25, 2019 5:06 pm
Has thanked: 48 times
Been thanked: 27 times

Re: Ship2pay in Phoenix

Post by Omar_one »

this what I have on the version where is was working ( overriding the payment class - payment.php)

replace

Code: Select all

 if (defined('MODULE_PAYMENT_INSTALLED') && !Text::is_empty(MODULE_PAYMENT_INSTALLED)) {
        $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);

        $include_modules = [];
with this

Code: Select all

  GLOBAL $shipping;
      if (defined('MODULE_PAYMENT_INSTALLED') && !empty(MODULE_PAYMENT_INSTALLED)) {
	 require('includes/classes/ship2pay.php');
                $my_ship2pay = new ship2pay;
				$arrship=explode('_',$shipping['id']);
				$ship2pay_mods = $my_ship2pay->get_pay_modules($arrship[0]);
				if (!empty($ship2pay_mods)) {
					$this->modules = explode(';', $ship2pay_mods);
				} else {
				  $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
				}

        $include_modules = [];
give it a try
Last edited by Omar_one on Thu Jan 13, 2022 4:01 pm, edited 1 time in total.
loop
VIP Member
VIP Member
Posts: 230
Joined: Thu Mar 25, 2021 12:26 pm
Has thanked: 7 times
Been thanked: 3 times

Re: Ship2pay in Phoenix

Post by loop »

THank you Omar, i already implemented it with overwritting, but i had a error about the "$shipping['id']"
that's why i made it like this, and it works as it should....not sure about the $_Session instead of shipping.....
if(!empty($_SESSION['shipping']['id'])){
require('ship2pay.php');
$my_ship2pay = new ship2pay;
$arrship=explode('_',$_SESSION['shipping']['id']);
$ship2pay_mods = $my_ship2pay->get_pay_modules($arrship[0]);
if (!empty($ship2pay_mods)) {
$this->modules = explode(';', $ship2pay_mods);
}else{
$this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
}
}else{
$this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
}
Omar_one
VIP Member
VIP Member
Posts: 481
Joined: Fri Oct 25, 2019 5:06 pm
Has thanked: 48 times
Been thanked: 27 times

Re: Ship2pay in Phoenix

Post by Omar_one »

I just install it on the last version 1.0.8.9 and I don't have any error and it's working as it should (shopside)
but if I have any disable shipping on the ship2pay (admin) will give error on shop side ..

Code: Select all

Notice: Undefined index: table in C:\xampp\htdocs\test\includes\classes\ship2pay.php on line 36
and line 34 is

Code: Select all

return $this->modules[$ship_module];  }
the admin side one issue .. that I can't delete the records.. I can change the status
Omar_one
VIP Member
VIP Member
Posts: 481
Joined: Fri Oct 25, 2019 5:06 pm
Has thanked: 48 times
Been thanked: 27 times

Re: Ship2pay in Phoenix

Post by Omar_one »

I change this line

Code: Select all

return $this->modules[$ship_module];  }
to this

Code: Select all

return $this->modules[$ship_module]?? null;
and the error gone ... I am not sure if its the right fix
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Has thanked: 38 times
Been thanked: 102 times

Re: Ship2pay in Phoenix

Post by raiwa »

There is no hook call in the payment class and I'm not aware of another way. I did a class override for something similar in the wholesale addon. But you could ask Matt directly. Maybe he knows a better method.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
Post Reply