本文整理汇总了PHP中WC_Product_Variation::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Product_Variation::__construct方法的具体用法?PHP WC_Product_Variation::__construct怎么用?PHP WC_Product_Variation::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Product_Variation
的用法示例。
在下文中一共展示了WC_Product_Variation::__construct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Create a simple subscription product object.
*
* @access public
* @param mixed $product
*/
public function __construct($product, $args = array())
{
parent::__construct($product, $args = array());
$this->parent_product_type = $this->product_type;
$this->product_type = 'subscription_variation';
// 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_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];
}
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];
}
$this->subscription_payment_sync_date = !isset($this->product_custom_fields['_subscription_payment_sync_date'][0]) ? 0 : maybe_unserialize($this->product_custom_fields['_subscription_payment_sync_date'][0]);
}
示例2: __construct
/**
* Create a simple subscription product object.
*
* @access public
* @param mixed $product
*/
public function __construct($product, $args = array())
{
parent::__construct($product, $args = array());
$this->parent_product_type = $this->product_type;
$this->product_type = 'subscription_variation';
$this->subscription_variation_level_meta_data = array('subscription_price' => 0, 'subscription_period' => '', 'subscription_period_interval' => 'day', 'subscription_length' => 0, 'subscription_trial_length' => 0, 'subscription_trial_period' => 'day', 'subscription_sign_up_fee' => 0, 'subscription_payment_sync_date' => 0);
$this->variation_level_meta_data = array_merge($this->variation_level_meta_data, $this->subscription_variation_level_meta_data);
}
示例3: __construct
/**
* Create a simple subscription product object.
*
* @access public
* @param mixed $product
*/
public function __construct($product, $args = array())
{
parent::__construct($product, $args = array());
$this->parent_product_type = $this->product_type;
$this->product_type = 'subscription_variation';
$this->subscription_variation_level_meta_data = array('subscription_price' => 0, 'subscription_period' => '', 'subscription_period_interval' => 'day', 'subscription_length' => 0, 'subscription_trial_length' => 0, 'subscription_trial_period' => 'day', 'subscription_sign_up_fee' => 0, 'subscription_payment_sync_date' => 0);
if (WC_Subscriptions::is_woocommerce_pre_2_2()) {
// WC 2.1
// Convert selected subscription meta fields for easy access
foreach ($this->subscription_variation_level_meta_data as $meta_key => $default_value) {
if (!empty($this->product_custom_fields['_' . $meta_key][0])) {
$this->{$meta_key} = maybe_unserialize($this->product_custom_fields['_' . $meta_key][0]);
} else {
$this->{$meta_key} = $this->subscription_variation_level_meta_data[$meta_key];
}
}
} else {
$this->variation_level_meta_data = array_merge($this->variation_level_meta_data, $this->subscription_variation_level_meta_data);
}
}
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:26,代码来源:class-wc-product-subscription-variation.php
示例4: __construct
public function __construct($variation_id, $parent_id = '', $parent_custom_fields = '')
{
_deprecated_function('woocommerce_product_variation', '1.4', 'WC_Product_Variation()');
parent::__construct($variation_id, $parent_id, $parent_custom_fields);
}