• Resolved wolphitdepartment

    (@wolphitdepartment)


    First of all, thank you so much for this plugin.

    However, I have one problem. One of the payment gateway plugins that I am using is not working with your plugin. Upon checking, it should be working with WooCommerce Sequence Order Number and Sequence Order Number Pro, as seen on this code snippet:

    
    private function get_order_id( $order_number ) {
    
    		@ob_start();
    
    		// Find the order ID from the custom order number, if we have SON or SONP enabled
    		if ( class_exists( 'WC_Seq_Order_Number' ) ) {
    
    			global $wc_seq_order_number;
    
    			$order_id = $wc_seq_order_number->find_order_by_order_number( $order_number );
    
    			if ( 0 === $order_id ) {
    				$order_id = $order_number;
    			}
    
    		} elseif ( class_exists( 'WC_Seq_Order_Number_Pro' ) ) {
    			global $wc_seq_order_number_pro;
    
    			$order_id = $wc_seq_order_number_pro->find_order_by_order_number( $order_number );
    
    			if ( 0 === $order_id ) {
    				$order_id = $order_number;
    			}
    
    		} else {
    			$order_id = $order_number;
    		}
    
    		// Remove any error notices generated during the process
    		@ob_clean();
    
    		return $order_id;
    
    	}
    

    How do I implement your plugin’s class on this? Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author WebToffee

    (@webtoffee)

    Hi @wolphitdepartment,

    You may please use the code snippet here to develop a similar work around. Hope it helps.

    Thread Starter wolphitdepartment

    (@wolphitdepartment)

    Thank you for your response. Could you please provide further instructions on how I can implement this? Thanks a lot.

    Thread Starter wolphitdepartment

    (@wolphitdepartment)

    I made a public function at wt-woocommerce-sequential-order-numbers/includes/class-wt-advanced-order-number.php and entered this code that you provided:

    public function find_order_by_order_number( $order_number ) {
    
    		$args    = array(
                'post_type'      => 'shop_order',
                'post_status'    => 'any',
                'meta_query'     => array(
                    array(
                        'key'        => '_order_number',
                        'value'      => $order_number,  //here you pass the Order Number
                        'compare'    => '=',
                    )
                )
            );
            $query   = new WP_Query( $args );
            if ( !empty( $query->posts ) ) 
            {
                $order_id = $query->posts[ 0 ]->ID;
            }
            else
            {
            	$order_id = $order_number;
            }
    		return $order_id;
    	}
    

    and then added this code on the payment gateway private function get_order_id [the first code snippet I provided on this thread]

    
    elseif ( class_exists( 'Wt_Advanced_Order_Number' ) ) {
    			global $wt_advanced_order_number;
    
    			$order_id = $wt_advanced_order_number->find_order_by_order_number( $order_number );
    
    			if ( 0 === $order_id ) {
    				$order_id = $order_number;
    			}
    
    		}

    `

    Everything is fine except for the part where payment is completed and will redirect already to the Thank You page. This is the error that I am getting:

    <blockquote>
    Fatal error: Uncaught Error: Call to a member function find_order_by_order_number() on null in /var/www/mydomain.com/wp-content/plugins/iPay88 for Woocommerce v1.1/includes/class-wc-gateway-ipay88.php:873 Stack trace: #0 /var/www/mydomain.com/wp-content/plugins/iPay88 for Woocommerce v1.1/includes/class-wc-gateway-ipay88.php(610): WC_Gateway_iPay88->get_order_id() #1 /var/www/mydomain.com/wp-content/plugins/iPay88 for Woocommerce v1.1/includes/class-wc-gateway-ipay88.php(660): WC_Gateway_iPay88->validate_response() #2 /var/www/mydomain.com/wp-includes/class-wp-hook.php(292): WC_Gateway_iPay88->check_status_response_ipay88() #3 /var/www/mydomain.com/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters() #4 /var/www/mydomain.com/wp-includes/plugin.php(484): WP_Hook->do_action() #5 /var/www/mydomain.com/wp-content/plugins/woocommerce/includes/class-wc-api.php(161): do_action() #6 /var/www/mydomain.com/wp-includes/class-wp-hook.php(292): WC_API->handle_api_requests() #7 /v in /var/www/mydomain.com/wp-content/plugins/iPay88 for Woocommerce v1.1/includes/class-wc-gateway-ipay88.php on line 873

    Your input is highly appreciated!

    • This reply was modified 3 years, 8 months ago by wolphitdepartment. Reason: code closing tag error
    Plugin Author WebToffee

    (@webtoffee)

    Hi @wolphitdepartment,

    Please try replacing the elseif code with below code:

    elseif ( class_exists( 'Wt_Advanced_Order_Number' ) ){
    			$args    = array(
    	            'post_type'      => 'shop_order',
    	            'post_status'    => 'any',
    	            'meta_query'     => array(
    	                array(
    	                    'key'        => '_order_number',
    	                    'value'      => $order_number,  //here you pass the Order Number
    	                    'compare'    => '=',
    	                )
    	            )
    	        );
    	        $query   = new WP_Query( $args );
    	        if ( !empty( $query->posts ) ) 
    	        {
    	            $order_id = $query->posts[ 0 ]->ID;
    	        }
    		}
    Thread Starter wolphitdepartment

    (@wolphitdepartment)

    Thank you so much! It’s working perfectly!

    Plugin Author WebToffee

    (@webtoffee)

    Hi @wolphitdepartment,

    Thanks for the follow-up and glad to know that the solution provided worked for you.

    If you like the plugin, please leave a review here.

    Hi
    I facing the same issues , may i know where I should add this file ?

    elseif ( class_exists( 'Wt_Advanced_Order_Number' ) ){
    			$args    = array(
    	            'post_type'      => 'shop_order',
    	            'post_status'    => 'any',
    	            'meta_query'     => array(
    	                array(
    	                    'key'        => '_order_number',
    	                    'value'      => $order_number,  //here you pass the Order Number
    	                    'compare'    => '=',
    	                )
    	            )
    	        );
    	        $query   = new WP_Query( $args );
    	        if ( !empty( $query->posts ) ) 
    	        {
    	            $order_id = $query->posts[ 0 ]->ID;
    	        }
    		}

    Kindly advice , thanks

    • This reply was modified 3 years, 5 months ago by TAN.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Integration with Payment Plugin (iPay88)’ is closed to new replies.