Changing variables in the UI

Discussion in 'Installation and "How-To" Questions' started by ViktorB, Apr 28, 2014.

  1. ViktorB

    ViktorB Kilo Poster

    Messages:
    15
    Hi,
    We are changing an exchange rate in our payment plugin every day manually through the UI form.
    Can we automate this process by changing the value of the exchange rate in the file that stores this value not in UI form?
    If it possible, please specify the file where the input parameter - config writes the values?

    Viktor Bondar
     
  2. FedorK

    FedorK Mega Poster

    Messages:
    224
    Hello,

    This data save not in file but in database.
    You can use script like this:

    Code:
    use HSPC::Application;
    use HSPC::MT::PluginConfig;
    
    my $plugin_id=1;
    
    my $plugin = HSPC::MT::PluginConfig->find_plugin(
            id          => $plugin_id,
            plugin_type => 'PP',
    );
    my $config    = $plugin->{plugin} ? $plugin->{plugin}->config_data() : undef;
    
    $config->{you_rate} = "asdf";
    
    $plugin->{plugin}->config_data($config);
    $plugin->{plugin}->save();
    
    
     
  3. ViktorB

    ViktorB Kilo Poster

    Messages:
    15
    Thank you!
     
  4. ViktorB

    ViktorB Kilo Poster

    Messages:
    15
    Can you say Where should we find the value for my $plugin_id?
    The script generates an error

    DBD::mysql::st execute failed: Column 'plugin_type' cannot be null at /usr/lib/perl5/site_perl/5.8.8/HSPC/WebDB.pm line 238.
    INSERT INTO `plugin` (`plugin_type`,`template_id`,`vendor_id`,`name`,`config_data`,`is_active`) VALUES (NULL,NULL,NULL,NULL,'BAcEMTIzNAQEBAgDBAAAAAoQB7CetJKmE1nDgLUI+gTO4wIAAABpdgoLQUVTLTEyOC1DQkMEAAAAbW9kZQoTQ3J5cHQ6Ok9wZW5TU0w6OkFFUwYAAABjaXBoZXIKMFs//he74fF7/5sr4NKj9KXfYwfqI6UOYh0YQyDhHFH9FbIPm1LGmbMF5LkuypSW8AQAAABkYXRh','0')
     
  5. FedorK

    FedorK Mega Poster

    Messages:
    224
    If you over mouse under requred plugin id you will see ID in bottom of page:
    plug.png
     
    Last edited: Apr 29, 2014
  6. ViktorB

    ViktorB Kilo Poster

    Messages:
    15
    Thank you!
    It works out.
     

Share This Page