Changeset 3147200
- Timestamp:
- 09/05/2024 04:13:11 PM (18 months ago)
- Location:
- drivefx-woocommerce/trunk
- Files:
-
- 7 edited
-
PHCLibrary/classes/invoice.php (modified) (1 diff)
-
PHCLibrary/invoices.php (modified) (1 diff)
-
class.DriveFxWoocommerce.php (modified) (6 diffs)
-
css/style_datatable.css (modified) (1 diff)
-
js/drivefx-woocommerce.js (modified) (23 diffs)
-
settings/import-products.php (modified) (1 diff)
-
settings/syncro_gate.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
drivefx-woocommerce/trunk/PHCLibrary/classes/invoice.php
r2556290 r3147200 5 5 public $billing_name; 6 6 public $billing_email; 7 public $billing_address _1;7 public $billing_address; 8 8 public $billing_city; 9 9 public $billing_phone; -
drivefx-woocommerce/trunk/PHCLibrary/invoices.php
r3059006 r3147200 340 340 # Billing address data 341 341 $response['result'][0]['nome2'] = $ft->billing_name; 342 $response['result'][0]['morada'] = $ft->billing_address _1;342 $response['result'][0]['morada'] = $ft->billing_address; 343 343 $response['result'][0]['local'] = $ft->billing_city; 344 344 $response['result'][0]['provincia'] = $ft->billing_city; -
drivefx-woocommerce/trunk/class.DriveFxWoocommerce.php
r3063623 r3147200 375 375 $settings = get_option(DRIVEFXWOOCOMMERCE_PLUGIN_NAME); 376 376 $method = sanitize_text_field( $_POST['method'] ); 377 $refs = (isset($_POST['refs']) && is_array($_POST['refs'])) ? filter_var_array($_POST['refs'], FILTER_SANITIZE_STRING) : '';377 $refs = (isset($_POST['refs']) && is_array($_POST['refs'])) ? array_map('htmlspecialchars', $_POST['refs']) : ''; 378 378 $selectItems = isset($_POST['selectItems']) ? filter_var($_POST['selectItems'], FILTER_SANITIZE_STRING) : ''; 379 379 $typeOfOrder = isset($_POST['typeOfOrder']) ? filter_var($_POST['typeOfOrder'], FILTER_SANITIZE_STRING) : ''; … … 1981 1981 $this->logs->writeFileLog('listProducts', $ch); 1982 1982 unset($_SESSION['username']); 1983 return ""; 1983 1984 } else if(empty($response)){ 1984 1985 $this->logs->writeFileLog('listProducts', 'EMPTY RESPONSE'); 1985 1986 unset($_SESSION['username']); 1987 return ""; 1986 1988 } else if(isset($response['messages'][0]['messageCodeLocale'])){ 1987 1989 $this->logs->writeFileLog('listProducts', $response['messages'][0]['messageCodeLocale']); 1988 1990 unset($_SESSION['username']); 1991 return ""; 1989 1992 } else { 1990 1993 # Get the Engine-Auth token and add to credentials … … 2014 2017 2015 2018 // Set if Vat is included or not (by default = false) 2016 $taxIncluded = 0; 2017 if (isset($settings['backend']['includeTaxonSendCost']) && $settings['backend']['includeTaxonSendCost'] == "true"){ 2018 $taxIncluded = 1; 2019 } 2019 $taxIncluded = isset($settings['backend']['includeTaxonSendCost']) && $settings['backend']['includeTaxonSendCost'] == "true" ? 1 : 0; 2020 2020 2021 2021 // Obtain PHC gama … … 2073 2073 $response = $this->utils_services->productQuery($ch, $credentials, "st.".$settings['backend']['productPriceColumn'], $filterItems); 2074 2074 //$this->logs->writeFileLog('Sts result:', $response); 2075 2076 2075 } else { 2077 2076 $response = $this->utils_services->productQuery2($ch, $credentials, "st.".$settings['backend']['productPriceColumn'],$settings['backend']['warehouse'], $filterItems); … … 2110 2109 } 2111 2110 2112 //Create rows with information of products2113 2111 $tableProducts = ''; 2114 $tableProducts .= "<thead><tr><th style='text-align: left;'><input type='checkbox' onClick='toggle(this)'/> Select all</th><th style='text-align: left;'>Ref</th><th style='text-align: left;'>Product Name</th><th style='text-align: left;'>Family</th><th style='text-align: left;'>Sale Price</th>"; 2115 2116 if($_SESSION['manageStockParameter'] === 'S' && $_SESSION['gamaDRIVEFX'] >= 9){ 2117 $tableProducts .= "<th style='text-align: right;'>Stock</th></tr></thead>"; 2118 } else { 2119 $tableProducts .= "</tr></thead>"; 2120 } 2121 2122 if(is_array($response['result'])){ 2123 if(!empty($settings['backend']['productPriceColumn']) && $settings['backend']['productPriceColumn'] != 'epv0'){ 2124 foreach ($response['result'] as $key => $value) { 2125 2126 # get the list of products by sku, from "wp_postmeta" table (already imported) 2127 global $wpdb; 2128 $product_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $response['result'][$key]['ref'] ) ); 2129 //$this->logs->writeFileLog('product_id:', $product_id); 2130 2131 //Create Table 2132 $tableProducts .= "<tr>"; 2133 if($product_id == ""){ 2134 if($arrayRef[$response['result'][$key]['ref']] < 0){ 2135 2136 $tableProducts .= "<td style='text-align: left;'><input type='checkbox' disabled name='checkboxes' value='".$response['result'][$key]['ref']."'></td>"; 2137 } else { 2138 $tableProducts .= "<td style='text-align: left;'><input type='checkbox' name='checkboxes' value='".$response['result'][$key]['ref']."'></td>"; 2139 } 2140 } else { 2141 $tableProducts .= "<td style='text-align: left;'><div class='updateStockShop' id='".$response['result'][$key]['ref']."'><img src='".plugins_url('/images/right.png', __FILE__)."' alt='' width='16' height='16'></div></td>"; 2142 } 2143 2144 $tableProducts .= "<td style='text-align: left;'>". $response['result'][$key]['ref']. 2145 "</td><td style='text-align: left;'>". $response['result'][$key]['design']. 2146 "</td><td style='text-align: left;'>". $response['result'][$key]['familia']. 2147 "</td><td style='text-align: left;'>". $response['result'][$key][$settings['backend']['productPriceColumn']]."</td>"; 2148 2149 //Only exists stocks after Star GAMA 2150 if($_SESSION['manageStockParameter'] === 'S' && $_SESSION['gamaDRIVEFX'] >= 9){ 2151 if($response['result'][$key]['stock'] < 0){ 2152 $tableProducts .= "<td style='text-align: right; color: red;'>".$arrayRef[$response['result'][$key]['ref']]."</td></tr>"; 2153 } else { 2154 $tableProducts .= "<td style='text-align: right;'>".$arrayRef[$response['result'][$key]['ref']]."</td></tr>"; 2155 } 2156 } 2157 } 2112 2113 if (is_array($response['result'])) { 2114 if (!empty($settings['backend']['productPriceColumn']) && $settings['backend']['productPriceColumn'] != 'epv0') { 2115 // Generate The Product Table 2116 $tableProducts = $this->generateProductTable($response['result'], $arrayRef, $settings); 2158 2117 echo $tableProducts; 2159 2118 } else { 2160 2119 $this->logs->writeFileLog('listProducts4', 'Products: Empty productPriceColumn'); 2161 2120 } 2162 } 2121 } else { 2122 $this->logs->writeFileLog('listProducts4', 'Products: No data available'); 2123 } 2163 2124 } 2164 2125 … … 2169 2130 } 2170 2131 2132 private function generateProductTable($products, $arrayRef, $settings) 2133 { 2134 $tableProducts = ''; 2135 $tableProducts .= "<thead><tr><th style='text-align: left;'><input type='checkbox' onClick='toggle(this)'/> Select all</th><th style='text-align: left;'>Ref</th><th style='text-align: left;'>Product Name</th><th style='text-align: left;'>Family</th><th style='text-align: left;'>Sale Price</th>"; 2136 2137 if ($_SESSION['manageStockParameter'] === 'S' && $_SESSION['gamaDRIVEFX'] >= 9) { 2138 $tableProducts .= "<th style='text-align: right;'>Stock</th></tr></thead>"; 2139 } else { 2140 $tableProducts .= "</tr></thead>"; 2141 } 2142 2143 if (is_array($products)) { 2144 if (!empty($settings['backend']['productPriceColumn']) && $settings['backend']['productPriceColumn'] != 'epv0') { 2145 foreach ($products as $value) { 2146 global $wpdb; 2147 $sku = $value['ref']; 2148 $product_id = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value=%s LIMIT 1", $sku)); 2149 2150 $tableProducts .= "<tr>"; 2151 if ($product_id == "") { 2152 $tableProducts .= $arrayRef[$sku] < 0 ? "<td style='text-align: left;'><input type='checkbox' disabled name='checkboxes' value='$sku'></td>" : "<td style='text-align: left;'><input type='checkbox' name='checkboxes' value='$sku'></td>"; 2153 } else { 2154 $tableProducts .= "<td style='text-align: left;'><div class='updateStockShop' id='$sku'><img src='" . plugins_url('/images/right.png', __FILE__) . "' alt='' width='16' height='16'></div></td>"; 2155 } 2156 2157 $tableProducts .= "<td style='text-align: left;'>$sku</td><td style='text-align: left;'>" . $value['design'] . "</td><td style='text-align: left;'>" . $value['familia'] . "</td><td style='text-align: left;'>" . $value[$settings['backend']['productPriceColumn']] . "</td>"; 2158 2159 if ($_SESSION['manageStockParameter'] === 'S' && $_SESSION['gamaDRIVEFX'] >= 9) { 2160 $tableProducts .= $value['stock'] < 0 ? "<td style='text-align: right; color: red;'>" . $arrayRef[$sku] . "</td></tr>" : "<td style='text-align: right;'>" . $arrayRef[$sku] . "</td></tr>"; 2161 } 2162 } 2163 } else { 2164 $this->logs->writeFileLog('listProducts4', 'Products: Empty productPriceColumn'); 2165 } 2166 } 2167 return $tableProducts; 2168 } 2169 2171 2170 # Save products in online shop 2172 2171 public function saveProducts($refs){ 2173 2172 $ch = curl_init(); 2174 2173 2175 2174 if(is_array($refs)){ 2176 2175 # Get Credentials -
drivefx-woocommerce/trunk/css/style_datatable.css
r2526532 r3147200 498 498 } 499 499 500 #updateStocks, #updateStocks, #updatePrices, #updateAllFields {500 #updateStocks, #updateStocks, #updatePrices, #updateAllFields, #applyForEntireTable{ 501 501 margin-left: 10px; 502 502 cursor: pointer; 503 503 margin-top: 20px; 504 504 float:left; 505 } 506 507 #applyForEntireTable{ 508 background-color: #e4eaf1; 509 padding: 5px; 510 border-radius: 5px; 505 511 } 506 512 -
drivefx-woocommerce/trunk/js/drivefx-woocommerce.js
r2526532 r3147200 2 2 3 3 jQuery(document).ready(function() { 4 5 4 //Initialize plugin 6 5 jQuery('#backend_url_initialize').click(function (){ … … 31 30 jQuery('#updatePrices').hide(); 32 31 jQuery('#updateAllFields').hide(); 32 jQuery('#applyForEntireTable').hide(); 33 33 34 34 jQuery.post(url, { … … 89 89 jQuery('#updatePrices').show(); 90 90 jQuery('#updateAllFields').show(); 91 jQuery('#applyForEntireTable').show(); 91 92 jQuery('#saveProductInShop').show(); 92 93 jQuery('#importToShop').show(); … … 99 100 jQuery('#updatePrices').hide(); 100 101 jQuery('#updateAllFields').hide(); 102 jQuery('#applyForEntireTable').hide(); 101 103 jQuery('#saveProductInShop').hide(); 102 104 } … … 118 120 jQuery('#updatePrices').hide(); 119 121 jQuery('#updateAllFields').hide(); 122 jQuery('#applyForEntireTable').hide(); 120 123 121 124 // stop normal form submission handler … … 143 146 jQuery('#updatePrices').show(); 144 147 jQuery('#updateAllFields').show(); 148 jQuery('#applyForEntireTable').show(); 145 149 jQuery('#loader2').html(''); 146 150 … … 165 169 jQuery('#updatePrices').show(); 166 170 jQuery('#updateAllFields').show(); 171 jQuery('#applyForEntireTable').show(); 167 172 jQuery('#saveProductInShop').show(); 168 173 jQuery('#importToShop').show(); … … 175 180 jQuery('#updatePrices').hide(); 176 181 jQuery('#updateAllFields').hide(); 182 jQuery('#applyForEntireTable').hide(); 177 183 jQuery('#saveProductInShop').hide(); 178 184 } … … 186 192 //Update products 187 193 var arr = new Array(); 188 jQuery(".updateStockShop").each(function() { 189 arr.push(jQuery(this).attr('id')); 190 }); 191 194 195 // Verify if the #applyForEntireTableCheckbox is checked 196 if (jQuery('#applyForEntireTableCheckbox').is(':checked')) { 197 // If checked, we get all data from the table 198 const data = jQuery('#tableOfProducts').DataTable().fnGetData(); 199 arr = data.filter(element => element[0].indexOf('updateStockShop') !== -1).map(value => value[1]); 200 } else { 201 // If unchecked, we only iterate through the visible elements on the page 202 jQuery(".updateStockShop").each(function() { 203 arr.push(jQuery(this).attr('id')); 204 }); 205 } 206 192 207 jQuery('#loader2').html('<img style="margin-top: 10px; margin-left: 20px;" src="'+pathPlugin+'images/ajax-loader.gif" title="Loading..">'); 193 208 jQuery('#saveProductInShop').hide(); … … 195 210 jQuery('#updatePrices').hide(); 196 211 jQuery('#updateAllFields').hide(); 212 jQuery('#applyForEntireTable').hide(); 197 213 198 214 // stop normal form submission handler … … 216 232 jQuery('#updatePrices').show(); 217 233 jQuery('#updateAllFields').show(); 234 jQuery('#applyForEntireTable').show(); 218 235 jQuery('#loader2').html(''); 219 236 … … 238 255 jQuery('#updatePrices').show(); 239 256 jQuery('#updateAllFields').show(); 257 jQuery('#applyForEntireTable').show(); 240 258 jQuery('#saveProductInShop').show(); 241 259 jQuery('#importToShop').show(); … … 248 266 jQuery('#updatePrices').hide(); 249 267 jQuery('#updateAllFields').hide(); 268 jQuery('#applyForEntireTable').hide(); 250 269 jQuery('#saveProductInShop').hide(); 251 270 } … … 259 278 //Update products 260 279 var arr = new Array(); 261 jQuery(".updateStockShop").each(function() { 262 arr.push(jQuery(this).attr('id')); 263 }); 264 280 281 // Verify if the #applyForEntireTableCheckbox is checked 282 if (jQuery('#applyForEntireTableCheckbox').is(':checked')) { 283 // If checked, we get all data from the table 284 const data = jQuery('#tableOfProducts').DataTable().fnGetData(); 285 arr = data.filter(element => element[0].indexOf('updateStockShop') !== -1).map(value => value[1]); 286 } else { 287 // If unchecked, we only iterate through the visible elements on the page 288 jQuery(".updateStockShop").each(function() { 289 arr.push(jQuery(this).attr('id')); 290 }); 291 } 292 265 293 jQuery('#loader2').html('<img style="margin-top: 10px; margin-left: 20px;" src="'+pathPlugin+'images/ajax-loader.gif" title="Loading..">'); 266 294 jQuery('#saveProductInShop').hide(); … … 268 296 jQuery('#updatePrices').hide(); 269 297 jQuery('#updateAllFields').hide(); 298 jQuery('#applyForEntireTable').hide(); 270 299 // stop normal form submission handler 271 300 event.preventDefault(); 272 // save products in MySQL301 // save products in MySQL 273 302 jQuery.post(url, { 274 303 action: 'woocommerce_fx', … … 287 316 jQuery('#updatePrices').show(); 288 317 jQuery('#updateAllFields').show(); 318 jQuery('#applyForEntireTable').show(); 289 319 jQuery('#loader2').html(''); 290 320 … … 309 339 jQuery('#updatePrices').show(); 310 340 jQuery('#updateAllFields').show(); 341 jQuery('#applyForEntireTable').show(); 311 342 jQuery('#saveProductInShop').show(); 312 343 jQuery('#importToShop').show(); … … 319 350 jQuery('#updatePrices').hide(); 320 351 jQuery('#updateAllFields').hide(); 352 jQuery('#applyForEntireTable').hide(); 321 353 jQuery('#saveProductInShop').hide(); 322 354 } … … 330 362 //Update products 331 363 var arr = new Array(); 332 jQuery(".updateStockShop").each(function() { 333 arr.push(jQuery(this).attr('id')); 334 }); 364 365 // Verify if the #applyForEntireTableCheckbox is checked 366 if (jQuery('#applyForEntireTableCheckbox').is(':checked')) { 367 // If checked, we get all data from the table 368 const data = jQuery('#tableOfProducts').DataTable().fnGetData(); 369 arr = data.filter(element => element[0].indexOf('updateStockShop') !== -1).map(value => value[1]); 370 } else { 371 // If unchecked, we only iterate through the visible elements on the page 372 jQuery(".updateStockShop").each(function() { 373 arr.push(jQuery(this).attr('id')); 374 }); 375 } 335 376 336 377 jQuery('#loader2').html('<img style="margin-top: 10px; margin-left: 20px;" src="'+pathPlugin+'images/ajax-loader.gif" title="Loading..">'); … … 339 380 jQuery('#updatePrices').hide(); 340 381 jQuery('#updateAllFields').hide(); 382 jQuery('#applyForEntireTable').hide(); 341 383 // stop normal form submission handler 342 384 event.preventDefault(); … … 358 400 jQuery('#updatePrices').show(); 359 401 jQuery('#updateAllFields').show(); 402 jQuery('#applyForEntireTable').show(); 360 403 jQuery('#loader2').html(''); 361 404 … … 380 423 jQuery('#updatePrices').show(); 381 424 jQuery('#updateAllFields').show(); 425 jQuery('#applyForEntireTable').show(); 382 426 jQuery('#saveProductInShop').show(); 383 427 jQuery('#importToShop').show(); … … 390 434 jQuery('#updatePrices').hide(); 391 435 jQuery('#updateAllFields').hide(); 436 jQuery('#applyForEntireTable').hide(); 392 437 jQuery('#saveProductInShop').hide(); 393 438 } -
drivefx-woocommerce/trunk/settings/import-products.php
r2526532 r3147200 34 34 35 35 <div id="updateAllFields" class="button button-primary" title="Update all fields of products from PHC"> 36 <img id="plus" src="<?php echo plugins_url('/../images/update.png', __FILE__) ?>" title="Update all fields of products in your online store"> Update all fields36 <img id="plus" src="<?php echo plugins_url('/../images/update.png', __FILE__) ?>" title="Update all data of products in your online store"> Update all Fields 37 37 </div> 38 39 <!-- Checkbox option --> 40 <div id="applyForEntireTable" class="option" title="Apply the updates for all imported products, from the whole table"> 41 <input id="applyForEntireTableCheckbox" type="checkbox" name="newOptionCheckbox" value="1"> 42 <label for="applyForEntireTableCheckbox">Apply for all imported products</label> 43 </div> -
drivefx-woocommerce/trunk/settings/syncro_gate.php
r3081910 r3147200 23 23 * --- CREDENTIALS --- * 24 24 ******************************************************************/ 25 25 26 public function fetchCredentials(){ 26 27 $credentials = new stdClass(); 27 28 28 29 $settings = get_option(DRIVEFXWOOCOMMERCE_PLUGIN_NAME); 29 //$this->logs->writeFileLog('settings', $settings); 30 31 // get token 30 31 # Check if settings are available 32 if (!$settings) { 33 $this->logs->writeFileLog('credentials_error_001:', "PHC GO plugin configurations are missing"); 34 return null; 35 } 36 37 # Get token 32 38 global $wpdb; 33 $table_name = $wpdb->prefix."postmeta"; 34 $query = "SELECT meta_value FROM %s WHERE meta_key = %s"; 35 $resultDB = $wpdb->get_row(str_replace("'".$table_name."'", $table_name, $wpdb->prepare($query, $table_name, '_token'))); 36 37 // build our web service full URL 38 if(!is_array($settings['backend']['url'])){ 39 $settings['backend']['url'] = rtrim($settings['backend']['url'], '/html/'); 40 $settings['backend']['url'] = rtrim($settings['backend']['url'], '/html'); 41 $settings['backend']['url'] = rtrim($settings['backend']['url'], '/'); 42 } 43 44 // build credencials 45 $credentials->backendUrl = isset($settings['backend']['url']) ? $settings['backend']['url'].$this->extraurl : null; 46 $credentials->userCode = isset($settings['backend']['username']) ? $settings['backend']['username'] : null; 47 $credentials->password = isset($settings['backend']['password']) ? $settings['backend']['password'] : null; 48 $credentials->appId = isset($resultDB->meta_value) ? $resultDB->meta_value : null; 49 $credentials->company = isset($settings['backend']['dbname']) ? $settings['backend']['dbname'] : null; 50 $credentials->invoiceType = isset($settings['backend']['typeOfInvoice']) ? $settings['backend']['typeOfInvoice'] : null; 51 $credentials->invoiceType_EU = isset($settings['backend']['typeOf_EU_Invoice']) ? $settings['backend']['typeOf_EU_Invoice'] : null; 52 39 $meta_value = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM {$wpdb->postmeta} WHERE meta_key = %s", '_token' ) ); 40 41 # Build credentials 42 $credentials->backendUrl = isset($settings['backend']['url']) ? rtrim($settings['backend']['url'], '/html/') . $this->extraurl : null; 43 $credentials->userCode = $settings['backend']['username'] ?? null; 44 $credentials->password = $settings['backend']['password'] ?? null; 45 $credentials->appId = $meta_value ?? null; 46 $credentials->company = $settings['backend']['dbname'] ?? null; 47 $credentials->invoiceType = $settings['backend']['typeOfInvoice'] ?? null; 48 $credentials->invoiceType_EU = $settings['backend']['typeOf_EU_Invoice'] ?? null; 49 53 50 return $credentials; 54 51 } … … 58 55 ******************************************************************/ 59 56 public function fetchOrderData($order_id) { 60 //get backendinfo from woocommerce61 $settings = get_option(DRIVEFXWOOCOMMERCE_PLUGIN_NAME);62 63 #Get billind data query64 global $wpdb;65 $table_name = $wpdb->prefix."postmeta";66 $query = "SELECT meta_key, meta_value FROM %s where post_id = %d";67 $raw_order = $wpdb->get_results(str_replace("'", "", $wpdb->prepare($query, $table_name, sanitize_text_field($order_id))));68 //$this->logs->writeFileLog('raw_order', $raw_order);69 70 //get NIF name field (billing) from backendinfo71 $ft_nifName = '_billing_'.$settings['backend']['fieldNif'];72 //get NIF name field (shipping) from backendinfo73 $ship_nifName = '_shipping_'.$settings['backend']['fieldNif'];74 75 //get price column field from backendinfo76 $preco = intval(str_replace('epv', '', $settings['backend']['productPriceColumn']));77 78 57 # Inicialize the syncro class 79 58 $syncroData = new stdClass(); 80 59 81 60 /******************************************************************* 82 * --- billing data ---*61 * --- Settings backend Data --- * 83 62 ********************************************************************/ 84 foreach ($raw_order as $key => $value) { 85 if($value->meta_key == '_billing_country'){ 86 $syncroData->billing_country = $value->meta_value; 87 } else if($value->meta_key == '_billing_first_name') { 88 $syncroData->billing_first_name = $value->meta_value; 89 } else if($value->meta_key == '_billing_last_name') { 90 $syncroData->billing_last_name = $value->meta_value; 91 } else if($value->meta_key == '_billing_address_1') { 92 $syncroData->billing_address_1 = $value->meta_value; 93 } else if($value->meta_key == '_billing_city') { 94 $syncroData->billing_city = $value->meta_value; 95 } else if($value->meta_key == '_billing_postcode') { 96 $syncroData->billing_postcode = $value->meta_value; 97 } else if($value->meta_key == $ft_nifName) { 98 $syncroData->ft_nifName = $value->meta_value; 99 } else if($value->meta_key == '_billing_email') { 100 $syncroData->billing_email = $value->meta_value; 101 } else if($value->meta_key == '_billing_phone') { 102 $syncroData->billing_phone = $value->meta_value; 103 } else if($value->meta_key == '_shipping_country') { 104 $syncroData->shipping_country = $value->meta_value; 105 } else if($value->meta_key == '_shipping_first_name') { 106 $syncroData->shipping_first_name = $value->meta_value; 107 } else if($value->meta_key == '_shipping_last_name') { 108 $syncroData->shipping_last_name = $value->meta_value; 109 } else if($value->meta_key == $ship_nifName) { 110 $syncroData->ship_nifName = $value->meta_value; 111 } else if($value->meta_key == '_shipping_address_1') { 112 $syncroData->shipping_address_1 = $value->meta_value; 113 } else if($value->meta_key == '_shipping_city') { 114 $syncroData->shipping_city = $value->meta_value; 115 } else if($value->meta_key == '_shipping_postcode') { 116 $syncroData->shipping_postcode = $value->meta_value; 117 } else if($value->meta_key == '_customer_user') { 118 $syncroData->customer_user = $value->meta_value; 119 } 120 } 121 63 global $wpdb; 64 65 # Get backendinfo from woocommerce 66 $settings = get_option(DRIVEFXWOOCOMMERCE_PLUGIN_NAME); 67 68 # Check if settings are available 69 if (!$settings) { 70 $this->logs->writeFileLog('syncro_error_001:', "PHC GO plugin configurations are missing"); 71 return null; 72 } 73 74 // Get NIF name field (billing) from plugin configs 75 $bill_nifName = '_billing_'.$settings['backend']['fieldNif']; 76 // Get NIF name field (shipping) from plugin configs 77 $ship_nifName = '_shipping_'.$settings['backend']['fieldNif']; 78 // Get price column field from plugin configs 79 $preco = intval(str_replace('epv', '', $settings['backend']['productPriceColumn'])); 80 81 $syncroData->createInvoice = (isset($settings['backend']['createInvoice']) && $settings['backend']['createInvoice'] == 'on'); 82 $syncroData->doInvoice = (isset($settings['backend']['doInvoice']) && $settings['backend']['doInvoice'] == 'on'); 83 $syncroData->typeOfInvoice = $settings['backend']['typeOfInvoice'] ?? null; 84 $syncroData->typeOf_EU_Invoice = $settings['backend']['typeOf_EU_Invoice'] ?? null; 85 $syncroData->toSignInvoice = (isset($settings['backend']['toSignInvoice']) && $settings['backend']['toSignInvoice'] == 'on'); 86 $syncroData->fieldNif = $settings['backend']['fieldNif'] ?? null; 87 $syncroData->includeTaxonSendCost = $settings['backend']['includeTaxonSendCost'] ?? null; 88 $syncroData->createExemptPT = (isset($settings['backend']['createExemptPT']) && $settings['backend']['createExemptPT'] == 'on'); 89 $syncroData->createExemptEU = (isset($settings['backend']['createExemptEU']) && $settings['backend']['createExemptEU'] == 'on'); 90 $syncroData->createExemptCO = (isset($settings['backend']['createExemptCO']) && $settings['backend']['createExemptCO'] == 'on'); 91 $syncroData->typeOfCountry = $settings['backend']['typeOfCountry'] ?? null; 92 $syncroData->typeOfReason = $settings['backend']['typeOfReason'] ?? null; 93 $syncroData->typeOfReasonEU = $settings['backend']['typeOfReasonEU'] ?? null; 94 $syncroData->typeOfReasonCO = $settings['backend']['typeOfReasonCO'] ?? null; 95 $syncroData->doOrder = (isset($settings['backend']['doOrder']) && $settings['backend']['doOrder'] == 'on'); 96 $syncroData->warehouseOrder = $settings['backend']['warehouseOrder'] ?? null; 97 $syncroData->typeOfOrder = $settings['backend']['typeOfOrder'] ?? null; 98 $syncroData->toSignOrder = (isset($settings['backend']['toSignOrder']) && $settings['backend']['toSignOrder'] == 'on'); 99 $syncroData->numberOfOrder = $settings['backend']['numberOfOrder'] ?? null; 100 $syncroData->statusOfOrder = $settings['backend']['statusOfOrder'] ?? null; 101 $syncroData->shippingName = $settings['backend']['shippingName'] ?? null; 102 $syncroData->feesName = $settings['backend']['feesName'] ?? null; 103 $syncroData->manageStock = (isset($settings['backend']['manageStock']) && $settings['backend']['manageStock'] == 'on'); 104 $syncroData->productPriceColumn = $preco; 105 $syncroData->warehouse = $settings['backend']['warehouse'] ?? null; 106 $syncroData->sendInvoice = $settings['backend']['sendInvoice'] ?? null; 107 $syncroData->typeOfReport = $settings['backend']['typeOfReport'] ?? null; 108 122 109 /******************************************************************* 123 * --- settings backend Data --- * 124 ********************************************************************/ 125 $syncroData->createInvoice = (isset($settings['backend']['createInvoice']) && $settings['backend']['createInvoice'] == 'on') ? true : false; 126 $syncroData->doInvoice = (isset($settings['backend']['doInvoice']) && $settings['backend']['doInvoice'] == 'on') ? true : false; 127 $syncroData->typeOfInvoice = (isset($settings['backend']['typeOfInvoice'])) ? $settings['backend']['typeOfInvoice'] : null; 128 $syncroData->typeOf_EU_Invoice = (isset($settings['backend']['typeOf_EU_Invoice'])) ? $settings['backend']['typeOf_EU_Invoice'] : null; 129 $syncroData->toSignInvoice = (isset($settings['backend']['toSignInvoice']) && $settings['backend']['toSignInvoice'] == 'on') ? true : false; 130 $syncroData->fieldNif = isset($settings['backend']['fieldNif']) ? $settings['backend']['fieldNif'] : null; 131 $syncroData->includeTaxonSendCost = isset($settings['backend']['includeTaxonSendCost']) ? $settings['backend']['includeTaxonSendCost'] : null; 132 $syncroData->createExemptPT = (isset($settings['backend']['createExemptPT']) && $settings['backend']['createExemptPT'] == 'on') ? true : false; 133 $syncroData->createExemptEU = (isset($settings['backend']['createExemptEU']) && $settings['backend']['createExemptEU'] == 'on') ? true : false; 134 $syncroData->createExemptCO = (isset($settings['backend']['createExemptCO']) && $settings['backend']['createExemptCO'] == 'on') ? true : false; 135 $syncroData->typeOfCountry = isset($settings['backend']['typeOfCountry']) ? $settings['backend']['typeOfCountry'] : null; 136 $syncroData->typeOfReason = isset($settings['backend']['typeOfReason']) ? $settings['backend']['typeOfReason'] : null; 137 $syncroData->typeOfReasonEU = isset($settings['backend']['typeOfReasonEU']) ? $settings['backend']['typeOfReasonEU'] : null; 138 $syncroData->typeOfReasonCO = isset($settings['backend']['typeOfReasonCO']) ? $settings['backend']['typeOfReasonCO'] : null; 139 $syncroData->doOrder = (isset($settings['backend']['doOrder']) && $settings['backend']['doOrder'] == 'on') ? true : false; 140 $syncroData->warehouseOrder = isset($settings['backend']['warehouseOrder']) ? $settings['backend']['warehouseOrder'] : null; 141 $syncroData->typeOfOrder = isset($settings['backend']['typeOfOrder']) ? $settings['backend']['typeOfOrder'] : null; 142 $syncroData->toSignOrder = (isset($settings['backend']['toSignOrder']) && $settings['backend']['toSignOrder'] == 'on') ? true : false; 143 $syncroData->numberOfOrder = isset($settings['backend']['numberOfOrder']) ? $settings['backend']['numberOfOrder'] : null; 144 $syncroData->statusOfOrder = isset($settings['backend']['statusOfOrder']) ? $settings['backend']['statusOfOrder'] : null; 145 $syncroData->shippingName = isset($settings['backend']['shippingName']) ? $settings['backend']['shippingName'] : null; 146 $syncroData->feesName = isset($settings['backend']['feesName']) ? $settings['backend']['feesName'] : null; 147 $syncroData->manageStock = (isset($settings['backend']['manageStock']) && $settings['backend']['manageStock'] == 'on') ? true : false; 148 $syncroData->productPriceColumn = isset($settings['backend']['productPriceColumn']) ? $preco : null; 149 $syncroData->warehouse = isset($settings['backend']['warehouse']) ? $settings['backend']['warehouse'] : null; 150 $syncroData->sendInvoice = isset($settings['backend']['sendInvoice']) ? $settings['backend']['sendInvoice'] : null; 151 $syncroData->typeOfReport = isset($settings['backend']['typeOfReport']) ? $settings['backend']['typeOfReport'] : null; 152 153 /******************************************************************* 154 * --- Company/Users Data --- * 155 ********************************************************************/ 156 // Obtain customer ID to obtain email in Woocommerce Users 157 global $wpdb; 158 $table_name = $wpdb->prefix."users"; 159 // Obtain next post_id of order in MySQL 160 $query = "SELECT user_email FROM %s WHERE id = %d"; 161 $docid = $wpdb->get_results(str_replace("'", "", $wpdb->prepare($query, $table_name, sanitize_text_field($syncroData->customer_user)))); 162 // set user enail 163 $syncroData->user_email = empty($docid) ? "" : $docid[0]->user_email; 164 165 #Get POST Id for current order 166 global $wpdb; 167 $table_name = $wpdb->prefix."postmeta"; 168 //Obtain post_id of order in MySQL 169 $query = "SELECT MAX(post_id) as postId FROM %s"; 170 $post_docid = $wpdb->get_row(str_replace("'", "", $wpdb->prepare($query, $table_name))); 171 //Post Id 172 $syncroData->post_ID = sanitize_text_field($post_docid->postId); 173 174 if($syncroData->post_ID == ''){$post_ID = sanitize_text_field($order_id);} 175 176 //Obtain doc ID based in order 177 $docid = get_post_meta($order_id); 178 179 $syncroData->docId = isset($docid['_docid'][0]) ? $docid['_docid'][0] : null; 110 * --- Billing data --- * 111 ********************************************************************/ 112 // Create order object 113 $order = wc_get_order($order_id); 114 //$this->logs->writeFileLog('order', $order); 115 116 if ($order) { 117 $syncroData->billing_country = $order->get_billing_country(); 118 $syncroData->billing_first_name = $order->get_billing_first_name(); 119 $syncroData->billing_last_name = $order->get_billing_last_name(); 120 $syncroData->billing_address = $order->get_billing_address_1(); 121 $syncroData->billing_city = $order->get_billing_city(); 122 $syncroData->billing_postcode = $order->get_billing_postcode(); 123 $syncroData->billing_nif = $order->get_meta($bill_nifName); 124 $syncroData->billing_email = $order->get_billing_email(); 125 $syncroData->billing_phone = $order->get_billing_phone(); 126 127 // Customer data on shipment 128 $syncroData->shipping_country = $order->get_shipping_country(); 129 $syncroData->shipping_cl_first_name = $order->get_shipping_first_name(); 130 $syncroData->shipping_cl_last_name = $order->get_shipping_last_name(); 131 $syncroData->shipping_address = $order->get_shipping_address_1(); 132 $syncroData->shipping_city = $order->get_shipping_city(); 133 $syncroData->shipping_postcode = $order->get_shipping_postcode(); 134 $syncroData->shipping_cl_nif = $order->get_meta($ship_nifName); 135 136 // Obtain user email 137 $user = $order->get_user(); 138 $syncroData->user_email = $user ? $user->user_email : ''; 139 140 // Get tax country 141 $tax_rate_id = ''; 142 foreach($order->get_items('tax') as $item_id => $item ) { 143 $tax_rate_id = $item->get_rate_id(); // Tax rate ID 144 } 145 146 $syncroData->taxCountry = $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate_country FROM ".$wpdb->prefix."woocommerce_tax_rates WHERE tax_rate_id=%d LIMIT 1", $tax_rate_id ) ); 147 148 // Other data 149 $syncroData->post_ID = $order->get_id(); 150 $syncroData->docId = $order->get_meta('_docid'); 151 $syncroData->statusOrder = $order->get_status(); 152 $syncroData->obs = $order->get_customer_note(); 153 } else { 154 # Alternative way to get the billing data 155 $order_meta = get_post_meta($order_id); 156 //$this->logs->writeFileLog('order_meta', $order_meta); 157 158 if (!$order_meta) { 159 $this->logs->writeFileLog('syncro_error_002:', "Order data is missing"); 160 } 161 162 $syncroData->billing_country = !empty($order_meta['_billing_country'][0]) ? $order_meta['_billing_country'][0] : sanitize_text_field($_REQUEST['_billing_country']); 163 $syncroData->billing_first_name = $order_meta['_billing_first_name'][0]; 164 $syncroData->billing_last_name = $order_meta['_billing_last_name'][0]; 165 166 $syncroData->billing_address = $order_meta['_billing_address_1'][0]; 167 $syncroData->billing_city = $order_meta['_billing_city'][0]; 168 $syncroData->billing_postcode = $order_meta['_billing_postcode'][0]; 169 $syncroData->billing_nif = $order_meta['_billing_'.$settings['backend']['fieldNif']][0]; 170 $syncroData->billing_email = $order_meta['_billing_email'][0]; 171 $syncroData->billing_phone = $order_meta['_billing_phone'][0]; 172 173 // Customer data on shipment 174 $syncroData->shipping_country = $order_meta['_shipping_country'][0]; 175 $syncroData->shipping_cl_first_name = $order_meta['_shipping_first_name'][0]; 176 $syncroData->shipping_cl_last_name = $order_meta['_shipping_last_name'][0]; 177 $syncroData->shipping_address = $order_meta['_shipping_address_1'][0]; 178 $syncroData->shipping_city = $order_meta['_shipping_city'][0]; 179 $syncroData->shipping_postcode = $order_meta['_shipping_postcode'][0]; 180 $syncroData->shipping_cl_nif = $order_meta['_shipping_'.$settings['backend']['fieldNif']][0]; 181 182 // Get User 183 $syncroData->customer_user = $order_meta['_customer_user'][0]; 184 $table_name = $wpdb->prefix."users"; 185 // Obtain next post_id of order in MySQL 186 $query = "SELECT user_email FROM %s WHERE id = %d"; 187 $docid = $wpdb->get_results(str_replace("'", "", $wpdb->prepare($query, $table_name, sanitize_text_field($syncroData->customer_user)))); 188 // Get user email 189 $syncroData->user_email = empty($docid) ? "" : $docid[0]->user_email; 190 191 // Get the tax_country 192 $tax_rate_id = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM ".$wpdb->prefix."woocommerce_order_itemmeta WHERE meta_key='rate_id' ORDER BY order_item_id DESC LIMIT 1" ) ); 193 $syncroData->taxCountry = $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate_country FROM ".$wpdb->prefix."woocommerce_tax_rates WHERE tax_rate_id='".$tax_rate_id."' LIMIT 1" ) ); 194 } 195 196 # Store data 180 197 $syncroData->orderId = sanitize_text_field($order_id); 181 182 #Customer notes183 $syncroData->obs = isset($_REQUEST['order_comments']) ? $_REQUEST['order_comments'] : null;184 #Get Currency from woocommerce185 198 $syncroData->wooCurrency = get_option('woocommerce_currency'); 186 #get order received endpoint from woocommerce187 199 $syncroData->order_received = get_option('woocommerce_checkout_order_received_endpoint'); 188 #get company country from woocommerce189 200 $syncroData->companyCountry = WC()->countries->countries[WC()->countries->get_base_country()]; 190 191 # Get order data 192 $order = new WC_Order($order_id); 193 194 #get order tax rate country 195 foreach($order->get_items('tax') as $item_id => $item ) { 196 $tax_rate_id = $item->get_rate_id(); // Tax rate ID 197 } 198 $syncroData->taxCountry = $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate_country FROM ".$wpdb->prefix."woocommerce_tax_rates WHERE tax_rate_id='".$tax_rate_id."' LIMIT 1" ) ); 199 200 //get status of order atualizated 201 $syncroData->statusOrder = $order->get_status(); 202 203 /******************************************************************* 204 * --- Alternative select Data --- * 205 ********************************************************************/ 206 207 /* if some data is not received from webhook or order object 208 here we fount alternative methods (like for create invoice process)*/ 209 210 #nextPostId 211 global $wpdb; 212 $table_name = $wpdb->prefix."postmeta"; 213 //Obtain next post_id of order in MySQL 214 $query = "SELECT MAX(post_id) as nextPostId FROM %s"; 215 $packDocId = $wpdb->get_row(str_replace("'", "", $wpdb->prepare($query, $table_name))); 216 217 //Save nextPostId 218 $syncroData->nextPostId = $packDocId->nextPostId; 219 220 if(empty($raw_order)){ 221 #get alternative stdClass Object data 222 $table = $wpdb->prefix . 'postmeta'; 223 $sql = 'SELECT * FROM `'. $table . '` WHERE post_id = '. $syncroData->nextPostId; 224 $resultStdClass = $wpdb->get_results($sql); 225 //$this->logs->writeFileLog('resultStdClass', $resultStdClass); 226 227 foreach($resultStdClass as $res) { 228 if(empty($syncroData->billing_email)) { 229 if( $res->meta_key == '_billing_email'){ 230 $syncroData->billing_email = $res->meta_value; // get customer email 231 } 232 } 233 if(empty($syncroData->ft_nifName)) { 234 if( $res->meta_key == $ft_nifName){ 235 $syncroData->ft_nifName = $res->meta_value; // get customer nif 236 } 237 } 238 if(empty($syncroData->billing_address_1)) { 239 if( $res->meta_key == '_billing_address_1'){ 240 $syncroData->billing_address_1 = $res->meta_value; // get customer address 241 } 242 } 243 if(empty($syncroData->billing_first_name)) { 244 if( $res->meta_key == '_billing_first_name'){ 245 $syncroData->billing_first_name = $res->meta_value; // get customer name 246 } 247 } 248 if(empty($syncroData->billing_last_name)) { 249 if( $res->meta_key == '_billing_last_name'){ 250 $syncroData->billing_last_name = $res->meta_value; // get customer surname 251 } 252 } 253 } 254 } 255 201 256 202 /******************************************************************* 257 203 * --- Order Shipping Data --- * 258 ********************************************************************/ 259 204 ********************************************************************/ 260 205 # shipping data (Queries) 261 206 $table_name = $wpdb->prefix."woocommerce_order_items"; 262 207 $query = "SELECT * FROM %s WHERE order_id = %s and order_item_type = 'shipping'"; 263 208 $resultShipping = $wpdb->get_row(str_replace("'".$table_name."'", $table_name, $wpdb->prepare($query, $table_name, $order_id))); 264 209 265 210 //get tax value for shipping 266 211 $table_name = $wpdb->prefix."woocommerce_order_itemmeta"; … … 311 256 $this->logs->writeFileLog('Warning', 'Without shipping tax'); 312 257 } 313 258 314 259 if(isset($resultDB)) { 315 260 if($settings['backend']['includeTaxonSendCost']=="true"){ … … 325 270 $syncroData->post_title = isset( $post->post_title ) ? $post->post_title : ''; 326 271 $syncroData->edescc = isset( WC()->cart->coupon_discount_amounts['saco'] ) ? WC()->cart->coupon_discount_amounts['saco'] : 0; 327 328 272 /******************************************************************* 329 273 * --- Order Fees Data --- * 330 274 ********************************************************************/ 331 //build common object332 $boFeesPack = new stdClass();333 275 $bofees = []; 334 335 $the_order = wc_get_order($order_id); 336 337 if(!empty($the_order)){ 338 // Iterating through order fee items ONLY 339 foreach( $the_order->get_items('fee') as $item_id => $item_fee){ 340 341 // The fee name 342 $fee_name = $item_fee->get_name(); 343 344 // The fee total amount 345 $fee_total = $item_fee->get_total(); 346 347 // The fee total tax amount 348 $fee_total_tax = $item_fee->get_total_tax(); 349 350 array_push($bofees,[ 351 'name' => $fee_name, 352 'value' => $fee_total, 353 'tax_value' => $fee_total_tax 354 ]); 355 } 356 } 357 358 $boFeesPack = $bofees; 359 $syncroData->fees_bo = $boFeesPack; 360 361 # Fetch fees data 362 363 if(isset($resultFee)) { 364 $syncroData->fee_name = $resultFee->order_item_name; 365 } 366 if(isset($resultFeeValue)) { 367 $syncroData->fee_value = $resultFeeValue->meta_value; 368 } 369 370 /******************************************************************* 371 * --- Invoice Data --- * 372 ********************************************************************/ 373 #get country for Ft 374 $order_meta = get_post_meta($order_id); 375 //$this->logs->writeFileLog('order_meta', $order_meta); 376 377 $syncroData->$bill_country_ft = isset( $order_meta['_billing_country'][0] ) ? $order_meta['_billing_country'][0] : ''; 378 if($syncroData->billing_country != ''){ 379 $syncroData->billing_country_ft = $syncroData->billing_country; 380 } else { 381 $syncroData->billing_country_ft = sanitize_text_field( $_REQUEST['_billing_country'] ); 382 } 383 384 #get Billing data 385 $syncroData->billing_first_name_ft = $order_meta['_billing_first_name'][0]; 386 $syncroData->billing_last_name_ft = $order_meta['_billing_last_name'][0]; 387 $syncroData->billing_email_ft = $order_meta['_billing_email'][0]; 388 $syncroData->billing_address_1_ft = $order_meta['_billing_address_1'][0]; 389 $syncroData->billing_city_ft = $order_meta['_billing_city'][0]; 390 $syncroData->billing_phone_ft = $order_meta['_billing_phone'][0]; 391 $syncroData->billing_postcode_ft = $order_meta['_billing_postcode'][0]; 392 $syncroData->billing_nif_ft = isset($order_meta) ? $order_meta['_billing_'.$settings['backend']['fieldNif']][0] : ''; 393 394 /******************************************************************* 395 * --- Invoice Shipping Data --- * 396 ********************************************************************/ 397 398 /* To avoid repetitive code, 399 data is taken from "Order Shipping Data" */ 400 401 //$this->logs->writeFileLog('syncroData', $syncroData); 402 276 foreach( $order->get_items('fee') as $item_id => $item_fee){ 277 $fee_name = $item_fee->get_name(); 278 $fee_total = $item_fee->get_total(); 279 $fee_total_tax = $item_fee->get_total_tax(); 280 $bofees[] = [ 281 'name' => $fee_name, 282 'value' => $fee_total, 283 'tax_value' => $fee_total_tax 284 ]; 285 } 286 $syncroData->fees_bo = $bofees; 287 288 //$this->logs->writeFileLog('syncroData', $syncroData); 403 289 return $syncroData; 404 } 405 290 } 406 291 /****************************************************************** 407 292 * --- Order Cart Data --- * … … 414 299 $products = []; 415 300 $cart_contents = WC()->cart->cart_contents; 416 417 // $this->logs->writeFileLog('cart_contents', $cart_contents); 301 //$this->logs->writeFileLog('cart_contents', $cart_contents); 418 302 419 303 if (is_array($cart_contents)){ … … 775 659 return $ftProducts; 776 660 } 777 778 779 780 661 /****************************************************************** 781 662 * --- Object PackData --- * … … 831 712 $bill->nome = $wooOrder->billing_first_name. " " .$wooOrder->billing_last_name; 832 713 $bill->email = $wooOrder->billing_email; 833 $bill->morada = $wooOrder->billing_address _1;714 $bill->morada = $wooOrder->billing_address; 834 715 $bill->local = $wooOrder->billing_city; 835 716 $bill->provincia = $wooOrder->billing_city; 836 717 $bill->telefone = $wooOrder->billing_phone; 837 718 $bill->codpost = $wooOrder->billing_postcode; 838 $bill->ncont = $wooOrder-> ft_nifName;719 $bill->ncont = $wooOrder->billing_nif; 839 720 840 721 # shipping data 841 $shipping->cl_name = $wooOrder->shipping_ first_name. " " .$wooOrder->shipping_last_name;842 $shipping->ncont = $wooOrder->ship _nifName;722 $shipping->cl_name = $wooOrder->shipping_cl_first_name. " " .$wooOrder->shipping_cl_last_name; 723 $shipping->ncont = $wooOrder->shipping_cl_nif; 843 724 $shipping->paisto = $wooOrder->shipping_country; 844 $shipping->moradato = $wooOrder->shipping_address _1;725 $shipping->moradato = $wooOrder->shipping_address; 845 726 $shipping->localto = $wooOrder->shipping_city; 846 727 $shipping->codpostto = $wooOrder->shipping_postcode; … … 854 735 $customer->nome = $wooOrder->billing_first_name. " " .$wooOrder->billing_last_name; 855 736 $customer->email = $wooOrder->billing_email; 856 $customer->morada = $wooOrder->billing_address _1;737 $customer->morada = $wooOrder->billing_address; 857 738 $customer->local = $wooOrder->billing_city; 858 739 $customer->provincia = $wooOrder->billing_city; 859 740 $customer->telefone = $wooOrder->billing_phone; 860 741 $customer->codpost = $wooOrder->billing_postcode; 861 $customer->ncont = $wooOrder-> ft_nifName;742 $customer->ncont = $wooOrder->billing_nif; 862 743 $customer->preco = $wooOrder->productPriceColumn; 863 744 $customer->country = $wooOrder->billing_country; … … 878 759 879 760 # invoice 880 $ft->country = $wooOrder->billing_country _ft;761 $ft->country = $wooOrder->billing_country; 881 762 $ft->cart = $ftprodPack; 882 $ft->billing_name = $wooOrder->billing_first_name _ft. " " .$wooOrder->billing_last_name_ft;883 $ft->billing_email = $wooOrder->billing_email _ft;884 $ft->billing_address _1 = $wooOrder->billing_address_1_ft;885 $ft->billing_city = $wooOrder->billing_city _ft;886 $ft->billing_phone = $wooOrder->billing_phone _ft;887 $ft->billing_postcode = $wooOrder->billing_postcode _ft;888 $ft->billing_nif = $wooOrder->billing_nif _ft;763 $ft->billing_name = $wooOrder->billing_first_name. " " .$wooOrder->billing_last_name; 764 $ft->billing_email = $wooOrder->billing_email; 765 $ft->billing_address = $wooOrder->billing_address; 766 $ft->billing_city = $wooOrder->billing_city; 767 $ft->billing_phone = $wooOrder->billing_phone; 768 $ft->billing_postcode = $wooOrder->billing_postcode; 769 $ft->billing_nif = $wooOrder->billing_nif; 889 770 $ft->shipping_name = $wooOrder->shipping_name; 890 771 $ft->shipping_value = $wooOrder->shipping_value;
Note: See TracChangeset
for help on using the changeset viewer.