Last active
June 2, 2021 21:40
-
-
Save krmgns/43a1c26f49be17d44d8012c44ae94a3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rewrite | |
- if ($shippingInfo && $shippingInfo['cost'] && $this->formatPrice($shippingInfo['cost'] != 0)) { | |
+ if (isset($shippingInfo['cost']) && $this->formatPrice($shippingInfo['cost']) > 0) | |
- $order_id = $this->request->get['order_id']; | |
+ $order_id = (int) $this->request->get['order_id']; | |
// Refactor | |
private function formatPrice($number) | |
{ | |
return round((float) $number, 2); | |
} | |
private function getShippingInfo() | |
{ | |
return isset($this->session->data['shipping_method']) | |
? (array) $this->session->data['shipping_method'] | |
: null; | |
} | |
private function getSiteUrl() | |
{ | |
return self::isHttps() | |
? ($this->config->get('config_ssl') ?: HTTPS_SERVER) | |
: ($this->config->get('config_url') ?: HTTP_SERVER); | |
} | |
private function getServerConnectionSlug() | |
{ | |
return self::isHttps() ? 'SSL' : 'NONSSL'; | |
} | |
private static function isHttps() | |
{ | |
static $ret; | |
isset($ret) || $ret =@ ( | |
$_SERVER['REQUEST_SCHEME'] == 'https' || | |
$_SERVER['SERVER_PORT'] == '443' || | |
$_SERVER['HTTPS'] == 'on' | |
); | |
return $ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment