2

I new to cscart. I need to fill the settings from database for my new addon.

I have below code in my addon.xml

<settings edition_type="ROOT,ULT:VENDOR">
        <sections>
            <section id="general">
                <items>
                    <item id="general">
                        <type>header</type>
                    </item>
                    <item id="info_feature">
                        <type>info</type>
                        <handler>fn_add_setting_info</handler>
                    </item>

                    <item id="order_status">
                        <type>selectbox</type>
                        <default_value>fn_add_setting_info</default_value>
                    </item>
                </items>
            </section>
        </sections>
    </settings>

 In func.php
function  fn_add_setting_info()
{
 $all_datas=get_feature_description();
       foreach($all_datas as $val){
           $arr_sett[$val['feature_id']]=$val['description'];
       }    
      Registry::get('view')->assign('option_details',@$arr_sett);

     }

Here the select box does not fill fn_add_setting_info() data. How can I do . Please help me.

3 Answers3

0
In func.php

function fn_settings_variants_addons_sharesoft_fancycolor_order_status()
    {
         $all_datas=get_feature_description();
           foreach($all_datas as $val){
               $arr_sett[$val['feature_id']]=$val['description'];
           }    

        return $arr_sett;
    }


 addon.xml

  <item id="order_status">
                        <type>selectbox</type>
                        <default_value>fn_add_setting_info</default_value>
                    </item>

This is way for fill the select box value with database values.

0

Is complicated to be detailed here but you can find here the solution, please download for free and check the code.

In Auto Add User To Group on Register free CS-Cart add-on on settings are displayed the user groups but you can use if for your own purpose ;)

Keep on smiling

Hungryweb
  • 615
  • 6
  • 11
0

In func.php

function fn_settings_variants_addons_sharesoft_fancycolor_order_status()
    {
         $all_datas=get_feature_description();
           foreach($all_datas as $val){
               $arr_sett[$val['feature_id']]=$val['description'];
           }    

        return $arr_sett;
    }

addon.xml

<item id="order_status">
      <type>selectbox</type>
      <variants/>   <!-- This tag will automatically load values from fn_settings_variants_addons_sharesoft_fancycolor_order_status() function. the function name template is fn_settings_variants_addons_<addon_id>_<setting_id> -->
  </item>