@@ -282,9 +282,9 @@ |
||
| 282 | 282 | if ($promotedProduct == 'true') {
|
| 283 | 283 | $promotedAmount+=$product->getAmount(); |
| 284 | 284 | $promotedMessage = 'Promoted Item: ' . $wcProduct->get_name() . |
| 285 | - ' - Price: ' . $item->get_total() . |
|
| 286 | - ' - Qty: ' . $product->getQuantity() . |
|
| 287 | - ' - Item ID: ' . $item['id_product']; |
|
| 285 | + ' - Price: ' . $item->get_total() . |
|
| 286 | + ' - Qty: ' . $product->getQuantity() . |
|
| 287 | + ' - Item ID: ' . $item['id_product']; |
|
| 288 | 288 | $promotedMessage = substr($promotedMessage, 0, 999); |
| 289 | 289 | $metadataOrder->addMetadata('promotedProduct', $promotedMessage);
|
| 290 | 290 | } |
@@ -54,38 +54,38 @@ discard block |
||
| 54 | 54 | $this->method_title = ucfirst($this->id); |
| 55 | 55 | |
| 56 | 56 | //Useful vars |
| 57 | - $this->template_path = plugin_dir_path(__FILE__) . '../templates/'; |
|
| 57 | + $this->template_path = plugin_dir_path(__FILE__).'../templates/'; |
|
| 58 | 58 | $this->allowed_currencies = array("EUR");
|
| 59 | - $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)) . '/WC_Pagantis.php'; |
|
| 59 | + $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)).'/WC_Pagantis.php'; |
|
| 60 | 60 | $this->plugin_info = get_file_data($this->mainFileLocation, array('Version' => 'Version'), false);
|
| 61 | 61 | $this->language = strstr(get_locale(), '_', true); |
| 62 | 62 | |
| 63 | - if ($this->language == 'es' || $this->language == '') {
|
|
| 63 | + if ($this->language=='es' || $this->language=='') {
|
|
| 64 | 64 | $this->icon = esc_url(plugins_url('../assets/images/logopagamastarde.png', __FILE__));
|
| 65 | 65 | } else {
|
| 66 | 66 | $this->icon = esc_url(plugins_url('../assets/images/logo.png', __FILE__));
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | //Panel form fields |
| 70 | - $this->form_fields = include(plugin_dir_path(__FILE__).'../includes/settings-pagantis.php');//Panel options |
|
| 70 | + $this->form_fields = include(plugin_dir_path(__FILE__).'../includes/settings-pagantis.php'); //Panel options |
|
| 71 | 71 | $this->init_settings(); |
| 72 | 72 | |
| 73 | 73 | $this->extraConfig = $this->getExtraConfig(); |
| 74 | 74 | $this->title = __($this->extraConfig['PAGANTIS_TITLE'], 'pagantis'); |
| 75 | 75 | $this->method_description = "Financial Payment Gateway. Enable the possibility for your customers to pay their order in confortable installments with Pagantis."; |
| 76 | 76 | |
| 77 | - $this->settings['ok_url'] = ($this->extraConfig['PAGANTIS_URL_OK']!='')?$this->extraConfig['PAGANTIS_URL_OK']:$this->generateOkUrl(); |
|
| 78 | - $this->settings['ko_url'] = ($this->extraConfig['PAGANTIS_URL_KO']!='')?$this->extraConfig['PAGANTIS_URL_KO']:$this->generateKoUrl(); |
|
| 77 | + $this->settings['ok_url'] = ($this->extraConfig['PAGANTIS_URL_OK']!='') ? $this->extraConfig['PAGANTIS_URL_OK'] : $this->generateOkUrl(); |
|
| 78 | + $this->settings['ko_url'] = ($this->extraConfig['PAGANTIS_URL_KO']!='') ? $this->extraConfig['PAGANTIS_URL_KO'] : $this->generateKoUrl(); |
|
| 79 | 79 | foreach ($this->settings as $setting_key => $setting_value) {
|
| 80 | 80 | $this->$setting_key = $setting_value; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | //Hooks |
| 84 | - add_action('woocommerce_update_options_payment_gateways_'.$this->id, array($this,'process_admin_options')); //Save plugin options
|
|
| 85 | - add_action('admin_notices', array($this, 'pagantisCheckFields')); //Check config fields
|
|
| 86 | - add_action('woocommerce_receipt_'.$this->id, array($this, 'pagantisReceiptPage')); //Pagantis form
|
|
| 87 | - add_action('woocommerce_api_wcpagantisgateway', array($this, 'pagantisNotification')); //Json Notification
|
|
| 88 | - add_filter('woocommerce_payment_complete_order_status', array($this,'pagantisCompleteStatus'), 10, 3);
|
|
| 84 | + add_action('woocommerce_update_options_payment_gateways_'.$this->id, array($this, 'process_admin_options')); //Save plugin options
|
|
| 85 | + add_action('admin_notices', array($this, 'pagantisCheckFields')); //Check config fields
|
|
| 86 | + add_action('woocommerce_receipt_'.$this->id, array($this, 'pagantisReceiptPage')); //Pagantis form
|
|
| 87 | + add_action('woocommerce_api_wcpagantisgateway', array($this, 'pagantisNotification')); //Json Notification
|
|
| 88 | + add_filter('woocommerce_payment_complete_order_status', array($this, 'pagantisCompleteStatus'), 10, 3);
|
|
| 89 | 89 | add_filter('load_textdomain_mofile', array($this, 'loadPagantisTranslation'), 10, 2);
|
| 90 | 90 | } |
| 91 | 91 | |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function loadPagantisTranslation($mofile, $domain) |
| 99 | 99 | {
|
| 100 | - if ('pagantis' === $domain) {
|
|
| 101 | - $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo'; |
|
| 100 | + if ('pagantis'===$domain) {
|
|
| 101 | + $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo'; |
|
| 102 | 102 | } |
| 103 | 103 | return $mofile; |
| 104 | 104 | } |
@@ -130,24 +130,24 @@ discard block |
||
| 130 | 130 | public function pagantisCheckFields() |
| 131 | 131 | {
|
| 132 | 132 | $error_string = ''; |
| 133 | - if ($this->settings['enabled'] !== 'yes') {
|
|
| 133 | + if ($this->settings['enabled']!=='yes') {
|
|
| 134 | 134 | return; |
| 135 | 135 | } elseif (!version_compare(phpversion(), '5.3.0', '>=')) {
|
| 136 | - $error_string = __(' is not compatible with your php and/or curl version', 'pagantis');
|
|
| 136 | + $error_string = __(' is not compatible with your php and/or curl version', 'pagantis');
|
|
| 137 | 137 | $this->settings['enabled'] = 'no'; |
| 138 | 138 | } elseif ($this->settings['pagantis_public_key']=="" || $this->settings['pagantis_private_key']=="") {
|
| 139 | 139 | $error_string = __(' is not configured correctly, the fields Public Key and Secret Key are mandatory for use this plugin', 'pagantis');
|
| 140 | 140 | $this->settings['enabled'] = 'no'; |
| 141 | 141 | } elseif (!in_array(get_woocommerce_currency(), $this->allowed_currencies)) {
|
| 142 | - $error_string = __(' only can be used in Euros', 'pagantis');
|
|
| 142 | + $error_string = __(' only can be used in Euros', 'pagantis');
|
|
| 143 | 143 | $this->settings['enabled'] = 'no'; |
| 144 | - } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS']<'2' |
|
| 145 | - || $this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS']>'12') {
|
|
| 144 | + } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'] < '2' |
|
| 145 | + || $this->extraConfig['PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'] > '12') {
|
|
| 146 | 146 | $error_string = __(' only can be payed from 2 to 12 installments', 'pagantis');
|
| 147 | - } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS']<'2' |
|
| 148 | - || $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS']>'12') {
|
|
| 147 | + } elseif ($this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] < '2' |
|
| 148 | + || $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] > '12') {
|
|
| 149 | 149 | $error_string = __(' only can be payed from 2 to 12 installments', 'pagantis');
|
| 150 | - } elseif ($this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT']<0) {
|
|
| 150 | + } elseif ($this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] < 0) {
|
|
| 151 | 151 | $error_string = __(' can not have a minimum amount less than 0', 'pagantis');
|
| 152 | 152 | } |
| 153 | 153 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | $shippingAddress = $order->get_address('shipping');
|
| 183 | 183 | $billingAddress = $order->get_address('billing');
|
| 184 | - if ($shippingAddress['address_1'] == '') {
|
|
| 184 | + if ($shippingAddress['address_1']=='') {
|
|
| 185 | 185 | $shippingAddress = $billingAddress; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | ->setNationalId($national_id) |
| 209 | 209 | ->setTaxId($tax_id) |
| 210 | 210 | ; |
| 211 | - $orderBillingAddress = new Address(); |
|
| 211 | + $orderBillingAddress = new Address(); |
|
| 212 | 212 | $orderBillingAddress |
| 213 | 213 | ->setZipCode($billingAddress['postcode']) |
| 214 | 214 | ->setFullName($billingAddress['first_name']." ".$billingAddress['last_name']) |
@@ -279,12 +279,12 @@ discard block |
||
| 279 | 279 | $details->addProduct($product); |
| 280 | 280 | |
| 281 | 281 | $promotedProduct = $this->isPromoted($item->get_product_id()); |
| 282 | - if ($promotedProduct == 'true') {
|
|
| 283 | - $promotedAmount+=$product->getAmount(); |
|
| 284 | - $promotedMessage = 'Promoted Item: ' . $wcProduct->get_name() . |
|
| 285 | - ' - Price: ' . $item->get_total() . |
|
| 286 | - ' - Qty: ' . $product->getQuantity() . |
|
| 287 | - ' - Item ID: ' . $item['id_product']; |
|
| 282 | + if ($promotedProduct=='true') {
|
|
| 283 | + $promotedAmount += $product->getAmount(); |
|
| 284 | + $promotedMessage = 'Promoted Item: '.$wcProduct->get_name(). |
|
| 285 | + ' - Price: '.$item->get_total(). |
|
| 286 | + ' - Qty: '.$product->getQuantity(). |
|
| 287 | + ' - Item ID: '.$item['id_product']; |
|
| 288 | 288 | $promotedMessage = substr($promotedMessage, 0, 999); |
| 289 | 289 | $metadataOrder->addMetadata('promotedProduct', $promotedMessage);
|
| 290 | 290 | } |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | wc_get_template('iframe.php', $template_fields, '', $this->template_path);
|
| 358 | 358 | } |
| 359 | 359 | } catch (\Exception $exception) {
|
| 360 | - wc_add_notice(__('Payment error ', 'pagantis') . $exception->getMessage(), 'error');
|
|
| 360 | + wc_add_notice(__('Payment error ', 'pagantis').$exception->getMessage(), 'error');
|
|
| 361 | 361 | $this->insertLog($exception); |
| 362 | 362 | $checkout_url = get_permalink(wc_get_page_id('checkout'));
|
| 363 | 363 | wp_redirect($checkout_url); |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | public function pagantisNotification() |
| 372 | 372 | {
|
| 373 | 373 | try {
|
| 374 | - $origin = ($_SERVER['REQUEST_METHOD'] == 'POST') ? 'Notify' : 'Order'; |
|
| 374 | + $origin = ($_SERVER['REQUEST_METHOD']=='POST') ? 'Notify' : 'Order'; |
|
| 375 | 375 | |
| 376 | 376 | include_once('notifyController.php');
|
| 377 | 377 | $notify = new WcPagantisNotify(); |
@@ -410,10 +410,10 @@ discard block |
||
| 410 | 410 | */ |
| 411 | 411 | public function pagantisCompleteStatus($status, $order_id, $order) |
| 412 | 412 | {
|
| 413 | - if ($order->get_payment_method() == WcPagantisGateway::METHOD_ID) {
|
|
| 414 | - if ($order->get_status() == 'failed') {
|
|
| 413 | + if ($order->get_payment_method()==WcPagantisGateway::METHOD_ID) {
|
|
| 414 | + if ($order->get_status()=='failed') {
|
|
| 415 | 415 | $status = 'processing'; |
| 416 | - } elseif ($order->get_status() == 'pending' && $status=='completed') {
|
|
| 416 | + } elseif ($order->get_status()=='pending' && $status=='completed') {
|
|
| 417 | 417 | $status = 'processing'; |
| 418 | 418 | } |
| 419 | 419 | } |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | $allowedCountries = unserialize($this->extraConfig['PAGANTIS_ALLOWED_COUNTRIES']); |
| 438 | 438 | $allowedCountry = (in_array(strtolower($locale), $allowedCountries)); |
| 439 | 439 | if ($this->enabled==='yes' && $this->pagantis_public_key!='' && $this->pagantis_private_key!='' && |
| 440 | - (int)$this->get_order_total()>$this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] && $allowedCountry) {
|
|
| 440 | + (int) $this->get_order_total() > $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT'] && $allowedCountry) {
|
|
| 441 | 441 | return true; |
| 442 | 442 | } |
| 443 | 443 | |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | |
| 466 | 466 | $redirectUrl = $order->get_checkout_payment_url(true); //pagantisReceiptPage function |
| 467 | 467 | if (strpos($redirectUrl, 'order-pay=')===false) {
|
| 468 | - $redirectUrl.="&order-pay=".$order_id; |
|
| 468 | + $redirectUrl .= "&order-pay=".$order_id; |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | return array( |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | ); |
| 475 | 475 | |
| 476 | 476 | } catch (Exception $e) {
|
| 477 | - wc_add_notice(__('Payment error ', 'pagantis') . $e->getMessage(), 'error');
|
|
| 477 | + wc_add_notice(__('Payment error ', 'pagantis').$e->getMessage(), 'error');
|
|
| 478 | 478 | return array(); |
| 479 | 479 | } |
| 480 | 480 | } |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | private function generateUrl($url) |
| 539 | 539 | {
|
| 540 | 540 | $parsed_url = parse_url($url); |
| 541 | - if ($parsed_url !== false) {
|
|
| 541 | + if ($parsed_url!==false) {
|
|
| 542 | 542 | $parsed_url['query'] = !isset($parsed_url['query']) ? '' : $parsed_url['query']; |
| 543 | 543 | parse_str($parsed_url['query'], $arrayParams); |
| 544 | 544 | foreach ($arrayParams as $keyParam => $valueParam) {
|
@@ -586,11 +586,10 @@ discard block |
||
| 586 | 586 | private function getKeysUrl($order, $url) |
| 587 | 587 | {
|
| 588 | 588 | $defaultFields = (get_class($order)=='WC_Order') ? |
| 589 | - array('order-received'=>$order->get_id(), 'key'=>$order->get_order_key()) :
|
|
| 590 | - array(); |
|
| 589 | + array('order-received'=>$order->get_id(), 'key'=>$order->get_order_key()) : array();
|
|
| 591 | 590 | |
| 592 | 591 | $parsedUrl = parse_url($url); |
| 593 | - if ($parsedUrl !== false) {
|
|
| 592 | + if ($parsedUrl!==false) {
|
|
| 594 | 593 | //Replace parameters from url |
| 595 | 594 | $parsedUrl['query'] = $this->getKeysParametersUrl($parsedUrl['query'], $defaultFields); |
| 596 | 595 | |
@@ -635,7 +634,7 @@ discard block |
||
| 635 | 634 | foreach ($arrayParams as $keyParam => $valueParam) {
|
| 636 | 635 | preg_match('#\{{.*?}\}#', $valueParam, $match);
|
| 637 | 636 | if (count($match)) {
|
| 638 | - $key = str_replace(array('{{','}}'), array('',''), $match[0]);
|
|
| 637 | + $key = str_replace(array('{{', '}}'), array('', ''), $match[0]);
|
|
| 639 | 638 | $arrayParams[$keyParam] = $defaultFields[$key]; |
| 640 | 639 | } |
| 641 | 640 | } |
@@ -650,13 +649,13 @@ discard block |
||
| 650 | 649 | */ |
| 651 | 650 | private function unparseUrl($parsed_url) |
| 652 | 651 | {
|
| 653 | - $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; |
|
| 652 | + $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : ''; |
|
| 654 | 653 | $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; |
| 655 | - $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; |
|
| 656 | - $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; |
|
| 657 | - $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; |
|
| 654 | + $port = isset($parsed_url['port']) ? ':'.$parsed_url['port'] : ''; |
|
| 655 | + $query = isset($parsed_url['query']) ? '?'.$parsed_url['query'] : ''; |
|
| 656 | + $fragment = isset($parsed_url['fragment']) ? '#'.$parsed_url['fragment'] : ''; |
|
| 658 | 657 | $path = $parsed_url['path']; |
| 659 | - return $scheme . $host . $port . $path . $query . $fragment; |
|
| 658 | + return $scheme.$host.$port.$path.$query.$fragment; |
|
| 660 | 659 | } |
| 661 | 660 | |
| 662 | 661 | /** |
@@ -678,20 +677,20 @@ discard block |
||
| 678 | 677 | $is_guest = "false"; |
| 679 | 678 | $sign_up = substr($current_user->user_registered, 0, 10); |
| 680 | 679 | $customer_orders = get_posts(array( |
| 681 | - 'numberposts' => - 1, |
|
| 680 | + 'numberposts' => -1, |
|
| 682 | 681 | 'meta_key' => '_customer_user', |
| 683 | 682 | 'meta_value' => $current_user->ID, |
| 684 | - 'post_type' => array( 'shop_order' ), |
|
| 685 | - 'post_status' => array( 'wc-completed', 'wc-processing', 'wc-refunded' ), |
|
| 683 | + 'post_type' => array('shop_order'),
|
|
| 684 | + 'post_status' => array('wc-completed', 'wc-processing', 'wc-refunded'),
|
|
| 686 | 685 | )); |
| 687 | 686 | } else {
|
| 688 | 687 | $is_guest = "true"; |
| 689 | 688 | $customer_orders = get_posts(array( |
| 690 | - 'numberposts' => - 1, |
|
| 689 | + 'numberposts' => -1, |
|
| 691 | 690 | 'meta_key' => '_billing_email', |
| 692 | 691 | 'meta_value' => $billingEmail, |
| 693 | - 'post_type' => array( 'shop_order' ), |
|
| 694 | - 'post_status' => array( 'wc-completed', 'wc-processing', 'wc-refunded'), |
|
| 692 | + 'post_type' => array('shop_order'),
|
|
| 693 | + 'post_status' => array('wc-completed', 'wc-processing', 'wc-refunded'),
|
|
| 695 | 694 | )); |
| 696 | 695 | foreach ($customer_orders as $customer_order) {
|
| 697 | 696 | if (trim($sign_up)=='' || |
@@ -720,7 +719,7 @@ discard block |
||
| 720 | 719 | //Check if id exists |
| 721 | 720 | $resultsSelect = $wpdb->get_results("select * from $tableName where id='$orderId'");
|
| 722 | 721 | $countResults = count($resultsSelect); |
| 723 | - if ($countResults == 0) {
|
|
| 722 | + if ($countResults==0) {
|
|
| 724 | 723 | $wpdb->insert( |
| 725 | 724 | $tableName, |
| 726 | 725 | array('id' => $orderId, 'order_id' => $pagantisOrderId),
|
@@ -745,7 +744,7 @@ discard block |
||
| 745 | 744 | global $wpdb; |
| 746 | 745 | $tableName = $wpdb->prefix.self::ORDERS_TABLE; |
| 747 | 746 | |
| 748 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) {
|
|
| 747 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) {
|
|
| 749 | 748 | $charset_collate = $wpdb->get_charset_collate(); |
| 750 | 749 | $sql = "CREATE TABLE $tableName ( id int, order_id varchar(50), wc_order_id varchar(50), |
| 751 | 750 | UNIQUE KEY id (id)) $charset_collate"; |
@@ -778,9 +777,9 @@ discard block |
||
| 778 | 777 | */ |
| 779 | 778 | private function getNationalId($order) |
| 780 | 779 | {
|
| 781 | - foreach ((array)$order->get_meta_data() as $mdObject) {
|
|
| 780 | + foreach ((array) $order->get_meta_data() as $mdObject) {
|
|
| 782 | 781 | $data = $mdObject->get_data(); |
| 783 | - if ($data['key'] == 'vat_number') {
|
|
| 782 | + if ($data['key']=='vat_number') {
|
|
| 784 | 783 | return $data['value']; |
| 785 | 784 | } |
| 786 | 785 | } |
@@ -795,9 +794,9 @@ discard block |
||
| 795 | 794 | */ |
| 796 | 795 | private function getTaxId($order) |
| 797 | 796 | {
|
| 798 | - foreach ((array)$order->get_meta_data() as $mdObject) {
|
|
| 797 | + foreach ((array) $order->get_meta_data() as $mdObject) {
|
|
| 799 | 798 | $data = $mdObject->get_data(); |
| 800 | - if ($data['key'] == 'billing_cfpiva') {
|
|
| 799 | + if ($data['key']=='billing_cfpiva') {
|
|
| 801 | 800 | return $data['value']; |
| 802 | 801 | } |
| 803 | 802 | } |
@@ -827,7 +826,7 @@ discard block |
||
| 827 | 826 | {
|
| 828 | 827 | global $wpdb; |
| 829 | 828 | $tableName = $wpdb->prefix.self::LOGS_TABLE; |
| 830 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) {
|
|
| 829 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) {
|
|
| 831 | 830 | $charset_collate = $wpdb->get_charset_collate(); |
| 832 | 831 | $sql = "CREATE TABLE $tableName ( id int NOT NULL AUTO_INCREMENT, log text NOT NULL, |
| 833 | 832 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY id (id)) $charset_collate"; |
@@ -846,7 +845,7 @@ discard block |
||
| 846 | 845 | {
|
| 847 | 846 | $metaProduct = get_post_meta($product_id); |
| 848 | 847 | return (array_key_exists('custom_product_pagantis_promoted', $metaProduct) &&
|
| 849 | - $metaProduct['custom_product_pagantis_promoted']['0'] === 'yes') ? 'true' : 'false'; |
|
| 848 | + $metaProduct['custom_product_pagantis_promoted']['0']==='yes') ? 'true' : 'false'; |
|
| 850 | 849 | } |
| 851 | 850 | |
| 852 | 851 | /** |
@@ -859,8 +858,8 @@ discard block |
||
| 859 | 858 | $promotedAmount = 0; |
| 860 | 859 | foreach ($items as $key => $item) {
|
| 861 | 860 | $promotedProduct = $this->isPromoted($item['product_id']); |
| 862 | - if ($promotedProduct == 'true') {
|
|
| 863 | - $promotedAmount+=$item['line_total'] + $item['line_tax']; |
|
| 861 | + if ($promotedProduct=='true') {
|
|
| 862 | + $promotedAmount += $item['line_total'] + $item['line_tax']; |
|
| 864 | 863 | } |
| 865 | 864 | } |
| 866 | 865 | |