mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-22 05:06:07 +03:00
fix compatibility with php 5.4 (#197)
This commit is contained in:
parent
1d9110c364
commit
769f35f379
@ -234,7 +234,7 @@ class ModelExtensionRetailcrmIcml extends Model
|
|||||||
* Dimensions
|
* Dimensions
|
||||||
*/
|
*/
|
||||||
if ((!empty($product['length']) && $product['length'] > 0) &&
|
if ((!empty($product['length']) && $product['length'] > 0) &&
|
||||||
(!empty($product['width'] && $product['width'] > 0))
|
(!empty($product['width']) && $product['width'] > 0)
|
||||||
&& !empty($product['height']))
|
&& !empty($product['height']))
|
||||||
{
|
{
|
||||||
$lenghtArray = $this->model_localisation_length_class->getLengthClass($product['length_class_id']);
|
$lenghtArray = $this->model_localisation_length_class->getLengthClass($product['length_class_id']);
|
||||||
|
@ -76,17 +76,20 @@ class RetailcrmOrderConverter {
|
|||||||
|
|
||||||
public function setDiscount() {
|
public function setDiscount() {
|
||||||
$discount = 0;
|
$discount = 0;
|
||||||
|
$totalCoupon = $this->getTotal('coupon');
|
||||||
|
$totalReward = $this->getTotal('reward');
|
||||||
|
$totalVoucher = $this->getTotal('voucher');
|
||||||
|
|
||||||
if (!empty($this->getTotal('coupon'))) {
|
if (!empty($totalCoupon)) {
|
||||||
$discount += abs($this->getTotal('coupon'));
|
$discount += abs($totalCoupon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->getTotal('reward'))) {
|
if (!empty($totalReward)) {
|
||||||
$discount += abs($this->getTotal('reward'));
|
$discount += abs($totalReward);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->getTotal('voucher'))) {
|
if (!empty($totalVoucher)) {
|
||||||
$discount += abs($this->getTotal('voucher'));
|
$discount += abs($totalVoucher);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($discount > 0) {
|
if ($discount > 0) {
|
||||||
@ -169,8 +172,10 @@ class RetailcrmOrderConverter {
|
|||||||
$this->data['delivery']['code'] = $delivery_code;
|
$this->data['delivery']['code'] = $delivery_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->getTotal('shipping'))) {
|
$totalShipping = $this->getTotal('shipping');
|
||||||
$this->data['delivery']['cost'] = $this->getTotal('shipping');
|
|
||||||
|
if (!empty($totalShipping)) {
|
||||||
|
$this->data['delivery']['cost'] = $totalShipping;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -57,7 +57,7 @@ class Retailcrm {
|
|||||||
* @return mixed object | boolean
|
* @return mixed object | boolean
|
||||||
*/
|
*/
|
||||||
public function getApiClient($apiUrl = null, $apiKey = null, $apiVersion = null) {
|
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());
|
$setting = $this->model_setting_setting->getSetting($this->getModuleTitle());
|
||||||
|
|
||||||
if ($apiUrl === null && $apiKey === null) {
|
if ($apiUrl === null && $apiKey === null) {
|
||||||
@ -72,12 +72,12 @@ class Retailcrm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->registry->set(
|
$this->registry->set(
|
||||||
\RetailcrmProxy::class,
|
'RetailcrmProxy',
|
||||||
new \RetailcrmProxy($apiUrl, $apiKey)
|
new \RetailcrmProxy($apiUrl, $apiKey)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->registry->get(\RetailcrmProxy::class);
|
return $this->registry->get('RetailcrmProxy');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user