process_shipping_settings() not firing when clicking "Save Changes"

Hello,

I have created a few options using the function "shipping_settings_box()" . I would like to use the options that the admin will choose in the "extra_shipping_field()" function. Since this function does not have access to the $settings variable I thought I would use the "process_shipping_settings()" function to save the desired variables.

However, it appears that this function does not run, or at least does not run when I click the "Save Changes" button. Is this a bug? Or does this function run at a different time?

Thanks
DM

  • pro120
    • Design Lord, Child of Thor

    <strike>I've done a lot of shipping plugin work for MP but could you clarify if your talking about product shipping settings, manage order shipping information, or the individual store settings for shipping?</strike>

    Nevermind that it's obvious your talking about the store settings. You have you created a custom class for your shipping plugin correct? If your not read through /marketpress/plugins-shipping/plugin-template.php

  • digitalmarauders
    • WPMU DEV Initiate

    I have also created several shipping plugins as well, but have never needed this function in the other ones.

    Pro120, have you successfully used the "process_shipping_settings() method? I have placed a line "exit();" and my cart continues to run properly as if it never encounters this line. I have attempted to manipulate the $settings variable inside the function to intentionally break the shipping plugin and it doesn't do anything. I've echo'ed comments that do not show up in the HTML. It sure seems that it is not running (note: everything else works as expected, the shipping plugin that I've created is active and works)

    DM

  • pro120
    • Design Lord, Child of Thor

    yes I was able to use process_shipping_settings() successfully. Make sure your returning the settings in that function and also don't forget to prefix your shipping_settings_box() html inputs with mp. The comment included with that function.

    Form field names should be prefixed with mp[shipping][plugin_name], like "mp[shipping][plugin_name][mysetting]"

  • pro120
    • Design Lord, Child of Thor

    Your totally right. It's not firing. I used the following in a separate plugin and class.

    add_filter('mp_shipping_settings_filter',array(&$this,'filter_bs'));

    function filter_bs($settings) {
    		$settings['shipping']['mp-test']['number'] = intval($settings['shipping']['mp-test']['number']) + 1;
    		return $settings;
    	}

    and it worked great.

    Maybe the filter priority needs to be adjusted or something.

  • pro120
    • Design Lord, Child of Thor

    Ok so I was testing where you could put the filter outside of the mp-test class and tried the process_shipping_settings() again and it worked. lol. If your still having the same trouble try the code I sent but don't forget if you are not in a new class to replace the array(&$this,'function_name') with just the string 'function_name'

    Just tested, it works inside the class just create a different function inside your mp-test class and use
    add_filter('mp_shipping_settings_filter',array(&$this,'filter_bs'));
    inside the on_creation()

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.