Changeset 3411540
- Timestamp:
- 12/05/2025 12:01:13 AM (4 months ago)
- Location:
- easy-product-bundles-for-woocommerce
- Files:
-
- 12 deleted
- 48 edited
- 1 copied
-
tags/6.13.0 (copied) (copied from easy-product-bundles-for-woocommerce/trunk)
-
tags/6.13.0/assets/css (deleted)
-
tags/6.13.0/assets/js/admin (deleted)
-
tags/6.13.0/assets/js/checkout-integration (deleted)
-
tags/6.13.0/assets/js/product (deleted)
-
tags/6.13.0/assets/js/shared (deleted)
-
tags/6.13.0/easy-product-bundles.php (modified) (3 diffs)
-
tags/6.13.0/languages/asnp-easy-product-bundles-ar-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
tags/6.13.0/languages/asnp-easy-product-bundles-bg_BG-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
tags/6.13.0/languages/asnp-easy-product-bundles-da_DK-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
tags/6.13.0/languages/asnp-easy-product-bundles-de_DE.mo (modified) (previous)
-
tags/6.13.0/languages/asnp-easy-product-bundles-de_DE.po (modified) (2 diffs)
-
tags/6.13.0/languages/asnp-easy-product-bundles-es_ES.mo (modified) (previous)
-
tags/6.13.0/languages/asnp-easy-product-bundles-es_ES.po (modified) (2 diffs)
-
tags/6.13.0/languages/asnp-easy-product-bundles-fa_IR-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
tags/6.13.0/languages/asnp-easy-product-bundles-fr_FR.mo (modified) (previous)
-
tags/6.13.0/languages/asnp-easy-product-bundles-fr_FR.po (modified) (3 diffs)
-
tags/6.13.0/languages/asnp-easy-product-bundles-he_IL-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
tags/6.13.0/languages/asnp-easy-product-bundles-hi_IN-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
tags/6.13.0/languages/asnp-easy-product-bundles-it_IT-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
tags/6.13.0/languages/asnp-easy-product-bundles-ja-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
tags/6.13.0/languages/asnp-easy-product-bundles-nl_NL-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
tags/6.13.0/languages/asnp-easy-product-bundles-pl_PL-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
tags/6.13.0/languages/asnp-easy-product-bundles-pt_PT-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
tags/6.13.0/languages/asnp-easy-product-bundles-ru_RU-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
tags/6.13.0/languages/asnp-easy-product-bundles-tr_TR-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
tags/6.13.0/languages/asnp-easy-product-bundles-zh_CN-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
tags/6.13.0/readme.txt (modified) (2 diffs)
-
tags/6.13.0/src/Admin/ProductBundle.php (modified) (1 diff)
-
tags/6.13.0/src/Helpers.php (modified) (32 diffs)
-
tags/6.13.0/vendor (deleted)
-
trunk/assets/css (deleted)
-
trunk/assets/js/admin (deleted)
-
trunk/assets/js/checkout-integration (deleted)
-
trunk/assets/js/product (deleted)
-
trunk/assets/js/shared (deleted)
-
trunk/easy-product-bundles.php (modified) (3 diffs)
-
trunk/languages/asnp-easy-product-bundles-ar-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
trunk/languages/asnp-easy-product-bundles-bg_BG-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
trunk/languages/asnp-easy-product-bundles-da_DK-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
trunk/languages/asnp-easy-product-bundles-de_DE.mo (modified) (previous)
-
trunk/languages/asnp-easy-product-bundles-de_DE.po (modified) (2 diffs)
-
trunk/languages/asnp-easy-product-bundles-es_ES.mo (modified) (previous)
-
trunk/languages/asnp-easy-product-bundles-es_ES.po (modified) (2 diffs)
-
trunk/languages/asnp-easy-product-bundles-fa_IR-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
trunk/languages/asnp-easy-product-bundles-fr_FR.mo (modified) (previous)
-
trunk/languages/asnp-easy-product-bundles-fr_FR.po (modified) (3 diffs)
-
trunk/languages/asnp-easy-product-bundles-he_IL-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
trunk/languages/asnp-easy-product-bundles-hi_IN-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
trunk/languages/asnp-easy-product-bundles-it_IT-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
trunk/languages/asnp-easy-product-bundles-ja-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
trunk/languages/asnp-easy-product-bundles-nl_NL-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
trunk/languages/asnp-easy-product-bundles-pl_PL-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
trunk/languages/asnp-easy-product-bundles-pt_PT-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
trunk/languages/asnp-easy-product-bundles-ru_RU-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
trunk/languages/asnp-easy-product-bundles-tr_TR-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
trunk/languages/asnp-easy-product-bundles-zh_CN-4ce3ef1d11b207f3bd5f8d6dd391062e.json (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/Admin/ProductBundle.php (modified) (1 diff)
-
trunk/src/Helpers.php (modified) (32 diffs)
-
trunk/vendor (deleted)
Legend:
- Unmodified
- Added
- Removed
-
easy-product-bundles-for-woocommerce/tags/6.13.0/easy-product-bundles.php
r3406359 r3411540 7 7 * Description: Create product bundles in WooCommerce easily 8 8 * Tags: woocommerce, product bundles, bundled products 9 * Version: 6.1 2.39 * Version: 6.13.0 10 10 * Author: Product Bundles Team 11 11 * Author URI: https://www.asanaplugins.com/ … … 14 14 * Domain Path: /languages 15 15 * WC requires at least: 3.0 16 * WC tested up to: 10.3. 516 * WC tested up to: 10.3.6 17 17 * 18 18 * Copyright 2025 Asana Plugins (https://www.asanaplugins.com/) … … 25 25 // Plugin version. 26 26 if ( ! defined( 'ASNP_WEPB_VERSION' ) ) { 27 define( 'ASNP_WEPB_VERSION', '6.1 2.3' );27 define( 'ASNP_WEPB_VERSION', '6.13.0' ); 28 28 } 29 29 -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-ar-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 196 196 "Change the button label shown for bundle products in the shop page.": [ 197 197 "غيّر تسمية الزر المعروضة لمنتجات الحزمة في صفحة المتجر." 198 ] 198 ], 199 "None": [ "لا شيء" ] 199 200 } 200 201 } -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-bg_BG-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 211 211 "Change the button label shown for bundle products in the shop page.": [ 212 212 "Променете етикета на бутона, показан за пакетни продукти в страницата на магазина." 213 ] 213 ], 214 "None": [ "Няма" ] 214 215 } 215 216 } -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-da_DK-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 199 199 "Change the button label shown for bundle products in the shop page.": [ 200 200 "Ændr knapetiketten, der vises for pakkeprodukter på butikssiden." 201 ] 201 ], 202 "None": [ "Ingen" ] 202 203 } 203 204 } -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-de_DE.po
r3393297 r3411540 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/easy-product-bundles-for-woocommerce\n" 7 7 "POT-Creation-Date: 2025-09-09T20:02:22+00:00\n" 8 "PO-Revision-Date: 2025-1 0-03 15:24+0330\n"8 "PO-Revision-Date: 2025-12-04 23:32+0330\n" 9 9 "Last-Translator: \n" 10 10 "Language-Team: \n" … … 353 353 msgstr "Nach den Produkt Meta" 354 354 355 #: assets/js/admin/admin/index.js:2 355 #: assets/js/admin/admin/index.js:2 assets/js/admin/product/index.js:2 356 356 msgid "None" 357 357 msgstr "Keine" -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-es_ES.po
r3393297 r3411540 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/easy-product-bundles-for-woocommerce\n" 7 7 "POT-Creation-Date: 2025-09-10T21:42:35+00:00\n" 8 "PO-Revision-Date: 2025-1 0-03 15:22+0330\n"8 "PO-Revision-Date: 2025-12-04 23:36+0330\n" 9 9 "Last-Translator: \n" 10 10 "Language-Team: \n" … … 362 362 msgstr "Después de los metadatos del producto" 363 363 364 #: assets/js/admin/admin/index.js:2 364 #: assets/js/admin/admin/index.js:2 assets/js/admin/product/index.js:2 365 365 msgid "None" 366 366 msgstr "Ninguno" -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-fa_IR-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 202 202 "Change the button label shown for bundle products in the shop page.": [ 203 203 "برچسب دکمه نمایش دادهشده برای محصولات بسته در صفحه فروشگاه را تغییر دهید." 204 ] 204 ], 205 "None": [ "هیچکدام" ] 205 206 } 206 207 } -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-fr_FR.po
r3393297 r3411540 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/easy-product-bundles-for-woocommerce\n" 7 7 "POT-Creation-Date: 2025-09-09T20:02:22+00:00\n" 8 "PO-Revision-Date: 2025-1 0-03 15:23+0330\n"8 "PO-Revision-Date: 2025-12-04 23:31+0330\n" 9 9 "Last-Translator: \n" 10 10 "Language-Team: \n" … … 364 364 msgstr "Après les méta du produit" 365 365 366 #: assets/js/admin/admin/index.js:2 366 #: assets/js/admin/admin/index.js:2 assets/js/admin/product/index.js:2 367 367 msgid "None" 368 368 msgstr "Aucun" … … 1458 1458 msgid "This option allows you to show or hide the product search field in the popup window." 1459 1459 msgstr "Cette option vous permet d’afficher ou de masquer le champ de recherche de produit dans la fenêtre contextuelle." 1460 -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-he_IL-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 191 191 "Change the button label shown for bundle products in the shop page.": [ 192 192 "שנה את תווית הכפתור המוצגת עבור מוצרי חבילה בדף החנות." 193 ] 193 ], 194 "None": [ "אין" ] 194 195 } 195 196 } -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-hi_IN-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 195 195 "Change the button label shown for bundle products in the shop page.": [ 196 196 "शॉप पेज पर बंडल उत्पादों के लिए दिखाए जाने वाले बटन लेबल को बदलें।" 197 ] 197 ], 198 "None": [ "कोई नहीं" ] 198 199 } 199 200 } -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-it_IT-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 210 210 "Change the button label shown for bundle products in the shop page.": [ 211 211 "Modifica l'etichetta del pulsante mostrata per i prodotti pacchetto nella pagina del negozio." 212 ] 212 ], 213 "None": [ "Nessuno" ] 213 214 } 214 215 } -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-ja-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 195 195 "Change the button label shown for bundle products in the shop page.": [ 196 196 "ショップページで表示されるバンドル商品のボタンラベルを変更します。" 197 ] 197 ], 198 "None": [ "なし" ] 198 199 } 199 200 } -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-nl_NL-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 207 207 "Change the button label shown for bundle products in the shop page.": [ 208 208 "Wijzig het knoplabel dat wordt weergegeven voor bundelproducten op de winkelpagina." 209 ] 209 ], 210 "None": [ "Geen" ] 210 211 } 211 212 } -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-pl_PL-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 202 202 "Change the button label shown for bundle products in the shop page.": [ 203 203 "Zmień etykietę przycisku wyświetlaną dla produktów pakietowych na stronie sklepu." 204 ] 204 ], 205 "None": [ "Żaden" ] 205 206 } 206 207 } -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-pt_PT-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 202 202 "Change the button label shown for bundle products in the shop page.": [ 203 203 "Altere a etiqueta do botão exibida para produtos em pacote na página da loja." 204 ] 204 ], 205 "None": [ "Nenhum" ] 205 206 } 206 207 } -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-ru_RU-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 210 210 "Change the button label shown for bundle products in the shop page.": [ 211 211 "Измените подпись кнопки, отображаемую для комплектных товаров на странице магазина." 212 ] 212 ], 213 "None": [ "Никакой" ] 213 214 } 214 215 } -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-tr_TR-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 205 205 "Change the button label shown for bundle products in the shop page.": [ 206 206 "Mağaza sayfasında paket ürünleri için gösterilen düğme etiketini değiştir." 207 ] 207 ], 208 "None": [ "Hiçbiri" ] 208 209 } 209 210 } -
easy-product-bundles-for-woocommerce/tags/6.13.0/languages/asnp-easy-product-bundles-zh_CN-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 184 184 "Change the button label shown for bundle products in the shop page.": [ 185 185 "更改商店页面中显示的套餐产品按钮标签。" 186 ] 186 ], 187 "None": [ "无" ] 187 188 } 188 189 } -
easy-product-bundles-for-woocommerce/tags/6.13.0/readme.txt
r3406359 r3411540 4 4 Tags: woocommerce product bundle, woocommerce bundle, product bundle woocommerce, composite product, wpc product bundles for woocommerce, yith woocommerce product bundles, woocommerce product bundles free, wpc product bundles, yith product bundles, custom product boxes woocommerce, woocommerce bundle plugin, woocommerce composite products, woocommerce, wordpress, ecommerce 5 5 Requires at least: 5.0 6 Tested up to: 6. 86 Tested up to: 6.9 7 7 Requires PHP: 5.6 8 Stable tag: 6.1 2.38 Stable tag: 6.13.0 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 216 216 == Changelog == 217 217 218 = 6.13.0 = 219 * New: Introduced a None option for discount types. 220 * Ensured compatibility with WordPress version 6.9 221 * Ensured compatibility with WooCommerce version 10.3.6 222 218 223 = 6.12.3 = 219 224 * Fix: Resolved an issue that occurred when creating bundles with a large number of items. -
easy-product-bundles-for-woocommerce/tags/6.13.0/src/Admin/ProductBundle.php
r3406359 r3411540 188 188 'query_relation' => 'OR', 189 189 'edit_quantity' => 'false', 190 'discount_type' => ' percentage',190 'discount_type' => 'none', 191 191 'discount' => '', 192 192 'product' => '', -
easy-product-bundles-for-woocommerce/tags/6.13.0/src/Helpers.php
r3378492 r3411540 46 46 if ( $product->get_image_id() ) { 47 47 $image = wp_get_attachment_image_src( $product->get_image_id(), $size ); 48 $src = ! empty( $image ) && ! empty( $image[0] ) ? $image[0] : '';48 $src = ! empty( $image ) && ! empty( $image[0] ) ? $image[0] : ''; 49 49 } elseif ( $product->get_parent_id() ) { 50 50 $parent_product = wc_get_product( $product->get_parent_id() ); … … 56 56 if ( empty( $src ) && $placeholder ) { 57 57 $image = wc_placeholder_img_src( $size ); 58 $src = ! empty( $image ) && ! empty( $image[0] ) ? $image[0] : '';58 $src = ! empty( $image ) && ! empty( $image[0] ) ? $image[0] : ''; 59 59 } 60 60 … … 74 74 if ( 75 75 ! empty( $item['discount_type'] ) && 76 'none' !== $item['discount_type'] && 76 77 isset( $item['discount'] ) && 77 78 '' !== $item['discount'] && … … 171 172 172 173 $regular_price = '' !== $product->get_regular_price() ? wc_get_price_to_display( $product, [ 'price' => $product->get_regular_price() ] ) : ''; 173 $sale_price = '' !== $product->get_sale_price() && $product->is_on_sale() ? $product->get_sale_price() : '';174 $sale_price = '' !== $product->get_sale_price() && $product->is_on_sale() ? $product->get_sale_price() : ''; 174 175 if ( 175 176 ! empty( $item['discount_type'] ) && 177 'none' !== $item['discount_type'] && 176 178 isset( $item['discount'] ) && 177 179 '' !== $item['discount'] && … … 196 198 [ 197 199 'regular_price' => $regular_price, 198 'sale_price' => $sale_price,200 'sale_price' => $sale_price, 199 201 'display_price' => $display_price, 200 202 ], … … 211 213 212 214 $data = array( 213 'id' => $product->get_id(),214 'image' => get_product_image_src( $product ),215 'id' => $product->get_id(), 216 'image' => get_product_image_src( $product ), 215 217 'is_variable' => $product->is_type( 'variable' ) ? 'true' : 'false', 216 218 'is_in_stock' => $product->is_in_stock() ? 'true' : 'false', 217 'link' => $product->get_permalink(),218 'max_qty' => 0 < $product->get_max_purchase_quantity() ? $product->get_max_purchase_quantity() : '',219 'min_qty' => $product->get_min_purchase_quantity(),219 'link' => $product->get_permalink(), 220 'max_qty' => 0 < $product->get_max_purchase_quantity() ? $product->get_max_purchase_quantity() : '', 221 'min_qty' => $product->get_min_purchase_quantity(), 220 222 ); 221 223 … … 267 269 268 270 $variation = is_numeric( $variation ) ? wc_get_product( $variation ) : $variation; 269 $variable = is_null( $variable ) ? $variation->get_parent_id() : $variable;270 $variable = is_numeric( $variable ) ? wc_get_product( $variable ) : $variable;271 $variable = is_null( $variable ) ? $variation->get_parent_id() : $variable; 272 $variable = is_numeric( $variable ) ? wc_get_product( $variable ) : $variable; 271 273 if ( $variable->get_id() !== $variation->get_parent_id() ) { 272 274 return array(); 273 275 } 274 276 275 $products = [];277 $products = []; 276 278 $variation_attributes = $variation->get_variation_attributes( false ); 277 $any_attributes = get_any_value_attributes( $variation_attributes );278 $extra_data = [ 'attributes' => [] ];279 $any_attributes = get_any_value_attributes( $variation_attributes ); 280 $extra_data = [ 'attributes' => [] ]; 279 281 if ( empty( $any_attributes ) ) { 280 282 if ( ! empty( $variation_attributes ) ) { … … 283 285 [ 284 286 'attribute' => $key, 285 'value' => $attribute,286 'by' => 'slug'287 'value' => $attribute, 288 'by' => 'slug' 287 289 ] 288 290 ); … … 301 303 ! empty( $attributes[ $any_attributes[ $i ] ]['is_variation'] ) 302 304 ) { 303 $any_values[] = $attributes[ $any_attributes[ $i ] ]['options'];305 $any_values[] = $attributes[ $any_attributes[ $i ] ]['options']; 304 306 $any_attributes[ $i ] = $attributes[ $any_attributes[ $i ] ]['name']; 305 307 } … … 321 323 [ 322 324 'attribute' => $key, 323 'value' => $attribute,324 'by' => 'slug'325 'value' => $attribute, 326 'by' => 'slug' 325 327 ] 326 328 ); … … 335 337 [ 336 338 'attribute' => $any_attributes[ $j ], 337 'value' => $any_values[ $i ][ $j ],338 'by' => 'id'339 'value' => $any_values[ $i ][ $j ], 340 'by' => 'id' 339 341 ] 340 342 ); … … 347 349 [ 348 350 'attribute' => $any_attributes[0], 349 'value' => $any_values[ $i ],350 'by' => 'id'351 'value' => $any_values[ $i ], 352 'by' => 'id' 351 353 ] 352 354 ); … … 367 369 apply_filters( 'asnp_wepb_get_variation_attribute_options_args', $args ), 368 370 array( 369 'options' => false,371 'options' => false, 370 372 'attribute' => false, 371 'product' => false,373 'product' => false, 372 374 ) 373 375 ); 374 376 375 $options = $args['options'];376 $product = $args['product'];377 $options = $args['options']; 378 $product = $args['product']; 377 379 $attribute = $args['attribute']; 378 380 379 381 if ( empty( $options ) && ! empty( $product ) && ! empty( $attribute ) ) { 380 382 $attributes = $product->get_variation_attributes(); 381 $options = $attributes[ $attribute ];383 $options = $attributes[ $attribute ]; 382 384 } 383 385 … … 398 400 if ( in_array( $term->slug, $options, true ) ) { 399 401 $select_options[] = [ 400 'name' => sanitize_text_field( apply_filters( 'woocommerce_variation_option_name', $term->name, $term, $attribute, $product ) ),402 'name' => sanitize_text_field( apply_filters( 'woocommerce_variation_option_name', $term->name, $term, $attribute, $product ) ), 401 403 'value' => esc_attr( $term->slug ), 402 404 ]; … … 407 409 // This handles < 2.4.0 bw compatibility where text attributes were not sanitized. 408 410 $select_options[] = [ 409 'name' => sanitize_text_field( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute, $product ) ),411 'name' => sanitize_text_field( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute, $product ) ), 410 412 'value' => esc_attr( $option ), 411 413 ]; … … 451 453 } 452 454 453 $defaults = [ 'variation'];454 $types = array_merge( array_keys( wc_get_product_types() ) );455 $defaults = [ 'variation' ]; 456 $types = array_merge( array_keys( wc_get_product_types() ) ); 455 457 if ( empty( $types ) ) { 456 458 if ( ! empty( $excludes ) ) { … … 523 525 if ( ! is_wp_error( $term ) && is_object( $term ) && $term->term_id ) { 524 526 return [ 525 'name' => $args['attribute'],526 'id' => $args['attribute'],527 'name' => $args['attribute'], 528 'id' => $args['attribute'], 527 529 'label' => $term->name, 528 530 'value' => $term->slug, … … 533 535 534 536 return [ 535 'name' => $args['attribute'],536 'id' => $args['attribute'],537 'name' => $args['attribute'], 538 'id' => $args['attribute'], 537 539 'label' => $args['value'], 538 540 'value' => $args['value'], … … 541 543 542 544 function combinations( $arrays, $i = 0 ) { 543 if ( ! isset( $arrays[$i] ) ) {544 return array();545 }546 if ( $i == count( $arrays ) - 1 ) {547 return $arrays[$i];548 }549 550 // get combinations from subsequent arrays551 $tmp = combinations( $arrays, $i + 1 );552 553 $result = array();554 555 // concat each array from tmp with each element from $arrays[$i]556 foreach ( $arrays[ $i ] as $v ) {557 foreach ( $tmp as $t ) {558 $result[] = is_array( $t ) ?559 array_merge( array( $v ), $t ) :560 array( $v, $t );561 }562 }563 564 return $result;545 if ( ! isset( $arrays[ $i ] ) ) { 546 return array(); 547 } 548 if ( $i == count( $arrays ) - 1 ) { 549 return $arrays[ $i ]; 550 } 551 552 // get combinations from subsequent arrays 553 $tmp = combinations( $arrays, $i + 1 ); 554 555 $result = array(); 556 557 // concat each array from tmp with each element from $arrays[$i] 558 foreach ( $arrays[ $i ] as $v ) { 559 foreach ( $tmp as $t ) { 560 $result[] = is_array( $t ) ? 561 array_merge( array( $v ), $t ) : 562 array( $v, $t ); 563 } 564 } 565 566 return $result; 565 567 } 566 568 … … 572 574 if ( is_json( $items ) ) { 573 575 $items = json_decode( $items, true ); 574 return array_map( function ( $item ) {576 return array_map( function ( $item ) { 575 577 return isset( $item['id'] ) ? $item['id'] : 0; 576 578 }, $items ); … … 579 581 $items = is_string( $items ) ? explode( ',', $items ) : $items; 580 582 581 return array_map( function ( $item ) {583 return array_map( function ( $item ) { 582 584 $item = explode( ':', $item ); 583 585 if ( 1 < count( $item ) && is_numeric( $item[0] ) ) { … … 595 597 if ( is_json( $items ) ) { 596 598 $items = json_decode( $items, true ); 597 return array_map( function ( $item ) {599 return array_map( function ( $item ) { 598 600 return isset( $item['qty'] ) ? absint( $item['qty'] ) : 0; 599 601 }, $items ); … … 602 604 $items = is_string( $items ) ? explode( ',', $items ) : $items; 603 605 604 return array_map( function ( $item ) {606 return array_map( function ( $item ) { 605 607 $item = explode( ':', $item ); 606 608 if ( 1 < count( $item ) && is_numeric( $item[1] ) ) { … … 618 620 if ( is_json( $items ) ) { 619 621 $items = json_decode( $items, true ); 620 return array_map( function ( $item ) {622 return array_map( function ( $item ) { 621 623 $attributes = []; 622 624 if ( ! empty( $item['attributes'] ) ) { … … 642 644 if ( 2 < count( $item ) ) { 643 645 $attributes = []; 644 array_map( function ( $value ) use ( &$attributes ) {646 array_map( function ( $value ) use ( &$attributes ) { 645 647 $value = explode( '=', $value ); 646 648 if ( 1 < count( $value ) ) { … … 668 670 ( ! isset( $args['is_fixed_price'] ) || ! $args['is_fixed_price'] ) && 669 671 ! empty( $args['discount_type'] ) && 672 'none' !== $args['discount_type'] && 670 673 isset( $args['discount'] ) && 671 674 '' !== $args['discount'] && … … 759 762 } 760 763 761 $model = get_plugin()->container()->get( SimpleBundleItemsModel::class );764 $model = get_plugin()->container()->get( SimpleBundleItemsModel::class); 762 765 $items = $model->get_bundle( $product->get_id() ); 763 766 if ( empty( $items ) ) { 764 $quantities = get_quantities_from_bundle_items( $default_products );767 $quantities = get_quantities_from_bundle_items( $default_products ); 765 768 $default_products = get_product_ids_from_bundle_items( $default_products ); 766 769 if ( count( $default_products ) === count( $quantities ) ) { 767 770 for ( $i = 0; $i < count( $default_products ); $i++ ) { 768 771 $model->add( [ 769 'bundle_id' => $product->get_id(),772 'bundle_id' => $product->get_id(), 770 773 'product_id' => (int) $default_products[ $i ], 771 'quantity' => (int) $quantities[ $i ],774 'quantity' => (int) $quantities[ $i ], 772 775 ] ); 773 776 } … … 785 788 786 789 $handles = array( 787 'react' => array( '17.0.2', array() ),788 'react-dom' => array( '17.0.2', array( 'react' ) ),789 'wp-i18n' => array( '6.0', array() ),790 'wp-hooks' => array( '6.0', array() ),790 'react' => array( '17.0.2', array() ), 791 'react-dom' => array( '17.0.2', array( 'react' ) ), 792 'wp-i18n' => array( '6.0', array() ), 793 'wp-hooks' => array( '6.0', array() ), 791 794 'wp-api-fetch' => array( '6.0', array() ), 792 795 ); … … 812 815 function added_product_bundle_type() { 813 816 $ids = Products\get_products( [ 814 'type' => Plugin::PRODUCT_TYPE,817 'type' => Plugin::PRODUCT_TYPE, 815 818 'return' => 'ids', 816 819 ] ); … … 874 877 function is_json( $string ) { 875 878 // Check if the string is empty or not a string 876 if ( ! is_string( $string ) || empty( trim( $string ) ) ) {877 return false;878 }879 880 // Check if string starts with either { or [881 if ( ! in_array( $string[0], [ '{', '[' ] ) ) {882 return false;883 }884 885 // Attempt to decode886 json_decode( $string );887 888 return ( json_last_error() === JSON_ERROR_NONE );879 if ( ! is_string( $string ) || empty( trim( $string ) ) ) { 880 return false; 881 } 882 883 // Check if string starts with either { or [ 884 if ( ! in_array( $string[0], [ '{', '[' ] ) ) { 885 return false; 886 } 887 888 // Attempt to decode 889 json_decode( $string ); 890 891 return ( json_last_error() === JSON_ERROR_NONE ); 889 892 } 890 893 … … 899 902 900 903 $items = explode( ',', $items ); 901 $items = array_map( function ( $item ) {904 $items = array_map( function ( $item ) { 902 905 $item = explode( ':', $item ); 903 906 if ( 3 === count( $item ) ) { 904 907 $attributes = explode( '&', $item[2] ); 905 $attributes = array_reduce( $attributes, function ( $carry, $attribute ) {908 $attributes = array_reduce( $attributes, function ( $carry, $attribute ) { 906 909 $attribute = explode( '=', $attribute ); 907 910 $carry[ $attribute[0] ] = $attribute[1]; … … 910 913 911 914 return [ 912 'id' => absint( $item[0] ),913 'qty' => ! empty( $item[1] ) ? absint( $item[1] ) : 0,915 'id' => absint( $item[0] ), 916 'qty' => ! empty( $item[1] ) ? absint( $item[1] ) : 0, 914 917 'attributes' => $attributes, 915 918 ]; 916 919 } 917 920 return [ 918 'id' => absint( $item[0] ),921 'id' => absint( $item[0] ), 919 922 'qty' => ! empty( $item[1] ) ? absint( $item[1] ) : 0, 920 923 ]; -
easy-product-bundles-for-woocommerce/trunk/easy-product-bundles.php
r3406359 r3411540 7 7 * Description: Create product bundles in WooCommerce easily 8 8 * Tags: woocommerce, product bundles, bundled products 9 * Version: 6.1 2.39 * Version: 6.13.0 10 10 * Author: Product Bundles Team 11 11 * Author URI: https://www.asanaplugins.com/ … … 14 14 * Domain Path: /languages 15 15 * WC requires at least: 3.0 16 * WC tested up to: 10.3. 516 * WC tested up to: 10.3.6 17 17 * 18 18 * Copyright 2025 Asana Plugins (https://www.asanaplugins.com/) … … 25 25 // Plugin version. 26 26 if ( ! defined( 'ASNP_WEPB_VERSION' ) ) { 27 define( 'ASNP_WEPB_VERSION', '6.1 2.3' );27 define( 'ASNP_WEPB_VERSION', '6.13.0' ); 28 28 } 29 29 -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-ar-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 196 196 "Change the button label shown for bundle products in the shop page.": [ 197 197 "غيّر تسمية الزر المعروضة لمنتجات الحزمة في صفحة المتجر." 198 ] 198 ], 199 "None": [ "لا شيء" ] 199 200 } 200 201 } -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-bg_BG-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 211 211 "Change the button label shown for bundle products in the shop page.": [ 212 212 "Променете етикета на бутона, показан за пакетни продукти в страницата на магазина." 213 ] 213 ], 214 "None": [ "Няма" ] 214 215 } 215 216 } -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-da_DK-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 199 199 "Change the button label shown for bundle products in the shop page.": [ 200 200 "Ændr knapetiketten, der vises for pakkeprodukter på butikssiden." 201 ] 201 ], 202 "None": [ "Ingen" ] 202 203 } 203 204 } -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-de_DE.po
r3393297 r3411540 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/easy-product-bundles-for-woocommerce\n" 7 7 "POT-Creation-Date: 2025-09-09T20:02:22+00:00\n" 8 "PO-Revision-Date: 2025-1 0-03 15:24+0330\n"8 "PO-Revision-Date: 2025-12-04 23:32+0330\n" 9 9 "Last-Translator: \n" 10 10 "Language-Team: \n" … … 353 353 msgstr "Nach den Produkt Meta" 354 354 355 #: assets/js/admin/admin/index.js:2 355 #: assets/js/admin/admin/index.js:2 assets/js/admin/product/index.js:2 356 356 msgid "None" 357 357 msgstr "Keine" -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-es_ES.po
r3393297 r3411540 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/easy-product-bundles-for-woocommerce\n" 7 7 "POT-Creation-Date: 2025-09-10T21:42:35+00:00\n" 8 "PO-Revision-Date: 2025-1 0-03 15:22+0330\n"8 "PO-Revision-Date: 2025-12-04 23:36+0330\n" 9 9 "Last-Translator: \n" 10 10 "Language-Team: \n" … … 362 362 msgstr "Después de los metadatos del producto" 363 363 364 #: assets/js/admin/admin/index.js:2 364 #: assets/js/admin/admin/index.js:2 assets/js/admin/product/index.js:2 365 365 msgid "None" 366 366 msgstr "Ninguno" -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-fa_IR-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 202 202 "Change the button label shown for bundle products in the shop page.": [ 203 203 "برچسب دکمه نمایش دادهشده برای محصولات بسته در صفحه فروشگاه را تغییر دهید." 204 ] 204 ], 205 "None": [ "هیچکدام" ] 205 206 } 206 207 } -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-fr_FR.po
r3393297 r3411540 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/easy-product-bundles-for-woocommerce\n" 7 7 "POT-Creation-Date: 2025-09-09T20:02:22+00:00\n" 8 "PO-Revision-Date: 2025-1 0-03 15:23+0330\n"8 "PO-Revision-Date: 2025-12-04 23:31+0330\n" 9 9 "Last-Translator: \n" 10 10 "Language-Team: \n" … … 364 364 msgstr "Après les méta du produit" 365 365 366 #: assets/js/admin/admin/index.js:2 366 #: assets/js/admin/admin/index.js:2 assets/js/admin/product/index.js:2 367 367 msgid "None" 368 368 msgstr "Aucun" … … 1458 1458 msgid "This option allows you to show or hide the product search field in the popup window." 1459 1459 msgstr "Cette option vous permet d’afficher ou de masquer le champ de recherche de produit dans la fenêtre contextuelle." 1460 -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-he_IL-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 191 191 "Change the button label shown for bundle products in the shop page.": [ 192 192 "שנה את תווית הכפתור המוצגת עבור מוצרי חבילה בדף החנות." 193 ] 193 ], 194 "None": [ "אין" ] 194 195 } 195 196 } -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-hi_IN-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 195 195 "Change the button label shown for bundle products in the shop page.": [ 196 196 "शॉप पेज पर बंडल उत्पादों के लिए दिखाए जाने वाले बटन लेबल को बदलें।" 197 ] 197 ], 198 "None": [ "कोई नहीं" ] 198 199 } 199 200 } -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-it_IT-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 210 210 "Change the button label shown for bundle products in the shop page.": [ 211 211 "Modifica l'etichetta del pulsante mostrata per i prodotti pacchetto nella pagina del negozio." 212 ] 212 ], 213 "None": [ "Nessuno" ] 213 214 } 214 215 } -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-ja-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 195 195 "Change the button label shown for bundle products in the shop page.": [ 196 196 "ショップページで表示されるバンドル商品のボタンラベルを変更します。" 197 ] 197 ], 198 "None": [ "なし" ] 198 199 } 199 200 } -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-nl_NL-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 207 207 "Change the button label shown for bundle products in the shop page.": [ 208 208 "Wijzig het knoplabel dat wordt weergegeven voor bundelproducten op de winkelpagina." 209 ] 209 ], 210 "None": [ "Geen" ] 210 211 } 211 212 } -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-pl_PL-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 202 202 "Change the button label shown for bundle products in the shop page.": [ 203 203 "Zmień etykietę przycisku wyświetlaną dla produktów pakietowych na stronie sklepu." 204 ] 204 ], 205 "None": [ "Żaden" ] 205 206 } 206 207 } -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-pt_PT-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 202 202 "Change the button label shown for bundle products in the shop page.": [ 203 203 "Altere a etiqueta do botão exibida para produtos em pacote na página da loja." 204 ] 204 ], 205 "None": [ "Nenhum" ] 205 206 } 206 207 } -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-ru_RU-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 210 210 "Change the button label shown for bundle products in the shop page.": [ 211 211 "Измените подпись кнопки, отображаемую для комплектных товаров на странице магазина." 212 ] 212 ], 213 "None": [ "Никакой" ] 213 214 } 214 215 } -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-tr_TR-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 205 205 "Change the button label shown for bundle products in the shop page.": [ 206 206 "Mağaza sayfasında paket ürünleri için gösterilen düğme etiketini değiştir." 207 ] 207 ], 208 "None": [ "Hiçbiri" ] 208 209 } 209 210 } -
easy-product-bundles-for-woocommerce/trunk/languages/asnp-easy-product-bundles-zh_CN-4ce3ef1d11b207f3bd5f8d6dd391062e.json
r3362820 r3411540 184 184 "Change the button label shown for bundle products in the shop page.": [ 185 185 "更改商店页面中显示的套餐产品按钮标签。" 186 ] 186 ], 187 "None": [ "无" ] 187 188 } 188 189 } -
easy-product-bundles-for-woocommerce/trunk/readme.txt
r3406359 r3411540 4 4 Tags: woocommerce product bundle, woocommerce bundle, product bundle woocommerce, composite product, wpc product bundles for woocommerce, yith woocommerce product bundles, woocommerce product bundles free, wpc product bundles, yith product bundles, custom product boxes woocommerce, woocommerce bundle plugin, woocommerce composite products, woocommerce, wordpress, ecommerce 5 5 Requires at least: 5.0 6 Tested up to: 6. 86 Tested up to: 6.9 7 7 Requires PHP: 5.6 8 Stable tag: 6.1 2.38 Stable tag: 6.13.0 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 216 216 == Changelog == 217 217 218 = 6.13.0 = 219 * New: Introduced a None option for discount types. 220 * Ensured compatibility with WordPress version 6.9 221 * Ensured compatibility with WooCommerce version 10.3.6 222 218 223 = 6.12.3 = 219 224 * Fix: Resolved an issue that occurred when creating bundles with a large number of items. -
easy-product-bundles-for-woocommerce/trunk/src/Admin/ProductBundle.php
r3406359 r3411540 188 188 'query_relation' => 'OR', 189 189 'edit_quantity' => 'false', 190 'discount_type' => ' percentage',190 'discount_type' => 'none', 191 191 'discount' => '', 192 192 'product' => '', -
easy-product-bundles-for-woocommerce/trunk/src/Helpers.php
r3378492 r3411540 46 46 if ( $product->get_image_id() ) { 47 47 $image = wp_get_attachment_image_src( $product->get_image_id(), $size ); 48 $src = ! empty( $image ) && ! empty( $image[0] ) ? $image[0] : '';48 $src = ! empty( $image ) && ! empty( $image[0] ) ? $image[0] : ''; 49 49 } elseif ( $product->get_parent_id() ) { 50 50 $parent_product = wc_get_product( $product->get_parent_id() ); … … 56 56 if ( empty( $src ) && $placeholder ) { 57 57 $image = wc_placeholder_img_src( $size ); 58 $src = ! empty( $image ) && ! empty( $image[0] ) ? $image[0] : '';58 $src = ! empty( $image ) && ! empty( $image[0] ) ? $image[0] : ''; 59 59 } 60 60 … … 74 74 if ( 75 75 ! empty( $item['discount_type'] ) && 76 'none' !== $item['discount_type'] && 76 77 isset( $item['discount'] ) && 77 78 '' !== $item['discount'] && … … 171 172 172 173 $regular_price = '' !== $product->get_regular_price() ? wc_get_price_to_display( $product, [ 'price' => $product->get_regular_price() ] ) : ''; 173 $sale_price = '' !== $product->get_sale_price() && $product->is_on_sale() ? $product->get_sale_price() : '';174 $sale_price = '' !== $product->get_sale_price() && $product->is_on_sale() ? $product->get_sale_price() : ''; 174 175 if ( 175 176 ! empty( $item['discount_type'] ) && 177 'none' !== $item['discount_type'] && 176 178 isset( $item['discount'] ) && 177 179 '' !== $item['discount'] && … … 196 198 [ 197 199 'regular_price' => $regular_price, 198 'sale_price' => $sale_price,200 'sale_price' => $sale_price, 199 201 'display_price' => $display_price, 200 202 ], … … 211 213 212 214 $data = array( 213 'id' => $product->get_id(),214 'image' => get_product_image_src( $product ),215 'id' => $product->get_id(), 216 'image' => get_product_image_src( $product ), 215 217 'is_variable' => $product->is_type( 'variable' ) ? 'true' : 'false', 216 218 'is_in_stock' => $product->is_in_stock() ? 'true' : 'false', 217 'link' => $product->get_permalink(),218 'max_qty' => 0 < $product->get_max_purchase_quantity() ? $product->get_max_purchase_quantity() : '',219 'min_qty' => $product->get_min_purchase_quantity(),219 'link' => $product->get_permalink(), 220 'max_qty' => 0 < $product->get_max_purchase_quantity() ? $product->get_max_purchase_quantity() : '', 221 'min_qty' => $product->get_min_purchase_quantity(), 220 222 ); 221 223 … … 267 269 268 270 $variation = is_numeric( $variation ) ? wc_get_product( $variation ) : $variation; 269 $variable = is_null( $variable ) ? $variation->get_parent_id() : $variable;270 $variable = is_numeric( $variable ) ? wc_get_product( $variable ) : $variable;271 $variable = is_null( $variable ) ? $variation->get_parent_id() : $variable; 272 $variable = is_numeric( $variable ) ? wc_get_product( $variable ) : $variable; 271 273 if ( $variable->get_id() !== $variation->get_parent_id() ) { 272 274 return array(); 273 275 } 274 276 275 $products = [];277 $products = []; 276 278 $variation_attributes = $variation->get_variation_attributes( false ); 277 $any_attributes = get_any_value_attributes( $variation_attributes );278 $extra_data = [ 'attributes' => [] ];279 $any_attributes = get_any_value_attributes( $variation_attributes ); 280 $extra_data = [ 'attributes' => [] ]; 279 281 if ( empty( $any_attributes ) ) { 280 282 if ( ! empty( $variation_attributes ) ) { … … 283 285 [ 284 286 'attribute' => $key, 285 'value' => $attribute,286 'by' => 'slug'287 'value' => $attribute, 288 'by' => 'slug' 287 289 ] 288 290 ); … … 301 303 ! empty( $attributes[ $any_attributes[ $i ] ]['is_variation'] ) 302 304 ) { 303 $any_values[] = $attributes[ $any_attributes[ $i ] ]['options'];305 $any_values[] = $attributes[ $any_attributes[ $i ] ]['options']; 304 306 $any_attributes[ $i ] = $attributes[ $any_attributes[ $i ] ]['name']; 305 307 } … … 321 323 [ 322 324 'attribute' => $key, 323 'value' => $attribute,324 'by' => 'slug'325 'value' => $attribute, 326 'by' => 'slug' 325 327 ] 326 328 ); … … 335 337 [ 336 338 'attribute' => $any_attributes[ $j ], 337 'value' => $any_values[ $i ][ $j ],338 'by' => 'id'339 'value' => $any_values[ $i ][ $j ], 340 'by' => 'id' 339 341 ] 340 342 ); … … 347 349 [ 348 350 'attribute' => $any_attributes[0], 349 'value' => $any_values[ $i ],350 'by' => 'id'351 'value' => $any_values[ $i ], 352 'by' => 'id' 351 353 ] 352 354 ); … … 367 369 apply_filters( 'asnp_wepb_get_variation_attribute_options_args', $args ), 368 370 array( 369 'options' => false,371 'options' => false, 370 372 'attribute' => false, 371 'product' => false,373 'product' => false, 372 374 ) 373 375 ); 374 376 375 $options = $args['options'];376 $product = $args['product'];377 $options = $args['options']; 378 $product = $args['product']; 377 379 $attribute = $args['attribute']; 378 380 379 381 if ( empty( $options ) && ! empty( $product ) && ! empty( $attribute ) ) { 380 382 $attributes = $product->get_variation_attributes(); 381 $options = $attributes[ $attribute ];383 $options = $attributes[ $attribute ]; 382 384 } 383 385 … … 398 400 if ( in_array( $term->slug, $options, true ) ) { 399 401 $select_options[] = [ 400 'name' => sanitize_text_field( apply_filters( 'woocommerce_variation_option_name', $term->name, $term, $attribute, $product ) ),402 'name' => sanitize_text_field( apply_filters( 'woocommerce_variation_option_name', $term->name, $term, $attribute, $product ) ), 401 403 'value' => esc_attr( $term->slug ), 402 404 ]; … … 407 409 // This handles < 2.4.0 bw compatibility where text attributes were not sanitized. 408 410 $select_options[] = [ 409 'name' => sanitize_text_field( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute, $product ) ),411 'name' => sanitize_text_field( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute, $product ) ), 410 412 'value' => esc_attr( $option ), 411 413 ]; … … 451 453 } 452 454 453 $defaults = [ 'variation'];454 $types = array_merge( array_keys( wc_get_product_types() ) );455 $defaults = [ 'variation' ]; 456 $types = array_merge( array_keys( wc_get_product_types() ) ); 455 457 if ( empty( $types ) ) { 456 458 if ( ! empty( $excludes ) ) { … … 523 525 if ( ! is_wp_error( $term ) && is_object( $term ) && $term->term_id ) { 524 526 return [ 525 'name' => $args['attribute'],526 'id' => $args['attribute'],527 'name' => $args['attribute'], 528 'id' => $args['attribute'], 527 529 'label' => $term->name, 528 530 'value' => $term->slug, … … 533 535 534 536 return [ 535 'name' => $args['attribute'],536 'id' => $args['attribute'],537 'name' => $args['attribute'], 538 'id' => $args['attribute'], 537 539 'label' => $args['value'], 538 540 'value' => $args['value'], … … 541 543 542 544 function combinations( $arrays, $i = 0 ) { 543 if ( ! isset( $arrays[$i] ) ) {544 return array();545 }546 if ( $i == count( $arrays ) - 1 ) {547 return $arrays[$i];548 }549 550 // get combinations from subsequent arrays551 $tmp = combinations( $arrays, $i + 1 );552 553 $result = array();554 555 // concat each array from tmp with each element from $arrays[$i]556 foreach ( $arrays[ $i ] as $v ) {557 foreach ( $tmp as $t ) {558 $result[] = is_array( $t ) ?559 array_merge( array( $v ), $t ) :560 array( $v, $t );561 }562 }563 564 return $result;545 if ( ! isset( $arrays[ $i ] ) ) { 546 return array(); 547 } 548 if ( $i == count( $arrays ) - 1 ) { 549 return $arrays[ $i ]; 550 } 551 552 // get combinations from subsequent arrays 553 $tmp = combinations( $arrays, $i + 1 ); 554 555 $result = array(); 556 557 // concat each array from tmp with each element from $arrays[$i] 558 foreach ( $arrays[ $i ] as $v ) { 559 foreach ( $tmp as $t ) { 560 $result[] = is_array( $t ) ? 561 array_merge( array( $v ), $t ) : 562 array( $v, $t ); 563 } 564 } 565 566 return $result; 565 567 } 566 568 … … 572 574 if ( is_json( $items ) ) { 573 575 $items = json_decode( $items, true ); 574 return array_map( function ( $item ) {576 return array_map( function ( $item ) { 575 577 return isset( $item['id'] ) ? $item['id'] : 0; 576 578 }, $items ); … … 579 581 $items = is_string( $items ) ? explode( ',', $items ) : $items; 580 582 581 return array_map( function ( $item ) {583 return array_map( function ( $item ) { 582 584 $item = explode( ':', $item ); 583 585 if ( 1 < count( $item ) && is_numeric( $item[0] ) ) { … … 595 597 if ( is_json( $items ) ) { 596 598 $items = json_decode( $items, true ); 597 return array_map( function ( $item ) {599 return array_map( function ( $item ) { 598 600 return isset( $item['qty'] ) ? absint( $item['qty'] ) : 0; 599 601 }, $items ); … … 602 604 $items = is_string( $items ) ? explode( ',', $items ) : $items; 603 605 604 return array_map( function ( $item ) {606 return array_map( function ( $item ) { 605 607 $item = explode( ':', $item ); 606 608 if ( 1 < count( $item ) && is_numeric( $item[1] ) ) { … … 618 620 if ( is_json( $items ) ) { 619 621 $items = json_decode( $items, true ); 620 return array_map( function ( $item ) {622 return array_map( function ( $item ) { 621 623 $attributes = []; 622 624 if ( ! empty( $item['attributes'] ) ) { … … 642 644 if ( 2 < count( $item ) ) { 643 645 $attributes = []; 644 array_map( function ( $value ) use ( &$attributes ) {646 array_map( function ( $value ) use ( &$attributes ) { 645 647 $value = explode( '=', $value ); 646 648 if ( 1 < count( $value ) ) { … … 668 670 ( ! isset( $args['is_fixed_price'] ) || ! $args['is_fixed_price'] ) && 669 671 ! empty( $args['discount_type'] ) && 672 'none' !== $args['discount_type'] && 670 673 isset( $args['discount'] ) && 671 674 '' !== $args['discount'] && … … 759 762 } 760 763 761 $model = get_plugin()->container()->get( SimpleBundleItemsModel::class );764 $model = get_plugin()->container()->get( SimpleBundleItemsModel::class); 762 765 $items = $model->get_bundle( $product->get_id() ); 763 766 if ( empty( $items ) ) { 764 $quantities = get_quantities_from_bundle_items( $default_products );767 $quantities = get_quantities_from_bundle_items( $default_products ); 765 768 $default_products = get_product_ids_from_bundle_items( $default_products ); 766 769 if ( count( $default_products ) === count( $quantities ) ) { 767 770 for ( $i = 0; $i < count( $default_products ); $i++ ) { 768 771 $model->add( [ 769 'bundle_id' => $product->get_id(),772 'bundle_id' => $product->get_id(), 770 773 'product_id' => (int) $default_products[ $i ], 771 'quantity' => (int) $quantities[ $i ],774 'quantity' => (int) $quantities[ $i ], 772 775 ] ); 773 776 } … … 785 788 786 789 $handles = array( 787 'react' => array( '17.0.2', array() ),788 'react-dom' => array( '17.0.2', array( 'react' ) ),789 'wp-i18n' => array( '6.0', array() ),790 'wp-hooks' => array( '6.0', array() ),790 'react' => array( '17.0.2', array() ), 791 'react-dom' => array( '17.0.2', array( 'react' ) ), 792 'wp-i18n' => array( '6.0', array() ), 793 'wp-hooks' => array( '6.0', array() ), 791 794 'wp-api-fetch' => array( '6.0', array() ), 792 795 ); … … 812 815 function added_product_bundle_type() { 813 816 $ids = Products\get_products( [ 814 'type' => Plugin::PRODUCT_TYPE,817 'type' => Plugin::PRODUCT_TYPE, 815 818 'return' => 'ids', 816 819 ] ); … … 874 877 function is_json( $string ) { 875 878 // Check if the string is empty or not a string 876 if ( ! is_string( $string ) || empty( trim( $string ) ) ) {877 return false;878 }879 880 // Check if string starts with either { or [881 if ( ! in_array( $string[0], [ '{', '[' ] ) ) {882 return false;883 }884 885 // Attempt to decode886 json_decode( $string );887 888 return ( json_last_error() === JSON_ERROR_NONE );879 if ( ! is_string( $string ) || empty( trim( $string ) ) ) { 880 return false; 881 } 882 883 // Check if string starts with either { or [ 884 if ( ! in_array( $string[0], [ '{', '[' ] ) ) { 885 return false; 886 } 887 888 // Attempt to decode 889 json_decode( $string ); 890 891 return ( json_last_error() === JSON_ERROR_NONE ); 889 892 } 890 893 … … 899 902 900 903 $items = explode( ',', $items ); 901 $items = array_map( function ( $item ) {904 $items = array_map( function ( $item ) { 902 905 $item = explode( ':', $item ); 903 906 if ( 3 === count( $item ) ) { 904 907 $attributes = explode( '&', $item[2] ); 905 $attributes = array_reduce( $attributes, function ( $carry, $attribute ) {908 $attributes = array_reduce( $attributes, function ( $carry, $attribute ) { 906 909 $attribute = explode( '=', $attribute ); 907 910 $carry[ $attribute[0] ] = $attribute[1]; … … 910 913 911 914 return [ 912 'id' => absint( $item[0] ),913 'qty' => ! empty( $item[1] ) ? absint( $item[1] ) : 0,915 'id' => absint( $item[0] ), 916 'qty' => ! empty( $item[1] ) ? absint( $item[1] ) : 0, 914 917 'attributes' => $attributes, 915 918 ]; 916 919 } 917 920 return [ 918 'id' => absint( $item[0] ),921 'id' => absint( $item[0] ), 919 922 'qty' => ! empty( $item[1] ) ? absint( $item[1] ) : 0, 920 923 ];
Note: See TracChangeset
for help on using the changeset viewer.