Esempio n. 1
0
 /**
  * Construct object
  */
 public function __construct()
 {
     /* Just to prepare taxonomies  */
     $this->prepareAndGet();
     /*  List of taxonomies which will be filtered by language */
     add_filter('pll_get_taxonomies', array($this, 'manageTaxonomiesTranslation'));
     if (Utilities::woocommerce_version_check('2.6')) {
         /* List of taxonomies to be copied/synced with exact same value */
         $metas = Meta::getProductMetaToCopy();
         // Shipping Class taxonomy translation is not supported after WooCommerce 2.6
         if (in_array('product_shipping_class', $metas)) {
             $this->tax_to_copy[] = 'product_shipping_class';
         }
         add_filter('pll_copy_taxonomies', array($this, 'copy_taxonomies'), 10, 2);
     }
 }
Esempio n. 2
0
 /**
  * Helper function - Gets the shipping methods enabled in the shop
  *
  * @return array $active_methods The id and respective plugin id of all active methods
  */
 private function get_active_shipping_methods()
 {
     $active_methods = array();
     if (Utilities::woocommerce_version_check('2.6')) {
         //  WooCommerce 2.6 intoduces the concept of Shipping Zones
         // Format:  $shipping_methods[zone_name_method_id] => shipping_method_object
         // where zone_name is e.g. domestic, europe, rest_of_the_world, and
         // methods_id is e.g. flat_rate, free_shiping, local_pickup, etc
         $shipping_methods = $this->get_zones_shipping_methods();
     } else {
         // Format:  $shipping_methods[method_id] => shipping_method_object
         // where methods_id is e.g. flat_rate, free_shiping, local_pickup, etc
         $shipping_methods = WC()->shipping->load_shipping_methods();
     }
     foreach ($shipping_methods as $id => $shipping_method) {
         if (isset($shipping_method->enabled) && 'yes' === $shipping_method->enabled) {
             $active_methods[$id] = $shipping_method->plugin_id;
         }
     }
     return $active_methods;
 }
Esempio n. 3
0
 /**
  * {@inheritdocs}
  */
 protected function doGetFields()
 {
     $fields = array(array('name' => 'fields-locker', 'type' => 'checkbox', 'default' => 'on', 'label' => __('Fields Locker', 'woopoly'), 'desc' => __('Fields locker makes it easy for user to know which
                      field to translate and which to ignore ', 'woopoly')), array('name' => 'emails', 'type' => 'checkbox', 'default' => 'on', 'label' => __('Emails', 'woopoly'), 'desc' => __('Use order language whenever woocommerce sends order emails', 'woopoly')), array('name' => 'reports', 'type' => 'checkbox', 'default' => 'on', 'label' => __('Reports', 'woopoly'), 'desc' => __('Enable reports language filtering and combining', 'woopoly')), array('name' => 'coupons', 'type' => 'checkbox', 'default' => 'on', 'label' => __('Coupons Sync', 'woopoly'), 'desc' => __('Apply coupons rules for products and their translations', 'woopoly')), array('name' => 'stock', 'type' => 'checkbox', 'default' => 'on', 'label' => __('Stock Sync', 'woopoly'), 'desc' => __('Sync stock for products and their translations', 'woopoly')), array('name' => 'categories', 'type' => 'checkbox', 'default' => 'on', 'label' => __('Translate Categories', 'woopoly'), 'desc' => __('Enable categories translation', 'woopoly')), array('name' => 'tags', 'type' => 'checkbox', 'default' => 'on', 'label' => __('Translate Tags', 'woopoly'), 'desc' => __('Enable tags translation', 'woopoly')), array('name' => 'attributes', 'type' => 'checkbox', 'default' => 'on', 'label' => __('Translate Attributes', 'woopoly'), 'desc' => __('Enable Attributes translation', 'woopoly')), array('name' => 'shipping-class', 'type' => 'checkbox', 'default' => 'off', 'label' => __('Translate Shipping Classes', 'woopoly'), 'desc' => __('Enable Shipping Classes translation' . (Utilities::woocommerce_version_check('2.6') ? ' (not supported for WooCommerce versions >= 2.6)' : ''), 'woopoly')));
     return $fields;
 }