Changeset 3313992
- Timestamp:
- 06/18/2025 03:26:58 PM (8 months ago)
- Location:
- makecommerce/trunk
- Files:
-
- 24 edited
-
README.txt (modified) (2 diffs)
-
api/templates/shipping_confirm.php (modified) (1 diff)
-
config.php (modified) (2 diffs)
-
makecommerce.php (modified) (1 diff)
-
makecommerce/admin/dashboard.php (modified) (1 diff)
-
makecommerce/languages/wc_makecommerce_domain-en.mo (modified) (previous)
-
makecommerce/languages/wc_makecommerce_domain-en.po (modified) (1 diff)
-
makecommerce/languages/wc_makecommerce_domain-et.mo (modified) (previous)
-
makecommerce/languages/wc_makecommerce_domain-et.po (modified) (1 diff)
-
makecommerce/languages/wc_makecommerce_domain-et_ET.mo (modified) (previous)
-
makecommerce/languages/wc_makecommerce_domain-lt.mo (modified) (previous)
-
makecommerce/languages/wc_makecommerce_domain-lt.po (modified) (1 diff)
-
makecommerce/languages/wc_makecommerce_domain-lt_LT.mo (modified) (previous)
-
makecommerce/languages/wc_makecommerce_domain-lv.mo (modified) (previous)
-
makecommerce/languages/wc_makecommerce_domain-lv.po (modified) (1 diff)
-
makecommerce/languages/wc_makecommerce_domain-lv_LV.mo (modified) (previous)
-
makecommerce/languages/wc_makecommerce_domain.pot (modified) (6 diffs)
-
makecommerce/makecommerce.php (modified) (1 diff)
-
makecommerce/payment/gateway/woocommerce/css/makecommerce.css (modified) (3 diffs)
-
makecommerce/payment/gateway/woocommerce/woocommerce.php (modified) (1 diff)
-
makecommerce/shipping/js/pickuppoint.js (modified) (8 diffs)
-
makecommerce/shipping/method/method.php (modified) (2 diffs)
-
makecommerce/shipping/product.php (modified) (1 diff)
-
payment/gateway/woocommerce/woocommerce.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
makecommerce/trunk/README.txt
r3313304 r3313992 4 4 Requires at least: 6.8.1 5 5 Tested up to: 6.8.1 6 Stable tag: 4.0. 16 Stable tag: 4.0.2 7 7 Requires PHP: 8.1 8 8 License: GPLv2 or later … … 60 60 61 61 == Changelog == 62 63 = 4.0.2 2025-06-18 = 64 * Feature - Added support for "Does not fit" parcel machine checkbox 65 * Fix - WooCommerce HPOS compatibility 62 66 63 67 = 4.0.1 2025-06-17 = -
makecommerce/trunk/api/templates/shipping_confirm.php
r3313138 r3313992 75 75 <li class="list-group-item d-flex" style="border: none !important;"> 76 76 <div class="ms-2"> 77 <div class="fw-bold"><?php _e('“Does not fit parcel machine” handled more smartly', 'wc_makecommerce_domain'); ?></div>78 <?php _e('This is now based on package weight and dimensions — no need for manual tagging.', 'wc_makecommerce_domain'); ?>79 </div>80 </li>81 <li class="list-group-item d-flex" style="border: none !important;">82 <div class="ms-2">83 77 <div class="fw-bold"><?php _e('Free shipping and coupon logic evolving', 'wc_makecommerce_domain'); ?></div> 84 78 <?php _e('Settings for free shipping from a certain amount and coupon combinations will return soon in a new, improved interface.', 'wc_makecommerce_domain'); ?> -
makecommerce/trunk/config.php
r3313304 r3313992 11 11 * Start at version 3.0.0 and use SemVer - https://semver.org 12 12 */ 13 define( 'MAKECOMMERCE_VERSION', '4.0. 1' );13 define( 'MAKECOMMERCE_VERSION', '4.0.2' ); 14 14 define( 'MAKECOMMERCE_PLUGIN_ID', 'makecommerce' ); 15 15 … … 28 28 add_action( 'before_woocommerce_init', function() { 29 29 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { 30 $plugin_main_file = plugin_dir_path( __DIR__ ) . 'makecommerce.php'; 30 31 // Declare HPOS compatibility - true / false 31 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );32 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', $plugin_main_file, true ); 32 33 33 34 // Declare Blocks compatibility - true / false 34 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true );35 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', $plugin_main_file, true ); 35 36 } 36 37 } ); -
makecommerce/trunk/makecommerce.php
r3313304 r3313992 9 9 * Plugin URI: https://makecommerce.net/ 10 10 * Description: Adds MakeCommerce payment gateway and shipping methods to WooCommerce checkout 11 * Version: 4.0. 111 * Version: 4.0.2 12 12 * Author: Maksekeskus AS 13 13 * Author URI: https://makecommerce.net/ -
makecommerce/trunk/makecommerce/admin/dashboard.php
r3313304 r3313992 309 309 $client = $this->get_client(); 310 310 $client->connectShop( 311 'userAgent',312 'myIP',311 $_SERVER['HTTP_USER_AGENT'] ?? 'unknown', 312 get_site_url() ?? $_SERVER['REMOTE_ADDR'], 313 313 get_site_url() . '/wp-admin/post.php?post={id}&action=edit' 314 314 ); -
makecommerce/trunk/makecommerce/languages/wc_makecommerce_domain-en.po
r3313138 r3313992 428 428 msgid "Phone number is required for the chosen shipping method." 429 429 msgstr "Phone number is required for the chosen shipping method" 430 431 #: shipping/product.php:61 432 msgid "Does not fit parcel machine" 433 msgstr "Does not fit parcel machine" 434 435 #: shipping/product.php:62 436 msgid "When this is checked, parcel machine shipping option is not available for a cart with this product" 437 msgstr "When this is checked, parcel machine shipping option is not available for a cart with this product" -
makecommerce/trunk/makecommerce/languages/wc_makecommerce_domain-et.po
r3313138 r3313992 430 430 msgid "Phone number is required for the chosen shipping method." 431 431 msgstr "Valitud saatmisviisi jaoks on vaja telefoninumbrit" 432 433 #: shipping/product.php:61 434 msgid "Does not fit parcel machine" 435 msgstr "Ei sobi pakiautomaati" 436 437 #: shipping/product.php:62 438 msgid "When this is checked, parcel machine shipping option is not available for a cart with this product" 439 msgstr "Kui see on märgitud, siis ostukorvile selle tootega pakiautomaate tarneviisina ei pakuta" -
makecommerce/trunk/makecommerce/languages/wc_makecommerce_domain-lt.po
r3313138 r3313992 430 430 msgid "Phone number is required for the chosen shipping method." 431 431 msgstr "Pasirinktam pristatymo būdui reikalingas telefono numeris" 432 433 #: shipping/product.php:61 434 msgid "Does not fit parcel machine" 435 msgstr "Netelpa į siuntų terminalą" 436 437 #: shipping/product.php:62 438 msgid "When this is checked, parcel machine shipping option is not available for a cart with this product" 439 msgstr "Kai tai pažymima, užsakymo su šiuo produktu į siuntų terminalus pristatymas negalimas" -
makecommerce/trunk/makecommerce/languages/wc_makecommerce_domain-lv.po
r3313138 r3313992 431 431 msgid "Phone number is required for the chosen shipping method." 432 432 msgstr "Izvēlētajai piegādes metodei ir nepieciešams tālruņa numurs" 433 434 #: shipping/product.php:61 435 msgid "Does not fit parcel machine" 436 msgstr "Neder pakomātam" 437 438 #: shipping/product.php:62 439 msgid "When this is checked, parcel machine shipping option is not available for a cart with this product" 440 msgstr "Kad šis ir atzīmēts, piegādes veids pakomāts nebūs pieejams pirkuma grozam, kas saturēs šo produktu" -
makecommerce/trunk/makecommerce/languages/wc_makecommerce_domain.pot
r3313138 r3313992 8 8 "Content-Type: text/plain; charset=UTF-8\n" 9 9 "Content-Transfer-Encoding: 8bit\n" 10 "POT-Creation-Date: 2025-06-1 7T07:30:58+00:00\n"10 "POT-Creation-Date: 2025-06-18T14:15:37+00:00\n" 11 11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 12 12 "X-Generator: WP-CLI 2.12.0\n" … … 208 208 msgstr "" 209 209 210 #: shipping/blocks/mc-shipping-blocks.php:83 211 msgid "Phone number is required for the chosen shipping method." 212 msgstr "" 213 214 #: shipping/blocks/mc-shipping-blocks.php:144 215 #: shipping/blocks/mc-shipping-blocks.php:162 210 #: shipping/blocks/mc-shipping-blocks.php:110 211 #: shipping/blocks/mc-shipping-blocks.php:128 216 212 #: shipping/order.php:83 217 213 #: shipping/order.php:150 … … 220 216 msgstr "" 221 217 222 #: shipping/blocks/mc-shipping-blocks.php:1 46218 #: shipping/blocks/mc-shipping-blocks.php:112 223 219 #: shipping/order.php:161 224 220 #: shipping/order.php:164 … … 226 222 msgstr "" 227 223 228 #: shipping/blocks/mc-shipping-blocks.php:1 64224 #: shipping/blocks/mc-shipping-blocks.php:130 229 225 #: shipping/order.php:183 230 226 #: shipping/order.php:188 … … 244 240 msgstr "" 245 241 246 #: shipping/method/method.php:15 0242 #: shipping/method/method.php:156 247 243 msgid "Unable to retrieve MakeCommerce shipping rates. " 248 244 msgstr "" 249 245 250 #: shipping/method/method.php:1 67246 #: shipping/method/method.php:189 251 247 msgid "<strong>Parcel machine</strong> is a required field." 252 248 msgstr "" … … 271 267 msgstr "" 272 268 269 #: shipping/product.php:61 270 msgid "Does not fit parcel machine" 271 msgstr "" 272 273 #: shipping/product.php:62 274 msgid "When this is checked, parcel machine shipping option is not available for a cart with this product" 275 msgstr "" 276 273 277 #: shipping/shipping.php:516 274 278 msgid "Loading pickup points..." -
makecommerce/trunk/makecommerce/makecommerce.php
r3313304 r3313992 11 11 * Start at version 3.0.0 and use SemVer - https://semver.org 12 12 */ 13 define( 'MAKECOMMERCE_VERSION', '4.0. 1' );13 define( 'MAKECOMMERCE_VERSION', '4.0.2' ); 14 14 define( 'MAKECOMMERCE_PLUGIN_ID', 'makecommerce' ); 15 15 -
makecommerce/trunk/makecommerce/payment/gateway/woocommerce/css/makecommerce.css
r3313304 r3313992 1 .makecommerce-payment-methods .payment-method-selected {1 .makecommerce-payment-methods .payment-method-selected { 2 2 border: 2px #32CB64 solid; 3 3 box-shadow: none; 4 4 } 5 5 6 .makecommerce-payment-methods .payment-method-selected > .check {6 .makecommerce-payment-methods .payment-method-selected > .check { 7 7 display: block; 8 8 width: 16px; 9 9 height: 16px; 10 background: url( ../images/check.svg) no-repeat 0 0;10 background: url("https://static.maksekeskus.ee/img/woocommerce/check.svg") no-repeat 0 0; 11 11 position: absolute; 12 12 top: -8px; … … 14 14 } 15 15 16 . payment-method-selected.payment-method.payment-control{16 .makecommerce-payment-methods .payment-method .payment-control{ 17 17 padding: 0px 0px 0px 0px !important; 18 18 } 19 20 19 21 20 /*!* Style the logo image on checkout *!*/ … … 27 26 height: 30px !important; 28 27 max-height: 100%; 28 position: static !important; 29 29 } 30 31 -
makecommerce/trunk/makecommerce/payment/gateway/woocommerce/woocommerce.php
r3313304 r3313992 13 13 public $id = MAKECOMMERCE_PLUGIN_ID; 14 14 15 public $version = '4.0. 1';15 public $version = '4.0.2'; 16 16 17 17 public $payment_return_url; -
makecommerce/trunk/makecommerce/shipping/js/pickuppoint.js
r3313138 r3313992 1 1 jQuery(function () { 2 jQuery(document). on('updated_checkout', function() {3 addClassicCheckoutPickupField();2 jQuery(document).ready(function() { 3 initPickupPointInjection(); 4 4 }); 5 jQuery(document).on('updated_checkout', initPickupPointInjection); 5 6 }); 6 7 7 function addClassicCheckoutPickupField() { 8 9 10 function initPickupPointInjection() { 8 11 jQuery('.makecommerce-shipping-container').remove(); 9 12 10 let method = jQuery('input[name="shipping_method[0]"]:checked').val(); 11 // Fallback if no radio input is checked (only one shipping method with hidden input) 12 if (!method) { 13 method = jQuery('input[type="hidden"][name="shipping_method[0]"]').val(); 14 } 13 let method = jQuery('input[name="shipping_method[0]"]:checked').val() 14 || jQuery('input[type="hidden"][name="shipping_method[0]"]').val(); 15 15 16 16 if (!method?.includes('mc_pickuppoint_')) return; 17 17 18 let carrier = method.split('_')[2];19 let country = jQuery('#mcCustomerCountry').val();20 let widthPx = (jQuery('table.shop_table').width() - 40) + 'px';18 const carrier = method.split('_')[2]; 19 const country = jQuery('#mcCustomerCountry').val(); 20 const widthPx = (jQuery('table.shop_table').width() - 40) + 'px'; 21 21 22 // Initialize Select2 for loading state23 22 const $select = insertLoadingSelect(carrier, widthPx); 24 23 25 // Fetch machine list and populate the same select box26 24 jQuery.ajax({ 27 25 url: '/wp-admin/admin-ajax.php', … … 46 44 select.className = 'pickup-point-select-box'; 47 45 select.name = '_mc_machine_id'; 48 let placeholderText = MC_PARCELMACHINE_JS['loadingPlaceholder'] ?? 'Loading pickup points...';46 const placeholderText = MC_PARCELMACHINE_JS['loadingPlaceholder'] ?? 'Loading pickup points...'; 49 47 50 48 const loadingOption = new Option(placeholderText, '', true, true); … … 64 62 td.colSpan = 2; 65 63 td.appendChild(div); 66 67 64 tr.appendChild(td); 68 65 69 jQuery('.woocommerce-shipping-totals.shipping').after(tr); 66 const $shippingTotals = jQuery('.woocommerce-shipping-totals.shipping'); 67 if ($shippingTotals.length > 0) { 68 $shippingTotals.last().after(tr); 69 } 70 70 71 const $select = jQuery(select);72 $select.select2({71 const $selectBox = jQuery(select).prop('disabled', true); 72 applySelectBox($selectBox, { 73 73 placeholder: placeholderText, 74 74 width: widthPx, 75 75 minimumResultsForSearch: Infinity 76 }) .prop('disabled', true);76 }); 77 77 78 return $select ;78 return $selectBox; 79 79 } 80 80 81 81 function populatePickupPointSelect($select, machines, widthPx) { 82 $select.empty(); // Clear loading state83 84 let placeholderText = MC_PARCELMACHINE_JS['placeholder'] ?? 'Select pickup point';82 $select.empty(); 83 $select.prop('disabled', false) 84 const placeholderText = MC_PARCELMACHINE_JS['placeholder'] ?? 'Select pickup point'; 85 85 const placeholder = new Option(placeholderText, '', true, true); 86 86 placeholder.disabled = true; … … 100 100 availability: item.availability 101 101 }); 102 103 if (item.selected) { 104 $option.prop('selected', true); 105 } 106 102 if (item.selected) $option.prop('selected', true); 107 103 $optgroup.append($option); 108 104 }); … … 110 106 } 111 107 112 // Re-enable and refresh Select2 113 $select.prop('disabled', false).select2({ 108 applySelectBox($select, { 114 109 placeholder: placeholderText, 115 110 width: widthPx, … … 118 113 templateResult: customOption 119 114 }); 115 } 120 116 121 focusSelect2Search($select); 117 function applySelectBox($element, options) { 118 if (typeof $element.selectWoo === 'function') { 119 $element.selectWoo(options); 120 focusSelect2Search($element); 121 } else if (typeof $element.select2 === 'function') { 122 $element.select2(options); 123 focusSelect2Search($element); 124 } else { 125 console.warn('No Select2 or SelectWoo found'); 126 } 122 127 } 123 128 124 129 function customOption(option) { 125 130 if (!option.id) return option.text; 126 127 131 const el = jQuery(option.element); 128 132 const name = el.data('name') || option.text || ''; … … 130 134 const address = el.data('address') || ''; 131 135 const zip = el.data('zip') || ''; 132 133 136 return jQuery(`<span>${name} - ${city}, ${address}, ${zip}</span>`); 134 137 } … … 136 139 function focusSelect2Search(select) { 137 140 jQuery(select).on('select2:open', function () { 138 let searchField = jQuery('.select2-container--open').find('input.select2-search__field')[0];141 const searchField = jQuery('.select2-container--open').find('input.select2-search__field')[0]; 139 142 setTimeout(() => searchField?.focus(), 300); 140 143 }); -
makecommerce/trunk/makecommerce/shipping/method/method.php
r3313138 r3313992 136 136 137 137 foreach ($rates as $method => $carriers) { 138 // If does not fit and is pickuppoint, then do not add shipping rate 139 if ($method === 'pickuppoint' && !$this->fits_parcel_machine($package)) { 140 continue; 141 } 142 138 143 foreach ($carriers as $carrier) { 139 144 $this->add_rate([ 140 'id' => 'mc_' . $method . '_' . $carrier->carrier,141 'label' => $carrier->title,142 'cost' => $carrier->price / 100,143 'taxes' => '',144 'calc_tax' => 'per_order'145 'id' => 'mc_' . $method . '_' . $carrier->carrier, 146 'label' => $carrier->title, 147 'cost' => $carrier->price / 100, 148 'taxes' => '', 149 'calc_tax' => 'per_order', 145 150 ]); 146 151 } 152 147 153 } 148 154 … … 150 156 $this->logger->error(__('Unable to retrieve MakeCommerce shipping rates. ' . json_encode($e->getMessage()), 'wc_makecommerce_domain'), $this->log_context); 151 157 } 158 } 159 160 /** 161 * Checks if there is a product that doesn't fit in parcelmachine 162 * 163 * @since 3.0.0 164 */ 165 private function fits_parcel_machine( $package ) { 166 167 foreach ( $package['contents'] as $line ) { 168 if ( get_post_meta( $line['product_id'], '_no_parcel_machine', true ) === 'yes' ) { 169 return false; 170 } 171 } 172 173 return true; 152 174 } 153 175 -
makecommerce/trunk/makecommerce/shipping/product.php
r3313138 r3313992 11 11 class Product extends \MakeCommerce\Shipping { 12 12 13 private $loader;14 15 /**16 * Constructs Label class, defines loader and hooks17 * 18 * @since 3.0.019 */13 private $loader; 14 15 /** 16 * Constructs Label class, defines loader and hooks 17 * 18 * @since 3.0.0 19 */ 20 20 public function __construct( \MakeCommerce\Loader $loader ) { 21 21 22 $this->loader = $loader; 22 } 23 24 $this->define_hooks(); 25 } 26 27 /** 28 * Define all wordpress hooks needed for printing stuff and creating labels 29 * 30 * @since 3.0.0 31 */ 32 public function define_hooks() { 33 34 $this->loader->add_filter( 'woocommerce_product_options_shipping', $this, 'option_fields' ); 35 $this->loader->add_filter( 'woocommerce_process_product_meta', $this, 'save' ); 36 } 37 38 /** 39 * Save product fields 40 * 41 * @since 3.0.0 42 */ 43 public function save( $post_id ) { 44 $no_parcel_machine = isset($_POST['_no_parcel_machine']) ? 'yes' : 'no'; 45 update_post_meta($post_id, '_no_parcel_machine', $no_parcel_machine); 46 47 } 48 49 /** 50 * Add options to product page 51 * 52 * @since 3.0.0 53 */ 54 public function option_fields( $fields ) { 55 56 echo '<div class="options_group">'; 57 58 woocommerce_wp_checkbox( 59 array( 60 'id' => '_no_parcel_machine', 61 'label' => __('Does not fit parcel machine', 'wc_makecommerce_domain'), 62 'description' => __('When this is checked, parcel machine shipping option is not available for a cart with this product', 'wc_makecommerce_domain') 63 ) 64 ); 65 66 echo '</div>'; 67 } 23 68 } -
makecommerce/trunk/payment/gateway/woocommerce/woocommerce.php
r3313304 r3313992 12 12 13 13 public $id = MAKECOMMERCE_PLUGIN_ID; 14 public $version = '4.0. 1';14 public $version = '4.0.2'; 15 15 16 16 public $payment_return_url;
Note: See TracChangeset
for help on using the changeset viewer.