Created
January 6, 2026 04:43
-
-
Save rajeshsingh520/c8e0ae259eb70c257a936c6cbddcd81e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TwentyTwenty_Enquiry_Handler { | |
| private static $instance; | |
| public static function get_instance() { | |
| if ( null === self::$instance ) { | |
| self::$instance = new self(); | |
| } | |
| return self::$instance; | |
| } | |
| private function __construct() { | |
| add_filter( 'pisol_eqw_form_fields', array( $this, 'filter_form_fields' ) ); | |
| add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); | |
| } | |
| public function filter_form_fields( $fields ) { | |
| $products = PISOL\ENQ\FRONT\Enquiry_Cart::getProductsInEnquirySession(); | |
| $present = ! empty( $products ); | |
| foreach ( $products as $product ) { | |
| $product_id = $product['id']; | |
| if ( ! has_term( 'isCloth', 'product_tag', $product_id ) ) { | |
| $present = false; | |
| break; | |
| } | |
| } | |
| if ( !$present ) { | |
| foreach ( $fields as $key => $field ) { | |
| if ( $field['type'] == 'dropdown' && $field['name'] == 'lieferservice' ) { | |
| $fields[ $key ]['options'] = array( '0' => 'Ja, bitte bieten Sie auch die Anlieferung und Abholung mit an' ); | |
| } | |
| } | |
| } | |
| return $fields; | |
| } | |
| public function enqueue_scripts() { | |
| $js = ' | |
| jQuery(document).ready(function($){ | |
| jQuery(document).on("pisol_enquiry_product_removed", function(e, product_id){ | |
| location.reload(); | |
| }); | |
| }); | |
| '; | |
| wp_add_inline_script( 'jquery', $js ); | |
| } | |
| } | |
| TwentyTwenty_Enquiry_Handler::get_instance(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment