當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WC_Product_Variable::__construct方法代碼示例

本文整理匯總了PHP中WC_Product_Variable::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP WC_Product_Variable::__construct方法的具體用法?PHP WC_Product_Variable::__construct怎麽用?PHP WC_Product_Variable::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WC_Product_Variable的用法示例。


在下文中一共展示了WC_Product_Variable::__construct方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Create a simple subscription product object.
  *
  * @access public
  * @param mixed $product
  */
 public function __construct($product)
 {
     parent::__construct($product);
     $this->product_type = 'variable-subscription';
     // Load all meta fields
     $this->product_custom_fields = get_post_meta($this->id);
     // Convert selected subscription meta fields for easy access
     if (!empty($this->product_custom_fields['_subscription_price'][0])) {
         $this->subscription_price = $this->product_custom_fields['_subscription_price'][0];
     }
     if (!empty($this->product_custom_fields['_subscription_sign_up_fee'][0])) {
         $this->subscription_sign_up_fee = $this->product_custom_fields['_subscription_sign_up_fee'][0];
     }
     if (!empty($this->product_custom_fields['_subscription_period'][0])) {
         $this->subscription_period = $this->product_custom_fields['_subscription_period'][0];
     }
     if (!empty($this->product_custom_fields['_subscription_period_interval'][0])) {
         $this->subscription_period_interval = $this->product_custom_fields['_subscription_period_interval'][0];
     }
     if (!empty($this->product_custom_fields['_subscription_length'][0])) {
         $this->subscription_length = $this->product_custom_fields['_subscription_length'][0];
     }
     if (!empty($this->product_custom_fields['_subscription_trial_length'][0])) {
         $this->subscription_trial_length = $this->product_custom_fields['_subscription_trial_length'][0];
     }
     if (!empty($this->product_custom_fields['_subscription_trial_period'][0])) {
         $this->subscription_trial_period = $this->product_custom_fields['_subscription_trial_period'][0];
     }
     $this->limit_subscriptions = !isset($this->product_custom_fields['_subscription_limit'][0]) ? 'no' : $this->product_custom_fields['_subscription_limit'][0];
     add_filter('woocommerce_add_to_cart_handler', array(&$this, 'add_to_cart_handler'), 10, 2);
 }
開發者ID:bulats,項目名稱:chef,代碼行數:37,代碼來源:class-wc-product-variable-subscription.php

示例2: __construct

 /**
  * Create a variable registration product object.
  *
  * @access public
  * @param mixed $product
  */
 public function __construct($product)
 {
     parent::__construct($product);
     $this->parent_product_type = $this->product_type;
     $this->product_type = 'registrations';
     add_filter('woocommerce_add_to_cart_handler', array(&$this, 'add_to_cart_handler'), 10, 2);
 }
開發者ID:HasteDesign,項目名稱:Registrations-for-WooCommerce,代碼行數:13,代碼來源:class-wc-product-registrations.php

示例3: __construct

 /**
  * Construct.
  *
  * @access public
  * @param mixed $product
  */
 public function __construct($product)
 {
     parent::__construct($product);
     $this->product_type = 'tour';
     $this->virtual = 'yes';
     $this->downloadable = 'no';
 }
開發者ID:j-kenneth,項目名稱:Expeero,代碼行數:13,代碼來源:WC_Product_Tour_Variable.php

示例4: __construct

 /**
  * Create a simple subscription product object.
  *
  * @access public
  * @param mixed $product
  */
 public function __construct($product)
 {
     parent::__construct($product);
     $this->parent_product_type = $this->product_type;
     $this->product_type = 'variable-subscription';
     // Load all meta fields
     $this->product_custom_fields = get_post_meta($this->id);
     // Convert selected subscription meta fields for easy access
     if (!empty($this->product_custom_fields['_subscription_price'][0])) {
         $this->subscription_price = $this->product_custom_fields['_subscription_price'][0];
     }
     if (!empty($this->product_custom_fields['_subscription_sign_up_fee'][0])) {
         $this->subscription_sign_up_fee = $this->product_custom_fields['_subscription_sign_up_fee'][0];
     }
     if (!empty($this->product_custom_fields['_subscription_period'][0])) {
         $this->subscription_period = $this->product_custom_fields['_subscription_period'][0];
     }
     if (!empty($this->product_custom_fields['_subscription_period_interval'][0])) {
         $this->subscription_period_interval = $this->product_custom_fields['_subscription_period_interval'][0];
     }
     if (!empty($this->product_custom_fields['_subscription_length'][0])) {
         $this->subscription_length = $this->product_custom_fields['_subscription_length'][0];
     }
     if (!empty($this->product_custom_fields['_subscription_trial_length'][0])) {
         $this->subscription_trial_length = $this->product_custom_fields['_subscription_trial_length'][0];
     }
     if (!empty($this->product_custom_fields['_subscription_trial_period'][0])) {
         $this->subscription_trial_period = $this->product_custom_fields['_subscription_trial_period'][0];
     }
     $this->subscription_payment_sync_date = 0;
     $this->subscription_one_time_shipping = !isset($this->product_custom_fields['_subscription_one_time_shipping'][0]) ? 'no' : $this->product_custom_fields['_subscription_one_time_shipping'][0];
     if (!isset($this->product_custom_fields['_subscription_limit'][0])) {
         $this->limit_subscriptions = 'no';
     } elseif ('yes' == $this->product_custom_fields['_subscription_limit'][0]) {
         // backward compatibility
         $this->limit_subscriptions = 'any';
     } else {
         $this->limit_subscriptions = $this->product_custom_fields['_subscription_limit'][0];
     }
     add_filter('woocommerce_add_to_cart_handler', array(&$this, 'add_to_cart_handler'), 10, 2);
 }
開發者ID:DustinHartzler,項目名稱:TheCLEFT,代碼行數:47,代碼來源:class-wc-product-variable-subscription.php


注:本文中的WC_Product_Variable::__construct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。