diff --git a/CHANGELOG.md b/CHANGELOG.md index a568328..7d45932 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,25 @@ All notable changes to WooCommerce Tier and Package Prices will be documented in The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.2.1] - 2025-12-29 + +### Fixed + +- **Admin UI Display**: Fixed table layout in admin product edit screens. The CSS was still using flexbox styling from the old `
/

` structure, which broke the new `//` with `
` layout introduced in v1.2.0. Updated `assets/css/admin.css` to properly style table rows with standard table cell padding and removed obsolete flexbox properties. + +- **Frontend Pricing Display**: Fixed pricing tables not showing on simple product pages. Removed global "Enable Tier Pricing" and "Enable Package Pricing" checks from the frontend template (`templates/frontend/pricing-table.twig`). Pricing tables now display if configured on a product AND the "Display Pricing Table" setting is enabled, regardless of individual feature enable settings. Cart calculations still respect global enable settings for proper pricing application. + +### Technical Details + +**Root Cause - Admin UI Bug**: In v1.2.0, admin templates were converted from a `
` with nested `

` elements to `

` elements for proper table structure. However, the CSS file (`assets/css/admin.css`) was not updated accordingly, leaving flexbox styling (`.wc-tpp-tier-row { display: flex; gap: 15px; ... }`) that conflicted with table display. This caused columns to not align with table headers. + +**Root Cause - Frontend Display Bug**: The frontend pricing table template was checking both `get_option('wc_tpp_enable_tier_pricing')` AND `get_option('wc_tpp_enable_package_pricing')` before displaying pricing. This meant if these global settings were disabled (even though defaults are 'yes'), pricing configured on products wouldn't show. The better UX is: if pricing is configured AND display is enabled, show it. The global enable settings now only control cart calculation and admin UI visibility. + +### Changed Files + +- `assets/css/admin.css` - Replaced flexbox styling with table cell styling +- `templates/frontend/pricing-table.twig` - Removed global enable setting checks from display conditions + ## [1.2.0] - 2025-12-29 ### Added - Variable Product Support diff --git a/CLAUDE.md b/CLAUDE.md index 2f900a3..cafdad7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,7 +1,7 @@ # WooCommerce Tier and Package Prices - AI Context Document **Last Updated:** 2025-12-29 -**Current Version:** 1.2.0 +**Current Version:** 1.2.1 **Author:** Marco Graetsch **Project Status:** Production-ready WordPress plugin @@ -558,7 +558,15 @@ Roadmap for the upcoming development. #### Version 1.2.x -1. New Feature: Create different, selectable templates for tierprices and packages to use in the frontend. Make the new templates selectable globally on the settings-page, not per product. +##### Bugfixes (Completed in v1.2.1) + +1. ~~The admin templates are not show right. The row templates didn't match the new table structure. The table-body columns didn't fit the table-head columns.~~ ✅ **FIXED in v1.2.1** - Updated admin.css to remove flexbox styling that was breaking the new `// elements in a table */ .wc-tpp-tier-row, .wc-tpp-package-row { - display: flex; - gap: 15px; - align-items: flex-end; - padding: 15px; - background: #f9f9f9; - border: 1px solid #ddd; - border-radius: 4px; - margin-bottom: 10px; + /* No special styling needed - standard table row */ } -.wc-tpp-tier-row .form-field, -.wc-tpp-package-row .form-field { - margin: 0; - flex: 1; -} - -.wc-tpp-tier-row label, -.wc-tpp-package-row label { - display: block; - font-weight: 600; - margin-bottom: 5px; +.wc-tpp-tier-row td, +.wc-tpp-package-row td { + padding: 8px; + vertical-align: middle; } +/* Ensure WooCommerce input classes work properly in table cells */ .wc-tpp-tier-row input, .wc-tpp-package-row input { - width: 100%; + margin: 0; } .wc-tpp-remove-tier, .wc-tpp-remove-package { - flex-shrink: 0; color: #b32d2e; border-color: #b32d2e; - margin-bottom: 0; } .wc-tpp-remove-tier:hover, diff --git a/composer.json b/composer.json index 7ec7bf1..04c894d 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "magdev/wc-tier-package-prices", "description": "WooCommerce plugin for tier pricing and package prices with Twig templates", - "version": "1.2.0", + "version": "1.2.1", "type": "wordpress-plugin", "license": "GPL-2.0-or-later", "authors": [ diff --git a/templates/frontend/pricing-table.twig b/templates/frontend/pricing-table.twig index c933a13..50a2592 100644 --- a/templates/frontend/pricing-table.twig +++ b/templates/frontend/pricing-table.twig @@ -5,13 +5,14 @@ # @var object product # @var array tiers # @var array packages + # @var bool restrict_to_packages #}
- {% if tiers is not empty and get_option('wc_tpp_enable_tier_pricing') == 'yes' %} + {% if tiers is not empty %} {% include 'frontend/tier-pricing-table.twig' with {'product': product, 'tiers': tiers} %} {% endif %} - {% if packages is not empty and get_option('wc_tpp_enable_package_pricing') == 'yes' %} + {% if packages is not empty %} {% include 'frontend/package-pricing-display.twig' with {'packages': packages, 'restrict_to_packages': restrict_to_packages|default(false)} %} {% endif %}
diff --git a/wc-tier-and-package-prices.php b/wc-tier-and-package-prices.php index d22b4d4..b934544 100644 --- a/wc-tier-and-package-prices.php +++ b/wc-tier-and-package-prices.php @@ -4,7 +4,7 @@ * Plugin Name: WooCommerce Tier and Package Prices * Plugin URI: https://src.bundespruefstelle.ch/magdev/wc-tier-package-prices * Description: Add tier pricing and package prices to WooCommerce products with configurable quantities at fixed prices - * Version: 1.2.0 + * Version: 1.2.1 * Author: Marco Graetsch * Author URI: https://src.bundespruefstelle.ch/magdev * Text Domain: wc-tier-package-prices @@ -23,7 +23,7 @@ if (!defined('ABSPATH')) { // Define plugin constants if (!defined('WC_TPP_VERSION')) { - define('WC_TPP_VERSION', '1.2.0'); + define('WC_TPP_VERSION', '1.2.1'); } if (!defined('WC_TPP_PLUGIN_DIR')) { define('WC_TPP_PLUGIN_DIR', plugin_dir_path(__FILE__));
` structure introduced in v1.2.0. The CSS was still using flexbox layout from the old `
/

` structure. + +2. ~~The tier and package prices are not shown on simple product pages~~ ✅ **FIXED in v1.2.1** - Removed global enable/disable checks from frontend template. Pricing tables now display if configured on a product AND the "Display Pricing Table" setting is enabled, regardless of "Enable Tier Pricing" or "Enable Package Pricing" global settings. Cart calculations still respect global enable settings. + +##### New Features + +1. Create different, selectable templates for tierprices and packages to use in the frontend. Make the new templates selectable globally on the settings-page, not per product. ### When Debugging Cart Issues diff --git a/assets/css/admin.css b/assets/css/admin.css index 9bdf77f..37e925f 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -23,42 +23,41 @@ color: #666; } +/* Table styling */ +.wc-tpp-tiers-table, +.wc-tpp-packages-table { + margin-top: 15px; + margin-bottom: 15px; +} + +.wc-tpp-tiers-table th, +.wc-tpp-packages-table th { + font-weight: 600; + text-align: left; +} + +/* Table row styling - rows are now