Changeset 2887511
- Timestamp:
- 03/27/2023 11:04:39 AM (3 years ago)
- Location:
- viaads
- Files:
-
- 16 added
- 3 edited
-
tags/1.1.11 (added)
-
tags/1.1.11/apikey.php (added)
-
tags/1.1.11/externalJS.php (added)
-
tags/1.1.11/handleEmailGuid.php (added)
-
tags/1.1.11/hooks (added)
-
tags/1.1.11/hooks/addCart.php (added)
-
tags/1.1.11/hooks/orderHooks.php (added)
-
tags/1.1.11/hooks/pageLook.php (added)
-
tags/1.1.11/hooks/removeCart.php (added)
-
tags/1.1.11/http.php (added)
-
tags/1.1.11/js (added)
-
tags/1.1.11/js/viaads_handleEmailGuid.js (added)
-
tags/1.1.11/readme.txt (added)
-
tags/1.1.11/sync.php (added)
-
tags/1.1.11/userAgent.php (added)
-
tags/1.1.11/viaads.php (added)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/sync.php (modified) (7 diffs)
-
trunk/viaads.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
viaads/trunk/readme.txt
r2884235 r2887511 4 4 Requires at least: 5.4 5 5 Tested up to: 6.1 6 Stable tag: 1.1.1 06 Stable tag: 1.1.11 7 7 Requires PHP: 7.0 8 8 License: GPLv3 -
viaads/trunk/sync.php
r2884235 r2887511 31 31 $webshop->ApiKey = get_option($name); 32 32 $webshop->Categories = ViaAds_getCategories(); 33 $webshop->Products = ViaAds_getProducts( );33 $webshop->Products = ViaAds_getProducts($_GET['full']); 34 34 if (isset($_GET['debug']) && $_GET['debug'] == "tEBLZTqKDLzhEjc2Kw9mqu5vrJUB") { 35 print_r(ViaAds_PostToUrl("https://sync.viaads.dk/woocommerce/WebShopData", $webshop, true)); 36 } else if (isset($_GET['debug1']) && $_GET['debug1'] == "tEBLZTqKDLzhEjc2Kw9mqu5vrJUB") { 35 37 print_r(json_encode($webshop)); 36 print_r(ViaAds_PostToUrl("https://sync.viaads.dk/woocommerce/WebShopData", $webshop, true));37 38 } else { 38 39 //Split array in chucks for max data size … … 47 48 $orders = ViaAds_getOrders(); 48 49 if (isset($_GET['debug']) && $_GET['debug'] == "tEBLZTqKDLzhEjc2Kw9mqu5vrJUB") { 50 print_r(ViaAds_PostToUrl("https://sync.viaads.dk/woocommerce/WebShopOrderData", $orders, true)); 51 } else if (isset($_GET['debug1']) && $_GET['debug1'] == "tEBLZTqKDLzhEjc2Kw9mqu5vrJUB") { 49 52 print_r(json_encode($orders)); 50 print_r(ViaAds_PostToUrl("https://sync.viaads.dk/woocommerce/WebShopOrderData", $orders, true));51 53 } else { 52 54 ViaAds_PostToUrl("https://sync.viaads.dk/woocommerce/WebShopOrderData", $orders, true); … … 69 71 70 72 71 function ViaAds_getProducts( )73 function ViaAds_getProducts($full) 72 74 { 73 $args = array( 74 'orderby' => 'name', 75 'limit' => -1, 76 ); 75 if ($full == "True") { 76 $args = array( 77 'orderby' => 'name', 78 'limit' => -1, 79 ); 80 } else { 81 $args = array( 82 'orderby' => 'name', 83 'limit' => -1, 84 'date_modified' => '>' . (time() - 3 * 24 * 60 * 60), 85 ); 86 } 77 87 $productCollection = wc_get_products($args); 78 88 $products = []; 79 89 80 if (isset($_GET['debug 1']) && $_GET['debug1'] == "tEBLZTqKDLzhEjc2Kw9mqu5vrJUB") {90 if (isset($_GET['debug2']) && $_GET['debug2'] == "tEBLZTqKDLzhEjc2Kw9mqu5vrJUB") { 81 91 print_r($productCollection); 82 92 } 83 84 93 85 94 foreach ($productCollection as $product) { … … 318 327 319 328 $orderCollection = wc_get_orders(array( 320 'limit' => -1,329 'limit' => -1, 321 330 'date_modified' => date('Y-m-d', strtotime(date("Y-m-d") . ' - ' . $lookBackDays . ' days')) . '...' 322 331 . date('Y-m-d'), 323 332 )); 324 333 325 if (isset($_GET['debug 1']) && $_GET['debug1'] == "tEBLZTqKDLzhEjc2Kw9mqu5vrJUB") {334 if (isset($_GET['debug2']) && $_GET['debug2'] == "tEBLZTqKDLzhEjc2Kw9mqu5vrJUB") { 326 335 print_r($orderCollection); 327 336 } … … 347 356 // Vat Percentage 348 357 $vat_percentage = floatval('0.25'); 349 foreach ($order->get_items('tax') as $item_id => $item) {350 $tax_rate_id = $item->get_rate_id(); // Tax rate ID351 $tax_percent = WC_Tax::get_rate_percent( $tax_rate_id); // Tax percentage352 $vat_percentage = floatval("0." . str_replace('%', '', $tax_percent)); // Tax rate358 foreach ($order->get_items('tax') as $item_id => $item) { 359 $tax_rate_id = $item->get_rate_id(); // Tax rate ID 360 $tax_percent = WC_Tax::get_rate_percent($tax_rate_id); // Tax percentage 361 $vat_percentage = floatval("0." . str_replace('%', '', $tax_percent)); // Tax rate 353 362 } 354 363 … … 422 431 423 432 // Refunds 424 if (count($refundItems) > 0) {433 if (count($refundItems) > 0) { 425 434 foreach ($refundItems as $refund) { 426 435 if ($order_item_object->Product_id == $refund->Product_id && … … 431 440 } 432 441 433 if ($order_item_object->Quantity > 0) {442 if ($order_item_object->Quantity > 0) { 434 443 array_push($orderItems, $order_item_object); 435 444 } -
viaads/trunk/viaads.php
r2884235 r2887511 3 3 * Plugin Name: ViaAds 4 4 * Description: Plugin der muliggør forbindelsen til ViaAds / Plug-in enabling the connection to ViaAds. 5 * Version: 1.1.1 05 * Version: 1.1.11 6 6 * Author: ViaAds 7 7 * Author URI: https://www.viaads.dk/
Note: See TracChangeset
for help on using the changeset viewer.