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-advance.php
131 lines
| 1 | <?php |
| 2 | |
| 3 | class Class_Pi_Eqw_Advance{ |
| 4 | |
| 5 | public $plugin_name; |
| 6 | |
| 7 | private $settings = array(); |
| 8 | |
| 9 | private $active_tab; |
| 10 | |
| 11 | private $this_tab = 'advance'; |
| 12 | |
| 13 | private $tab_name = "Advance option"; |
| 14 | |
| 15 | private $setting_key = 'pi_eqw_advance_setting'; |
| 16 | |
| 17 | public $tab; |
| 18 | |
| 19 | |
| 20 | function __construct($plugin_name){ |
| 21 | $this->plugin_name = $plugin_name; |
| 22 | |
| 23 | $this->settings = array( |
| 24 | |
| 25 | array('field'=>'pi_eqw_remove_add_to_cart2', 'label'=>__('Remove add to cart button','pisol-enquiry-quotation-woocommerce'),'type'=>'select', 'default'=>'hide-if-enquiry', 'desc'=>__('This will remove the add to cart button from website<br>Dont Hide<br>Hide for All Products<br>Hide for product which has enquiry enabled','pisol-enquiry-quotation-woocommerce'), 'value'=>array('hide-if-enquiry'=>__('Hide if enquiry enabled','pisol-enquiry-quotation-woocommerce')), 'pro'=>true), |
| 26 | |
| 27 | array('field'=>'pi_eqw_hide_price', 'label'=>__('Hide price','pisol-enquiry-quotation-woocommerce'),'type'=>'select', 'default'=>'no', 'desc'=>__('This will hide the price based on the selections, If price is hidden then the add to cart button will also be hidden','pisol-enquiry-quotation-woocommerce'), 'value'=>array('no'=>__('Don\'t hide','pisol-enquiry-quotation-woocommerce'), 'all'=>__('Hide for all','pisol-enquiry-quotation-woocommerce'), 'guest'=>__('Hide for non log-in users','pisol-enquiry-quotation-woocommerce'))), |
| 28 | |
| 29 | array('field'=>'pi_eqw_hide_price_in_cart', 'label'=>__('Remove price columns from the enquiry cart and enquiry emails','pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('This will remove the price columns from the cart page and enquiry emails','pisol-enquiry-quotation-woocommerce'), 'pro'=>true), |
| 30 | |
| 31 | array('field'=>'pi_eqw_hide_message_in_cart_1', 'label'=>__('Remove product specific message columns from the enquiry cart and enquiry emails','pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('This will remove the message columns from the cart page and enquiry emails','pisol-enquiry-quotation-woocommerce'), 'pro'=>true), |
| 32 | |
| 33 | array('field'=>'pi_eqw_enquiry_cart', 'label'=>__('Select the page where to show the enquiry cart','pisol-enquiry-quotation-woocommerce'),'type'=>'select', 'default'=>0, 'value'=>$this->pages(), 'desc'=>__('Enquiry button position on show / category page, If you make some other page as Enquiry make sure to put the short code <strong>[pisol_enquiry_cart]</strong> on that page','pisol-enquiry-quotation-woocommerce')), |
| 34 | |
| 35 | array('field'=>'pi_eqw_redirect_to_enquiry_cart', 'label'=>__('Redirect WooCommerce cart and checkout page to enquiry cart page','pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('This will redirect all the traffic on cart and checkout page to enquiry cart page','pisol-enquiry-quotation-woocommerce')), |
| 36 | |
| 37 | array('field'=>'pi_eqw_success_message', 'label'=>__('Success message shown on form submission','pisol-enquiry-quotation-woocommerce'),'type'=>'text', 'default'=>__('Enquiry submitted'), 'desc'=>__('This is the message that is shown on successful submission of the enquiry','pisol-enquiry-quotation-woocommerce'),'pro'=>true), |
| 38 | |
| 39 | array('field'=>'pi_eqw_redirect_to_form', 'label'=>__('After Add to enquiry click','pisol-enquiry-quotation-woocommerce'),'type'=>'select', 'default'=>0, 'value'=>array('0'=> __('Product will be added to enquiry cart only','pisol-enquiry-quotation-woocommerce'), 1 =>__('User will be redirected to enquiry cart page once product is added','pisol-enquiry-quotation-woocommerce'), 'popup'=>__('Enquiry popup will get opened','pisol-enquiry-quotation-woocommerce')), 'desc'=>__('What happen when user click on add to enquiry (Product will be added to the enquiry cart in all the 3 cases),<br> |
| 40 | Redirect to cart page<br>Open cart page in popup','pisol-enquiry-quotation-woocommerce'), 'pro'=>true), |
| 41 | |
| 42 | array('field'=>'title', 'class'=> 'bg-primary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__("Webhook Integration",'pisol-enquiry-quotation-woocommerce'), 'type'=>"setting_category"), |
| 43 | |
| 44 | array('field'=>'pi_eqw_webhook_url', 'label'=>__('Webhook url','pisol-enquiry-quotation-woocommerce'),'type'=>'text', 'default'=>'', 'desc'=>__('Insert webhook url where the enquiry data will send send, you can insert webhook url of zapier or Pabbly or any other platform that support webhook url','pisol-enquiry-quotation-woocommerce')), |
| 45 | |
| 46 | array('field'=>'title', 'class'=> 'hide-pro bg-primary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Enquiry popup settings','pisol-enquiry-quotation-woocommerce'), 'type'=>'setting_category', 'pro'=>true), |
| 47 | |
| 48 | array('field'=>'pi_eqw_show_products_in_cart_in_popup', 'label'=>__('Show products added to the enquiry cart in the popup','pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>1, 'desc'=>__('Show products added in the inquiry cart in the popup','pisol-enquiry-quotation-woocommerce'), 'pro'=>true), |
| 49 | |
| 50 | array('field'=>'pi_eqw_popup_title', 'label'=>__('Popup title','pisol-enquiry-quotation-woocommerce'),'type'=>'text', 'default'=>__('Submit Enquiry','pisol-enquiry-quotation-woocommerce'), 'desc'=>__('Title shown above the popup','pisol-enquiry-quotation-woocommerce'), 'pro'=>true), |
| 51 | |
| 52 | array('field'=>'pi_eqw_popup_title_bg_color', 'type'=>'color', 'default'=>'#FF0000','label'=>__('Popup Title Background color','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Title background color','pisol-enquiry-quotation-woocommerce'), 'pro'=>true), |
| 53 | |
| 54 | array('field'=>'pi_eqw_popup_title_text_color', 'type'=>'color', 'default'=>'#FFFFFF','label'=>__('Popup Title text color','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Title text color','pisol-enquiry-quotation-woocommerce'), 'pro'=>true), |
| 55 | |
| 56 | ); |
| 57 | |
| 58 | $this->tab = sanitize_text_field(filter_input( INPUT_GET, 'tab')); |
| 59 | $this->active_tab = $this->tab != "" ? $this->tab : 'default'; |
| 60 | |
| 61 | if($this->this_tab == $this->active_tab){ |
| 62 | add_action($this->plugin_name.'_tab_content', array($this,'tab_content')); |
| 63 | } |
| 64 | |
| 65 | |
| 66 | add_action($this->plugin_name.'_tab', array($this,'tab'),1); |
| 67 | |
| 68 | |
| 69 | $this->register_settings(); |
| 70 | |
| 71 | if(PI_EQW_DELETE_SETTING){ |
| 72 | $this->delete_settings(); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | function pages(){ |
| 77 | $pages = array(0 => 'Select page for Enquiry cart'); |
| 78 | $obj = get_posts(array('numberposts' => -1, 'post_type' => 'page')); |
| 79 | if(!is_array($obj) || empty($obj)) return array(0 => 'Please create a Page and add shortcode [pisol_enquiry_cart]'); |
| 80 | foreach($obj as $page){ |
| 81 | if($page->post_status == 'publish'){ |
| 82 | $pages[$page->ID] = $page->post_title; |
| 83 | } |
| 84 | } |
| 85 | return $pages; |
| 86 | |
| 87 | } |
| 88 | |
| 89 | |
| 90 | function delete_settings(){ |
| 91 | foreach($this->settings as $setting){ |
| 92 | delete_option( $setting['field'] ); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | function register_settings(){ |
| 97 | |
| 98 | foreach($this->settings as $setting){ |
| 99 | register_setting( $this->setting_key, $setting['field']); |
| 100 | } |
| 101 | |
| 102 | } |
| 103 | |
| 104 | function tab(){ |
| 105 | $page = sanitize_text_field(filter_input( INPUT_GET, 'page')); |
| 106 | $this->tab_name = __('Advance option','pisol-enquiry-quotation-woocommerce'); |
| 107 | ?> |
| 108 | <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 ) ); ?>"> |
| 109 | <?php echo esc_html( $this->tab_name); ?> |
| 110 | </a> |
| 111 | <?php |
| 112 | } |
| 113 | |
| 114 | function tab_content(){ |
| 115 | |
| 116 | ?> |
| 117 | <form method="post" action="options.php" class="pisol-setting-form"> |
| 118 | <?php settings_fields( $this->setting_key ); ?> |
| 119 | <?php |
| 120 | foreach($this->settings as $setting){ |
| 121 | new pisol_class_form_eqw($setting, $this->setting_key); |
| 122 | } |
| 123 | ?> |
| 124 | <input type="submit" class="mt-3 btn btn-primary btn-sm" value="Save Option" /> |
| 125 | </form> |
| 126 | <?php |
| 127 | } |
| 128 | |
| 129 | |
| 130 | } |
| 131 |