/** * Declare the different options for the plugin */ public static function add_options() { global $wpshop_display_option; /*Catalog - Main */ register_setting('wpshop_options', 'wpshop_catalog_main_option', array('wpshop_options', 'wpshop_options_validate_catalog_main_option')); add_settings_section('wpshop_catalog_main_section', '<span class="dashicons dashicons-category"></span>' . __('Catalog', 'wpshop'), array('wpshop_options', 'plugin_section_text'), 'wpshop_catalog_main_option'); add_settings_field('wpshop_catalog_empty_price_behaviour', __('Empty price', 'wpshop'), array('wpshop_options', 'wpshop_catalog_empty_price_behaviour'), 'wpshop_catalog_main_option', 'wpshop_catalog_main_section'); /* Catalog - Product */ register_setting('wpshop_options', 'wpshop_catalog_product_option', array('wpshop_options', 'wpshop_options_validate_catalog_product_option')); add_settings_section('wpshop_catalog_product_section', '<span class="dashicons dashicons-archive"></span>' . __('Products', 'wpshop'), array('wpshop_options', 'plugin_section_text'), 'wpshop_catalog_product_option'); add_settings_field('wpshop_catalog_product_slug', __('Products common rewrite param', 'wpshop'), array('wpshop_options', 'wpshop_catalog_product_slug_field'), 'wpshop_catalog_product_option', 'wpshop_catalog_product_section'); /* Catalog - Categories */ register_setting('wpshop_options', 'wpshop_catalog_categories_option', array('wpshop_options', 'wpshop_options_validate_catalog_categories_option')); add_settings_section('wpshop_catalog_categories_section', '<span class="dashicons dashicons-portfolio"></span>' . __('Categories', 'wpshop'), array('wpshop_options', 'plugin_section_text'), 'wpshop_catalog_categories_option'); add_settings_field('wpshop_catalog_categories_slug', __('Categories common rewrite param', 'wpshop'), array('wpshop_options', 'wpshop_catalog_categories_slug_field'), 'wpshop_catalog_categories_option', 'wpshop_catalog_categories_section'); add_settings_field('wpshop_catalog_no_category_slug', __('Default category slug for unassociated product', 'wpshop'), array('wpshop_options', 'wpshop_catalog_no_category_slug_field'), 'wpshop_catalog_categories_option', 'wpshop_catalog_categories_section'); /* General option */ wpshop_general_options::declare_options(); /* Company */ wpshop_company_options::declare_options(); /* Payments */ if (WPSHOP_DEFINED_SHOP_TYPE == 'sale' && !isset($_POST['wpshop_shop_type']) || isset($_POST['wpshop_shop_type']) && $_POST['wpshop_shop_type'] != 'presentation' && !isset($_POST['old_wpshop_shop_type']) || isset($_POST['old_wpshop_shop_type']) && $_POST['old_wpshop_shop_type'] != 'presentation') { wpshop_payment_options::declare_options(); } /* Cart */ if (WPSHOP_DEFINED_SHOP_TYPE == 'sale' && !isset($_POST['wpshop_shop_type']) || isset($_POST['wpshop_shop_type']) && $_POST['wpshop_shop_type'] != 'presentation' && !isset($_POST['old_wpshop_shop_type']) || isset($_POST['old_wpshop_shop_type']) && $_POST['old_wpshop_shop_type'] != 'presentation') { register_setting('wpshop_options', 'wpshop_cart_option', array('wpshop_options', 'wpshop_options_validate_cart')); add_settings_section('wpshop_cart_info', '<span class="dashicons dashicons-cart"></span>' . __('Cart', 'wpshop'), array('wpshop_options', 'plugin_section_text'), 'wpshop_cart_info'); add_settings_field('wpshop_cart_product_added_behaviour', __('Action when produt is added succesfully into cart', 'wpshop'), array('wpshop_options', 'wpshop_cart_product_added_behaviour_field'), 'wpshop_cart_info', 'wpshop_cart_info'); add_settings_field('wpshop_cart_product_added_to_quotation_behaviour', __('Action when produt is added succesfully into a quotation', 'wpshop'), array('wpshop_options', 'wpshop_cart_product_added_to_quotation_behaviour_field'), 'wpshop_cart_info', 'wpshop_cart_info'); add_settings_field('wpshop_cart_total_item_nb', __('Allow only one product into cart', 'wpshop'), array('wpshop_options', 'wpshop_cart_total_item_nb_field'), 'wpshop_cart_info', 'wpshop_cart_info'); //add_settings_field('wpshop_cart_same_item_nb', __('Number of same item allowed into cart', 'wpshop'), array('wpshop_options', 'wpshop_cart_same_item_nb_field'), 'wpshop_cart_info', 'wpshop_cart_info'); register_setting('wpshop_options', 'wpshop_catalog_product_option', array('wpshop_options', 'wpshop_catalog_product_variation_option_validate')); add_settings_field('wpshop_catalog_product_option', __('Variation product display options for all products', 'wpshop'), array('wpshop_options', 'wpshop_catalog_varition_product_field'), 'wpshop_catalog_product_option', 'wpshop_catalog_product_section'); do_action('wsphop_options'); } do_action('wsphop_options'); /* Pages */ wpshop_page_options::declare_options(); /* Emails */ wpshop_email_options::declare_options(); /* Addons */ $wpshop_addons_settings = new wpshop_addons_settings(); $wpshop_addons_settings->declare_options(); /* Advanced Settings */ $wpshop_advanced_settings = new wpshop_advanced_settings(); $wpshop_advanced_settings->declare_options(); /* Shipping section */ if (WPSHOP_DEFINED_SHOP_TYPE == 'sale' && !isset($_POST['wpshop_shop_type']) || isset($_POST['wpshop_shop_type']) && $_POST['wpshop_shop_type'] != 'presentation' && !isset($_POST['old_wpshop_shop_type']) || isset($_POST['old_wpshop_shop_type']) && $_POST['old_wpshop_shop_type'] != 'presentation') { $wpshop_shipping_options = new wpshop_shipping_options(); $wpshop_shipping_options->declare_options(); } flush_rewrite_rules(); }
<th><?php _e('Shop type', 'wpshop'); ?> </th> <td><?php wpshop_general_options::wpshop_shop_type(); ?> </td> </tr> <tr> <th><?php _e('Price piloting for the shop', 'wpshop'); ?> </th> <td><?php wpshop_general_options::wpshop_shop_price_piloting_field(); ?> </td> </tr> <tr> <td colspan="2" ><label><input type="checkbox" name="wps-installer-data-insertion" value="yes" checked="checked" disabled="disabled" /><?php _e('Create necessary datas for wpshop (emails, pages)', 'wpshop'); ?> </label></td> </tr> <!-- <tr> <td colspan="2" ><label><input type="checkbox" name="wps-installer-data-insertion" value="yes" /><?php _e('Create sample datas (products)', 'wpshop'); ?> </label></td>
<h4><?php _e('Those informations will be used into invoice and to display your contact informations', 'wpshop'); ?> </h4> <?php do_settings_sections('wpshop_company_info'); ?> <table class="form-table" > <tr> <th><?php _e('The logo for emails and invoices', 'wpshop'); ?> </th> <td><?php wpshop_general_options::wpshop_logo_field(); ?> </td> </tr> </table>