@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $new_val = true; |
| 49 | 49 | $option = false; |
| 50 | 50 | } |
| 51 | - $this->is_active = (bool) $option; |
|
| 51 | + $this->is_active = (bool)$option; |
|
| 52 | 52 | } |
| 53 | 53 | if (isset($new_val) && $this->is_active !== $new_val) { |
| 54 | 54 | update_option('wps_variation_interface_display', $new_val); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | if (!isset($this->variations)) { |
| 68 | 68 | $variations = wpshop_attributes::get_variation_available_attribute($element); |
| 69 | - $this->variations = (array) array_merge((isset($variations['available']) ? $variations['available'] : array()), (isset($variations['unavailable']) ? $variations['unavailable'] : array())); |
|
| 69 | + $this->variations = (array)array_merge((isset($variations['available']) ? $variations['available'] : array()), (isset($variations['unavailable']) ? $variations['unavailable'] : array())); |
|
| 70 | 70 | unset($variations); |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -4,37 +4,37 @@ discard block |
||
| 4 | 4 | */ |
| 5 | 5 | class wps_product_variation_interface |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * Array of variations. |
|
| 9 | - * |
|
| 10 | - * @var array |
|
| 11 | - */ |
|
| 12 | - private $variations = null; |
|
| 13 | - /** |
|
| 14 | - * Call hooks. |
|
| 15 | - */ |
|
| 16 | - public function __construct() |
|
| 17 | - { |
|
| 7 | + /** |
|
| 8 | + * Array of variations. |
|
| 9 | + * |
|
| 10 | + * @var array |
|
| 11 | + */ |
|
| 12 | + private $variations = null; |
|
| 13 | + /** |
|
| 14 | + * Call hooks. |
|
| 15 | + */ |
|
| 16 | + public function __construct() |
|
| 17 | + { |
|
| 18 | 18 | add_action('init', array($this, 'init')); |
| 19 | - add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 11, 2); |
|
| 20 | - add_action('save_post', array($this, 'save_post'), 10, 2); |
|
| 21 | - add_filter('wpshop_attribute_output_def', array($this, 'wpshop_attribute_output_def'), 10, 2); |
|
| 22 | - } |
|
| 23 | - /** |
|
| 24 | - * Call private functions if class is activate. |
|
| 25 | - * |
|
| 26 | - * @param string $name Name of function to call. |
|
| 27 | - * @param array $arguments Array of arguments to pass. |
|
| 28 | - * @return mixed Return of real function called. |
|
| 29 | - */ |
|
| 30 | - public function __call($name, $arguments) |
|
| 31 | - { |
|
| 32 | - if (method_exists($this, $name)) { |
|
| 33 | - if ($this->is_activate()) { |
|
| 34 | - return call_user_func_array(array($this, $name), $arguments); |
|
| 35 | - } |
|
| 36 | - } |
|
| 37 | - } |
|
| 19 | + add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 11, 2); |
|
| 20 | + add_action('save_post', array($this, 'save_post'), 10, 2); |
|
| 21 | + add_filter('wpshop_attribute_output_def', array($this, 'wpshop_attribute_output_def'), 10, 2); |
|
| 22 | + } |
|
| 23 | + /** |
|
| 24 | + * Call private functions if class is activate. |
|
| 25 | + * |
|
| 26 | + * @param string $name Name of function to call. |
|
| 27 | + * @param array $arguments Array of arguments to pass. |
|
| 28 | + * @return mixed Return of real function called. |
|
| 29 | + */ |
|
| 30 | + public function __call($name, $arguments) |
|
| 31 | + { |
|
| 32 | + if (method_exists($this, $name)) { |
|
| 33 | + if ($this->is_activate()) { |
|
| 34 | + return call_user_func_array(array($this, $name), $arguments); |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | 38 | public function init() { |
| 39 | 39 | $_wpnonce = !empty($_REQUEST['_wpnonce']) ? sanitize_text_field(wp_unslash($_REQUEST['_wpnonce'])) : ''; // Input var okay. |
| 40 | 40 | $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. |
@@ -42,141 +42,141 @@ discard block |
||
| 42 | 42 | $this->is_activate($wps_variation_interface); |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | - /** |
|
| 46 | - * Get if module is active. |
|
| 47 | - * |
|
| 48 | - * @param boolean $new_val If set & db is different, save it. |
|
| 49 | - * @return boolean Actual state of module. |
|
| 50 | - */ |
|
| 51 | - public function is_activate($new_val = null) |
|
| 52 | - { |
|
| 53 | - if (!isset($this->is_active)) { |
|
| 54 | - $option = get_option('wps_variation_interface_display', null); |
|
| 55 | - if (is_null($option)) { |
|
| 56 | - $new_val = true; |
|
| 57 | - $option = false; |
|
| 58 | - } |
|
| 59 | - $this->is_active = (bool) $option; |
|
| 60 | - } |
|
| 61 | - if (isset($new_val) && $this->is_active !== $new_val) { |
|
| 62 | - update_option('wps_variation_interface_display', $new_val); |
|
| 63 | - $this->is_active = $new_val; |
|
| 64 | - } |
|
| 65 | - return $this->is_active; |
|
| 66 | - } |
|
| 67 | - /** |
|
| 68 | - * Get variations of an element. |
|
| 69 | - * |
|
| 70 | - * @param array $element Direct array attribute of db. |
|
| 71 | - * @return void It set directly in variable class. |
|
| 72 | - */ |
|
| 73 | - private function get_variations($element) |
|
| 74 | - { |
|
| 75 | - if (!isset($this->variations)) { |
|
| 76 | - $variations = wpshop_attributes::get_variation_available_attribute($element); |
|
| 77 | - $this->variations = (array) array_merge((isset($variations['available']) ? $variations['available'] : array()), (isset($variations['unavailable']) ? $variations['unavailable'] : array())); |
|
| 78 | - unset($variations); |
|
| 79 | - } |
|
| 80 | - } |
|
| 81 | - public function add_meta_boxes($post_status, $post) |
|
| 82 | - { |
|
| 83 | - global $pagenow; |
|
| 84 | - if ($this->is_activate()) { |
|
| 85 | - $this->get_variations($post->ID); |
|
| 86 | - remove_meta_box('wpshop_wpshop_variations', WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'normal'); |
|
| 87 | - if ($pagenow !== 'post-new.php' && !empty($this->variations)) { |
|
| 88 | - add_meta_box('wpshop_wpshop_variations', __('Product variation', 'wpshop'), array($this, 'meta_box_variation'), WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'normal', 'default'); |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - } |
|
| 92 | - /** |
|
| 93 | - * The metabox. |
|
| 94 | - * |
|
| 95 | - * @param object $post Given by WordPress. |
|
| 96 | - * @return void Display directly. |
|
| 97 | - */ |
|
| 98 | - private function meta_box_variation($post) |
|
| 99 | - { |
|
| 100 | - $this->get_variations($post->ID); |
|
| 101 | - global $wpdb; |
|
| 102 | - $ids = array(); |
|
| 103 | - foreach ($this->variations as $key => $variation) { |
|
| 104 | - $available = wpshop_attributes::get_select_output($variation['attribute_complete_def']); |
|
| 105 | - $this->variations[$key]['available'] = array_keys($available['possible_value']); |
|
| 106 | - $ids = array_merge($ids, array_keys($available['possible_value'])); |
|
| 107 | - } |
|
| 108 | - $query = $wpdb->prepare('SELECT * FROM ' . WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS . " WHERE id IN ('" . implode("', '", $ids) . "') AND status = %s", 'valid'); |
|
| 109 | - $product = wpshop_products::get_product_data($post->ID, false, '"publish","draft","future"'); |
|
| 110 | - $is_used_in_variation = wpshop_attributes::getElement('yes', "'valid', 'notused'", 'is_used_in_variation', true); |
|
| 111 | - $attribute_list = array(); |
|
| 112 | - foreach ($is_used_in_variation as $attribute) { |
|
| 113 | - if (in_array($attribute->backend_input, array('multiple-select', 'select', 'radio', 'checkbox'), true)) { |
|
| 114 | - $values = wpshop_attributes::get_select_output($attribute); |
|
| 115 | - if (!empty($values['possible_value'])) { |
|
| 116 | - $attribute->possible_value = $values['possible_value']; |
|
| 117 | - } |
|
| 118 | - } |
|
| 119 | - $attribute_list[$attribute->code] = $attribute; |
|
| 120 | - } |
|
| 121 | - $variation_defining = get_post_meta($post->ID, '_wpshop_variation_defining', true); |
|
| 122 | - $variations_saved = wpshop_products::get_variation($post->ID); |
|
| 123 | - if (!empty($variations_saved)) { |
|
| 124 | - foreach ($variations_saved as $variation_id => $variation) { |
|
| 125 | - $downloadable = get_post_meta($variation_id, 'attribute_option_is_downloadable_', true); |
|
| 126 | - if (!empty($downloadable['file_url'])) { |
|
| 127 | - $variations_saved[$variation_id]['file']['path'] = $downloadable['file_url']; |
|
| 128 | - $variations_saved[$variation_id]['file']['name'] = basename($downloadable['file_url']); |
|
| 129 | - } |
|
| 130 | - } |
|
| 131 | - } |
|
| 132 | - $price_piloting = get_option('wpshop_shop_price_piloting'); |
|
| 133 | - $product_currency = wpshop_tools::wpshop_get_currency(); |
|
| 134 | - wp_enqueue_style('wps-product-variation-interface-style', WPSPDTVARIATION_INTERFACE_ASSETS_MAIN_DIR . '/css/style-backend.css'); |
|
| 135 | - wp_enqueue_script('wps-product-variation-interface-script', WPSPDTVARIATION_INTERFACE_ASSETS_MAIN_DIR . '/js/script-backend.js'); |
|
| 136 | - wp_enqueue_script('wps-product-variation-interface-script-utils', WPSPDTVARIATION_INTERFACE_ASSETS_MAIN_DIR . '/js/script-backend-utils.js'); |
|
| 137 | - wp_localize_script('wps-product-variation-interface-script', 'wps_product_variation_interface', array('variation' => $this->variations, 'nonce_delete' => wp_create_nonce('wpshop_variation_management'), 'variation_value' => $wpdb->get_results($query), 'product_price' => $product['product_price'], 'tx_tva' => $product['tx_tva'], 'attribute_in_variation' => $attribute_list, 'variations_saved' => $variations_saved, 'price_piloting' => $price_piloting, 'currency' => $product_currency, 'variation_defining' => $variation_defining, 'label_file' => __('Click to add file', 'wpshop'))); |
|
| 138 | - require_once wpshop_tools::get_template_part(WPSPDTVARIATION_INTERFACE_DIR, WPSPDTVARIATION_INTERFACE_TEMPLATES_MAIN_DIR, 'backend', 'meta_box_variation'); |
|
| 139 | - } |
|
| 140 | - /** |
|
| 141 | - * Save other values out of old variation interface. |
|
| 142 | - * |
|
| 143 | - * @param int $post_id Id of post. |
|
| 144 | - * @param object $post WP_Post of WordPress. |
|
| 145 | - * @return void |
|
| 146 | - */ |
|
| 147 | - private function save_post($post_id, $post) |
|
| 148 | - { |
|
| 149 | - 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'])) { |
|
| 150 | - return; |
|
| 151 | - } |
|
| 152 | - wpshop_products::variation_parameters_save($post_id, $_REQUEST['wpshop_variation_defining']['options']); |
|
| 153 | - remove_action('save_post', array($this, 'save_post')); |
|
| 154 | - foreach ($_REQUEST['wps_pdt_variations'] as $variation_id => $data) { |
|
| 155 | - $variation = array('ID' => $variation_id); |
|
| 156 | - if (isset($data['status']) && 'on' === $data['status']) { |
|
| 157 | - $variation['post_status'] = 'publish'; |
|
| 158 | - } else { |
|
| 159 | - $variation['post_status'] = 'draft'; |
|
| 160 | - } |
|
| 161 | - wp_update_post($variation); |
|
| 162 | - } |
|
| 163 | - add_action('save_post', array($this, 'save_post'), 10, 2); |
|
| 164 | - } |
|
| 165 | - /** |
|
| 166 | - * Delete display in attributes products always in metabox. |
|
| 167 | - * |
|
| 168 | - * @param array $output Result of wpshop_attributes::display_attribute() function. |
|
| 169 | - * @param array $element Direct array attribute of db. |
|
| 170 | - * @return array SAme array $output modified. |
|
| 171 | - */ |
|
| 172 | - public function wpshop_attribute_output_def($output, $element) |
|
| 173 | - { |
|
| 174 | - if ($this->is_activate()) { |
|
| 175 | - $this->get_variations($element); |
|
| 176 | - if (!empty($this->variations) && in_array($output['field_definition']['name'], array_keys($this->variations), true)) { |
|
| 177 | - $output['field'] = ''; |
|
| 178 | - } |
|
| 179 | - } |
|
| 180 | - return $output; |
|
| 181 | - } |
|
| 45 | + /** |
|
| 46 | + * Get if module is active. |
|
| 47 | + * |
|
| 48 | + * @param boolean $new_val If set & db is different, save it. |
|
| 49 | + * @return boolean Actual state of module. |
|
| 50 | + */ |
|
| 51 | + public function is_activate($new_val = null) |
|
| 52 | + { |
|
| 53 | + if (!isset($this->is_active)) { |
|
| 54 | + $option = get_option('wps_variation_interface_display', null); |
|
| 55 | + if (is_null($option)) { |
|
| 56 | + $new_val = true; |
|
| 57 | + $option = false; |
|
| 58 | + } |
|
| 59 | + $this->is_active = (bool) $option; |
|
| 60 | + } |
|
| 61 | + if (isset($new_val) && $this->is_active !== $new_val) { |
|
| 62 | + update_option('wps_variation_interface_display', $new_val); |
|
| 63 | + $this->is_active = $new_val; |
|
| 64 | + } |
|
| 65 | + return $this->is_active; |
|
| 66 | + } |
|
| 67 | + /** |
|
| 68 | + * Get variations of an element. |
|
| 69 | + * |
|
| 70 | + * @param array $element Direct array attribute of db. |
|
| 71 | + * @return void It set directly in variable class. |
|
| 72 | + */ |
|
| 73 | + private function get_variations($element) |
|
| 74 | + { |
|
| 75 | + if (!isset($this->variations)) { |
|
| 76 | + $variations = wpshop_attributes::get_variation_available_attribute($element); |
|
| 77 | + $this->variations = (array) array_merge((isset($variations['available']) ? $variations['available'] : array()), (isset($variations['unavailable']) ? $variations['unavailable'] : array())); |
|
| 78 | + unset($variations); |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | + public function add_meta_boxes($post_status, $post) |
|
| 82 | + { |
|
| 83 | + global $pagenow; |
|
| 84 | + if ($this->is_activate()) { |
|
| 85 | + $this->get_variations($post->ID); |
|
| 86 | + remove_meta_box('wpshop_wpshop_variations', WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'normal'); |
|
| 87 | + if ($pagenow !== 'post-new.php' && !empty($this->variations)) { |
|
| 88 | + add_meta_box('wpshop_wpshop_variations', __('Product variation', 'wpshop'), array($this, 'meta_box_variation'), WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, 'normal', 'default'); |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | + /** |
|
| 93 | + * The metabox. |
|
| 94 | + * |
|
| 95 | + * @param object $post Given by WordPress. |
|
| 96 | + * @return void Display directly. |
|
| 97 | + */ |
|
| 98 | + private function meta_box_variation($post) |
|
| 99 | + { |
|
| 100 | + $this->get_variations($post->ID); |
|
| 101 | + global $wpdb; |
|
| 102 | + $ids = array(); |
|
| 103 | + foreach ($this->variations as $key => $variation) { |
|
| 104 | + $available = wpshop_attributes::get_select_output($variation['attribute_complete_def']); |
|
| 105 | + $this->variations[$key]['available'] = array_keys($available['possible_value']); |
|
| 106 | + $ids = array_merge($ids, array_keys($available['possible_value'])); |
|
| 107 | + } |
|
| 108 | + $query = $wpdb->prepare('SELECT * FROM ' . WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS . " WHERE id IN ('" . implode("', '", $ids) . "') AND status = %s", 'valid'); |
|
| 109 | + $product = wpshop_products::get_product_data($post->ID, false, '"publish","draft","future"'); |
|
| 110 | + $is_used_in_variation = wpshop_attributes::getElement('yes', "'valid', 'notused'", 'is_used_in_variation', true); |
|
| 111 | + $attribute_list = array(); |
|
| 112 | + foreach ($is_used_in_variation as $attribute) { |
|
| 113 | + if (in_array($attribute->backend_input, array('multiple-select', 'select', 'radio', 'checkbox'), true)) { |
|
| 114 | + $values = wpshop_attributes::get_select_output($attribute); |
|
| 115 | + if (!empty($values['possible_value'])) { |
|
| 116 | + $attribute->possible_value = $values['possible_value']; |
|
| 117 | + } |
|
| 118 | + } |
|
| 119 | + $attribute_list[$attribute->code] = $attribute; |
|
| 120 | + } |
|
| 121 | + $variation_defining = get_post_meta($post->ID, '_wpshop_variation_defining', true); |
|
| 122 | + $variations_saved = wpshop_products::get_variation($post->ID); |
|
| 123 | + if (!empty($variations_saved)) { |
|
| 124 | + foreach ($variations_saved as $variation_id => $variation) { |
|
| 125 | + $downloadable = get_post_meta($variation_id, 'attribute_option_is_downloadable_', true); |
|
| 126 | + if (!empty($downloadable['file_url'])) { |
|
| 127 | + $variations_saved[$variation_id]['file']['path'] = $downloadable['file_url']; |
|
| 128 | + $variations_saved[$variation_id]['file']['name'] = basename($downloadable['file_url']); |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | + $price_piloting = get_option('wpshop_shop_price_piloting'); |
|
| 133 | + $product_currency = wpshop_tools::wpshop_get_currency(); |
|
| 134 | + wp_enqueue_style('wps-product-variation-interface-style', WPSPDTVARIATION_INTERFACE_ASSETS_MAIN_DIR . '/css/style-backend.css'); |
|
| 135 | + wp_enqueue_script('wps-product-variation-interface-script', WPSPDTVARIATION_INTERFACE_ASSETS_MAIN_DIR . '/js/script-backend.js'); |
|
| 136 | + wp_enqueue_script('wps-product-variation-interface-script-utils', WPSPDTVARIATION_INTERFACE_ASSETS_MAIN_DIR . '/js/script-backend-utils.js'); |
|
| 137 | + wp_localize_script('wps-product-variation-interface-script', 'wps_product_variation_interface', array('variation' => $this->variations, 'nonce_delete' => wp_create_nonce('wpshop_variation_management'), 'variation_value' => $wpdb->get_results($query), 'product_price' => $product['product_price'], 'tx_tva' => $product['tx_tva'], 'attribute_in_variation' => $attribute_list, 'variations_saved' => $variations_saved, 'price_piloting' => $price_piloting, 'currency' => $product_currency, 'variation_defining' => $variation_defining, 'label_file' => __('Click to add file', 'wpshop'))); |
|
| 138 | + require_once wpshop_tools::get_template_part(WPSPDTVARIATION_INTERFACE_DIR, WPSPDTVARIATION_INTERFACE_TEMPLATES_MAIN_DIR, 'backend', 'meta_box_variation'); |
|
| 139 | + } |
|
| 140 | + /** |
|
| 141 | + * Save other values out of old variation interface. |
|
| 142 | + * |
|
| 143 | + * @param int $post_id Id of post. |
|
| 144 | + * @param object $post WP_Post of WordPress. |
|
| 145 | + * @return void |
|
| 146 | + */ |
|
| 147 | + private function save_post($post_id, $post) |
|
| 148 | + { |
|
| 149 | + 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'])) { |
|
| 150 | + return; |
|
| 151 | + } |
|
| 152 | + wpshop_products::variation_parameters_save($post_id, $_REQUEST['wpshop_variation_defining']['options']); |
|
| 153 | + remove_action('save_post', array($this, 'save_post')); |
|
| 154 | + foreach ($_REQUEST['wps_pdt_variations'] as $variation_id => $data) { |
|
| 155 | + $variation = array('ID' => $variation_id); |
|
| 156 | + if (isset($data['status']) && 'on' === $data['status']) { |
|
| 157 | + $variation['post_status'] = 'publish'; |
|
| 158 | + } else { |
|
| 159 | + $variation['post_status'] = 'draft'; |
|
| 160 | + } |
|
| 161 | + wp_update_post($variation); |
|
| 162 | + } |
|
| 163 | + add_action('save_post', array($this, 'save_post'), 10, 2); |
|
| 164 | + } |
|
| 165 | + /** |
|
| 166 | + * Delete display in attributes products always in metabox. |
|
| 167 | + * |
|
| 168 | + * @param array $output Result of wpshop_attributes::display_attribute() function. |
|
| 169 | + * @param array $element Direct array attribute of db. |
|
| 170 | + * @return array SAme array $output modified. |
|
| 171 | + */ |
|
| 172 | + public function wpshop_attribute_output_def($output, $element) |
|
| 173 | + { |
|
| 174 | + if ($this->is_activate()) { |
|
| 175 | + $this->get_variations($element); |
|
| 176 | + if (!empty($this->variations) && in_array($output['field_definition']['name'], array_keys($this->variations), true)) { |
|
| 177 | + $output['field'] = ''; |
|
| 178 | + } |
|
| 179 | + } |
|
| 180 | + return $output; |
|
| 181 | + } |
|
| 182 | 182 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <div id="wps_variations_summary"> |
| 2 | - <div data-view-model="wps_variations_options_summary" id="wps_variations_summary_display"><b>%summary%</b></div><a id="wps_variations_parameters" href="<?php print wp_nonce_url(get_edit_post_link($post->ID) . '&wps_variation_interface=false', 'wps_remove_variation_interface');?>" title="<?php _e('Back to old interface', 'wpshop'); ?>"><span class="dashicons dashicons-admin-generic"></span></a> |
|
| 2 | + <div data-view-model="wps_variations_options_summary" id="wps_variations_summary_display"><b>%summary%</b></div><a id="wps_variations_parameters" href="<?php print wp_nonce_url(get_edit_post_link($post->ID) . '&wps_variation_interface=false', 'wps_remove_variation_interface'); ?>" title="<?php _e('Back to old interface', 'wpshop'); ?>"><span class="dashicons dashicons-admin-generic"></span></a> |
|
| 3 | 3 | </div> |
| 4 | 4 | <div id="wps_variations_options"> |
| 5 | 5 | <ul id="wps_variations_options_title"> |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | <li class="wps_variations_price_stock_col"><input type="text" pattern="[0-9]*" onchange="wps_variations_price_option_raw.control.stock(this)" name="wps_pdt_variations[%ID%][attribute][decimal][product_stock]" align="right" value="%stock%"></li> |
| 57 | 57 | <li class="wps_variations_price_weight_col"><input type="text" pattern="[0-9]+(\.[0-9][0-9]?)?" onchange="wps_variations_price_option_raw.control.weight(this)" name="wps_pdt_variations[%ID%][attribute][decimal][product_weight]" align="right" value="%weight%"></li> |
| 58 | 58 | <li class="wps_variations_price_reference_col"><input type="text" onchange="wps_variations_price_option_raw.control.reference(this)" name="wps_pdt_variations[%ID%][attribute][varchar][product_reference]" align="right" value="%reference%"></li> |
| 59 | - <li class="wps_variations_price_file_col" data-view-model="wps_variations_price_option_file_%ID%"><span class="wps_variations_price_option_price_file" onclick="wps_variations_price_option_raw.control.file(this)">%link%</span><input style="display: none;" type="file" name="wpshop_file" id="wpshop_file" onchange="wps_variations_price_option_raw.control.link(event, this)"><?php wp_nonce_field('ajax_wpshop_upload_downloadable_file_action', 'wpshop_file_nonce');?><a class="wps_variations_price_option_price_download_file" href="%path%" target="_blank" download="" style="display: %download%"><span class="dashicons dashicons-download"></span></a></li> |
|
| 59 | + <li class="wps_variations_price_file_col" data-view-model="wps_variations_price_option_file_%ID%"><span class="wps_variations_price_option_price_file" onclick="wps_variations_price_option_raw.control.file(this)">%link%</span><input style="display: none;" type="file" name="wpshop_file" id="wpshop_file" onchange="wps_variations_price_option_raw.control.link(event, this)"><?php wp_nonce_field('ajax_wpshop_upload_downloadable_file_action', 'wpshop_file_nonce'); ?><a class="wps_variations_price_option_price_download_file" href="%path%" target="_blank" download="" style="display: %download%"><span class="dashicons dashicons-download"></span></a></li> |
|
| 60 | 60 | <li class="wps_variations_price_active_col"><input name="wps_pdt_variations[%ID%][status]" onclick="wps_variations_price_option_raw.control.activate(this)" type="checkbox" %price_option_activate%></li> |
| 61 | 61 | </ul> |
| 62 | 62 | </div> |