@@ -26,112 +26,112 @@ discard block |
||
26 | 26 | |
27 | 27 | <?php |
28 | 28 | |
29 | - // Fires before printing a line item column. |
|
30 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
29 | + // Fires before printing a line item column. |
|
30 | + do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
31 | 31 | |
32 | - // Item name. |
|
33 | - if ( 'name' == $key ) { |
|
32 | + // Item name. |
|
33 | + if ( 'name' == $key ) { |
|
34 | 34 | |
35 | - ob_start(); |
|
36 | - // And an optional description. |
|
35 | + ob_start(); |
|
36 | + // And an optional description. |
|
37 | 37 | $description = $item->get_description(); |
38 | 38 | |
39 | 39 | if ( ! empty( $description ) ) { |
40 | 40 | $description = wp_kses_post( $description ); |
41 | 41 | echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
42 | - } |
|
42 | + } |
|
43 | 43 | |
44 | - // Price help text. |
|
44 | + // Price help text. |
|
45 | 45 | $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
46 | 46 | if ( $description ) { |
47 | 47 | echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
50 | + if ( wpinv_current_user_can_manage_invoicing() ) { |
|
51 | 51 | |
52 | - edit_post_link( |
|
53 | - __( 'Edit this item.', 'invoicing' ), |
|
54 | - '<small class="form-text text-muted">', |
|
55 | - '</small>', |
|
56 | - $item->get_id(), |
|
57 | - 'text-danger' |
|
58 | - ); |
|
52 | + edit_post_link( |
|
53 | + __( 'Edit this item.', 'invoicing' ), |
|
54 | + '<small class="form-text text-muted">', |
|
55 | + '</small>', |
|
56 | + $item->get_id(), |
|
57 | + 'text-danger' |
|
58 | + ); |
|
59 | 59 | |
60 | - } |
|
60 | + } |
|
61 | 61 | |
62 | - do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
62 | + do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
63 | 63 | |
64 | - $description = ob_get_clean(); |
|
64 | + $description = ob_get_clean(); |
|
65 | 65 | |
66 | - // Display the name. |
|
67 | - $tootip = empty( $description ) ? '' : " " . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
68 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . $tootip . '</div>'; |
|
66 | + // Display the name. |
|
67 | + $tootip = empty( $description ) ? '' : " " . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
68 | + echo '<div class="mb-1">' . esc_html( $item->get_name() ) . $tootip . '</div>'; |
|
69 | 69 | |
70 | - if ( ! empty( $description ) ) { |
|
71 | - printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description ); |
|
72 | - } |
|
73 | - |
|
74 | - if ( $item->allows_quantities() ) { |
|
75 | - printf( |
|
76 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
77 | - sprintf( |
|
78 | - __( 'Qty %s', 'invoicing' ), |
|
79 | - sprintf( |
|
80 | - '<input |
|
70 | + if ( ! empty( $description ) ) { |
|
71 | + printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description ); |
|
72 | + } |
|
73 | + |
|
74 | + if ( $item->allows_quantities() ) { |
|
75 | + printf( |
|
76 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
77 | + sprintf( |
|
78 | + __( 'Qty %s', 'invoicing' ), |
|
79 | + sprintf( |
|
80 | + '<input |
|
81 | 81 | type="text" |
82 | 82 | style="width: 48px;" |
83 | 83 | class="getpaid-item-mobile-quantity-input p-1 m-0 text-center" |
84 | 84 | value="%s" |
85 | 85 | min="1">', |
86 | - (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity() |
|
87 | - ) |
|
88 | - ) |
|
89 | - ); |
|
90 | - } else { |
|
91 | - printf( |
|
92 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
93 | - sprintf( |
|
94 | - __( 'Qty %s', 'invoicing' ), |
|
95 | - (float) $item->get_quantity() |
|
96 | - ) |
|
97 | - ); |
|
98 | - } |
|
99 | - |
|
100 | - } |
|
101 | - |
|
102 | - // Item price. |
|
103 | - if ( 'price' == $key ) { |
|
104 | - |
|
105 | - // Set the currency position. |
|
106 | - $position = wpinv_currency_position(); |
|
107 | - |
|
108 | - if ( $position == 'left_space' ) { |
|
109 | - $position = 'left'; |
|
110 | - } |
|
111 | - |
|
112 | - if ( $position == 'right_space' ) { |
|
113 | - $position = 'right'; |
|
114 | - } |
|
115 | - |
|
116 | - if ( $item->user_can_set_their_price() ) { |
|
117 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
118 | - $minimum = (float) $item->get_minimum_price(); |
|
119 | - $validate_minimum = ''; |
|
120 | - $class = ''; |
|
121 | - $data_minimum = ''; |
|
122 | - |
|
123 | - if ( $minimum > 0 ) { |
|
124 | - $validate_minimum = sprintf( |
|
125 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
126 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
127 | - ); |
|
128 | - |
|
129 | - $class = 'getpaid-validate-minimum-amount'; |
|
130 | - |
|
131 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
132 | - } |
|
133 | - |
|
134 | - ?> |
|
86 | + (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity() |
|
87 | + ) |
|
88 | + ) |
|
89 | + ); |
|
90 | + } else { |
|
91 | + printf( |
|
92 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
93 | + sprintf( |
|
94 | + __( 'Qty %s', 'invoicing' ), |
|
95 | + (float) $item->get_quantity() |
|
96 | + ) |
|
97 | + ); |
|
98 | + } |
|
99 | + |
|
100 | + } |
|
101 | + |
|
102 | + // Item price. |
|
103 | + if ( 'price' == $key ) { |
|
104 | + |
|
105 | + // Set the currency position. |
|
106 | + $position = wpinv_currency_position(); |
|
107 | + |
|
108 | + if ( $position == 'left_space' ) { |
|
109 | + $position = 'left'; |
|
110 | + } |
|
111 | + |
|
112 | + if ( $position == 'right_space' ) { |
|
113 | + $position = 'right'; |
|
114 | + } |
|
115 | + |
|
116 | + if ( $item->user_can_set_their_price() ) { |
|
117 | + $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
118 | + $minimum = (float) $item->get_minimum_price(); |
|
119 | + $validate_minimum = ''; |
|
120 | + $class = ''; |
|
121 | + $data_minimum = ''; |
|
122 | + |
|
123 | + if ( $minimum > 0 ) { |
|
124 | + $validate_minimum = sprintf( |
|
125 | + esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
126 | + strip_tags( wpinv_price( $minimum, $currency ) ) |
|
127 | + ); |
|
128 | + |
|
129 | + $class = 'getpaid-validate-minimum-amount'; |
|
130 | + |
|
131 | + $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
132 | + } |
|
133 | + |
|
134 | + ?> |
|
135 | 135 | <div class="input-group input-group-sm"> |
136 | 136 | <?php if( 'left' == $position ) : ?> |
137 | 137 | <div class="input-group-prepend"> |
@@ -156,44 +156,44 @@ discard block |
||
156 | 156 | |
157 | 157 | <?php |
158 | 158 | |
159 | - } else { |
|
160 | - echo wpinv_price( $item->get_price(), $currency ); |
|
159 | + } else { |
|
160 | + echo wpinv_price( $item->get_price(), $currency ); |
|
161 | 161 | |
162 | - ?> |
|
162 | + ?> |
|
163 | 163 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'> |
164 | 164 | <?php |
165 | - } |
|
165 | + } |
|
166 | 166 | |
167 | - printf( |
|
168 | - '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
169 | - sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
170 | - ); |
|
171 | - } |
|
167 | + printf( |
|
168 | + '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
169 | + sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
170 | + ); |
|
171 | + } |
|
172 | 172 | |
173 | - // Item quantity. |
|
174 | - if ( 'quantity' == $key ) { |
|
173 | + // Item quantity. |
|
174 | + if ( 'quantity' == $key ) { |
|
175 | 175 | |
176 | - if ( $item->allows_quantities() ) { |
|
177 | - ?> |
|
176 | + if ( $item->allows_quantities() ) { |
|
177 | + ?> |
|
178 | 178 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' required> |
179 | 179 | <?php |
180 | - } else { |
|
181 | - echo (float) $item->get_quantity(); |
|
182 | - echo ' '; |
|
183 | - ?> |
|
180 | + } else { |
|
181 | + echo (float) $item->get_quantity(); |
|
182 | + echo ' '; |
|
183 | + ?> |
|
184 | 184 | <input type='hidden' name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'> |
185 | 185 | <?php |
186 | - } |
|
186 | + } |
|
187 | 187 | |
188 | - } |
|
188 | + } |
|
189 | 189 | |
190 | - // Item sub total. |
|
191 | - if ( 'subtotal' == $key ) { |
|
192 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
193 | - } |
|
190 | + // Item sub total. |
|
191 | + if ( 'subtotal' == $key ) { |
|
192 | + echo wpinv_price( $item->get_sub_total(), $currency ); |
|
193 | + } |
|
194 | 194 | |
195 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
196 | - ?> |
|
195 | + do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
196 | + ?> |
|
197 | 197 | |
198 | 198 | </div> |
199 | 199 |