Changeset 3479021
- Timestamp:
- 03/10/2026 11:46:55 AM (3 weeks ago)
- Location:
- f12-wc-accessories/trunk
- Files:
-
- 8 edited
-
Accessories.class.php (modified) (2 diffs)
-
Readme.txt (modified) (3 diffs)
-
includes/Frontend/AccessoriesCart.class.php (modified) (2 diffs)
-
includes/UI/UIOptionalAccessories.class.php (modified) (1 diff)
-
templates/woo-accessories-cart.php (modified) (1 diff)
-
templates/woo-accessories-checkbox.php (modified) (2 diffs)
-
templates/woo-accessories-inline.php (modified) (2 diffs)
-
templates/woo-accessories.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
f12-wc-accessories/trunk/Accessories.class.php
r3475601 r3479021 11 11 * Plugin URI: https://www.forge12.com/product/woocommerce-zubehoer/ 12 12 * Description: Add optional and required accessories for WooCommerce products and categories. The only plugin that combines optional + required + category-based accessories + cart crossselling. 13 * Version: 2.3. 513 * Version: 2.3.6 14 14 * Author: Forge12 Interactive GmbH 15 15 * Author URI: https://www.forge12.com … … 24 24 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 25 25 */ 26 define('FORGE12_ACCESSORIES_VERSION', '2.3. 5');26 define('FORGE12_ACCESSORIES_VERSION', '2.3.6'); 27 27 define('FORGE12_ACCESSORIES_SLUG', 'f12-woo-accessoires'); 28 28 define('FORGE12_ACCESSORIES_BASENAME', plugin_basename(__FILE__)); -
f12-wc-accessories/trunk/Readme.txt
r3475601 r3479021 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 2.3. 57 Stable tag: 2.3.6 8 8 WC requires at least: 6.0 9 9 WC tested up to: 9.5 … … 134 134 135 135 == Changelog == 136 137 = 2.3.6 = 138 * Fix: Hidden products (catalog visibility set to "hidden") no longer show blank spaces in accessory displays. 139 * Fix: Draft, private and trashed products excluded from all accessory templates regardless of user role. 140 * Fix: Array to string conversion warning in cart crossselling when multiple products with accessories are in the cart. 141 * Fix: Cart crossselling template now uses a flat, deduplicated accessory ID list for consistent rendering. 142 * New: `f12_woo_accessories_cart_template` filter allows Pro layouts (Slider, Accordion, Tabs) to override the cart template. 143 * Improved: Autoplay setting uses toggle switch instead of checkbox for better UX consistency. 136 144 137 145 = 2.3.5 = … … 311 319 == Upgrade Notice == 312 320 321 = 2.3.6 = 322 Fixes hidden and draft products showing blank spaces in accessory displays, array to string conversion warning in cart crossselling, and adds cart template filter for Pro layout support. 323 313 324 = 2.3.5 = 314 325 Fixes fatal error when WooCommerce is not active. Plugin now gracefully skips frontend features if WooCommerce functions are unavailable. -
f12-wc-accessories/trunk/includes/Frontend/AccessoriesCart.class.php
r3475601 r3479021 103 103 * Get all Accessories for the products 104 104 */ 105 $flat_collected = array(); 105 106 foreach ($list_of_products as $cart_item) { 106 // Get optional and required ids 107 $accessory_ids[$cart_item['product_id']] = apply_filters('f12_woo_accessories_cart', $accessory_ids, $cart_item['product_id'], $accessory_ids_already_added); 107 // Pass flat array of already-collected IDs to avoid nested array issues 108 $result = apply_filters('f12_woo_accessories_cart', $flat_collected, $cart_item['product_id'], $accessory_ids_already_added); 109 $accessory_ids[$cart_item['product_id']] = $result; 110 $flat_collected = array_merge($flat_collected, $result); 108 111 } 109 112 … … 121 124 if (!$template) { 122 125 $template = FORGE12_ACCESSORIES_PATH . 'templates/woo-accessories-cart.php'; 126 } 127 128 // Allow Pro plugin to override the cart template based on layout setting 129 $template = apply_filters('f12_woo_accessories_cart_template', $template, $accessory_ids); 130 131 // Flatten accessory IDs for layout templates that expect a flat array 132 $accessoire_ids = array(); 133 foreach ($accessory_ids as $product_id => $ids) { 134 $accessoire_ids = array_merge($accessoire_ids, $ids); 135 } 136 $accessoire_ids = array_unique($accessoire_ids); 137 138 // Provide $product for layout templates (use first cart product as context) 139 $product = null; 140 $first_product_id = array_key_first($accessory_ids); 141 if ($first_product_id) { 142 $product = wc_get_product($first_product_id); 123 143 } 124 144 -
f12-wc-accessories/trunk/includes/UI/UIOptionalAccessories.class.php
r3468706 r3479021 370 370 <div id="layout-slider-settings" style="<?php echo $settings['layout'] !== 'slider' ? 'display:none;' : ''; ?>margin-top:10px;"> 371 371 <p> 372 <input id="slider_autoplay" type="checkbox" name="slider_autoplay" 373 value="1" <?php echo isset($settings['slider_autoplay']) && (int) $settings['slider_autoplay'] == 1 ? 'checked="checked"' : ''; ?> 374 /> 372 <label class="f12-toggle"> 373 <input id="slider_autoplay" type="checkbox" name="slider_autoplay" 374 value="1" <?php echo isset($settings['slider_autoplay']) && (int) $settings['slider_autoplay'] == 1 ? 'checked="checked"' : ''; ?> 375 /> 376 <span class="f12-toggle-slider"></span> 377 </label> 375 378 <label for="slider_autoplay"><?php _e('Autoplay', 'f12-woo-accessories'); ?></label> 376 379 </p> -
f12-wc-accessories/trunk/templates/woo-accessories-cart.php
r3468706 r3479021 31 31 <?php woocommerce_product_loop_start(); ?> 32 32 33 <?php foreach ($accessory_ids as $product_id => $accessories) : ?> 34 <?php foreach ($accessories as $accessory_id): ?> 35 <?php 36 $post_object = get_post($accessory_id); 33 <?php foreach ($accessoire_ids as $accessory_id): ?> 34 <?php 35 $accessory = wc_get_product($accessory_id); 37 36 38 if (!$post_object) {39 continue;40 }37 if (!$accessory || $accessory->get_status() !== 'publish' || !$accessory->is_purchasable() || !$accessory->is_in_stock() || $accessory->get_catalog_visibility() === 'hidden') { 38 continue; 39 } 41 40 42 setup_postdata($GLOBALS['post'] =& $post_object); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited, Squiz.PHP.DisallowMultipleAssignments.Found41 $post_object = get_post($accessory_id); 43 42 44 wc_get_template_part('content', 'product'); 45 ?> 46 <?php endforeach; ?> 43 if (!$post_object) { 44 continue; 45 } 46 47 setup_postdata($GLOBALS['post'] =& $post_object); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited, Squiz.PHP.DisallowMultipleAssignments.Found 48 49 wc_get_template_part('content', 'product'); 50 ?> 47 51 <?php endforeach; ?> 48 52 -
f12-wc-accessories/trunk/templates/woo-accessories-checkbox.php
r3468706 r3479021 117 117 // Collect filter reasons 118 118 $filter_reasons = array(); 119 if ($accessory->get_status() !== 'publish') { 120 $filter_reasons[] = __('not published', 'f12-woo-accessories'); 121 } 119 122 if (!$accessory->is_purchasable()) { 120 123 $filter_reasons[] = __('not purchasable', 'f12-woo-accessories'); … … 122 125 if (!$accessory->is_in_stock()) { 123 126 $filter_reasons[] = __('out of stock', 'f12-woo-accessories'); 127 } 128 if ($accessory->get_catalog_visibility() === 'hidden') { 129 $filter_reasons[] = __('hidden from catalog', 'f12-woo-accessories'); 124 130 } 125 131 -
f12-wc-accessories/trunk/templates/woo-accessories-inline.php
r3468706 r3479021 78 78 // Collect filter reasons 79 79 $filter_reasons = array(); 80 if ($accessory->get_status() !== 'publish') { 81 $filter_reasons[] = __('not published', 'f12-woo-accessories'); 82 } 80 83 if (!$accessory->is_purchasable()) { 81 84 $filter_reasons[] = __('not purchasable', 'f12-woo-accessories'); … … 83 86 if (!$accessory->is_in_stock()) { 84 87 $filter_reasons[] = __('out of stock', 'f12-woo-accessories'); 88 } 89 if ($accessory->get_catalog_visibility() === 'hidden') { 90 $filter_reasons[] = __('hidden from catalog', 'f12-woo-accessories'); 85 91 } 86 92 -
f12-wc-accessories/trunk/templates/woo-accessories.php
r3468706 r3479021 90 90 // Collect filter reasons 91 91 $filter_reasons = array(); 92 if ($accessory->get_status() !== 'publish') { 93 $filter_reasons[] = __('not published', 'f12-woo-accessories'); 94 } 92 95 if (!$accessory->is_purchasable()) { 93 96 $filter_reasons[] = __('not purchasable', 'f12-woo-accessories'); … … 95 98 if (!$accessory->is_in_stock()) { 96 99 $filter_reasons[] = __('out of stock', 'f12-woo-accessories'); 100 } 101 if ($accessory->get_catalog_visibility() === 'hidden') { 102 $filter_reasons[] = __('hidden from catalog', 'f12-woo-accessories'); 97 103 } 98 104
Note: See TracChangeset
for help on using the changeset viewer.