/** * 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(); }
/** * Generate Sender part invoice template * @return Ambigous <string, string> */ public static function generate_invoice_sender_part() { $output = ''; $company = get_option('wpshop_company_info', array()); $emails = get_option('wpshop_emails', array()); if (!empty($company)) { $tpl_component['COMPANY_EMAIL'] = !empty($emails) && !empty($emails['contact_email']) ? $emails['contact_email'] : ''; $tpl_component['COMPANY_WEBSITE'] = get_option('siteurl'); foreach ($company as $company_info_key => $company_info_value) { switch ($company_info_key) { case 'company_rcs': $data = !empty($company_info_value) ? __('RCS', 'wpshop') . ' : ' . $company_info_value : ''; break; case 'company_capital': $data = !empty($company_info_value) ? __('Capital', 'wpshop') . ' : ' . $company_info_value : ''; break; case 'company_siren': $data = !empty($company_info_value) ? __('SIREN', 'wpshop') . ' : ' . $company_info_value : ''; break; case 'company_siret': $data = !empty($company_info_value) ? __('SIRET', 'wpshop') . ' : ' . $company_info_value : ''; break; case 'company_tva_intra': $data = !empty($company_info_value) ? __('TVA Intracommunautaire', 'wpshop') . ' : ' . $company_info_value : ''; break; case 'company_legal_statut': $array_state_compagny = wpshop_company_options::get_legal_status(); $data = !empty($array_state_compagny) && !empty($array_state_compagny[$company_info_value]) ? $array_state_compagny[$company_info_value] : __('Auto-Entrepreneur', 'wpshop'); break; default: $data = $company_info_value; break; } $tpl_component[strtoupper($company_info_key)] = $data; } $output = wpshop_display::display_template_element('invoice_sender_formatted_address', $tpl_component, array(), 'common'); } return $output; }