Changeset 2423337
- Timestamp:
- 11/23/2020 05:27:31 AM (5 years ago)
- Location:
- mobile-builder/trunk
- Files:
-
- 5 edited
-
README.txt (modified) (1 diff)
-
api/class-mobile-builder-products.php (modified) (1 diff)
-
includes/class-mobile-builder.php (modified) (2 diffs)
-
mobile-builder.php (modified) (1 diff)
-
product/class-mobile-builder-product.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
mobile-builder/trunk/README.txt
r2421992 r2423337 40 40 5. Colors config 41 41 6. App settings 42 43 == Changelog == 44 = 1.3.2 = 45 46 * Fixed: get products variations * 42 47 43 48 == Changelog == -
mobile-builder/trunk/api/class-mobile-builder-products.php
r2421992 r2423337 242 242 243 243 /** 244 * @param $product_data 245 * 246 * @return mixed 247 * @since 1.0.0 248 */ 249 public function custom_woocommerce_rest_prepare_product_variation_object( $product_data ) { 250 251 global $woocommerce_wpml; 252 253 if ( ! empty( $woocommerce_wpml->multi_currency ) && ! empty( $woocommerce_wpml->settings['currencies_order'] ) ) { 254 255 $product_data->data['multi-currency-prices'] = array(); 256 257 $custom_prices_on = get_post_meta( $product_data->data['id'], '_wcml_custom_prices_status', true ); 258 259 foreach ( $woocommerce_wpml->settings['currencies_order'] as $currency ) { 260 261 if ( $currency != get_option( 'woocommerce_currency' ) ) { 262 263 if ( $custom_prices_on ) { 264 265 $custom_prices = (array) $woocommerce_wpml->multi_currency->custom_prices->get_product_custom_prices( $product_data->data['id'], 266 $currency ); 267 foreach ( $custom_prices as $key => $price ) { 268 $product_data->data['multi-currency-prices'][ $currency ][ preg_replace( '#^_#', '', 269 $key ) ] = $price; 270 271 } 272 273 } else { 274 $product_data->data['multi-currency-prices'][ $currency ]['regular_price'] = 275 $woocommerce_wpml->multi_currency->prices->raw_price_filter( $product_data->data['regular_price'], 276 $currency ); 277 if ( ! empty( $product_data->data['sale_price'] ) ) { 278 $product_data->data['multi-currency-prices'][ $currency ]['sale_price'] = 279 $woocommerce_wpml->multi_currency->prices->raw_price_filter( $product_data->data['sale_price'], 280 $currency ); 281 } 282 } 283 284 } 285 } 286 287 } 288 289 return $product_data; 290 } 291 292 /** 244 293 * @param $response 245 294 * @param $post -
mobile-builder/trunk/includes/class-mobile-builder.php
r2421992 r2423337 239 239 $this->loader->add_action( 'rest_api_init', $products_api, 'add_api_routes', 10 ); 240 240 $this->loader->add_filter( 'woocommerce_rest_product_object_query', $products_api, 'woocommerce_rest_product_object_query', 10, 2 ); 241 242 241 $this->loader->add_filter( 'woocommerce_rest_prepare_product_object', $products_api, 243 242 'prepare_product_images', 30, 3 ); 243 244 // Product variation 245 $this->loader->add_filter( 'woocommerce_rest_prepare_product_variation_object', $products_api, 246 'custom_woocommerce_rest_prepare_product_variation_object' ); 247 248 $this->loader->add_filter( 'woocommerce_rest_prepare_product_variation_object', $products_api, 249 'prepare_product_variation_images', 10, 3 ); 250 251 // Product Attributes 244 252 $this->loader->add_filter( 'woocommerce_rest_prepare_product_attribute', $products_api, 245 253 'custom_woocommerce_rest_prepare_product_attribute', 10, 3 ); … … 311 319 $this->loader->add_action( 'rest_api_init', $plugin_product, 'add_api_routes' ); 312 320 313 // Product variation314 $this->loader->add_filter( 'woocommerce_rest_prepare_product_variation_object', $plugin_product,315 'custom_woocommerce_rest_prepare_product_variation_object' );316 317 $this->loader->add_filter( 'woocommerce_rest_prepare_product_variation_object', $plugin_product,318 'prepare_product_variation_images', 10, 3 );319 320 321 // Product 321 322 $this->loader->add_filter( 'woocommerce_rest_prepare_product_object', $plugin_product, -
mobile-builder/trunk/mobile-builder.php
r2421992 r2423337 11 11 * Plugin URI: https://doc-oreo.rnlab.io 12 12 * Description: The most advanced drag & drop app builder. Create multi templates and app controls. 13 * Version: 1.3. 113 * Version: 1.3.2 14 14 * Author: Rnlab.io 15 15 * Author URI: https://rnlab.io -
mobile-builder/trunk/product/class-mobile-builder-product.php
r2421992 r2423337 283 283 return wp_specialchars_decode( $title ); 284 284 } 285 286 /**287 * @param $product_data288 *289 * @return mixed290 * @since 1.0.0291 */292 public function custom_woocommerce_rest_prepare_product_variation_object( $product_data ) {293 294 global $woocommerce_wpml;295 296 if ( ! empty( $woocommerce_wpml->multi_currency ) && ! empty( $woocommerce_wpml->settings['currencies_order'] ) ) {297 298 $product_data->data['multi-currency-prices'] = array();299 300 $custom_prices_on = get_post_meta( $product_data->data['id'], '_wcml_custom_prices_status', true );301 302 foreach ( $woocommerce_wpml->settings['currencies_order'] as $currency ) {303 304 if ( $currency != get_option( 'woocommerce_currency' ) ) {305 306 if ( $custom_prices_on ) {307 308 $custom_prices = (array) $woocommerce_wpml->multi_currency->custom_prices->get_product_custom_prices( $product_data->data['id'],309 $currency );310 foreach ( $custom_prices as $key => $price ) {311 $product_data->data['multi-currency-prices'][ $currency ][ preg_replace( '#^_#', '',312 $key ) ] = $price;313 314 }315 316 } else {317 $product_data->data['multi-currency-prices'][ $currency ]['regular_price'] =318 $woocommerce_wpml->multi_currency->prices->raw_price_filter( $product_data->data['regular_price'],319 $currency );320 if ( ! empty( $product_data->data['sale_price'] ) ) {321 $product_data->data['multi-currency-prices'][ $currency ]['sale_price'] =322 $woocommerce_wpml->multi_currency->prices->raw_price_filter( $product_data->data['sale_price'],323 $currency );324 }325 }326 327 }328 }329 330 }331 332 return $product_data;333 }334 285 }
Note: See TracChangeset
for help on using the changeset viewer.