@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | * Call hooks. |
14 | 14 | */ |
15 | 15 | public function __construct() { |
16 | - add_action( 'init', array( $this, 'init' ) ); |
|
17 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 11, 2 ); |
|
18 | - add_action( 'save_post', array( $this, 'save_post' ), 10, 2 ); |
|
19 | - add_filter( 'wpshop_attribute_output_def', array( $this, 'wpshop_attribute_output_def' ), 10, 2 ); |
|
16 | + add_action('init', array($this, 'init')); |
|
17 | + add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 11, 2); |
|
18 | + add_action('save_post', array($this, 'save_post'), 10, 2); |
|
19 | + add_filter('wpshop_attribute_output_def', array($this, 'wpshop_attribute_output_def'), 10, 2); |
|
20 | 20 | } |
21 | 21 | /** |
22 | 22 | * Call private functions if class is activate. |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | * @param array $arguments Array of arguments to pass. |
26 | 26 | * @return mixed Return of real function called. |
27 | 27 | */ |
28 | - public function __call( $name, $arguments ) { |
|
29 | - if ( method_exists( $this, $name ) ) { |
|
30 | - if ( $this->is_activate() ) { |
|
31 | - return call_user_func_array( array( $this, $name ), $arguments ); |
|
28 | + public function __call($name, $arguments) { |
|
29 | + if (method_exists($this, $name)) { |
|
30 | + if ($this->is_activate()) { |
|
31 | + return call_user_func_array(array($this, $name), $arguments); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | } |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | * @return void |
40 | 40 | */ |
41 | 41 | public function init() { |
42 | - $_wpnonce = ! empty( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ) : ''; // Input var okay. |
|
43 | - $wps_variation_interface = ! empty( $_GET['wps_variation_interface'] ) ? filter_var( wp_unslash( $_GET['wps_variation_interface'] ), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE ) : null; // Input var okay. |
|
44 | - if ( wp_verify_nonce( $_wpnonce, 'wps_remove_variation_interface' ) && null !== $wps_variation_interface ) { |
|
45 | - $this->is_activate( $wps_variation_interface ); |
|
42 | + $_wpnonce = !empty($_REQUEST['_wpnonce']) ? sanitize_text_field(wp_unslash($_REQUEST['_wpnonce'])) : ''; // Input var okay. |
|
43 | + $wps_variation_interface = !empty($_GET['wps_variation_interface']) ? filter_var(wp_unslash($_GET['wps_variation_interface']), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) : null; // Input var okay. |
|
44 | + if (wp_verify_nonce($_wpnonce, 'wps_remove_variation_interface') && null !== $wps_variation_interface) { |
|
45 | + $this->is_activate($wps_variation_interface); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | /** |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | * @param boolean $new_val If set & db is different, save it. |
52 | 52 | * @return boolean Actual state of module. |
53 | 53 | */ |
54 | - public function is_activate( $new_val = null ) { |
|
55 | - if ( ! isset( $this->is_active ) ) { |
|
56 | - $option = get_option( 'wps_variation_interface_display', null ); |
|
57 | - if ( is_null( $option ) ) { |
|
54 | + public function is_activate($new_val = null) { |
|
55 | + if (!isset($this->is_active)) { |
|
56 | + $option = get_option('wps_variation_interface_display', null); |
|
57 | + if (is_null($option)) { |
|
58 | 58 | $new_val = true; |
59 | 59 | $option = false; |
60 | 60 | } |
61 | - $this->is_active = (bool) $option; |
|
61 | + $this->is_active = (bool)$option; |
|
62 | 62 | } |
63 | - if ( isset( $new_val ) && $this->is_active !== $new_val ) { |
|
64 | - update_option( 'wps_variation_interface_display', $new_val ); |
|
63 | + if (isset($new_val) && $this->is_active !== $new_val) { |
|
64 | + update_option('wps_variation_interface_display', $new_val); |
|
65 | 65 | $this->is_active = $new_val; |
66 | 66 | } |
67 | 67 | return $this->is_active; |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | * @param array $element Direct array attribute of db. |
73 | 73 | * @return void It set directly in variable class. |
74 | 74 | */ |
75 | - private function get_variations( $element ) { |
|
76 | - if ( ! isset( $this->variations ) ) { |
|
77 | - $variations = wpshop_attributes::get_variation_available_attribute( $element ); |
|
78 | - $this->variations = (array) array_merge( ( isset( $variations['available'] ) ? $variations['available'] : array()), ( isset( $variations['unavailable'] ) ? $variations['unavailable'] : array() ) ); |
|
79 | - unset( $variations ); |
|
75 | + private function get_variations($element) { |
|
76 | + if (!isset($this->variations)) { |
|
77 | + $variations = wpshop_attributes::get_variation_available_attribute($element); |
|
78 | + $this->variations = (array)array_merge((isset($variations['available']) ? $variations['available'] : array()), (isset($variations['unavailable']) ? $variations['unavailable'] : array())); |
|
79 | + unset($variations); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | /** |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | * @param string $post_status Generated by WP. |
87 | 87 | * @param WP_Post $post Generated by WP. |
88 | 88 | */ |
89 | - public function add_meta_boxes( $post_status, $post ) { |
|
89 | + public function add_meta_boxes($post_status, $post) { |
|
90 | 90 | global $pagenow; |
91 | - if ( $this->is_activate() ) { |
|
92 | - $this->get_variations( $post->ID ); |
|
93 | - remove_meta_box( 'wpshop_wpshop_variations', WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'normal' ); |
|
94 | - if ( 'post-new.php' !== $pagenow && ! empty( $this->variations ) ) { |
|
95 | - add_meta_box( 'wpshop_wpshop_variations', __( 'Product variation', 'wpshop' ), array( $this, 'meta_box_variation' ), WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'normal', 'default' ); |
|
91 | + if ($this->is_activate()) { |
|
92 | + $this->get_variations($post->ID); |
|
93 | + remove_meta_box('wpshop_wpshop_variations', WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'normal'); |
|
94 | + if ('post-new.php' !== $pagenow && !empty($this->variations)) { |
|
95 | + add_meta_box('wpshop_wpshop_variations', __('Product variation', 'wpshop'), array($this, 'meta_box_variation'), WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'normal', 'default'); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |
@@ -102,59 +102,59 @@ discard block |
||
102 | 102 | * @param object $post Given by WordPress. |
103 | 103 | * @return void Display directly. |
104 | 104 | */ |
105 | - private function meta_box_variation( $post ) { |
|
106 | - $this->get_variations( $post->ID ); |
|
105 | + private function meta_box_variation($post) { |
|
106 | + $this->get_variations($post->ID); |
|
107 | 107 | global $wpdb; |
108 | 108 | $ids = array(); |
109 | - foreach ( $this->variations as $key => $variation ) { |
|
110 | - $available = wpshop_attributes::get_select_output( $variation['attribute_complete_def'] ); |
|
111 | - $this->variations[ $key ]['available'] = array_keys( $available['possible_value'] ); |
|
112 | - $ids = array_merge( $ids, array_keys( $available['possible_value'] ) ); |
|
109 | + foreach ($this->variations as $key => $variation) { |
|
110 | + $available = wpshop_attributes::get_select_output($variation['attribute_complete_def']); |
|
111 | + $this->variations[$key]['available'] = array_keys($available['possible_value']); |
|
112 | + $ids = array_merge($ids, array_keys($available['possible_value'])); |
|
113 | 113 | } |
114 | - $sql = 'SELECT * FROM ' . WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS . ' WHERE id IN (\'' . implode( '\', \'', $ids ) . '\') AND status = %s'; |
|
115 | - $query = call_user_func( array( $wpdb, 'prepare' ), $sql, 'valid' ); |
|
116 | - $product = wpshop_products::get_product_data( $post->ID, false, '"publish","draft","future"' ); |
|
117 | - $is_used_in_variation = wpshop_attributes::getElement( 'yes', "'valid', 'notused'", 'is_used_in_variation', true ); |
|
114 | + $sql = 'SELECT * FROM ' . WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS . ' WHERE id IN (\'' . implode('\', \'', $ids) . '\') AND status = %s'; |
|
115 | + $query = call_user_func(array($wpdb, 'prepare'), $sql, 'valid'); |
|
116 | + $product = wpshop_products::get_product_data($post->ID, false, '"publish","draft","future"'); |
|
117 | + $is_used_in_variation = wpshop_attributes::getElement('yes', "'valid', 'notused'", 'is_used_in_variation', true); |
|
118 | 118 | $attribute_list = array(); |
119 | - foreach ( $is_used_in_variation as $attribute ) { |
|
120 | - if ( in_array( $attribute->backend_input, array( 'multiple-select', 'select', 'radio', 'checkbox' ), true ) ) { |
|
121 | - $values = wpshop_attributes::get_select_output( $attribute ); |
|
122 | - if ( ! empty( $values['possible_value'] ) ) { |
|
119 | + foreach ($is_used_in_variation as $attribute) { |
|
120 | + if (in_array($attribute->backend_input, array('multiple-select', 'select', 'radio', 'checkbox'), true)) { |
|
121 | + $values = wpshop_attributes::get_select_output($attribute); |
|
122 | + if (!empty($values['possible_value'])) { |
|
123 | 123 | $attribute->possible_value = $values['possible_value']; |
124 | 124 | } |
125 | 125 | } |
126 | - $attribute_list[ $attribute->code ] = $attribute; |
|
126 | + $attribute_list[$attribute->code] = $attribute; |
|
127 | 127 | } |
128 | - $variation_defining = get_post_meta( $post->ID, '_wpshop_variation_defining', true ); |
|
129 | - $variations_saved = wpshop_products::get_variation( $post->ID ); |
|
130 | - if ( ! empty( $variations_saved ) ) { |
|
131 | - foreach ( $variations_saved as $variation_id => $variation ) { |
|
132 | - $downloadable = get_post_meta( $variation_id, 'attribute_option_is_downloadable_', true ); |
|
133 | - if ( ! empty( $downloadable['file_url'] ) ) { |
|
134 | - $variations_saved[ $variation_id ]['file']['path'] = $downloadable['file_url']; |
|
135 | - $variations_saved[ $variation_id ]['file']['name'] = basename( $downloadable['file_url'] ); |
|
128 | + $variation_defining = get_post_meta($post->ID, '_wpshop_variation_defining', true); |
|
129 | + $variations_saved = wpshop_products::get_variation($post->ID); |
|
130 | + if (!empty($variations_saved)) { |
|
131 | + foreach ($variations_saved as $variation_id => $variation) { |
|
132 | + $downloadable = get_post_meta($variation_id, 'attribute_option_is_downloadable_', true); |
|
133 | + if (!empty($downloadable['file_url'])) { |
|
134 | + $variations_saved[$variation_id]['file']['path'] = $downloadable['file_url']; |
|
135 | + $variations_saved[$variation_id]['file']['name'] = basename($downloadable['file_url']); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | } |
139 | - $price_piloting = get_option( 'wpshop_shop_price_piloting' ); |
|
139 | + $price_piloting = get_option('wpshop_shop_price_piloting'); |
|
140 | 140 | $product_currency = wpshop_tools::wpshop_get_currency(); |
141 | - wp_enqueue_style( 'wps-product-variation-interface-style', WPSPDTVARIATION_INTERFACE_ASSETS_MAIN_DIR . '/css/style-backend.css' ); |
|
142 | - wp_enqueue_script( 'wps-product-variation-interface-script', WPSPDTVARIATION_INTERFACE_ASSETS_MAIN_DIR . '/js/script-backend.js' ); |
|
143 | - wp_enqueue_script( 'wps-product-variation-interface-script-utils', WPSPDTVARIATION_INTERFACE_ASSETS_MAIN_DIR . '/js/script-backend-utils.js' ); |
|
144 | - wp_localize_script( 'wps-product-variation-interface-script', 'wps_product_variation_interface', apply_filters( 'wps_filters_product_variation_extra_columns_product_definition', array( |
|
141 | + wp_enqueue_style('wps-product-variation-interface-style', WPSPDTVARIATION_INTERFACE_ASSETS_MAIN_DIR . '/css/style-backend.css'); |
|
142 | + wp_enqueue_script('wps-product-variation-interface-script', WPSPDTVARIATION_INTERFACE_ASSETS_MAIN_DIR . '/js/script-backend.js'); |
|
143 | + wp_enqueue_script('wps-product-variation-interface-script-utils', WPSPDTVARIATION_INTERFACE_ASSETS_MAIN_DIR . '/js/script-backend-utils.js'); |
|
144 | + wp_localize_script('wps-product-variation-interface-script', 'wps_product_variation_interface', apply_filters('wps_filters_product_variation_extra_columns_product_definition', array( |
|
145 | 145 | 'variation' => $this->variations, |
146 | - 'nonce_delete' => wp_create_nonce( 'wpshop_variation_management' ), |
|
147 | - 'variation_value' => call_user_func( array( $wpdb, 'get_results' ), $query ), |
|
148 | - 'product_price' => ( ! empty( $price_piloting ) && 'HT' !== $price_piloting ) ? $product['product_price'] : $product['price_ht'], |
|
146 | + 'nonce_delete' => wp_create_nonce('wpshop_variation_management'), |
|
147 | + 'variation_value' => call_user_func(array($wpdb, 'get_results'), $query), |
|
148 | + 'product_price' => (!empty($price_piloting) && 'HT' !== $price_piloting) ? $product['product_price'] : $product['price_ht'], |
|
149 | 149 | 'tx_tva' => $product['tx_tva'], |
150 | 150 | 'attribute_in_variation' => $attribute_list, |
151 | 151 | 'variations_saved' => $variations_saved, |
152 | 152 | 'price_piloting' => $price_piloting, |
153 | 153 | 'currency' => $product_currency, |
154 | 154 | 'variation_defining' => $variation_defining, |
155 | - 'label_file' => __( 'Click to add file', 'wpshop' ), |
|
156 | - ) ) ); |
|
157 | - require_once wpshop_tools::get_template_part( WPSPDTVARIATION_INTERFACE_DIR, WPSPDTVARIATION_INTERFACE_TEMPLATES_MAIN_DIR, 'backend', 'meta_box_variation' ); |
|
155 | + 'label_file' => __('Click to add file', 'wpshop'), |
|
156 | + ))); |
|
157 | + require_once wpshop_tools::get_template_part(WPSPDTVARIATION_INTERFACE_DIR, WPSPDTVARIATION_INTERFACE_TEMPLATES_MAIN_DIR, 'backend', 'meta_box_variation'); |
|
158 | 158 | } |
159 | 159 | /** |
160 | 160 | * Save other values out of old variation interface. |
@@ -163,24 +163,24 @@ discard block |
||
163 | 163 | * @param object $post WP_Post of WordPress. |
164 | 164 | * @return void |
165 | 165 | */ |
166 | - private function save_post( $post_id, $post ) { |
|
167 | - if ( wp_is_post_revision( $post_id ) || WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT !== $post->post_type || ! isset( $_REQUEST['wpshop_variation_defining']['options'] ) || ! isset( $_REQUEST['wps_pdt_variations'] ) ) { // Input var okay. |
|
166 | + private function save_post($post_id, $post) { |
|
167 | + if (wp_is_post_revision($post_id) || WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT !== $post->post_type || !isset($_REQUEST['wpshop_variation_defining']['options']) || !isset($_REQUEST['wps_pdt_variations'])) { // Input var okay. |
|
168 | 168 | return; |
169 | 169 | } |
170 | - wpshop_products::variation_parameters_save( $post_id, $_REQUEST['wpshop_variation_defining']['options'] ); // Input var okay. |
|
171 | - remove_action( 'save_post', array( $this, 'save_post' ) ); |
|
172 | - foreach ( $_REQUEST['wps_pdt_variations'] as $variation_id => $data ) { // Input var okay. |
|
170 | + wpshop_products::variation_parameters_save($post_id, $_REQUEST['wpshop_variation_defining']['options']); // Input var okay. |
|
171 | + remove_action('save_post', array($this, 'save_post')); |
|
172 | + foreach ($_REQUEST['wps_pdt_variations'] as $variation_id => $data) { // Input var okay. |
|
173 | 173 | $variation = array( |
174 | 174 | 'ID' => $variation_id, |
175 | 175 | ); |
176 | - if ( isset( $data['status'] ) && 'on' === $data['status'] ) { |
|
176 | + if (isset($data['status']) && 'on' === $data['status']) { |
|
177 | 177 | $variation['post_status'] = 'publish'; |
178 | 178 | } else { |
179 | 179 | $variation['post_status'] = 'draft'; |
180 | 180 | } |
181 | - wp_update_post( $variation ); |
|
181 | + wp_update_post($variation); |
|
182 | 182 | } |
183 | - add_action( 'save_post', array( $this, 'save_post' ), 10, 2 ); |
|
183 | + add_action('save_post', array($this, 'save_post'), 10, 2); |
|
184 | 184 | } |
185 | 185 | /** |
186 | 186 | * Delete display in attributes products always in metabox. |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | * @param array $element Direct array attribute of db. |
190 | 190 | * @return array SAme array $output modified. |
191 | 191 | */ |
192 | - public function wpshop_attribute_output_def( $output, $element ) { |
|
193 | - if ( $this->is_activate() ) { |
|
194 | - $this->get_variations( $element ); |
|
195 | - if ( ! empty( $this->variations ) && in_array( $output['field_definition']['name'], array_keys( $this->variations ), true ) ) { |
|
192 | + public function wpshop_attribute_output_def($output, $element) { |
|
193 | + if ($this->is_activate()) { |
|
194 | + $this->get_variations($element); |
|
195 | + if (!empty($this->variations) && in_array($output['field_definition']['name'], array_keys($this->variations), true)) { |
|
196 | 196 | $output['field'] = ''; |
197 | 197 | } |
198 | 198 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * @return void |
206 | 206 | */ |
207 | 207 | public static function wpshop_download_file_dialog_active() { |
208 | - add_filter( 'wps_filters_product_variation_file', array( 'wps_product_variation_interface', 'wps_filters_product_variation_file' ), 0, 1 ); |
|
208 | + add_filter('wps_filters_product_variation_file', array('wps_product_variation_interface', 'wps_filters_product_variation_file'), 0, 1); |
|
209 | 209 | } |
210 | 210 | /** |
211 | 211 | * Add old upload box for custom php dsiplay. |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | * @param string $string Input filter. |
215 | 215 | * @return string The div for box. |
216 | 216 | */ |
217 | - public static function wps_filters_product_variation_file( $string ) { |
|
217 | + public static function wps_filters_product_variation_file($string) { |
|
218 | 218 | ob_start(); |
219 | 219 | ?> |
220 | - <div style="display: none;" onclick="open_dialog_box(this, %ID%, '<?php esc_html_e( 'Send the downloadable file', 'wpshop' ); ?>')"> |
|
220 | + <div style="display: none;" onclick="open_dialog_box(this, %ID%, '<?php esc_html_e('Send the downloadable file', 'wpshop'); ?>')"> |
|
221 | 221 | <div class="is_downloadable_statut_%ID%"></div> |
222 | 222 | </div> |
223 | 223 | <?php |
@@ -2,18 +2,18 @@ discard block |
||
2 | 2 | <div data-view-model="wps_variations_options_summary" id="wps_variations_summary_display"> |
3 | 3 | <b>%summary%</b> |
4 | 4 | </div> |
5 | - <a id="wps_variations_parameters" title="<?php esc_html_e( 'Edit possibilities', 'wpshop' ); ?>" href="#"> |
|
5 | + <a id="wps_variations_parameters" title="<?php esc_html_e('Edit possibilities', 'wpshop'); ?>" href="#"> |
|
6 | 6 | <?php // href=">?php print wp_nonce_url( get_edit_post_link( $post->ID ) . '&wps_variation_interface=false', 'wps_remove_variation_interface' );?<">. ?> |
7 | 7 | <span class="dashicons dashicons-admin-generic"></span> |
8 | 8 | </a> |
9 | 9 | </div> |
10 | 10 | <div id="wps_variations_options"> |
11 | 11 | <ul id="wps_variations_options_title"> |
12 | - <li><?php esc_html_e( 'Generate option', 'wpshop' ); ?></li> |
|
13 | - <li><?php esc_html_e( 'Option', 'wpshop' ); ?></li> |
|
14 | - <li><?php esc_html_e( 'Requiered', 'wpshop' ); ?></li> |
|
15 | - <li><?php esc_html_e( 'Possibilities', 'wpshop' ); ?></li> |
|
16 | - <li><?php esc_html_e( 'Default', 'wpshop' ); ?></li> |
|
12 | + <li><?php esc_html_e('Generate option', 'wpshop'); ?></li> |
|
13 | + <li><?php esc_html_e('Option', 'wpshop'); ?></li> |
|
14 | + <li><?php esc_html_e('Requiered', 'wpshop'); ?></li> |
|
15 | + <li><?php esc_html_e('Possibilities', 'wpshop'); ?></li> |
|
16 | + <li><?php esc_html_e('Default', 'wpshop'); ?></li> |
|
17 | 17 | </ul> |
18 | 18 | <ul data-view-model="wps_variations_options_raw" class="wps_variations_options_raw"> |
19 | 19 | <li class="wps_variations_generate_col"> |
@@ -44,42 +44,42 @@ discard block |
||
44 | 44 | </div> |
45 | 45 | <div id="wps_variations_questions"> |
46 | 46 | <ul> |
47 | - <li class="wps_variations_questions_question_col"><?php esc_html_e( 'Do you want to manage each options singly or combine them ?', 'wpshop' ); ?></li> |
|
47 | + <li class="wps_variations_questions_question_col"><?php esc_html_e('Do you want to manage each options singly or combine them ?', 'wpshop'); ?></li> |
|
48 | 48 | <li class="wps_variations_questions_answers_col"> |
49 | 49 | <?php |
50 | 50 | $id = uniqid(); |
51 | 51 | ?> |
52 | - <input id="question_combine_options_<?php echo intval( $id ); ?>" name="question_combine_options" type="radio" value="combine"> |
|
53 | - <label for="question_combine_options_<?php echo intval( $id ); ?>"><?php esc_html_e( 'Combined options', 'wpshop' ); ?></label> |
|
52 | + <input id="question_combine_options_<?php echo intval($id); ?>" name="question_combine_options" type="radio" value="combine"> |
|
53 | + <label for="question_combine_options_<?php echo intval($id); ?>"><?php esc_html_e('Combined options', 'wpshop'); ?></label> |
|
54 | 54 | <?php |
55 | 55 | $id = uniqid(); |
56 | 56 | ?> |
57 | - <input id="question_combine_options_<?php echo intval( $id ); ?>" name="question_combine_options" type="radio" value="single"> |
|
58 | - <label for="question_combine_options_<?php echo intval( $id ); ?>"><?php esc_html_e( 'Distinct options', 'wpshop' ); ?></label> |
|
57 | + <input id="question_combine_options_<?php echo intval($id); ?>" name="question_combine_options" type="radio" value="single"> |
|
58 | + <label for="question_combine_options_<?php echo intval($id); ?>"><?php esc_html_e('Distinct options', 'wpshop'); ?></label> |
|
59 | 59 | </li> |
60 | 60 | </ul> |
61 | 61 | </div> |
62 | 62 | <div id="wps_variations_tabs"> |
63 | 63 | <ul> |
64 | - <li data-tab="wps_variations_price_option_tab" class="disabled"><?php esc_html_e( 'Options prices', 'wpshop' ); ?></li> |
|
65 | - <li id="wps_variations_apply_btn" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpshop_variation_management' ) ); ?>"> |
|
66 | - <?php esc_html_e( 'Apply modifications', 'wpshop' ); ?> |
|
64 | + <li data-tab="wps_variations_price_option_tab" class="disabled"><?php esc_html_e('Options prices', 'wpshop'); ?></li> |
|
65 | + <li id="wps_variations_apply_btn" data-nonce="<?php echo esc_attr(wp_create_nonce('wpshop_variation_management')); ?>"> |
|
66 | + <?php esc_html_e('Apply modifications', 'wpshop'); ?> |
|
67 | 67 | </li> |
68 | 68 | </ul> |
69 | 69 | </div> |
70 | 70 | <div id="wps_variations_price_option_tab" class="wps_variations_tabs"> |
71 | 71 | <ul id="wps_variations_price_option_tab_title"> |
72 | - <li class="wps_variations_price_id_col"><?php esc_html_e( 'ID', 'wpshop' ); ?></li> |
|
73 | - <li class="wps_variations_price_name_col"><?php esc_html_e( 'Options', 'wpshop' ); ?></li> |
|
74 | - <li class="wps_variations_price_config_col"><?php esc_html_e( 'Prices', 'wpshop' ); ?></li> |
|
75 | - <li class="wps_variations_price_final_col"><?php esc_html_e( 'Final prices', 'wpshop' ); ?></li> |
|
76 | - <li class="wps_variations_price_vat_col"><?php esc_html_e( 'VAT', 'wpshop' ); ?></li> |
|
77 | - <li class="wps_variations_price_stock_col"><?php esc_html_e( 'Stock', 'wpshop' ); ?></li> |
|
78 | - <li class="wps_variations_price_weight_col"><?php esc_html_e( 'Weight', 'wpshop' ); ?></li> |
|
79 | - <li class="wps_variations_price_reference_col"><?php esc_html_e( 'Ref. product', 'wpshop' ); ?></li> |
|
80 | - <li class="wps_variations_price_file_col"><?php esc_html_e( 'Link download', 'wpshop' ); ?></li> |
|
81 | - <?php echo apply_filters( 'wps_filters_product_variation_extra_columns_title', '' ); ?> |
|
82 | - <li class="wps_variations_price_active_col"><?php esc_html_e( 'Activate', 'wpshop' ); ?></li> |
|
72 | + <li class="wps_variations_price_id_col"><?php esc_html_e('ID', 'wpshop'); ?></li> |
|
73 | + <li class="wps_variations_price_name_col"><?php esc_html_e('Options', 'wpshop'); ?></li> |
|
74 | + <li class="wps_variations_price_config_col"><?php esc_html_e('Prices', 'wpshop'); ?></li> |
|
75 | + <li class="wps_variations_price_final_col"><?php esc_html_e('Final prices', 'wpshop'); ?></li> |
|
76 | + <li class="wps_variations_price_vat_col"><?php esc_html_e('VAT', 'wpshop'); ?></li> |
|
77 | + <li class="wps_variations_price_stock_col"><?php esc_html_e('Stock', 'wpshop'); ?></li> |
|
78 | + <li class="wps_variations_price_weight_col"><?php esc_html_e('Weight', 'wpshop'); ?></li> |
|
79 | + <li class="wps_variations_price_reference_col"><?php esc_html_e('Ref. product', 'wpshop'); ?></li> |
|
80 | + <li class="wps_variations_price_file_col"><?php esc_html_e('Link download', 'wpshop'); ?></li> |
|
81 | + <?php echo apply_filters('wps_filters_product_variation_extra_columns_title', ''); ?> |
|
82 | + <li class="wps_variations_price_active_col"><?php esc_html_e('Activate', 'wpshop'); ?></li> |
|
83 | 83 | </ul> |
84 | 84 | <ul data-view-model="wps_variations_price_option_raw"> |
85 | 85 | <li class="wps_variations_price_id_col"> |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | <input type="text" pattern="[0-9]+(\.[0-9][0-9]?)?" onchange="wps_variations_price_option_raw.control.price(this)" align="right" value="%price_value%"> |
99 | 99 | </li> |
100 | 100 | <li class="wps_variations_price_final_col"> |
101 | - <input type="hidden" name="wps_pdt_variations[%ID%][attribute][decimal][<?php echo (!empty($price_piloting) && $price_piloting != 'HT') ? 'product_price' : 'price_ht' ; ?>]" value="%price_option%"> |
|
101 | + <input type="hidden" name="wps_pdt_variations[%ID%][attribute][decimal][<?php echo (!empty($price_piloting) && $price_piloting != 'HT') ? 'product_price' : 'price_ht'; ?>]" value="%price_option%"> |
|
102 | 102 | <b>%price_option%%currency%</b> %piloting% |
103 | 103 | </li> |
104 | 104 | <li class="wps_variations_price_vat_col"> |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | </li> |
119 | 119 | <li class="wps_variations_price_file_col" data-view-model="wps_variations_price_option_file_%ID%"> |
120 | 120 | <span class="wps_variations_price_option_price_file" onclick="wps_variations_price_option_raw.control.file(this)">%link%</span> |
121 | - <?php echo apply_filters( 'wps_filters_product_variation_file', '<input style="display: none;" type="file" name="wpshop_file" id="wpshop_file" onchange="wps_variations_price_option_raw.control.link(event, this)">' ); ?> |
|
122 | - <?php wp_nonce_field( 'ajax_wpshop_upload_downloadable_file_action', 'wpshop_file_nonce' );?> |
|
121 | + <?php echo apply_filters('wps_filters_product_variation_file', '<input style="display: none;" type="file" name="wpshop_file" id="wpshop_file" onchange="wps_variations_price_option_raw.control.link(event, this)">'); ?> |
|
122 | + <?php wp_nonce_field('ajax_wpshop_upload_downloadable_file_action', 'wpshop_file_nonce'); ?> |
|
123 | 123 | <a class="wps_variations_price_option_price_download_file" href="%path%" target="_blank" download="" style="display: %download%"> |
124 | 124 | <span class="dashicons dashicons-download"></span> |
125 | 125 | </a> |
126 | 126 | </li> |
127 | - <?php echo apply_filters( 'wps_filters_product_variation_extra_columns_content', '' ); ?> |
|
127 | + <?php echo apply_filters('wps_filters_product_variation_extra_columns_content', ''); ?> |
|
128 | 128 | <li class="wps_variations_price_active_col"> |
129 | 129 | <input name="wps_pdt_variations[%ID%][status]" onclick="wps_variations_price_option_raw.control.activate(this)" type="checkbox" %price_option_activate%> |
130 | 130 | </li> |