fix compatibility with php 5.4 (#197)

This commit is contained in:
DanielWeiser 2020-09-24 10:52:14 +03:00 committed by GitHub
parent 1d9110c364
commit 769f35f379
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 12 deletions

View File

@ -234,7 +234,7 @@ class ModelExtensionRetailcrmIcml extends Model
* Dimensions
*/
if ((!empty($product['length']) && $product['length'] > 0) &&
(!empty($product['width'] && $product['width'] > 0))
(!empty($product['width']) && $product['width'] > 0)
&& !empty($product['height']))
{
$lenghtArray = $this->model_localisation_length_class->getLengthClass($product['length_class_id']);

View File

@ -76,17 +76,20 @@ class RetailcrmOrderConverter {
public function setDiscount() {
$discount = 0;
$totalCoupon = $this->getTotal('coupon');
$totalReward = $this->getTotal('reward');
$totalVoucher = $this->getTotal('voucher');
if (!empty($this->getTotal('coupon'))) {
$discount += abs($this->getTotal('coupon'));
if (!empty($totalCoupon)) {
$discount += abs($totalCoupon);
}
if (!empty($this->getTotal('reward'))) {
$discount += abs($this->getTotal('reward'));
if (!empty($totalReward)) {
$discount += abs($totalReward);
}
if (!empty($this->getTotal('voucher'))) {
$discount += abs($this->getTotal('voucher'));
if (!empty($totalVoucher)) {
$discount += abs($totalVoucher);
}
if ($discount > 0) {
@ -169,8 +172,10 @@ class RetailcrmOrderConverter {
$this->data['delivery']['code'] = $delivery_code;
}
if (!empty($this->getTotal('shipping'))) {
$this->data['delivery']['cost'] = $this->getTotal('shipping');
$totalShipping = $this->getTotal('shipping');
if (!empty($totalShipping)) {
$this->data['delivery']['cost'] = $totalShipping;
}
return $this;

View File

@ -57,7 +57,7 @@ class Retailcrm {
* @return mixed object | boolean
*/
public function getApiClient($apiUrl = null, $apiKey = null, $apiVersion = null) {
if (!$this->registry->has(\RetailcrmProxy::class)) {
if (!$this->registry->has('RetailcrmProxy')) {
$setting = $this->model_setting_setting->getSetting($this->getModuleTitle());
if ($apiUrl === null && $apiKey === null) {
@ -72,12 +72,12 @@ class Retailcrm {
}
$this->registry->set(
\RetailcrmProxy::class,
'RetailcrmProxy',
new \RetailcrmProxy($apiUrl, $apiKey)
);
}
return $this->registry->get(\RetailcrmProxy::class);
return $this->registry->get('RetailcrmProxy');
}
/**