Forum Replies Created

Viewing 15 replies - 16 through 30 (of 59 total)
  • Thread Starter rkvisit

    (@rkvisit)

    hmm but the email went if we manage to transfer at the first time.but if i failed first attempt and try the second time using pay button no email will trigger.(Ex: lets say i got an issue when pay by credit card came back and added bank transfer and proceeded).How i can identify this is a second attempt and then trigger the email?As you said its on hold!. Can i add a function like this

    if ($order->status == 'pending' || $order->status == 'failed') {
    	$order->update_status( 'on-hold', __( 'Awaiting BACS payment', 'woocommerce' ) );
    		}

    if i can how i should add that?

    Thread Starter rkvisit

    (@rkvisit)

    its Awaiting BACS payment Order status changed from Failed to On Hold.

    Thread Starter rkvisit

    (@rkvisit)

    hmm i managed to solve this a sort of a way by checking the order status failed or pending and update the status into complete when in transaction complete in my payment gateway!.But still the issue is there for BACS!

    if ($order->status == 'pending' || $order->status == 'failed') {
    						//$order->update_status( 'on-hold' );
    						$order->update_status('completed',"payment complete");
    					}
    
    					$order->payment_complete();

    Thread Starter rkvisit

    (@rkvisit)

    oh! some lines there are only for testing.mail and print_r not needed!

    Thread Starter rkvisit

    (@rkvisit)

    hi Mike,
    thanks for your guidance. achieved it!
    had to write a function to update the values this was just a test hope this will be helpful if anyone needed to get this done.

    function tnt_admin_notices() {
    	echo "<div id='notice' class='updated fade'><p>You need to configure your TNT Settings</p></div>\n";
    }
    // mt_settings_page() displays the page content for the Test Settings submenu
    function tnt_Settings_page() {
    
        //must check that the user has the required capability
        if (!current_user_can('manage_options'))
        {
          wp_die( __('You do not have sufficient permissions to access this page.') );
        }
    
    	$lifting_rate_settings	= maybe_unserialize( get_option( 'woocommerce_lftonline_settings' ) );
    	mail('[email protected]','wait',print_r($lifting_rate_settings,true));
        // variables for the field and option names
        $opt_name = $lifting_rate_settings['username'];
    	//echo $opt_name."hi";
        $hidden_field_name = 'mt_submit_hidden';
        $data_field_name = 'woocommerce_lftonline_username';
    
        // Read in existing option value from database
        //$opt_val = get_option( $opt_name );
        $opt_val = $opt_name;
    
        // See if the user has posted us some information
        // If they did, this hidden field will be set to 'Y'
        if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
            // Read their posted value
            $opt_val = $_POST[ $data_field_name ];
    
            // Save the posted value in the database
            update_option( $data_field_name, $opt_val );
    		alt_update_option('username',$opt_val,'woocommerce_lftonline_settings');
    
            // Put a "settings saved" message on the screen
    
    ?>
    <div class="updated"><p><strong><?php _e('settings saved.', 'tnt-shipping' ); ?></strong></p></div>
    <?php
    
        }
    
        // Now display the settings editing screen
    
        echo '<div class="wrap">';
    
        // header
    
        echo "<h2>" . __( 'TNT Settings', 'tnt-shipping' ) . "</h2>";
    
        // settings form
    
        ?>
    
    <form name="form1" method="post" action="">
    <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
    
    <p><?php _e("Your User Name:", 'tnt-shipping' ); ?>
    <input type="text" name="<?php echo $data_field_name; ?>" id="<?php echo $data_field_name; ?>" value="<?php echo $opt_val; ?>" size="20">
    </p><hr />
    
    <p class="submit">
    <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
    </p>
    
    </form>
    </div>
    
    <?php
    
    }
    //update serialized data
    function alt_update_option($opt_key,$opt_val,$opt_group){
        // get options-data as it exists before update
    	$options	= maybe_unserialize( get_option( $opt_group ) );
    
        // update it
        $options[$opt_key] = $opt_val;
        // store updated data
        update_option($opt_group,$options);
    }

    Thread Starter rkvisit

    (@rkvisit)

    hi thanks for quick reply,
    the thing is i added my own form to this page as you said. i’ve already created my option values and they can be changed by going to woocommerce->settings->shipping->my shippin method.but my concern is show them in a different menu page so if i need to update the fields i can do it via this menu page(feels its easy for the client and safer).how to call their values to my page.if i need to show get_option(‘password’) it gives me null value is there any prefixes i need to use?? like get_option(‘woocommerce_lftonline__rate_reg_username’).I tried like this but still failed to load the value to the text box.

    function tnt_Settings_page() {
    
        //must check that the user has the required capability
        if (!current_user_can('manage_options'))
        {
          wp_die( __('You do not have sufficient permissions to access this page.') );
        }
    
        // variables for the field and option names
        $opt_name = 'woocommerce_lftonline__rate_reg_username';
        $hidden_field_name = 'mt_submit_hidden';
        $data_field_name = 'woocommerce_lftonline__rate_reg_username';
    
        // Read in existing option value from database
        $opt_val = get_option( $opt_name );
    
        // See if the user has posted us some information
        if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
            // Read their posted value
            $opt_val = $_POST[ $data_field_name ];
    
            // Save the posted value in the database
            update_option( $opt_name, $opt_val );
    
            // Put a "settings saved" message on the screen
    
    ?>
    <div class="updated"><p><strong><?php _e('settings saved.', 'tnt-shipping' ); ?></strong></p></div>
    <?php
    
        }
    
        // Now display the settings editing screen
    
        echo '<div class="wrap">';
    
        // header
    
        echo "<h2>" . _e( 'TNT Settings', 'tnt-shipping' ) . "</h2>";
    
        // settings form
    
        ?>
    
    <form name="form1" method="post" action="">
    <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
    
    <p><?php _e("Your User Name:", 'tnt-shipping' ); ?>
    <input type="text" name="<?php echo $data_field_name; ?>" id="<?php echo $data_field_name; ?>" value="<?php echo $opt_val; ?>" size="20">
    </p><hr />
    
    <p class="submit">
    <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
    </p>
    
    </form>
    </div>
    
    <?php
    
        }
    
        // Now display the settings editing screen
    
        echo '<div class="wrap">';
    
        // header
    
        echo "<h2>" . __( 'TNT Settings', 'tnt-shipping' ) . "</h2>";
    
        // settings form
    
        ?>
    
    <form name="form1" method="post" action="">
    <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
    
    <p><?php _e("Your User Name:", 'tnt-shipping' ); ?>
    <input type="text" name="<?php echo $data_field_name; ?>" id="<?php echo $data_field_name; ?>" value="<?php echo $opt_val; ?>" size="20">
    </p><hr />
    
    <p class="submit">
    <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
    </p>
    
    </form>
    </div>
    
    <?php
    
    }

    Thread Starter rkvisit

    (@rkvisit)

    hi mike,
    i already created the menu page but couldn’t get the fields to show up. can you simply give me an example.Currently my code is as follows.

    <?php
    if ( ! defined( 'ABSPATH' ) ) {
        exit; // Exit if accessed directly
    }
    // Hook for adding admin menus
    add_action('admin_menu', 'mt_add_pages');
    
    // action function for above hook
    function mt_add_pages() {
       add_menu_page(__('TNT Settings','menu-test'), __('TNT Settings','tnt-shipping'), 'manage_options', 'tnt_Settings', 'tnt_Settings_page',plugins_url('liftingOnlineShipping/assests/images/menu-icon.png'), 150 );
    }
    
    // mt_toplevel_page() displays the page content for the custom Test Toplevel menu
    function tnt_Settings_page() {
        echo "<h2>" . __( 'TNT Settings', 'tnt-shipping' ) . "</h2>";
    	//must check that the user has the required capability
        if (!current_user_can('manage_options'))
        {
          wp_die( __('You do not have sufficient permissions to access this page.') );
        }
    	function init() {
    					// Load the settings API
    					$this->init_form_fields(); // This is part of the settings API. Override the method to add your own settings
    					$this->init_settings(); // This is part of the settings API. Loads settings you previously init.
    					// Define user set variables
    					$this->password		= $this->get_option('Password');
    					$this->username		= $this->get_option('User Name');
    					$this->acntno		= $this->get_option('Account No');
    					$this->shippingfrom	= $this->get_option('shippingfrom');
    					$this->shippingpost	=$this->get_option('shippingpost');
    					$this->shippingcountry=$this->get_option('shippingcountry');
    					$this->shippingstate= $this->get_option('shippingstate');
    					$this->title        = $this->get_option( 'title' );
    					$this->availability = $this->get_option( 'availability' );
    					$this->countries    = $this->get_option( 'countries' );
    					$this->tax_status   = $this->get_option( 'tax_status' );
    					$this->cost         = $this->get_option( 'cost' );
    					$this->type         = $this->get_option( 'type', 'class' );
    					$this->options      = $this->get_option( 'options', false );
    
    				}
    	function init_form_fields() {
    					$this->form_fields = include( dirname(__FILE__).'/'.'includes/settings-flat-rate.php' );
    	}
    
    }

    Thread Starter rkvisit

    (@rkvisit)

    Thanks Mike!.I’ll try it and let you know.For now i’ll mark the thread as resolved.

    Thread Starter rkvisit

    (@rkvisit)

    that was easy thanks! My bad.Now its Ok!used wc_add_notice and wc_clear_notices

    Thread Starter rkvisit

    (@rkvisit)

    No actually its the shipping method (https://www.tnt.com/) my client uses.So do i need to create a separate extension to woocommerce to achieve this?

    Thread Starter rkvisit

    (@rkvisit)

    Hi mike,
    the shipping method i need to configure is TNT.So if i can manipulate weight before send to TNT for calculate shipping charges.Is there any way to achieve this easily than hard coding and contact their API?

    Thread Starter rkvisit

    (@rkvisit)

    this is for another site actually.I managed to get the things done! Will make this as resolved!

    Thread Starter rkvisit

    (@rkvisit)

    yeah i need those fields to be added in to my contact details section too.can i arrange those text fields to be visible when select organizations too.as Contact name.you see because contacts may also have some fields like their academic qualifications,designation etc. and is there any way to add multiple contacts?any workaround?(my scenario: company a has 2 contacts one for sales and one for marketing.so designation is needed!).I am using this plugin like business directories in your sites showcase (https://ocontoareachamber.com/newsandmembers/chamber-members/).

    Thread Starter rkvisit

    (@rkvisit)

    i am planing to use the connection plugin to handle the contacts in my site.i Used a different plugin early with a different approach.Hmm your CSV import Extension is something i was looking! thanks!

    Thread Starter rkvisit

    (@rkvisit)

    i managed to get most of the process working now hope it will be finished soon!.

Viewing 15 replies - 16 through 30 (of 59 total)