Changeset 2033514
- Timestamp:
- 02/18/2019 05:16:07 PM (7 years ago)
- Location:
- clipr
- Files:
-
- 8 added
- 3 edited
-
tags/1.2.1 (added)
-
tags/1.2.1/clipr.php (added)
-
tags/1.2.1/contributors.txt (added)
-
tags/1.2.1/inc (added)
-
tags/1.2.1/inc/functions.cart-builder.php (added)
-
tags/1.2.1/inc/functions.clipr-toolbox.php (added)
-
tags/1.2.1/inc/functions.product-data.php (added)
-
tags/1.2.1/readme.txt (added)
-
trunk/clipr.php (modified) (2 diffs)
-
trunk/inc/functions.cart-builder.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
clipr/trunk/clipr.php
r2033312 r2033514 4 4 Plugin Name: Clipr 5 5 Description: Mobile experience that converts. Connect your Woocommerce e-shop with Clipr platform now ! 6 Version: 1.2. 06 Version: 1.2.1 7 7 Author: Clipr 8 8 Author URI: https://clipr.co … … 11 11 */ 12 12 13 define( 'CLIPR__VERSION', '1.2. 0' );13 define( 'CLIPR__VERSION', '1.2.1' ); 14 14 define( 'CLIPR__PLUGIN_DIR', __DIR__ ); 15 15 define( 'CLIPR__PLUGIN_FILE', __FILE__ ); -
clipr/trunk/inc/functions.cart-builder.php
r1955385 r2033514 11 11 global $woocommerce; 12 12 13 $LOG_CHECKOUT = []; 14 15 $debug = true; 16 13 17 // Call clipr for cart content 14 18 $response = clipr_curl("landing","/p/module/cart/".$cnv_cart_id."/",[],$env); 15 19 // $response = json_decode('{"success":true,"data":{"products":[{"idProduct":"10","idVariant":"19"}]}}',true); // for debugging purpose 16 20 21 if ($debug) { 22 $LOG_CHECKOUT['ENV'] = $env; 23 $LOG_CHECKOUT['URL'] = "/p/module/cart/".$cnv_cart_id."/"; 24 $LOG_CHECKOUT['GET_CART_CONTENT'] = $response; 25 } 17 26 18 27 if ($response != null && in_array("data",array_keys($response))) { … … 24 33 // $woocommerce->cart->empty_cart(); // Better keep old cart content here (especially for embedded clip) 25 34 26 27 28 35 // Add product to cart one by one 29 36 foreach ($products as $product) { … … 34 41 if ($idProduct == $idVariant) { 35 42 // No variant 36 $woocommerce->cart->add_to_cart($idProduct, 1); 43 try { 44 $woocommerce->cart->add_to_cart($idProduct, 1); 45 } catch (\Exception $e) { 46 if ($debug) { 47 $LOG_CHECKOUT['ERROR_ADD_CART_NO_VARIAT'] = $e->getMessage(); 48 } 49 } 37 50 } else { 38 $woocommerce->cart->add_to_cart($idProduct, 1, $idVariant); 51 try { 52 $woocommerce->cart->add_to_cart($idProduct, 1, $idVariant); 53 } catch (\Exception $e) { 54 if ($debug) { 55 $LOG_CHECKOUT['ERROR_ADD_CART_WITH_VARIANT'] = $e->getMessage(); 56 } 57 } 39 58 } 40 59 } 60 } 61 62 if ($debug) { 63 $LOG_CHECKOUT['REDIRECT_URL'] = $redirect_url; 64 $LOG_CHECKOUT['CHECKOUT_URL'] = $woocommerce->cart->get_checkout_url(); 65 $LOG_CHECKOUT['CART_URL'] = $woocommerce->cart->get_cart_url(); 66 wp_send_json(['debug'=>true,'data'=>$LOG_CHECKOUT]); 41 67 } 42 68 -
clipr/trunk/readme.txt
r2033312 r2033514 5 5 Tested up to: 5.1 6 6 Requires PHP : 5.4 7 Stable tag: 1.2. 07 Stable tag: 1.2.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 77 77 = 1.2.0 = 78 78 * Wordpress 5.0 compatibility 79 80 = 1.2.1 = 81 * Debug support
Note: See TracChangeset
for help on using the changeset viewer.