PluginProbe ʕ •ᴥ•ʔ
PiWeb Product Enquiry or product catalog for WooCommerce / 2.2.33.49
PiWeb Product Enquiry or product catalog for WooCommerce v2.2.33.49
2.2.34.43 2.2.34.42 2.2.34.41 2.2.34.40 2.2.34.39 trunk 2.2.22 2.2.26 2.2.33.16 2.2.33.17 2.2.33.19 2.2.33.20 2.2.33.21 2.2.33.22 2.2.33.23 2.2.33.24 2.2.33.26 2.2.33.27 2.2.33.29 2.2.33.30 2.2.33.31 2.2.33.32 2.2.33.33 2.2.33.34 2.2.33.36 2.2.33.37 2.2.33.39 2.2.33.40 2.2.33.41 2.2.33.42 2.2.33.43 2.2.33.44 2.2.33.46 2.2.33.47 2.2.33.49 2.2.34.0 2.2.34.1 2.2.34.10 2.2.34.11 2.2.34.12 2.2.34.13 2.2.34.14 2.2.34.16 2.2.34.17 2.2.34.19 2.2.34.2 2.2.34.20 2.2.34.21 2.2.34.22 2.2.34.23 2.2.34.24 2.2.34.26 2.2.34.27 2.2.34.29 2.2.34.3 2.2.34.30 2.2.34.31 2.2.34.32 2.2.34.33 2.2.34.34 2.2.34.36 2.2.34.37 2.2.34.4 2.2.34.6 2.2.34.7 2.2.34.9
enquiry-quotation-for-woocommerce / admin / class-eqw-option.php
enquiry-quotation-for-woocommerce / admin Last commit date
css 1 year ago img 1 year ago js 1 year ago partials 1 year ago class-eqw-advance.php 1 year ago class-eqw-cart.php 1 year ago class-eqw-email.php 1 year ago class-eqw-enquiry.php 1 year ago class-eqw-form-control.php 1 year ago class-eqw-menu.php 1 year ago class-eqw-option.php 1 year ago class-eqw-product-options.php 1 year ago class-pisol-enquiry-quotation-woocommerce-admin.php 1 year ago index.php 1 year ago plugins.php 1 year ago
class-eqw-option.php
151 lines
1 <?php
2
3 class Class_Pi_Eqw_Option{
4
5 public $plugin_name;
6
7 private $settings = array();
8
9 private $active_tab;
10
11 private $this_tab = 'default';
12
13 private $tab_name = 'Enquiry Button';
14
15 private $setting_key = 'pi_eqw_basic_setting';
16
17 public $tab;
18
19 function __construct($plugin_name){
20 $this->plugin_name = $plugin_name;
21
22 $this->settings = array(
23
24 array('field'=>'title', 'class'=> 'hide-pro bg-primary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>'Enable enquiry for specific roles of users only', 'type'=>'setting_category'),
25
26 array('field'=>'pi_eqw_show_enquiry_button_to_role2', 'type'=>'multiselect', 'default'=>array('guest'),'label'=>__('Show enquiry button for user with role'),'desc'=>__('select roles to whom the enquiry button will be shown'), 'value'=>$this->allUserRoles(), 'pro'=>true),
27
28 array('field'=>'title', 'class'=> 'bg-primary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Enquiry button on shop / category page','pisol-enquiry-quotation-woocommerce'), 'type'=>'setting_category'),
29
30 array('field'=>'pi_eqw_enquiry_loop', 'label'=>__('Enquiry button on category/show page', 'pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('This will show enquiry button on loop product like shop, category page', 'pisol-enquiry-quotation-woocommerce')),
31
32 array('field'=>'pi_eqw_enquiry_loop_pro', 'label'=>__('Show button on Variable Product', 'pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('This will show enquiry button on variable product', 'pisol-enquiry-quotation-woocommerce'), 'pro'=>true),
33
34 array('field'=>'pi_eqw_loop_show_on_out_of_stock_pro', 'label'=>__('Show enquiry option only when product is out of stock', 'pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('On shop / category product page', 'pisol-enquiry-quotation-woocommerce'), 'pro'=>true),
35
36 array('field'=>'pi_eqw_enquiry_loop_position', 'label'=>__('Position on shop/category page', 'pisol-enquiry-quotation-woocommerce'),'type'=>'select', 'default'=> 'woocommerce_after_shop_loop_item', 'value'=>array('woocommerce_after_shop_loop_item'=>__('At the end of product', 'pisol-enquiry-quotation-woocommerce'), 'woocommerce_before_shop_loop_item'=>__('At the start of the product', 'pisol-enquiry-quotation-woocommerce'), 'woocommerce_before_shop_loop_item_title'=>__('Before product title', 'pisol-enquiry-quotation-woocommerce'), 'woocommerce_after_shop_loop_item_title'=>__('After product title', 'pisol-enquiry-quotation-woocommerce')), 'desc'=>__('Enquiry button position on show / category page','pisol-enquiry-quotation-woocommerce'), 'pro'=>true),
37
38 array('field'=>'pi_eqw_enquiry_loop_bg_color', 'type'=>'color', 'default'=>'#ee6443','label'=>__('Background color','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Background color of the button on the shop / category page','pisol-enquiry-quotation-woocommerce')),
39
40 array('field'=>'pi_eqw_enquiry_loop_text_color', 'type'=>'color', 'default'=>'#ffffff','label'=>__('Text color','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Text color of the button on the shop / category page','pisol-enquiry-quotation-woocommerce')),
41
42 array('field'=>'pisol_eqw_loop_button_size','desc'=>'Enquiry button width on product page (PX), if left blank it will be 100% width ', 'label'=>__('Enquiry button width on product page'),'type'=>'number', 'default'=>'', 'min'=>100, 'placeholder'=>'px'),
43
44 array('field'=>'pisol_eqw_loop_button_font_size','desc'=>'Enquiry button font size (PX)', 'label'=>__('Enquiry button font size on product page'),'type'=>'number', 'default'=>'16', 'placeholder'=>'px', 'min'=>12),
45
46 array('field'=>'pi_eqw_enquiry_loop_button_text', 'type'=>'text', 'default'=>__('Add to Enquiry','pisol-enquiry-quotation-woocommerce'),'label'=>__('Enquiry button text','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Text shown in the enquiry button','pisol-enquiry-quotation-woocommerce')),
47
48
49 array('field'=>'title', 'class'=> 'bg-primary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Enquiry button on single product page','pisol-enquiry-quotation-woocommerce'), 'type'=>'setting_category'),
50
51 array('field'=>'pi_eqw_enquiry_single', 'label'=>__('Enquiry button on single product page','pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>1, 'desc'=>__('This will show enquiry button on single product page','pisol-enquiry-quotation-woocommerce')),
52
53 array('field'=>'pi_eqw_enquiry_single_pro', 'label'=>__('Show button on Variable Product','pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('This will show enquiry button on variable product','pisol-enquiry-quotation-woocommerce'), 'pro'=>true),
54
55 array('field'=>'pi_eqw_single_show_on_out_of_stock_pro', 'label'=>__('Show enquiry option Only when product is out of stock','pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('On single product page','pisol-enquiry-quotation-woocommerce'), 'pro'=>true),
56
57 array('field'=>'pi_eqw_enquiry_single_position', 'label'=>__('Position on single product page','pisol-enquiry-quotation-woocommerce'),'type'=>'select', 'default'=> 52, 'value'=> array(4 =>__('Before summary','pisol-enquiry-quotation-woocommerce'), 52 => __('After Summary','pisol-enquiry-quotation-woocommerce'), 36 => __('After add to cart button','pisol-enquiry-quotation-woocommerce'), 29 => __('Before add to cart button','pisol-enquiry-quotation-woocommerce')), 'desc'=>__('Enquiry button position on single product page','pisol-enquiry-quotation-woocommerce'), 'pro'=>true),
58
59 array('field'=>'pi_eqw_enquiry_single_bg_color', 'type'=>'color', 'default'=>'#ee6443','label'=>__('Background color','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Background color of the button on the shop / category page','pisol-enquiry-quotation-woocommerce')),
60
61 array('field'=>'pi_eqw_enquiry_single_text_color', 'type'=>'color', 'default'=>'#ffffff','label'=>__('Text color','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Text color of the button on the shop / category page','pisol-enquiry-quotation-woocommerce')),
62
63 array('field'=>'pisol_eqw_button_size','desc'=>'Enquiry button width on product page (PX), if left blank it will be 100% width ', 'label'=>__('Enquiry button width on product page'),'type'=>'number', 'default'=>'200', 'min'=>100, 'placeholder'=>'px'),
64
65 array('field'=>'pisol_eqw_button_font_size','desc'=>'Enquiry button font size (PX)', 'label'=>__('Enquiry button font size on product page'),'type'=>'number', 'default'=>'16', 'placeholder'=>'px', 'min'=>12),
66
67 array('field'=>'pi_eqw_enquiry_single_button_text', 'type'=>'text', 'default'=>__('Add to Enquiry','pisol-enquiry-quotation-woocommerce'),'label'=>__('Enquiry button text','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Text shown in the enquiry button','pisol-enquiry-quotation-woocommerce')),
68
69 array('field'=>'title', 'class'=> 'bg-primary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('If you notice change in enquiry button after upgrading to v2.1.2, then enable the below option to fall back to old way of position','pisol-enquiry-quotation-woocommerce'), 'type'=>'setting_category'),
70
71 array('field'=>'pi_eqw_trouble_shoot_position', 'label'=>__('Fall back to old position hook','pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('We have changed the single product page hook in v2.1.2 this is done to improve compatibility, but if you face any issue like enquiry button not showing after upgrading to v2.1.2 then enable this option to fall back to old hook','pisol-enquiry-quotation-woocommerce')),
72
73 array('field'=>'title', 'class'=> 'hide-pro bg-primary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Processing image','pisol-enquiry-quotation-woocommerce'), 'type'=>'setting_category'),
74
75 array('field'=>'pisol_eqw_loading_img', 'type'=>'image','label'=>__('Processing image','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Image is shown as loading image','pisol-enquiry-quotation-woocommerce'), 'pro'=>true),
76
77
78 );
79
80 $this->tab = sanitize_text_field(filter_input( INPUT_GET, 'tab'));
81 $this->active_tab = $this->tab != "" ? $this->tab : 'default';
82
83 if($this->this_tab == $this->active_tab){
84 add_action($this->plugin_name.'_tab_content', array($this,'tab_content'));
85 }
86
87
88 add_action($this->plugin_name.'_tab', array($this,'tab'),1);
89
90
91 $this->register_settings();
92
93 if(PI_EQW_DELETE_SETTING){
94 $this->delete_settings();
95 }
96 }
97
98 function allUserRoles(){
99 $wp_roles = new WP_Roles();
100 $roles = array();
101 foreach($wp_roles->roles as $key => $role){
102 $roles[$key] = $role['name'];
103 }
104 $roles['guest'] = 'Guest Customer';
105 return $roles;
106 }
107
108
109 function delete_settings(){
110 foreach($this->settings as $setting){
111 delete_option( $setting['field'] );
112 }
113 }
114
115 function register_settings(){
116
117 foreach($this->settings as $setting){
118 register_setting( $this->setting_key, $setting['field']);
119 }
120
121 }
122
123 function tab(){
124 $page = sanitize_text_field(filter_input( INPUT_GET, 'page'));
125 $this->tab_name = __('Enquiry Button','pisol-enquiry-quotation-woocommerce');
126 ?>
127 <a class=" px-3 text-light d-flex align-items-center border-left border-right <?php echo ($this->active_tab == $this->this_tab ? 'bg-primary' : 'bg-secondary'); ?>" href="<?php echo esc_url( admin_url( 'admin.php?page='.$page.'&tab='.$this->this_tab ) ); ?>">
128 <?php echo esc_html( $this->tab_name); ?>
129 </a>
130 <?php
131 }
132
133 function tab_content(){
134
135 ?>
136 <form method="post" action="options.php" class="pisol-setting-form">
137 <?php settings_fields( $this->setting_key ); ?>
138 <?php
139 foreach($this->settings as $setting){
140 new pisol_class_form_eqw($setting, $this->setting_key);
141 }
142 ?>
143 <input type="submit" class="mt-3 btn btn-primary btn-sm" value="Save Option" />
144 </form>
145 <?php
146 }
147
148
149 }
150
151