Changeset 2468156
- Timestamp:
- 02/03/2021 05:18:59 PM (5 years ago)
- Location:
- appmax-woocommerce/trunk
- Files:
-
- 4 edited
-
appmax-woocommerce.php (modified) (2 diffs)
-
includes/class-awc-api.php (modified) (2 diffs)
-
includes/class-awc-webhook-post.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
appmax-woocommerce/trunk/appmax-woocommerce.php
r2421485 r2468156 3 3 * Plugin Name: AppMax WooCommerce 4 4 * Description: Gateway de pagamento AppMax para WooCommerce. 5 * Version: 2.0.3 15 * Version: 2.0.32 6 6 * License: GPLv2 or later 7 7 * Author: AppMax Plataforma de Vendas Ltda … … 24 24 class AppMax_WC 25 25 { 26 const VERSION = '2.0.3 1';26 const VERSION = '2.0.32'; 27 27 28 28 /** -
appmax-woocommerce/trunk/includes/class-awc-api.php
r2393838 r2468156 246 246 247 247 foreach ($items as $item => $values) { 248 249 $product = wc_get_product( $values['product_id'] ); 250 251 $data = [ 252 "sku" => $product->get_sku(), 253 "price" => (float) $product->get_price(), 254 "name" => $product->get_title(), 255 "qty" => $values['quantity'], 256 "description" => $product->get_description(), 257 "image" => get_the_post_thumbnail_url( $values['product_id'] ), 258 ]; 259 260 array_push( $array_products, $data ); 248 array_push( $array_products, $this->awc_get_current_product( $values ) ); 261 249 } 262 250 … … 337 325 }); 338 326 } 327 328 /** 329 * @param $skuParentProduct 330 * @param $values 331 * @return array 332 */ 333 private function awc_get_information_product_variation( $skuParentProduct, $values ) 334 { 335 $variation = wc_get_product($values['variation_id']); 336 337 return [ 338 "sku" => "{$skuParentProduct}__{$variation->get_sku()}", 339 "price" => (float) $variation->get_price(), 340 "name" => $variation->get_name(), 341 "qty" => $values['quantity'], 342 "description" => $variation->get_description(), 343 "image" => get_the_post_thumbnail_url( $values ), 344 ]; 345 } 346 347 /** 348 * @param WC_Product $product 349 * @param $values 350 * @return array 351 */ 352 private function awc_get_information_product( WC_Product $product, $values ) 353 { 354 return [ 355 "sku" => $product->get_sku(), 356 "price" => (float) $product->get_price(), 357 "name" => $product->get_title(), 358 "qty" => $values['quantity'], 359 "description" => $product->get_description(), 360 "image" => get_the_post_thumbnail_url( $values['product_id'] ), 361 ]; 362 } 363 364 /** 365 * @param $values 366 * @return array 367 */ 368 private function awc_get_current_product( $values ) 369 { 370 $product = wc_get_product( $values['product_id'] ); 371 372 if (empty($values['variation_id']) && count($values['variation']) == 0) { 373 return $this->awc_get_information_product( $product, $values ); 374 } 375 376 return $this->awc_get_information_product_variation( $product->get_sku(), $values ); 377 378 } 339 379 } -
appmax-woocommerce/trunk/includes/class-awc-webhook-post.php
r2421485 r2468156 286 286 foreach ($bundle['products'] as $product) { 287 287 288 $product_woo_commerce = $this->awc_get_product_by_sku( $ product['sku']);288 $product_woo_commerce = $this->awc_get_product_by_sku( $this->awc_verify_sku_variation( $product['sku'] ) ); 289 289 290 290 if ( $product_woo_commerce ) { … … 330 330 } 331 331 332 private function awc_verify_sku_variation( $sku ) 333 { 334 if (preg_match("/__/i", $sku)) { 335 list($parent, $children) = explode("__", $sku); 336 return $children; 337 } 338 339 return $sku; 340 } 341 332 342 private function awc_get_order() 333 343 { -
appmax-woocommerce/trunk/readme.txt
r2421485 r2468156 4 4 Requires at least: 4.0 5 5 Tested up to: 5.1 6 Stable tag: 2.0.3 16 Stable tag: 2.0.32 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 117 117 == Changelog == 118 118 119 = 2.0.32 = 120 121 * Ajustando a rotina que monta os itens do carrinho que são enviados via API. 122 * Tratando produtos do tipo Variável. 123 119 124 = 2.0.31 = 120 125
Note: See TracChangeset
for help on using the changeset viewer.