本文整理汇总了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);
}
示例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';
}
示例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);
}