Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Disable your ad blocker to continue using our website.
Ask the community for help and support.
Omar_one
VIP Member
Posts: 481 Joined: Fri Oct 25, 2019 5:06 pm
Has thanked: 48 times
Been thanked: 27 times
Post
by Omar_one » Thu Jan 13, 2022 3:28 pm
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
Posts: 230 Joined: Thu Mar 25, 2021 12:26 pm
Has thanked: 7 times
Been thanked: 3 times
Post
by loop » Thu Jan 13, 2022 3:55 pm
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
Posts: 481 Joined: Fri Oct 25, 2019 5:06 pm
Has thanked: 48 times
Been thanked: 27 times
Post
by Omar_one » Thu Jan 13, 2022 4:05 pm
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
Posts: 481 Joined: Fri Oct 25, 2019 5:06 pm
Has thanked: 48 times
Been thanked: 27 times
Post
by Omar_one » Thu Jan 13, 2022 4:44 pm
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
Posts: 1184 Joined: Sat Dec 21, 2019 8:08 am
: Buy Me A Beverage
Has thanked: 38 times
Been thanked: 102 times
Post
by raiwa » Thu Jan 13, 2022 5:29 pm
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.