Exemplo n.º 1
0
 /**
  * Adds legal page ids to different options and adds a hook to the email footer
  */
 public function __construct()
 {
     // Order attachments
     $attachment_order = wc_gzd_get_email_attachment_order();
     $this->footer_attachments = array();
     foreach ($attachment_order as $key => $order) {
         $this->footer_attachments['woocommerce_gzd_mail_attach_' . $key] = $key;
     }
     add_action('woocommerce_email', array($this, 'email_hooks'), 0, 1);
 }
 /**
  * Get settings array
  *
  * @return array
  */
 public function get_settings()
 {
     $delivery_terms = array('' => __('None', 'woocommerce-germanized'));
     $terms = get_terms('product_delivery_time', array('fields' => 'id=>name', 'hide_empty' => false));
     if (!is_wp_error($terms)) {
         $delivery_terms = $delivery_terms + $terms;
     }
     $mailer = WC()->mailer();
     $email_templates = $mailer->get_emails();
     $email_select = array();
     foreach ($email_templates as $email) {
         $email_select[$email->id] = empty($email->title) ? ucfirst($email->id) : ucfirst($email->title);
     }
     $email_order = wc_gzd_get_email_attachment_order();
     $email_settings = array();
     foreach ($email_order as $key => $order) {
         array_push($email_settings, array('title' => sprintf(__('Attach %s', 'woocommerce-germanized'), $order), 'desc' => sprintf(__('Attach %s to the following email templates', 'woocommerce-germanized'), $order), 'id' => 'woocommerce_gzd_mail_attach_' . $key, 'type' => 'multiselect', 'class' => 'chosen_select', 'desc_tip' => true, 'options' => $email_select));
     }
     $settings = array(array('title' => __('General', 'woocommerce-germanized'), 'type' => 'title', 'id' => 'general_options'), array('title' => __('Small-Enterprise-Regulation', 'woocommerce-germanized'), 'desc' => __('VAT based on &#167;19 UStG', 'woocommerce-germanized'), 'id' => 'woocommerce_gzd_small_enterprise', 'default' => 'no', 'type' => 'checkbox', 'desc_tip' => sprintf(__('set this Option if you have chosen <a href="%s" target="_blank">&#167;19 UStG</a>', 'woocommerce-germanized'), esc_url('http://www.gesetze-im-internet.de/ustg_1980/__19.html'))), array('title' => __('Show no VAT notice', 'woocommerce-germanized'), 'desc' => __('Show no VAT &#167;19 UStG notice on single product', 'woocommerce-germanized'), 'id' => 'woocommerce_gzd_display_product_detail_small_enterprise', 'type' => 'checkbox', 'default' => 'no'), array('title' => __('Submit Order Button Text', 'woocommerce-germanized'), 'desc' => __('This text serves as Button text for the Order Submit Button.', 'woocommerce-germanized'), 'desc_tip' => true, 'id' => 'woocommerce_gzd_order_submit_btn_text', 'type' => 'text', 'css' => 'min-width:300px;', 'default' => __('Buy Now', 'woocommerce-germanized')), array('title' => __('Phone as required field', 'woocommerce-germanized'), 'desc' => __('Should phone number be a required field within checkout?', 'woocommerce-germanized'), 'id' => 'woocommerce_gzd_checkout_phone_required', 'type' => 'checkbox', 'default' => 'no'), array('title' => __('Add title field', 'woocommerce-germanized'), 'desc' => __('Add a title field to the address within checkout?', 'woocommerce-germanized'), 'id' => 'woocommerce_gzd_checkout_address_field', 'type' => 'checkbox', 'default' => 'yes'), array('title' => __('Disallow cancellations', 'woocommerce-germanized'), 'desc' => __('Don’t allow customers to manually cancel orders.', 'woocommerce-germanized'), 'desc_tip' => __('By default payment methods like PayPal allow order cancellation by clicking the abort link. This option will stop customers from manually cancel orders.', 'woocommerce-germanized'), 'id' => 'woocommerce_gzd_checkout_stop_order_cancellation', 'type' => 'checkbox', 'default' => 'yes'), array('type' => 'sectionend', 'id' => 'general_options'), array('title' => __('Contract', 'woocommerce-germanized'), 'type' => 'title', 'id' => 'contract_options', 'desc' => '<div class="notice inline notice-warning"><p>' . sprintf(__('%sUpgrade to %spro%s%s to unlock this feature and get premium support.', 'woocommerce-germanized'), '<a href="https://vendidero.de/woocommerce-germanized" class="button">', '<span class="wc-gzd-pro">', '</span>', '</a>') . '</p></div>'), array('title' => '', 'id' => 'woocommerce_gzdp_contract_after_confirmation', 'img' => WC_Germanized()->plugin_url() . '/assets/images/pro/settings-inline-contract.png', 'href' => 'https://vendidero.de/woocommerce-germanized#contract', 'type' => 'image'), array('type' => 'sectionend', 'id' => 'contract_options'), array('title' => __('Legal Pages', 'woocommerce-germanized'), 'type' => 'title', 'id' => 'legal_pages_options'), array('title' => __('Terms & Conditions', 'woocommerce-germanized'), 'desc_tip' => __('This page should contain your terms & conditions.', 'woocommerce-germanized'), 'id' => 'woocommerce_terms_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc' => !get_option('woocommerce_terms_page_id') ? sprintf(__('Don\'t have terms & conditions yet? <a href="%s">Generate now</a>!', 'woocommerce-germanized'), admin_url('admin.php?page=wc-settings&tab=germanized&section=agbs')) : ''), array('title' => __('Power of Revocation', 'woocommerce-germanized'), 'desc_tip' => __('This page should contain information regarding your customer\'s Right of Revocation.', 'woocommerce-germanized'), 'id' => 'woocommerce_revocation_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc' => !get_option('woocommerce_revocation_page_id') ? sprintf(__('Don\'t have a revocation page yet? <a href="%s">Generate now</a>!', 'woocommerce-germanized'), admin_url('admin.php?page=wc-settings&tab=germanized&section=widerruf')) : ''), array('title' => __('Imprint', 'woocommerce-germanized'), 'desc' => __('This page should contain an imprint with your company\'s information.', 'woocommerce-germanized'), 'id' => 'woocommerce_imprint_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('Data Security Statement', 'woocommerce-germanized'), 'desc' => __('This page should contain information regarding your data security policy.', 'woocommerce-germanized'), 'id' => 'woocommerce_data_security_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('Payment Methods', 'woocommerce-germanized'), 'desc' => __('This page should contain information regarding the Payment Methods that are chooseable during checkout.', 'woocommerce-germanized'), 'id' => 'woocommerce_payment_methods_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('Shipping Methods', 'woocommerce-germanized'), 'desc' => __('This page should contain information regarding shipping methods that are chooseable during checkout.', 'woocommerce-germanized'), 'id' => 'woocommerce_shipping_costs_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'chosen_select_nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('type' => 'sectionend', 'id' => 'legal_pages_options'), array('title' => __('Delivery Times', 'woocommerce-germanized'), 'type' => 'title', 'desc' => '', 'id' => 'delivery_times_options'), array('title' => __('Default Delivery Time', 'woocommerce-germanized'), 'desc' => __('This delivery time will be added to every product if no delivery time has been chosen individually', 'woocommerce-germanized'), 'id' => 'woocommerce_gzd_default_delivery_time', 'css' => 'min-width:250px;', 'default' => '', 'type' => 'select', 'class' => 'chosen_select', 'options' => $delivery_terms, 'desc_tip' => true), array('title' => __('Delivery Time Text', 'woocommerce-germanized'), 'desc' => __('This text will be used to indicate delivery time for products. Use {delivery_time} as placeholder.', 'woocommerce-germanized'), 'desc_tip' => true, 'id' => 'woocommerce_gzd_delivery_time_text', 'type' => 'text', 'css' => 'min-width:300px;', 'default' => __('Delivery time: {delivery_time}', 'woocommerce-germanized')), array('type' => 'sectionend', 'id' => 'delivery_times_options'), array('title' => __('Shipping Costs', 'woocommerce-germanized'), 'type' => 'title', 'id' => 'shipping_costs_options'), array('title' => __('Shipping Costs Text', 'woocommerce-germanized'), 'desc' => __('This text will be used to inform the customer about shipping costs. Use {link}{/link} to insert link to shipping costs page.', 'woocommerce-germanized'), 'desc_tip' => true, 'id' => 'woocommerce_gzd_shipping_costs_text', 'type' => 'text', 'css' => 'min-width:300px;', 'default' => __('plus {link}Shipping Costs{/link}', 'woocommerce-germanized')), array('title' => __('Shipping Costs Tax', 'woocommerce-germanized'), 'desc' => __('Enable better taxation for shpping costs?', 'woocommerce-germanized'), 'id' => 'woocommerce_gzd_shipping_tax', 'default' => 'yes', 'type' => 'checkbox', 'desc_tip' => sprintf(__('By choosing this option shipping cost taxation will be calculated based on tax rates within cart. Imagine the following example. Further information can be found <a href="%s" target="_blank">here</a>. %s', 'woocommerce-germanized'), 'http://www.it-recht-kanzlei.de/umsatzsteuer-versandkosten-mehrwertsteuer.html', '<table class="wc-gzd-tax-example"><thead><tr><th>Produkt</th><th>Preis</th><th>MwSt.-Satz</th><th>Anteil</th><th>MwSt.</th></tr></thead><tbody><tr><td>Buch</td><td>' . wc_price(40) . '</td><td>7%</td><td>40%</td><td>' . wc_price(2.62) . '</td></tr><tr><td>DVD</td><td>' . wc_price(60) . '</td><td>19%</td><td>60%</td><td>' . wc_price(9.58) . '</td></tr><tr><td>Versand</td><td>' . wc_price(5) . '</td><td>7% | 19%</td><td>40% | 60%</td><td>' . wc_price(0.13) . ' | ' . wc_price(0.48) . '</td></tr></tbody></table>')), array('title' => __('Force Tax Calculation', 'woocommerce-germanized'), 'desc' => __('Force shipping costs tax calculation for every method?', 'woocommerce-germanized'), 'id' => 'woocommerce_gzd_shipping_tax_force', 'default' => 'yes', 'type' => 'checkbox', 'desc_tip' => __('This option will overwrite settings for each individual shipping method to force tax calculation (instead of only calculating tax for those methods which are taxeable).', 'woocommerce-germanized')), array('type' => 'sectionend', 'id' => 'shipping_costs_options'), array('title' => __('Fees', 'woocommerce-germanized'), 'type' => 'title', 'id' => 'fees_options'), array('title' => __('Fee Tax', 'woocommerce-germanized'), 'desc' => __('Enable better taxation for fees?', 'woocommerce-germanized'), 'id' => 'woocommerce_gzd_fee_tax', 'default' => 'yes', 'type' => 'checkbox', 'desc_tip' => __('By choosing this option fee taxation will be calculated based on tax rates within cart. See shipping costs taxation for more information.', 'woocommerce-germanized')), array('title' => __('Force Tax Calculation', 'woocommerce-germanized'), 'desc' => __('Force fee tax calculation for every fee?', 'woocommerce-germanized'), 'id' => 'woocommerce_gzd_fee_tax_force', 'default' => 'yes', 'type' => 'checkbox', 'desc_tip' => __('This option will overwrite settings for each individual fee to force tax calculation (instead of only calculating tax for those fees which are taxeable).', 'woocommerce-germanized')), array('type' => 'sectionend', 'id' => 'fees_options'), array('title' => __('Customers', 'woocommerce-germanized'), 'type' => 'title', 'desc' => '', 'id' => 'customer_options'), array('title' => __('Checkbox', 'woocommerce-germanized'), 'desc' => __('Add a checkbox to customer registration form.', 'woocommerce-germanized'), 'id' => 'woocommerce_gzd_customer_account_checkbox', 'type' => 'checkbox', 'default' => 'yes'), array('title' => __('Checkbox text', 'woocommerce-germanized'), 'desc' => __('Choose a Plain Text which will be shown as checkbox text for customer account creation. Use {term_link}{/term_link}, {data_security_link}{/data_security_link}, {revocation_link}{/revocation_link} as Placeholders for the links to legal pages.', 'woocommerce-germanized'), 'desc_tip' => true, 'default' => __('Yes, I’d like create a new account and have read and understood the {data_security_link}data privacy statement{/data_security_link}.', 'woocommerce-germanized'), 'css' => 'width:100%; height: 65px;', 'id' => 'woocommerce_gzd_customer_account_text', 'type' => 'textarea'), array('title' => __('Checkout', 'woocommerce-germanized'), 'desc' => __('Replace default WooCommerce text regarding account creation during checkout.', 'woocommerce-germanized'), 'desc_tip' => __('Use the text from above instead of the default WooCommerce text regarding account creation during checkout. This checkbox is only show if you have activated guest accounts.', 'woocommerce-germanized'), 'id' => 'woocommerce_gzd_customer_account_checkout_checkbox', 'type' => 'checkbox', 'default' => 'yes'), array('title' => __('Customer Double Opt In', 'woocommerce-germanized'), 'desc' => __('Enable customer double opt in on registration?', 'woocommerce-germanized'), 'desc_tip' => sprintf(__('If customer chooses to create a customer account an email with an activation link will be sent by mail. Customer account will be marked as activated if user clicks on the link within the email. More information on this topic can be found <a href="%s" target="_blank">here</a>.', 'woocommerce-germanized'), 'http://t3n.de/news/urteil-anmeldebestatigungen-double-opt-in-pflicht-592304/'), 'id' => 'woocommerce_gzd_customer_activation', 'default' => 'yes', 'type' => 'checkbox'), array('title' => __('Delete Unactivated After', 'woocommerce-germanized'), 'desc_tip' => __('This will make sure unactivated customer accounts will be deleted after X days. Set to 0 if you don\'t want to automatically delete unactivated customers.', 'woocommerce-germanized'), 'desc' => __('days', 'woocommerce-germanized'), 'id' => 'woocommerce_gzd_customer_cleanup_interval', 'type' => 'number', 'custom_attributes' => array('min' => 0, 'step' => 1), 'default' => 7), array('type' => 'sectionend', 'id' => 'customer_options'), array('title' => __('Unit Price', 'woocommerce-germanized'), 'type' => 'title', 'id' => 'unit_price_options'), array('title' => __('Unit Price Text', 'woocommerce-germanized'), 'desc' => __('This text will be used to display the unit price. Use {price} to insert the price.', 'woocommerce-germanized'), 'desc_tip' => true, 'id' => 'woocommerce_gzd_unit_price_text', 'type' => 'text', 'css' => 'min-width:300px;', 'default' => __('{price}', 'woocommerce-germanized')), array('type' => 'sectionend', 'id' => 'unit_price_options'), array('title' => __('Right of Recission', 'woocommerce-germanized'), 'type' => 'title', 'id' => 'recission_options'), array('title' => __('Revocation Address', 'woocommerce-germanized'), 'desc' => __('Type in an address, telephone/telefax number, email address which is to be used as revocation address', 'woocommerce-germanized'), 'desc_tip' => true, 'css' => 'width:100%; height: 65px;', 'id' => 'woocommerce_gzd_revocation_address', 'type' => 'textarea'), array('type' => 'sectionend', 'id' => 'recission_options'), array('title' => __('E-Mails', 'woocommerce-germanized'), 'type' => 'title', 'id' => 'email_options', 'desc' => __('Use drag & drop to customize attachment order. Don\'t forget to save your changes.', 'woocommerce-germanized')));
     $settings = array_merge($settings, $email_settings);
     $settings = array_merge($settings, array(array('title' => '', 'id' => 'woocommerce_gzd_mail_attach_order', 'type' => 'hidden', 'default' => 'terms,revocation,data_security,imprint'), array('type' => 'sectionend', 'id' => 'email_options'), array('title' => __('Virtual VAT', 'woocommerce-germanized'), 'type' => 'title', 'id' => 'virtual_vat_options'), array('title' => __('Enable Virtual VAT', 'woocommerce-germanized'), 'desc' => __('Enable if you want to charge your customer\'s countries\' VAT for virtual products.', 'woocommerce-germanized'), 'id' => 'woocommerce_gzd_enable_virtual_vat', 'default' => 'no', 'type' => 'checkbox', 'desc_tip' => sprintf(__('New EU VAT rule applies on 01.01.2015. Make sure that every digital or virtual product has chosen the right tax class (Virtual Rate or Virtual Reduced Rate). Gross prices will not differ from the prices you have chosen for affected products. In fact the net price will differ depending on the VAT rate of your customers\' country. Shop settings will be adjusted to show prices including tax. More information can be found <a href="%s" target="_blank">here</a>.', 'woocommerce-germanized'), 'http://ec.europa.eu/taxation_customs/taxation/vat/how_vat_works/telecom/index_de.htm#new_rules')), array('type' => 'sectionend', 'id' => 'virtual_vat_options'), array('title' => _x('Invoices', 'invoices', 'woocommerce-germanized'), 'type' => 'title', 'id' => 'invoice_options', 'desc' => '<div class="notice inline notice-warning"><p>' . sprintf(__('%sUpgrade to %spro%s%s to unlock this feature and get premium support.', 'woocommerce-germanized'), '<a href="https://vendidero.de/woocommerce-germanized" class="button">', '<span class="wc-gzd-pro">', '</span>', '</a>') . '</p></div>'), array('title' => '', 'id' => 'woocommerce_gzdp_contract_after_confirmation', 'img' => WC_Germanized()->plugin_url() . '/assets/images/pro/settings-inline-invoices.png', 'href' => 'https://vendidero.de/woocommerce-germanized#accounting', 'type' => 'image'), array('type' => 'sectionend', 'id' => 'invoice_options'), array('title' => __('VAT', 'woocommerce-germanized'), 'type' => 'title', 'id' => 'vat_options', 'desc' => '<div class="notice inline notice-warning"><p>' . sprintf(__('%sUpgrade to %spro%s%s to unlock this feature and get premium support.', 'woocommerce-germanized'), '<a href="https://vendidero.de/woocommerce-germanized" class="button">', '<span class="wc-gzd-pro">', '</span>', '</a>') . '</p></div>'), array('title' => '', 'id' => 'woocommerce_gzdp_contract_after_confirmation', 'img' => WC_Germanized()->plugin_url() . '/assets/images/pro/settings-inline-vat.png', 'href' => 'https://vendidero.de/woocommerce-germanized#vat', 'type' => 'image'), array('type' => 'sectionend', 'id' => 'vat_options')));
     // End general settings
     return apply_filters('woocommerce_germanized_settings', $settings);
 }
 public function get_email_settings()
 {
     $mailer = WC()->mailer();
     $email_templates = $mailer->get_emails();
     $email_select = array();
     foreach ($email_templates as $email) {
         $email_select[$email->id] = empty($email->title) ? ucfirst($email->id) : ucfirst($email->title);
     }
     $email_order = wc_gzd_get_email_attachment_order();
     $email_settings = array();
     foreach ($email_order as $key => $order) {
         array_push($email_settings, array('title' => sprintf(__('Attach %s', 'woocommerce-germanized'), $order), 'desc' => sprintf(__('Attach %s to the following email templates', 'woocommerce-germanized'), $order), 'id' => 'woocommerce_gzd_mail_attach_' . $key, 'type' => 'multiselect', 'class' => 'chosen_select', 'desc_tip' => true, 'options' => $email_select));
     }
     $settings = array(array('title' => __('E-Mails', 'woocommerce-germanized'), 'type' => 'title', 'id' => 'email_options', 'desc' => __('Use drag & drop to customize attachment order. Don\'t forget to save your changes.', 'woocommerce-germanized')), array('title' => '', 'id' => 'woocommerce_gzd_mail_attach_order', 'type' => 'hidden', 'default' => 'terms,revocation,data_security,imprint'));
     $settings = array_merge($settings, $email_settings);
     $settings = array_merge($settings, array(array('type' => 'sectionend', 'id' => 'email_options'), array('title' => __('Email Attachment Options', 'woocommerce-germanized'), 'type' => 'title', 'id' => 'email_attachment_options', 'desc' => '<div class="notice inline notice-warning"><p>' . sprintf(__('Want to attach automatically generated PDF files to emails instead of plain text? %sUpgrade to %spro%s%s', 'woocommerce-germanized'), '<a style="margin-left: 1em" href="https://vendidero.de/woocommerce-germanized" class="button">', '<span class="wc-gzd-pro">', '</span>', '</a>') . '</p></div>'), array('title' => '', 'id' => 'woocommerce_gzdp_legal_page_terms_enabled', 'img' => WC_Germanized()->plugin_url() . '/assets/images/pro/settings-inline-emails.png', 'href' => 'https://vendidero.de/woocommerce-germanized#legal-page', 'type' => 'image'), array('type' => 'sectionend', 'id' => 'email_attachment_options')));
     return apply_filters('woocommerce_germanized_settings_email', $settings);
 }