Changeset 3169811
- Timestamp:
- 10/16/2024 06:52:38 AM (15 months ago)
- Location:
- quotes-for-woocommerce
- Files:
-
- 28 edited
- 1 copied
-
tags/2.6 (copied) (copied from quotes-for-woocommerce/trunk)
-
tags/2.6/assets/css/qwc-frontend.css (modified) (1 diff)
-
tags/2.6/changelog.txt (modified) (1 diff)
-
tags/2.6/class-quotes-wc.php (modified) (9 diffs)
-
tags/2.6/includes/blocks/class-quotes-wc-blocks-integration.php (modified) (3 diffs)
-
tags/2.6/includes/class-quotes-payment-gateway.php (modified) (2 diffs)
-
tags/2.6/includes/qwc-functions.php (modified) (7 diffs)
-
tags/2.6/languages/quote-wc.pot (modified) (10 diffs)
-
tags/2.6/quotes-woocommerce.php (modified) (3 diffs)
-
tags/2.6/readme.txt (modified) (3 diffs)
-
tags/2.6/templates/emails/new-quote-request-sent-customer.php (modified) (1 diff)
-
tags/2.6/templates/emails/plain/request-new-quote.php (modified) (2 diffs)
-
tags/2.6/templates/emails/plain/send-quote.php (modified) (2 diffs)
-
tags/2.6/templates/emails/request-new-quote.php (modified) (1 diff)
-
tags/2.6/templates/emails/send-quote.php (modified) (1 diff)
-
trunk/assets/css/qwc-frontend.css (modified) (1 diff)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/class-quotes-wc.php (modified) (9 diffs)
-
trunk/includes/blocks/class-quotes-wc-blocks-integration.php (modified) (3 diffs)
-
trunk/includes/class-quotes-payment-gateway.php (modified) (2 diffs)
-
trunk/includes/qwc-functions.php (modified) (7 diffs)
-
trunk/languages/quote-wc.pot (modified) (10 diffs)
-
trunk/quotes-woocommerce.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/templates/emails/new-quote-request-sent-customer.php (modified) (1 diff)
-
trunk/templates/emails/plain/request-new-quote.php (modified) (2 diffs)
-
trunk/templates/emails/plain/send-quote.php (modified) (2 diffs)
-
trunk/templates/emails/request-new-quote.php (modified) (1 diff)
-
trunk/templates/emails/send-quote.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
quotes-for-woocommerce/tags/2.6/assets/css/qwc-frontend.css
r3033995 r3169811 42 42 display: none; 43 43 } 44 45 44 /* Only for large screens */ 46 45 @media (min-width: 700px) { -
quotes-for-woocommerce/tags/2.6/changelog.txt
r3153140 r3169811 1 1 *** Quotes for WooCommerce *** 2 3 2024-10-16 - Version 2.6 4 * Tweak - Added some filters for compatibility with Premium 1.5. 5 * Fix - Address WooCommerce Payment Gateway API required fields. 2 6 3 7 2024-09-17 - Version 2.5 -
quotes-for-woocommerce/tags/2.6/class-quotes-wc.php
r3153140 r3169811 29 29 * @since 1.0.0 30 30 */ 31 public $version = '2. 5';31 public $version = '2.6'; 32 32 33 33 /** … … 541 541 542 542 $product_id = apply_filters( 'qwc_cart_check_item_product_id', $cart_item['product_id'], $cart_item ); 543 544 $quotes = product_quote_enabled( $product_id ); 543 $quantity = isset( $cart_item['quantity'] ) ? $cart_item['quantity'] : 1; 544 545 $quotes = product_quote_enabled( $product_id, $quantity ); 545 546 546 547 if ( $quotes && ! qwc_cart_display_price() ) { … … 597 598 598 599 // Check if the product being added is quotable. 599 $product_quotable = product_quote_enabled( $product_id );600 $product_quotable = product_quote_enabled( $product_id, $qty ); 600 601 601 602 // Check if the cart contains a product that is quotable. … … 636 637 if ( ! $needs_payment ) { 637 638 foreach ( $cart->cart_contents as $cart_item ) { 638 $requires_quotes = product_quote_enabled( $cart_item['product_id'] ); 639 $quantity = isset( $cart_item['quantity'] ) ? $cart_item['quantity'] : 1; 640 641 $requires_quotes = product_quote_enabled( $cart_item['product_id'], $quantity ); 639 642 640 643 if ( $requires_quotes ) { … … 891 894 892 895 if ( is_array( $products ) && count( $products ) > 0 ) { 893 foreach ( $products as $product_id => $ value) {894 if ( product_quote_enabled( $product_id ) ) {896 foreach ( $products as $product_id => $quantity ) { 897 if ( product_quote_enabled( $product_id, $quantity ) ) { 895 898 $message = str_replace( 'added to your cart', "added to your $cart_name", $message ); 896 899 $message = str_replace( 'View cart', "View $cart_name", $message ); … … 947 950 */ 948 951 public function qwc_change_proceed_checkout_btn_text() { 949 if ( cart_contains_quotable() ) { 952 $modify_text = apply_filters( 'qwc_modify_proceed_checkout_button_text', true ); 953 if ( cart_contains_quotable() && $modify_text ) { 950 954 remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 ); 951 955 $proceed_checkout_label = '' === get_option( 'qwc_proceed_checkout_btn_label', '' ) ? __( 'Proceed to Checkout', 'quote-wc' ) : get_option( 'qwc_proceed_checkout_btn_label' ); … … 966 970 */ 967 971 public function cart_needs_shipping( $needs_shipping ) { 968 if ( cart_contains_quotable() && 'on' === get_option( 'qwc_hide_address_fields' ) ) { 972 // Override lite verison shipping removal for quote orders by using this filter. 973 $shipping_choice = apply_filters( 974 'qwc_override_shipping_quotes', 975 array( 976 'override' => false, 977 'needs_shipping' => $needs_shipping, 978 ) 979 ); 980 // Override should be returned true, if u want to override the default behaviour. 981 if ( isset( $shipping_choice['override'] ) && $shipping_choice['override'] ) { 982 if ( isset( $shipping_choice['needs_shipping'] ) ) { 983 return $shipping_choice['needs_shipping']; 984 } else { // if user choice not found after overriding, return as is. 985 return $needs_shipping; 986 } 987 } elseif ( cart_contains_quotable() && 'on' === get_option( 'qwc_hide_address_fields' ) ) { // default, free verison removes shipping for quote orders. 969 988 return false; 970 989 } else { … … 995 1014 ); 996 1015 997 foreach ( $qwc_hide_fields_list as $field_name ) { 998 unset( $fields[ $field_name ] ); 1016 if ( is_array( $qwc_hide_fields_list ) && count( $qwc_hide_fields_list ) > 0 ) { 1017 foreach ( $qwc_hide_fields_list as $field_name ) { 1018 unset( $fields[ $field_name ] ); 1019 } 999 1020 } 1000 1021 } … … 1025 1046 ); 1026 1047 1027 foreach ( $qwc_hide_fields_list as $field_name ) { 1028 unset( $fields['billing'][ $field_name ] ); 1048 if ( is_array( $qwc_hide_fields_list ) && count( $qwc_hide_fields_list ) > 0 ) { 1049 foreach ( $qwc_hide_fields_list as $field_name ) { 1050 unset( $fields['billing'][ $field_name ] ); 1051 } 1029 1052 } 1030 1053 } -
quotes-for-woocommerce/tags/2.6/includes/blocks/class-quotes-wc-blocks-integration.php
r2949503 r3169811 21 21 add_action( 'woocommerce_store_api_checkout_update_order_from_request', array( &$this, 'qwc_wc_blocks_update_order_meta_data' ), 10, 2 ); 22 22 // Order has been processed, initiate emails. 23 add_action( 'woocommerce_store_api_checkout_order_processed', array( &$this, 'qwc_init_quote_emails' ), 10, 1 );23 add_action( 'woocommerce_store_api_checkout_order_processed', array( &$this, 'qwc_init_quote_emails' ), 90, 1 ); 24 24 } 25 25 … … 52 52 53 53 if ( $order ) { 54 $order_id = $order->get_id(); 55 $order_id = apply_filters( 'qwc_init_quote_emails', $order_id ); 56 $order = wc_get_order( $order_id ); // We refetch the order obj to ensure the correct obj is used if the order Id was modified by the filter. 54 57 $quote = order_requires_quote( $order ); 55 $order_id = $order->get_id();56 57 58 if ( $quote && isset( $order_id ) && $order_id > 0 ) { 58 59 WC_Emails::instance(); … … 61 62 } 62 63 } 63 64 64 } 65 65 } -
quotes-for-woocommerce/tags/2.6/includes/class-quotes-payment-gateway.php
r3153140 r3169811 37 37 $this->order_button_text = '' === get_option( 'qwc_place_order_text', '' ) ? __( 'Request Quote', 'quote-wc' ) : __( get_option( 'qwc_place_order_text' ), 'quote-wc' ); // phpcs:ignore 38 38 39 $this->description = ''; 40 $this->instructions = ''; 39 $this->description = ''; 40 $this->method_description = ''; 41 $this->instructions = ''; 41 42 // Actions. 42 43 add_filter( 'woocommerce_thankyou_order_received_text', array( &$this, 'thankyou_page' ), 10, 2 ); … … 99 100 return $message; 100 101 } 101 102 102 } 103 103 } -
quotes-for-woocommerce/tags/2.6/includes/qwc-functions.php
r3058097 r3169811 11 11 * 12 12 * @param int $product_id - Product ID. 13 * @param int $qty - Product Qty. 13 14 * @return bool $quotes_enabled - Quote Status. 14 15 */ 15 function product_quote_enabled( $product_id ) {16 function product_quote_enabled( $product_id, $qty = 1 ) { 16 17 $quote_enabled = false; 17 18 … … 23 24 } 24 25 } 25 $quote_enabled = apply_filters( 'qwc_product_quote_enabled', $quote_enabled, $product_id );26 $quote_enabled = apply_filters( 'qwc_product_quote_enabled', $quote_enabled, $product_id, $qty ); 26 27 return $quote_enabled; 27 28 } … … 58 59 } 59 60 $product_id = apply_filters( 'qwc_cart_check_item_product_id', $item['product_id'], $item ); 60 $quote_enabled = product_quote_enabled( $product_id ); 61 $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; 62 $quote_enabled = product_quote_enabled( $product_id, $quantity ); 61 63 62 64 if ( $quote_enabled ) { … … 67 69 } 68 70 return $quotable; 69 70 71 } 71 72 … … 82 83 if ( $order ) { 83 84 foreach ( $order->get_items() as $item ) { 84 $product_quote = product_quote_enabled( $item['product_id'] ); 85 $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; 86 $product_quote = product_quote_enabled( $item['product_id'], $quantity ); 85 87 if ( $product_quote ) { 86 88 $requires = true; … … 156 158 157 159 return $display; 158 159 160 } 160 161 … … 204 205 } 205 206 } 207 208 /** 209 * Returns whether the cart contains products with quotes. 210 * 211 * @return bool Cart has quote products or no. 212 * @since 2.6 213 */ 214 function cart_contains_purchasable() { 215 216 $purchasable = false; 217 218 if ( isset( WC()->cart ) ) { 219 foreach ( WC()->cart->cart_contents as $item ) { 220 221 if ( 0 === $item['product_id'] ) { 222 $item['product_id'] = qwc_get_product_id_by_variation_id( $item['variation_id'] ); 223 } 224 $product_id = apply_filters( 'qwc_cart_check_item_product_id', $item['product_id'], $item ); 225 $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; 226 $quote_enabled = product_quote_enabled( $product_id, $quantity ); 227 228 if ( ! $quote_enabled ) { 229 $purchasable = true; 230 break; 231 } 232 } 233 } 234 return $purchasable; 235 } 236 237 /** 238 * Returns whether order contains non-quote (purchase) products or no. 239 * 240 * @param object $order - WC_Order. 241 * @return bool|false - Order contains quot products | false when no data found. 242 */ 243 function order_contains_purchase( $order ) { 244 245 $purchasable = false; 246 247 if ( $order ) { 248 foreach ( $order->get_items() as $item ) { 249 $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; 250 $product_quote = product_quote_enabled( $item['product_id'], $quantity ); 251 if ( ! $product_quote ) { 252 $purchasable = true; 253 break; 254 } 255 } 256 } 257 258 return $purchasable; 259 } -
quotes-for-woocommerce/tags/2.6/languages/quote-wc.pot
r3153140 r3169811 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Quotes for WooCommerce 2. 4\n"5 "Project-Id-Version: Quotes for WooCommerce 2.5\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/quotes-for-woocommerce\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2024- 09-16T16:43:57+02:00\n"12 "POT-Creation-Date: 2024-10-15T13:10:54+02:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.11.0\n" … … 48 48 49 49 #: class-quotes-wc.php:505 50 #: class-quotes-wc.php:95 150 #: class-quotes-wc.php:955 51 51 #: includes/admin/class-quotes-wc-general-settings.php:77 52 52 msgid "Proceed to Checkout" … … 54 54 55 55 #. translators: Leave price blanks as its not be displayed. 56 #: class-quotes-wc.php:58 156 #: class-quotes-wc.php:582 57 57 msgid "<strong>Subtotal:</strong> <span class='amount'>%s</span>" 58 58 msgstr "" 59 59 60 #: class-quotes-wc.php:6 1960 #: class-quotes-wc.php:620 61 61 msgid "It is not possible to add products that require quotes to the Cart along with ones that do not. Hence, the existing products have been removed from the Cart." 62 62 msgstr "" 63 63 64 #: class-quotes-wc.php:7 6864 #: class-quotes-wc.php:771 65 65 msgid "Quote Complete" 66 66 msgstr "" 67 67 68 #: class-quotes-wc.php:77 268 #: class-quotes-wc.php:775 69 69 #: includes/emails/class-qwc-send-quote.php:24 70 70 msgid "Send Quote" 71 71 msgstr "" 72 72 73 #: class-quotes-wc.php:77 473 #: class-quotes-wc.php:777 74 74 msgid "Resend Quote" 75 75 msgstr "" 76 76 77 #: class-quotes-wc.php:80 377 #: class-quotes-wc.php:806 78 78 msgid "Quote Complete." 79 79 msgstr "" 80 80 81 #: class-quotes-wc.php:87 281 #: class-quotes-wc.php:875 82 82 msgid "Quote email sent to " 83 83 msgstr "" 84 84 85 #: class-quotes-wc.php:89 086 #: class-quotes-wc.php:91 685 #: class-quotes-wc.php:893 86 #: class-quotes-wc.php:919 87 87 #: includes/admin/class-quotes-wc-general-settings.php:75 88 88 msgid "Cart" 89 89 msgstr "" 90 90 91 #: class-quotes-wc.php:92 291 #: class-quotes-wc.php:925 92 92 #: includes/admin/class-quotes-wc-general-settings.php:76 93 93 msgid "Checkout" 94 94 msgstr "" 95 95 96 #: class-quotes-wc.php:10 4497 #: includes/class-quotes-payment-gateway.php: 4996 #: class-quotes-wc.php:1067 97 #: includes/class-quotes-payment-gateway.php:50 98 98 msgid "Settings" 99 99 msgstr "" 100 100 101 #: class-quotes-wc.php:10 45101 #: class-quotes-wc.php:1068 102 102 msgid "Get Quotes Pro" 103 103 msgstr "" 104 104 105 #: class-quotes-wc.php:10 60105 #: class-quotes-wc.php:1083 106 106 msgid "Quotes menu has moved!" 107 107 msgstr "" 108 108 109 #: class-quotes-wc.php:10 61109 #: class-quotes-wc.php:1084 110 110 msgid "The Quotes settings can now be managed from WooCommerce > Settings > Quotes." 111 111 msgstr "" … … 203 203 msgstr "" 204 204 205 #: includes/class-quotes-payment-gateway.php:5 3205 #: includes/class-quotes-payment-gateway.php:54 206 206 msgid "This is a fictitious payment method used for quotes." 207 207 msgstr "" 208 208 209 #: includes/class-quotes-payment-gateway.php:5 4209 #: includes/class-quotes-payment-gateway.php:55 210 210 msgid "This gateway requires no configuration." 211 211 msgstr "" 212 212 213 #: includes/class-quotes-payment-gateway.php:7 4213 #: includes/class-quotes-payment-gateway.php:75 214 214 msgid "This order is awaiting quote." 215 215 msgstr "" 216 216 217 #: includes/class-quotes-payment-gateway.php:9 6217 #: includes/class-quotes-payment-gateway.php:97 218 218 msgid "We have received your request for a quote. You will be notified via email soon." 219 219 msgstr "" … … 402 402 msgstr "" 403 403 404 #. translators: Site Name.405 404 #. translators: Customer Name. 406 405 #: templates/emails/plain/request-new-quote.php:12 … … 409 408 msgstr "" 410 409 411 #. translators: Order payment link. 412 #. translators: Admin Url for payment. 410 #. translators: Admin Url for order. 413 411 #: templates/emails/plain/request-new-quote.php:68 414 412 #: templates/emails/request-new-quote.php:79 … … 416 414 msgstr "" 417 415 418 #. translators: User first name.419 416 #. translators: Billing First Name. 420 417 #: templates/emails/plain/send-quote.php:14 … … 423 420 msgstr "" 424 421 425 #. translators: Site name.426 422 #. translators: Site Name. 427 423 #: templates/emails/plain/send-quote.php:17 … … 430 426 msgstr "" 431 427 432 #. translators: Payment URL.433 428 #. translators: Payment Link Url. 434 429 #: templates/emails/plain/send-quote.php:24 -
quotes-for-woocommerce/tags/2.6/quotes-woocommerce.php
r3153140 r3169811 3 3 * Plugin Name: Quotes for WooCommerce 4 4 * Description: This plugin allows you to convert your WooCommerce store into a quote only store. It will hide the prices for the products and not take any payment at Checkout. You can then setup prices for the items in the order and send a notification to the Customer. 5 * Version: 2. 55 * Version: 2.6 6 6 * Author: TechnoVama 7 7 * Requires at least: 4.5 … … 30 30 add_action( 31 31 'admin_notices', 32 function () {32 function () { 33 33 // translators: plugin name with link. 34 34 $msg = sprintf( __( 'Please install and activate %s before activating Quotes for WooCommerce.', 'quote-wc' ), '<a href="https://wordpress.org/plugins/woocommerce/" target="_blank">WooCommerce</a>' ); … … 51 51 add_action( 52 52 'before_woocommerce_init', 53 function () {53 function () { 54 54 if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) { 55 55 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); -
quotes-for-woocommerce/tags/2.6/readme.txt
r3153140 r3169811 5 5 Requires at least: 4.5 6 6 Tested up to: 6.6.2 7 Stable tag: 2. 57 Stable tag: 2.6 8 8 Requires PHP: 7.2 9 9 License: GPLv2 or later … … 38 38 <ul> 39 39 <li>Enable quotes for only some products in the store.</li> 40 <li>Allow quote and purchasable products in a single cart.</li> 40 41 <li>Enable quotes for select variations of a product</li> 42 <li>Automatically enable quotes based on item quantity for each product.</li> 41 43 <li>Customize quote button display based on WordPress User Roles</li> 42 44 <li>Seamlessly process both regular orders and quote requests for all products</li> … … 81 83 82 84 == Changelog == 85 86 = 2.6 ( 16.10.2024 ) = 87 * Tweak - Added some filters for compatibility with Premium 1.5. 88 * Fix - Address WooCommerce Payment Gateway API required fields. 83 89 84 90 = 2.5 ( 17.09.2024 ) = -
quotes-for-woocommerce/tags/2.6/templates/emails/new-quote-request-sent-customer.php
r3153140 r3169811 44 44 <tr> 45 45 <td style="text-align:left; border: 1px solid #eee;"> 46 <a href='<?php echo esc_url( get_permalink( $product_id ) ); ?>' target='_blank'><?php echo wp_kses_post( $items->get_name() ); ?></a>46 <a href='<?php echo esc_url( get_permalink( $product_id ) ); ?>' target='_blank'><?php echo wp_kses_post( $items->get_name() ); ?></a> 47 47 <?php 48 48 // allow other plugins to add additional product information here. -
quotes-for-woocommerce/tags/2.6/templates/emails/plain/request-new-quote.php
r3153140 r3169811 9 9 $margin_side = is_rtl() ? 'left' : 'right'; 10 10 11 // translators: SiteName.11 // translators: Customer Name. 12 12 $opening_paragraph = __( 'A request for quote has been made by %s and is awaiting your attention. The details of the order are as follows:', 'quote-wc' ); 13 13 echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n"; … … 65 65 echo "\n----------------------------------------\n\n"; 66 66 echo sprintf( esc_html__( 'This order is awaiting a quote.', 'quote-wc' ) ); 67 // translators: Order payment link.67 // translators: Admin Url for order. 68 68 echo wp_kses_post( make_clickable( sprintf( __( 'You can view and edit this order in the dashboard here: %s', 'quote-wc' ), $order_url ) ) ); 69 69 -
quotes-for-woocommerce/tags/2.6/templates/emails/plain/send-quote.php
r3110434 r3169811 11 11 if ( $order ) : 12 12 $billing_first_name = ( version_compare( WOOCOMMERCE_VERSION, '3.0.0' ) < 0 ) ? $order->billing_first_name : $order->get_billing_first_name(); 13 // translators: User first name.13 // translators: Billing First Name. 14 14 echo sprintf( esc_html__( 'Hello %s', 'quote-wc' ), esc_attr( $billing_first_name ) ) . "\n\n"; 15 15 endif; 16 // translators: Site name.16 // translators: Site Name. 17 17 echo sprintf( esc_html__( 'You have received a quotation for your order on %s. The details of the same are shown below.', 'quote-wc' ), esc_attr( $order_details->blogname ) ); 18 18 … … 21 21 $order_status = $order->get_status(); 22 22 if ( 'pending' === $order_status ) : 23 // translators: Payment URL.23 // translators: Payment Link Url. 24 24 echo sprintf( esc_html__( 'To pay for this order please use the following link: %s', 'quote-wc' ), esc_url( $order->get_checkout_payment_url() ) ); 25 25 endif; -
quotes-for-woocommerce/tags/2.6/templates/emails/request-new-quote.php
r3153140 r3169811 76 76 <p> 77 77 <?php 78 // translators: Admin Url for payment.78 // translators: Admin Url for order. 79 79 echo wp_kses_post( make_clickable( sprintf( __( 'You can view and edit this order in the dashboard here: %s', 'quote-wc' ), esc_url( $order_url ) ) ) ); 80 80 ?> -
quotes-for-woocommerce/tags/2.6/templates/emails/send-quote.php
r3110434 r3169811 53 53 } 54 54 ?> 55 <h2><?php echo esc_html__( 'Order', 'quote-wc' ) . ': ' . esc_html( $order->get_order_number() ); ?> (<?php printf( '<time datetime="%s">%s</time>', wp_kses_post( date_i18n( 'c', strtotime( $order_date ) ) ), wp_kses_post( date_i18n( wc_date_format(), strtotime( $order_date ) ) ) ); ?>)</h2>55 <h2><?php echo esc_html__( 'Order', 'quote-wc' ) . ': ' . esc_html( $order->get_order_number() ); ?> (<?php printf( '<time datetime="%s">%s</time>', wp_kses_post( date_i18n( 'c', strtotime( $order_date ) ) ), wp_kses_post( date_i18n( wc_date_format(), strtotime( $order_date ) ) ) ); ?>)</h2> 56 56 <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee"> 57 57 <thead> -
quotes-for-woocommerce/trunk/assets/css/qwc-frontend.css
r3033995 r3169811 42 42 display: none; 43 43 } 44 45 44 /* Only for large screens */ 46 45 @media (min-width: 700px) { -
quotes-for-woocommerce/trunk/changelog.txt
r3153140 r3169811 1 1 *** Quotes for WooCommerce *** 2 3 2024-10-16 - Version 2.6 4 * Tweak - Added some filters for compatibility with Premium 1.5. 5 * Fix - Address WooCommerce Payment Gateway API required fields. 2 6 3 7 2024-09-17 - Version 2.5 -
quotes-for-woocommerce/trunk/class-quotes-wc.php
r3153140 r3169811 29 29 * @since 1.0.0 30 30 */ 31 public $version = '2. 5';31 public $version = '2.6'; 32 32 33 33 /** … … 541 541 542 542 $product_id = apply_filters( 'qwc_cart_check_item_product_id', $cart_item['product_id'], $cart_item ); 543 544 $quotes = product_quote_enabled( $product_id ); 543 $quantity = isset( $cart_item['quantity'] ) ? $cart_item['quantity'] : 1; 544 545 $quotes = product_quote_enabled( $product_id, $quantity ); 545 546 546 547 if ( $quotes && ! qwc_cart_display_price() ) { … … 597 598 598 599 // Check if the product being added is quotable. 599 $product_quotable = product_quote_enabled( $product_id );600 $product_quotable = product_quote_enabled( $product_id, $qty ); 600 601 601 602 // Check if the cart contains a product that is quotable. … … 636 637 if ( ! $needs_payment ) { 637 638 foreach ( $cart->cart_contents as $cart_item ) { 638 $requires_quotes = product_quote_enabled( $cart_item['product_id'] ); 639 $quantity = isset( $cart_item['quantity'] ) ? $cart_item['quantity'] : 1; 640 641 $requires_quotes = product_quote_enabled( $cart_item['product_id'], $quantity ); 639 642 640 643 if ( $requires_quotes ) { … … 891 894 892 895 if ( is_array( $products ) && count( $products ) > 0 ) { 893 foreach ( $products as $product_id => $ value) {894 if ( product_quote_enabled( $product_id ) ) {896 foreach ( $products as $product_id => $quantity ) { 897 if ( product_quote_enabled( $product_id, $quantity ) ) { 895 898 $message = str_replace( 'added to your cart', "added to your $cart_name", $message ); 896 899 $message = str_replace( 'View cart', "View $cart_name", $message ); … … 947 950 */ 948 951 public function qwc_change_proceed_checkout_btn_text() { 949 if ( cart_contains_quotable() ) { 952 $modify_text = apply_filters( 'qwc_modify_proceed_checkout_button_text', true ); 953 if ( cart_contains_quotable() && $modify_text ) { 950 954 remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 ); 951 955 $proceed_checkout_label = '' === get_option( 'qwc_proceed_checkout_btn_label', '' ) ? __( 'Proceed to Checkout', 'quote-wc' ) : get_option( 'qwc_proceed_checkout_btn_label' ); … … 966 970 */ 967 971 public function cart_needs_shipping( $needs_shipping ) { 968 if ( cart_contains_quotable() && 'on' === get_option( 'qwc_hide_address_fields' ) ) { 972 // Override lite verison shipping removal for quote orders by using this filter. 973 $shipping_choice = apply_filters( 974 'qwc_override_shipping_quotes', 975 array( 976 'override' => false, 977 'needs_shipping' => $needs_shipping, 978 ) 979 ); 980 // Override should be returned true, if u want to override the default behaviour. 981 if ( isset( $shipping_choice['override'] ) && $shipping_choice['override'] ) { 982 if ( isset( $shipping_choice['needs_shipping'] ) ) { 983 return $shipping_choice['needs_shipping']; 984 } else { // if user choice not found after overriding, return as is. 985 return $needs_shipping; 986 } 987 } elseif ( cart_contains_quotable() && 'on' === get_option( 'qwc_hide_address_fields' ) ) { // default, free verison removes shipping for quote orders. 969 988 return false; 970 989 } else { … … 995 1014 ); 996 1015 997 foreach ( $qwc_hide_fields_list as $field_name ) { 998 unset( $fields[ $field_name ] ); 1016 if ( is_array( $qwc_hide_fields_list ) && count( $qwc_hide_fields_list ) > 0 ) { 1017 foreach ( $qwc_hide_fields_list as $field_name ) { 1018 unset( $fields[ $field_name ] ); 1019 } 999 1020 } 1000 1021 } … … 1025 1046 ); 1026 1047 1027 foreach ( $qwc_hide_fields_list as $field_name ) { 1028 unset( $fields['billing'][ $field_name ] ); 1048 if ( is_array( $qwc_hide_fields_list ) && count( $qwc_hide_fields_list ) > 0 ) { 1049 foreach ( $qwc_hide_fields_list as $field_name ) { 1050 unset( $fields['billing'][ $field_name ] ); 1051 } 1029 1052 } 1030 1053 } -
quotes-for-woocommerce/trunk/includes/blocks/class-quotes-wc-blocks-integration.php
r2949503 r3169811 21 21 add_action( 'woocommerce_store_api_checkout_update_order_from_request', array( &$this, 'qwc_wc_blocks_update_order_meta_data' ), 10, 2 ); 22 22 // Order has been processed, initiate emails. 23 add_action( 'woocommerce_store_api_checkout_order_processed', array( &$this, 'qwc_init_quote_emails' ), 10, 1 );23 add_action( 'woocommerce_store_api_checkout_order_processed', array( &$this, 'qwc_init_quote_emails' ), 90, 1 ); 24 24 } 25 25 … … 52 52 53 53 if ( $order ) { 54 $order_id = $order->get_id(); 55 $order_id = apply_filters( 'qwc_init_quote_emails', $order_id ); 56 $order = wc_get_order( $order_id ); // We refetch the order obj to ensure the correct obj is used if the order Id was modified by the filter. 54 57 $quote = order_requires_quote( $order ); 55 $order_id = $order->get_id();56 57 58 if ( $quote && isset( $order_id ) && $order_id > 0 ) { 58 59 WC_Emails::instance(); … … 61 62 } 62 63 } 63 64 64 } 65 65 } -
quotes-for-woocommerce/trunk/includes/class-quotes-payment-gateway.php
r3153140 r3169811 37 37 $this->order_button_text = '' === get_option( 'qwc_place_order_text', '' ) ? __( 'Request Quote', 'quote-wc' ) : __( get_option( 'qwc_place_order_text' ), 'quote-wc' ); // phpcs:ignore 38 38 39 $this->description = ''; 40 $this->instructions = ''; 39 $this->description = ''; 40 $this->method_description = ''; 41 $this->instructions = ''; 41 42 // Actions. 42 43 add_filter( 'woocommerce_thankyou_order_received_text', array( &$this, 'thankyou_page' ), 10, 2 ); … … 99 100 return $message; 100 101 } 101 102 102 } 103 103 } -
quotes-for-woocommerce/trunk/includes/qwc-functions.php
r3058097 r3169811 11 11 * 12 12 * @param int $product_id - Product ID. 13 * @param int $qty - Product Qty. 13 14 * @return bool $quotes_enabled - Quote Status. 14 15 */ 15 function product_quote_enabled( $product_id ) {16 function product_quote_enabled( $product_id, $qty = 1 ) { 16 17 $quote_enabled = false; 17 18 … … 23 24 } 24 25 } 25 $quote_enabled = apply_filters( 'qwc_product_quote_enabled', $quote_enabled, $product_id );26 $quote_enabled = apply_filters( 'qwc_product_quote_enabled', $quote_enabled, $product_id, $qty ); 26 27 return $quote_enabled; 27 28 } … … 58 59 } 59 60 $product_id = apply_filters( 'qwc_cart_check_item_product_id', $item['product_id'], $item ); 60 $quote_enabled = product_quote_enabled( $product_id ); 61 $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; 62 $quote_enabled = product_quote_enabled( $product_id, $quantity ); 61 63 62 64 if ( $quote_enabled ) { … … 67 69 } 68 70 return $quotable; 69 70 71 } 71 72 … … 82 83 if ( $order ) { 83 84 foreach ( $order->get_items() as $item ) { 84 $product_quote = product_quote_enabled( $item['product_id'] ); 85 $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; 86 $product_quote = product_quote_enabled( $item['product_id'], $quantity ); 85 87 if ( $product_quote ) { 86 88 $requires = true; … … 156 158 157 159 return $display; 158 159 160 } 160 161 … … 204 205 } 205 206 } 207 208 /** 209 * Returns whether the cart contains products with quotes. 210 * 211 * @return bool Cart has quote products or no. 212 * @since 2.6 213 */ 214 function cart_contains_purchasable() { 215 216 $purchasable = false; 217 218 if ( isset( WC()->cart ) ) { 219 foreach ( WC()->cart->cart_contents as $item ) { 220 221 if ( 0 === $item['product_id'] ) { 222 $item['product_id'] = qwc_get_product_id_by_variation_id( $item['variation_id'] ); 223 } 224 $product_id = apply_filters( 'qwc_cart_check_item_product_id', $item['product_id'], $item ); 225 $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; 226 $quote_enabled = product_quote_enabled( $product_id, $quantity ); 227 228 if ( ! $quote_enabled ) { 229 $purchasable = true; 230 break; 231 } 232 } 233 } 234 return $purchasable; 235 } 236 237 /** 238 * Returns whether order contains non-quote (purchase) products or no. 239 * 240 * @param object $order - WC_Order. 241 * @return bool|false - Order contains quot products | false when no data found. 242 */ 243 function order_contains_purchase( $order ) { 244 245 $purchasable = false; 246 247 if ( $order ) { 248 foreach ( $order->get_items() as $item ) { 249 $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; 250 $product_quote = product_quote_enabled( $item['product_id'], $quantity ); 251 if ( ! $product_quote ) { 252 $purchasable = true; 253 break; 254 } 255 } 256 } 257 258 return $purchasable; 259 } -
quotes-for-woocommerce/trunk/languages/quote-wc.pot
r3153140 r3169811 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Quotes for WooCommerce 2. 4\n"5 "Project-Id-Version: Quotes for WooCommerce 2.5\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/quotes-for-woocommerce\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2024- 09-16T16:43:57+02:00\n"12 "POT-Creation-Date: 2024-10-15T13:10:54+02:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.11.0\n" … … 48 48 49 49 #: class-quotes-wc.php:505 50 #: class-quotes-wc.php:95 150 #: class-quotes-wc.php:955 51 51 #: includes/admin/class-quotes-wc-general-settings.php:77 52 52 msgid "Proceed to Checkout" … … 54 54 55 55 #. translators: Leave price blanks as its not be displayed. 56 #: class-quotes-wc.php:58 156 #: class-quotes-wc.php:582 57 57 msgid "<strong>Subtotal:</strong> <span class='amount'>%s</span>" 58 58 msgstr "" 59 59 60 #: class-quotes-wc.php:6 1960 #: class-quotes-wc.php:620 61 61 msgid "It is not possible to add products that require quotes to the Cart along with ones that do not. Hence, the existing products have been removed from the Cart." 62 62 msgstr "" 63 63 64 #: class-quotes-wc.php:7 6864 #: class-quotes-wc.php:771 65 65 msgid "Quote Complete" 66 66 msgstr "" 67 67 68 #: class-quotes-wc.php:77 268 #: class-quotes-wc.php:775 69 69 #: includes/emails/class-qwc-send-quote.php:24 70 70 msgid "Send Quote" 71 71 msgstr "" 72 72 73 #: class-quotes-wc.php:77 473 #: class-quotes-wc.php:777 74 74 msgid "Resend Quote" 75 75 msgstr "" 76 76 77 #: class-quotes-wc.php:80 377 #: class-quotes-wc.php:806 78 78 msgid "Quote Complete." 79 79 msgstr "" 80 80 81 #: class-quotes-wc.php:87 281 #: class-quotes-wc.php:875 82 82 msgid "Quote email sent to " 83 83 msgstr "" 84 84 85 #: class-quotes-wc.php:89 086 #: class-quotes-wc.php:91 685 #: class-quotes-wc.php:893 86 #: class-quotes-wc.php:919 87 87 #: includes/admin/class-quotes-wc-general-settings.php:75 88 88 msgid "Cart" 89 89 msgstr "" 90 90 91 #: class-quotes-wc.php:92 291 #: class-quotes-wc.php:925 92 92 #: includes/admin/class-quotes-wc-general-settings.php:76 93 93 msgid "Checkout" 94 94 msgstr "" 95 95 96 #: class-quotes-wc.php:10 4497 #: includes/class-quotes-payment-gateway.php: 4996 #: class-quotes-wc.php:1067 97 #: includes/class-quotes-payment-gateway.php:50 98 98 msgid "Settings" 99 99 msgstr "" 100 100 101 #: class-quotes-wc.php:10 45101 #: class-quotes-wc.php:1068 102 102 msgid "Get Quotes Pro" 103 103 msgstr "" 104 104 105 #: class-quotes-wc.php:10 60105 #: class-quotes-wc.php:1083 106 106 msgid "Quotes menu has moved!" 107 107 msgstr "" 108 108 109 #: class-quotes-wc.php:10 61109 #: class-quotes-wc.php:1084 110 110 msgid "The Quotes settings can now be managed from WooCommerce > Settings > Quotes." 111 111 msgstr "" … … 203 203 msgstr "" 204 204 205 #: includes/class-quotes-payment-gateway.php:5 3205 #: includes/class-quotes-payment-gateway.php:54 206 206 msgid "This is a fictitious payment method used for quotes." 207 207 msgstr "" 208 208 209 #: includes/class-quotes-payment-gateway.php:5 4209 #: includes/class-quotes-payment-gateway.php:55 210 210 msgid "This gateway requires no configuration." 211 211 msgstr "" 212 212 213 #: includes/class-quotes-payment-gateway.php:7 4213 #: includes/class-quotes-payment-gateway.php:75 214 214 msgid "This order is awaiting quote." 215 215 msgstr "" 216 216 217 #: includes/class-quotes-payment-gateway.php:9 6217 #: includes/class-quotes-payment-gateway.php:97 218 218 msgid "We have received your request for a quote. You will be notified via email soon." 219 219 msgstr "" … … 402 402 msgstr "" 403 403 404 #. translators: Site Name.405 404 #. translators: Customer Name. 406 405 #: templates/emails/plain/request-new-quote.php:12 … … 409 408 msgstr "" 410 409 411 #. translators: Order payment link. 412 #. translators: Admin Url for payment. 410 #. translators: Admin Url for order. 413 411 #: templates/emails/plain/request-new-quote.php:68 414 412 #: templates/emails/request-new-quote.php:79 … … 416 414 msgstr "" 417 415 418 #. translators: User first name.419 416 #. translators: Billing First Name. 420 417 #: templates/emails/plain/send-quote.php:14 … … 423 420 msgstr "" 424 421 425 #. translators: Site name.426 422 #. translators: Site Name. 427 423 #: templates/emails/plain/send-quote.php:17 … … 430 426 msgstr "" 431 427 432 #. translators: Payment URL.433 428 #. translators: Payment Link Url. 434 429 #: templates/emails/plain/send-quote.php:24 -
quotes-for-woocommerce/trunk/quotes-woocommerce.php
r3153140 r3169811 3 3 * Plugin Name: Quotes for WooCommerce 4 4 * Description: This plugin allows you to convert your WooCommerce store into a quote only store. It will hide the prices for the products and not take any payment at Checkout. You can then setup prices for the items in the order and send a notification to the Customer. 5 * Version: 2. 55 * Version: 2.6 6 6 * Author: TechnoVama 7 7 * Requires at least: 4.5 … … 30 30 add_action( 31 31 'admin_notices', 32 function () {32 function () { 33 33 // translators: plugin name with link. 34 34 $msg = sprintf( __( 'Please install and activate %s before activating Quotes for WooCommerce.', 'quote-wc' ), '<a href="https://wordpress.org/plugins/woocommerce/" target="_blank">WooCommerce</a>' ); … … 51 51 add_action( 52 52 'before_woocommerce_init', 53 function () {53 function () { 54 54 if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) { 55 55 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); -
quotes-for-woocommerce/trunk/readme.txt
r3153140 r3169811 5 5 Requires at least: 4.5 6 6 Tested up to: 6.6.2 7 Stable tag: 2. 57 Stable tag: 2.6 8 8 Requires PHP: 7.2 9 9 License: GPLv2 or later … … 38 38 <ul> 39 39 <li>Enable quotes for only some products in the store.</li> 40 <li>Allow quote and purchasable products in a single cart.</li> 40 41 <li>Enable quotes for select variations of a product</li> 42 <li>Automatically enable quotes based on item quantity for each product.</li> 41 43 <li>Customize quote button display based on WordPress User Roles</li> 42 44 <li>Seamlessly process both regular orders and quote requests for all products</li> … … 81 83 82 84 == Changelog == 85 86 = 2.6 ( 16.10.2024 ) = 87 * Tweak - Added some filters for compatibility with Premium 1.5. 88 * Fix - Address WooCommerce Payment Gateway API required fields. 83 89 84 90 = 2.5 ( 17.09.2024 ) = -
quotes-for-woocommerce/trunk/templates/emails/new-quote-request-sent-customer.php
r3153140 r3169811 44 44 <tr> 45 45 <td style="text-align:left; border: 1px solid #eee;"> 46 <a href='<?php echo esc_url( get_permalink( $product_id ) ); ?>' target='_blank'><?php echo wp_kses_post( $items->get_name() ); ?></a>46 <a href='<?php echo esc_url( get_permalink( $product_id ) ); ?>' target='_blank'><?php echo wp_kses_post( $items->get_name() ); ?></a> 47 47 <?php 48 48 // allow other plugins to add additional product information here. -
quotes-for-woocommerce/trunk/templates/emails/plain/request-new-quote.php
r3153140 r3169811 9 9 $margin_side = is_rtl() ? 'left' : 'right'; 10 10 11 // translators: SiteName.11 // translators: Customer Name. 12 12 $opening_paragraph = __( 'A request for quote has been made by %s and is awaiting your attention. The details of the order are as follows:', 'quote-wc' ); 13 13 echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n"; … … 65 65 echo "\n----------------------------------------\n\n"; 66 66 echo sprintf( esc_html__( 'This order is awaiting a quote.', 'quote-wc' ) ); 67 // translators: Order payment link.67 // translators: Admin Url for order. 68 68 echo wp_kses_post( make_clickable( sprintf( __( 'You can view and edit this order in the dashboard here: %s', 'quote-wc' ), $order_url ) ) ); 69 69 -
quotes-for-woocommerce/trunk/templates/emails/plain/send-quote.php
r3110434 r3169811 11 11 if ( $order ) : 12 12 $billing_first_name = ( version_compare( WOOCOMMERCE_VERSION, '3.0.0' ) < 0 ) ? $order->billing_first_name : $order->get_billing_first_name(); 13 // translators: User first name.13 // translators: Billing First Name. 14 14 echo sprintf( esc_html__( 'Hello %s', 'quote-wc' ), esc_attr( $billing_first_name ) ) . "\n\n"; 15 15 endif; 16 // translators: Site name.16 // translators: Site Name. 17 17 echo sprintf( esc_html__( 'You have received a quotation for your order on %s. The details of the same are shown below.', 'quote-wc' ), esc_attr( $order_details->blogname ) ); 18 18 … … 21 21 $order_status = $order->get_status(); 22 22 if ( 'pending' === $order_status ) : 23 // translators: Payment URL.23 // translators: Payment Link Url. 24 24 echo sprintf( esc_html__( 'To pay for this order please use the following link: %s', 'quote-wc' ), esc_url( $order->get_checkout_payment_url() ) ); 25 25 endif; -
quotes-for-woocommerce/trunk/templates/emails/request-new-quote.php
r3153140 r3169811 76 76 <p> 77 77 <?php 78 // translators: Admin Url for payment.78 // translators: Admin Url for order. 79 79 echo wp_kses_post( make_clickable( sprintf( __( 'You can view and edit this order in the dashboard here: %s', 'quote-wc' ), esc_url( $order_url ) ) ) ); 80 80 ?> -
quotes-for-woocommerce/trunk/templates/emails/send-quote.php
r3110434 r3169811 53 53 } 54 54 ?> 55 <h2><?php echo esc_html__( 'Order', 'quote-wc' ) . ': ' . esc_html( $order->get_order_number() ); ?> (<?php printf( '<time datetime="%s">%s</time>', wp_kses_post( date_i18n( 'c', strtotime( $order_date ) ) ), wp_kses_post( date_i18n( wc_date_format(), strtotime( $order_date ) ) ) ); ?>)</h2>55 <h2><?php echo esc_html__( 'Order', 'quote-wc' ) . ': ' . esc_html( $order->get_order_number() ); ?> (<?php printf( '<time datetime="%s">%s</time>', wp_kses_post( date_i18n( 'c', strtotime( $order_date ) ) ), wp_kses_post( date_i18n( wc_date_format(), strtotime( $order_date ) ) ) ); ?>)</h2> 56 56 <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee"> 57 57 <thead>
Note: See TracChangeset
for help on using the changeset viewer.