Changeset 3807287
- Timestamp:
- 11/17/2026 11:50:07 AM (less than one hour ago)
- Location:
- kigocloud-for-woocommerce
- Files:
-
- 12 edited
- 1 copied
-
tags/2.2.19 (copied) (copied from kigocloud-for-woocommerce/trunk )
-
tags/2.2.19/CHANGELOG.md (modified) (1 diff)
-
tags/2.2.19/includes/class-woo-kigocloud-pricelist.php (modified) (2 diffs)
-
tags/2.2.19/includes/class-woo-kigocloud.php (modified) (1 diff)
-
tags/2.2.19/kigocloud-for-woocommerce.php (modified) (2 diffs)
-
tags/2.2.19/public/class-woo-kigocloud-public.php (modified) (4 diffs)
-
tags/2.2.19/readme.txt (modified) (3 diffs)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/includes/class-woo-kigocloud-pricelist.php (modified) (2 diffs)
-
trunk/includes/class-woo-kigocloud.php (modified) (1 diff)
-
trunk/kigocloud-for-woocommerce.php (modified) (2 diffs)
-
trunk/public/class-woo-kigocloud-public.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kigocloud-for-woocommerce/tags/2.2.19/CHANGELOG.md
r3807119 r3807287 4 4 The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) 5 5 and the project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 7 ## [2.2.19] - 2026-11-17 8 9 ### Fixed 10 - Bazna cijena on variable products. A variable product has no `_kigo_anchor_price` of its own and its SKU is usually not in the price list, and when all variations have the same price WooCommerce shows no variation price, so the base price appeared nowhere on the page. `anchor_price_html()` now reads the visible variations (`variations_anchor()`: meta, then the price list by the variation's SKU, the parent's SKU when the variation has none, or GTIN, one meta cache query) and prints one amount or lowest – highest, with the reference day when all variations share it; otherwise the product's own base price as before (`own_anchor()`). New `Woo_KigoCloud_Pricelist::anchor_for_codes($sku, $gtin)`, which `anchor_for()` uses. 6 11 7 12 ## [2.2.18] - 2026-11-17 -
kigocloud-for-woocommerce/tags/2.2.19/includes/class-woo-kigocloud-pricelist.php
r3807119 r3807287 763 763 public static function anchor_for($product) 764 764 { 765 $gtin = is_callable(array($product, 'get_global_unique_id')) ? (string) $product->get_global_unique_id() : ''; 766 767 return self::anchor_for_codes((string) $product->get_sku(), $gtin); 768 } 769 770 /** 771 * Base price from Kigo.Cloud for an SKU, then a GTIN/EAN. 772 * 773 * @param string $sku 774 * @param string $gtin 775 * @return array|null array(price, date) or null when there is none 776 */ 777 public static function anchor_for_codes($sku, $gtin) 778 { 765 779 if (self::$anchor_index === null) { 766 780 $index = get_option(self::OPTION_ANCHOR, null); … … 770 784 return null; 771 785 } 772 $sku = self::anchor_key($ product->get_sku());786 $sku = self::anchor_key($sku); 773 787 if ($sku !== '' && isset(self::$anchor_index['ref'][$sku])) { 774 788 return self::$anchor_index['ref'][$sku]; 775 789 } 776 if (is_callable(array($product, 'get_global_unique_id'))) { 777 $gtin = self::anchor_key($product->get_global_unique_id()); 778 if ($gtin !== '' && isset(self::$anchor_index['barcode'][$gtin])) { 779 return self::$anchor_index['barcode'][$gtin]; 780 } 790 $gtin = self::anchor_key($gtin); 791 if ($gtin !== '' && isset(self::$anchor_index['barcode'][$gtin])) { 792 return self::$anchor_index['barcode'][$gtin]; 781 793 } 782 794 -
kigocloud-for-woocommerce/tags/2.2.19/includes/class-woo-kigocloud.php
r3807119 r3807287 46 46 * @since 1.0.0 47 47 */ 48 const PLUGIN_VERSION = '2.2.1 8';48 const PLUGIN_VERSION = '2.2.19'; 49 49 50 50 /** -
kigocloud-for-woocommerce/tags/2.2.19/kigocloud-for-woocommerce.php
r3807119 r3807287 11 11 * Plugin URI: https://www.kigocloud.com/fiskalizacija-web-trgovine/ 12 12 * Description: Croatian fiscalization for WooCommerce: every order becomes a fiscalized invoice in Kigo.Cloud, with R1 invoices, the invoice PDF for the customer and stock sync. Without WooCommerce it publishes the Kigo.Cloud price list (cjenik) on any WordPress site. 13 * Version: 2.2.1 813 * Version: 2.2.19 14 14 * Requires at least: 5.5 15 15 * Requires PHP: 7.2 … … 27 27 } 28 28 29 define( 'WOO_KIGOCLOUD_PLUGIN_NAME_VERSION', '2.2.1 8' );29 define( 'WOO_KIGOCLOUD_PLUGIN_NAME_VERSION', '2.2.19' ); 30 30 define( 'WOO_KIGOCLOUD_PLUGIN_FILE', __FILE__ ); 31 31 define( 'WOO_KIGOCLOUD_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); -
kigocloud-for-woocommerce/tags/2.2.19/public/class-woo-kigocloud-public.php
r3805644 r3807287 96 96 * HTML is returned unchanged. 97 97 * 98 * A variable product shows the base prices of its variations: one amount 99 * when they are all the same (WooCommerce then shows no variation price 100 * when one is selected, so this is the only line on the page), otherwise 101 * the lowest and the highest, like the price range above it. 102 * 98 103 * @param string $price_html 99 104 * @param WC_Product $product … … 109 114 return $price_html; 110 115 } 111 $anchor = $product->get_meta('_kigo_anchor_price', true); 112 $date = $product->get_meta('_kigo_anchor_price_date', true); 113 if ($anchor === '' || $anchor === null || !is_numeric($anchor)) { 114 $listed = class_exists('Woo_KigoCloud_Pricelist') ? Woo_KigoCloud_Pricelist::anchor_for($product) : null; 115 if ($listed === null) { 116 return $price_html; 117 } 118 $anchor = $listed[0]; 119 $date = $listed[1]; 120 } 121 if ((float) $anchor < 0) { 116 $found = null; 117 if ($product->is_type('variable')) { 118 $found = $this->variations_anchor($product); 119 } 120 if ($found === null) { 121 $found = $this->own_anchor($product); 122 } 123 if ($found === null) { 122 124 return $price_html; 123 125 } 126 list($anchor, $date, $highest) = $found; 124 127 // "Bazna cijena (10. 9. 2026.): 12,00 €", the name the Pravilnik o 125 128 // isticanju bazne cijene proizvoda (NN 132/2026) gives it and Kigo.Cloud … … 136 139 // must not reach the anchor price, only the line's own style does. 137 140 $amount = trim(wp_strip_all_tags(wc_price((float) $anchor))); 141 if ($highest !== null && (float) $highest !== (float) $anchor) { 142 $amount .= ' – ' . trim(wp_strip_all_tags(wc_price((float) $highest))); 143 } 138 144 139 145 // Themes lay the price out as flex rows, absolutely positioned boxes of a … … 172 178 173 179 /** 180 * Base price of the product or variation itself: its meta from KigoCloud, 181 * otherwise the price list by SKU or GTIN. 182 * 183 * @param WC_Product $product 184 * @return array|null array(price, date, null) 185 */ 186 private function own_anchor($product) 187 { 188 $anchor = $product->get_meta('_kigo_anchor_price', true); 189 $date = $product->get_meta('_kigo_anchor_price_date', true); 190 if ($anchor === '' || $anchor === null || !is_numeric($anchor)) { 191 $listed = class_exists('Woo_KigoCloud_Pricelist') ? Woo_KigoCloud_Pricelist::anchor_for($product) : null; 192 if ($listed === null) { 193 return null; 194 } 195 $anchor = $listed[0]; 196 $date = $listed[1]; 197 } 198 if ((float) $anchor < 0) { 199 return null; 200 } 201 202 return array($anchor, $date, null); 203 } 204 205 /** 206 * Base prices of the visible variations of a variable product, read the 207 * same way as for a single variation (meta, then the price list by the 208 * variation's SKU, which WooCommerce takes from the parent when the 209 * variation has none, or GTIN). One meta query for all variations. 210 * 211 * @param WC_Product $product variable product 212 * @return array|null array(lowest, date when all are of the same day, highest) 213 */ 214 private function variations_anchor($product) 215 { 216 $ids = array_map('intval', (array) $product->get_visible_children()); 217 if (empty($ids)) { 218 return null; 219 } 220 update_meta_cache('post', $ids); 221 $prices = array(); 222 $dates = array(); 223 foreach ($ids as $id) { 224 $anchor = get_post_meta($id, '_kigo_anchor_price', true); 225 $date = get_post_meta($id, '_kigo_anchor_price_date', true); 226 if ($anchor === '' || !is_numeric($anchor)) { 227 $sku = (string) get_post_meta($id, '_sku', true); 228 if ($sku === '') { 229 $sku = (string) $product->get_sku(); 230 } 231 $listed = class_exists('Woo_KigoCloud_Pricelist') 232 ? Woo_KigoCloud_Pricelist::anchor_for_codes($sku, (string) get_post_meta($id, '_global_unique_id', true)) 233 : null; 234 if ($listed === null) { 235 continue; 236 } 237 $anchor = $listed[0]; 238 $date = $listed[1]; 239 } 240 if ((float) $anchor < 0) { 241 continue; 242 } 243 $prices[] = (float) $anchor; 244 $dates[(string) $date] = true; 245 } 246 if (empty($prices)) { 247 return null; 248 } 249 250 return array(min($prices), count($dates) === 1 ? (string) key($dates) : '', max($prices)); 251 } 252 253 /** 174 254 * Is this the price of the product the page is about (its summary or one of 175 255 * its variations), as opposed to a product card or widget on the page? -
kigocloud-for-woocommerce/tags/2.2.19/readme.txt
r3807119 r3807287 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.2 7 Stable tag: 2.2.1 87 Stable tag: 2.2.19 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 133 133 == Changelog == 134 134 135 = 2.2.19 = 136 * Bazna cijena on variable products. When all variations had the same price, WooCommerce showed no variation price, so the base price appeared nowhere on the product page. The price of a variable product now carries the base prices of its variations: one amount when they are the same, otherwise the lowest and the highest, with the reference day when all are of the same day. 137 135 138 = 2.2.18 = 136 139 * The price list is published only under the file names the Pravilnik prescribes (OIB, sales point, ROBA or USLUGE, storage number and time). The extra copies cjenik-roba.csv, cjenik-roba.xml, cjenik-usluge.csv and cjenik-usluge.xml of 2.2.17 are removed. The page with [kigo_cjenik] is the place of the price list on your site: its buttons and the Price list tab link the current files under their prescribed names, and a changed price list always comes to that page. … … 283 286 == Upgrade Notice == 284 287 288 = 2.2.19 = 289 Bazna cijena is also shown on variable products. 290 285 291 = 2.2.18 = 286 292 The price list is published only under the prescribed file names. -
kigocloud-for-woocommerce/trunk/CHANGELOG.md
r3807119 r3807287 4 4 The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) 5 5 and the project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 7 ## [2.2.19] - 2026-11-17 8 9 ### Fixed 10 - Bazna cijena on variable products. A variable product has no `_kigo_anchor_price` of its own and its SKU is usually not in the price list, and when all variations have the same price WooCommerce shows no variation price, so the base price appeared nowhere on the page. `anchor_price_html()` now reads the visible variations (`variations_anchor()`: meta, then the price list by the variation's SKU, the parent's SKU when the variation has none, or GTIN, one meta cache query) and prints one amount or lowest – highest, with the reference day when all variations share it; otherwise the product's own base price as before (`own_anchor()`). New `Woo_KigoCloud_Pricelist::anchor_for_codes($sku, $gtin)`, which `anchor_for()` uses. 6 11 7 12 ## [2.2.18] - 2026-11-17 -
kigocloud-for-woocommerce/trunk/includes/class-woo-kigocloud-pricelist.php
r3807119 r3807287 763 763 public static function anchor_for($product) 764 764 { 765 $gtin = is_callable(array($product, 'get_global_unique_id')) ? (string) $product->get_global_unique_id() : ''; 766 767 return self::anchor_for_codes((string) $product->get_sku(), $gtin); 768 } 769 770 /** 771 * Base price from Kigo.Cloud for an SKU, then a GTIN/EAN. 772 * 773 * @param string $sku 774 * @param string $gtin 775 * @return array|null array(price, date) or null when there is none 776 */ 777 public static function anchor_for_codes($sku, $gtin) 778 { 765 779 if (self::$anchor_index === null) { 766 780 $index = get_option(self::OPTION_ANCHOR, null); … … 770 784 return null; 771 785 } 772 $sku = self::anchor_key($ product->get_sku());786 $sku = self::anchor_key($sku); 773 787 if ($sku !== '' && isset(self::$anchor_index['ref'][$sku])) { 774 788 return self::$anchor_index['ref'][$sku]; 775 789 } 776 if (is_callable(array($product, 'get_global_unique_id'))) { 777 $gtin = self::anchor_key($product->get_global_unique_id()); 778 if ($gtin !== '' && isset(self::$anchor_index['barcode'][$gtin])) { 779 return self::$anchor_index['barcode'][$gtin]; 780 } 790 $gtin = self::anchor_key($gtin); 791 if ($gtin !== '' && isset(self::$anchor_index['barcode'][$gtin])) { 792 return self::$anchor_index['barcode'][$gtin]; 781 793 } 782 794 -
kigocloud-for-woocommerce/trunk/includes/class-woo-kigocloud.php
r3807119 r3807287 46 46 * @since 1.0.0 47 47 */ 48 const PLUGIN_VERSION = '2.2.1 8';48 const PLUGIN_VERSION = '2.2.19'; 49 49 50 50 /** -
kigocloud-for-woocommerce/trunk/kigocloud-for-woocommerce.php
r3807119 r3807287 11 11 * Plugin URI: https://www.kigocloud.com/fiskalizacija-web-trgovine/ 12 12 * Description: Croatian fiscalization for WooCommerce: every order becomes a fiscalized invoice in Kigo.Cloud, with R1 invoices, the invoice PDF for the customer and stock sync. Without WooCommerce it publishes the Kigo.Cloud price list (cjenik) on any WordPress site. 13 * Version: 2.2.1 813 * Version: 2.2.19 14 14 * Requires at least: 5.5 15 15 * Requires PHP: 7.2 … … 27 27 } 28 28 29 define( 'WOO_KIGOCLOUD_PLUGIN_NAME_VERSION', '2.2.1 8' );29 define( 'WOO_KIGOCLOUD_PLUGIN_NAME_VERSION', '2.2.19' ); 30 30 define( 'WOO_KIGOCLOUD_PLUGIN_FILE', __FILE__ ); 31 31 define( 'WOO_KIGOCLOUD_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); -
kigocloud-for-woocommerce/trunk/public/class-woo-kigocloud-public.php
r3805644 r3807287 96 96 * HTML is returned unchanged. 97 97 * 98 * A variable product shows the base prices of its variations: one amount 99 * when they are all the same (WooCommerce then shows no variation price 100 * when one is selected, so this is the only line on the page), otherwise 101 * the lowest and the highest, like the price range above it. 102 * 98 103 * @param string $price_html 99 104 * @param WC_Product $product … … 109 114 return $price_html; 110 115 } 111 $anchor = $product->get_meta('_kigo_anchor_price', true); 112 $date = $product->get_meta('_kigo_anchor_price_date', true); 113 if ($anchor === '' || $anchor === null || !is_numeric($anchor)) { 114 $listed = class_exists('Woo_KigoCloud_Pricelist') ? Woo_KigoCloud_Pricelist::anchor_for($product) : null; 115 if ($listed === null) { 116 return $price_html; 117 } 118 $anchor = $listed[0]; 119 $date = $listed[1]; 120 } 121 if ((float) $anchor < 0) { 116 $found = null; 117 if ($product->is_type('variable')) { 118 $found = $this->variations_anchor($product); 119 } 120 if ($found === null) { 121 $found = $this->own_anchor($product); 122 } 123 if ($found === null) { 122 124 return $price_html; 123 125 } 126 list($anchor, $date, $highest) = $found; 124 127 // "Bazna cijena (10. 9. 2026.): 12,00 €", the name the Pravilnik o 125 128 // isticanju bazne cijene proizvoda (NN 132/2026) gives it and Kigo.Cloud … … 136 139 // must not reach the anchor price, only the line's own style does. 137 140 $amount = trim(wp_strip_all_tags(wc_price((float) $anchor))); 141 if ($highest !== null && (float) $highest !== (float) $anchor) { 142 $amount .= ' – ' . trim(wp_strip_all_tags(wc_price((float) $highest))); 143 } 138 144 139 145 // Themes lay the price out as flex rows, absolutely positioned boxes of a … … 172 178 173 179 /** 180 * Base price of the product or variation itself: its meta from KigoCloud, 181 * otherwise the price list by SKU or GTIN. 182 * 183 * @param WC_Product $product 184 * @return array|null array(price, date, null) 185 */ 186 private function own_anchor($product) 187 { 188 $anchor = $product->get_meta('_kigo_anchor_price', true); 189 $date = $product->get_meta('_kigo_anchor_price_date', true); 190 if ($anchor === '' || $anchor === null || !is_numeric($anchor)) { 191 $listed = class_exists('Woo_KigoCloud_Pricelist') ? Woo_KigoCloud_Pricelist::anchor_for($product) : null; 192 if ($listed === null) { 193 return null; 194 } 195 $anchor = $listed[0]; 196 $date = $listed[1]; 197 } 198 if ((float) $anchor < 0) { 199 return null; 200 } 201 202 return array($anchor, $date, null); 203 } 204 205 /** 206 * Base prices of the visible variations of a variable product, read the 207 * same way as for a single variation (meta, then the price list by the 208 * variation's SKU, which WooCommerce takes from the parent when the 209 * variation has none, or GTIN). One meta query for all variations. 210 * 211 * @param WC_Product $product variable product 212 * @return array|null array(lowest, date when all are of the same day, highest) 213 */ 214 private function variations_anchor($product) 215 { 216 $ids = array_map('intval', (array) $product->get_visible_children()); 217 if (empty($ids)) { 218 return null; 219 } 220 update_meta_cache('post', $ids); 221 $prices = array(); 222 $dates = array(); 223 foreach ($ids as $id) { 224 $anchor = get_post_meta($id, '_kigo_anchor_price', true); 225 $date = get_post_meta($id, '_kigo_anchor_price_date', true); 226 if ($anchor === '' || !is_numeric($anchor)) { 227 $sku = (string) get_post_meta($id, '_sku', true); 228 if ($sku === '') { 229 $sku = (string) $product->get_sku(); 230 } 231 $listed = class_exists('Woo_KigoCloud_Pricelist') 232 ? Woo_KigoCloud_Pricelist::anchor_for_codes($sku, (string) get_post_meta($id, '_global_unique_id', true)) 233 : null; 234 if ($listed === null) { 235 continue; 236 } 237 $anchor = $listed[0]; 238 $date = $listed[1]; 239 } 240 if ((float) $anchor < 0) { 241 continue; 242 } 243 $prices[] = (float) $anchor; 244 $dates[(string) $date] = true; 245 } 246 if (empty($prices)) { 247 return null; 248 } 249 250 return array(min($prices), count($dates) === 1 ? (string) key($dates) : '', max($prices)); 251 } 252 253 /** 174 254 * Is this the price of the product the page is about (its summary or one of 175 255 * its variations), as opposed to a product card or widget on the page? -
kigocloud-for-woocommerce/trunk/readme.txt
r3807119 r3807287 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.2 7 Stable tag: 2.2.1 87 Stable tag: 2.2.19 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 133 133 == Changelog == 134 134 135 = 2.2.19 = 136 * Bazna cijena on variable products. When all variations had the same price, WooCommerce showed no variation price, so the base price appeared nowhere on the product page. The price of a variable product now carries the base prices of its variations: one amount when they are the same, otherwise the lowest and the highest, with the reference day when all are of the same day. 137 135 138 = 2.2.18 = 136 139 * The price list is published only under the file names the Pravilnik prescribes (OIB, sales point, ROBA or USLUGE, storage number and time). The extra copies cjenik-roba.csv, cjenik-roba.xml, cjenik-usluge.csv and cjenik-usluge.xml of 2.2.17 are removed. The page with [kigo_cjenik] is the place of the price list on your site: its buttons and the Price list tab link the current files under their prescribed names, and a changed price list always comes to that page. … … 283 286 == Upgrade Notice == 284 287 288 = 2.2.19 = 289 Bazna cijena is also shown on variable products. 290 285 291 = 2.2.18 = 286 292 The price list is published only under the prescribed file names.
Note:
See TracChangeset
for help on using the changeset viewer.