当前位置: 首页>>代码示例>>PHP>>正文


PHP WC_Product::__construct方法代码示例

本文整理汇总了PHP中WC_Product::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Product::__construct方法的具体用法?PHP WC_Product::__construct怎么用?PHP WC_Product::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WC_Product的用法示例。


在下文中一共展示了WC_Product::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: empty

 function __construct($bundle_id)
 {
     $this->product_type = 'composite';
     parent::__construct($bundle_id);
     $this->composite_data = get_post_meta($this->id, '_bto_data', true);
     $this->per_product_pricing = get_post_meta($this->id, '_per_product_pricing_bto', true);
     $this->per_product_shipping = get_post_meta($this->id, '_per_product_shipping_bto', true);
     $this->composite_layout = get_post_meta($this->id, '_bto_style', true);
     $this->selections_style = get_post_meta($this->id, '_bto_selection_mode', true);
     $this->contains_nyp = false;
     $this->has_discounts = false;
     $this->min_price = get_post_meta($this->id, '_min_composite_price', true);
     $this->max_price = get_post_meta($this->id, '_max_composite_price', true);
     $this->price_meta = (double) get_post_meta($this->id, '_price', true);
     $base_price = get_post_meta($this->id, '_base_price', true);
     $base_regular_price = get_post_meta($this->id, '_base_regular_price', true);
     $base_sale_price = get_post_meta($this->id, '_base_sale_price', true);
     $this->base_price = empty($base_price) ? 0.0 : (double) $base_price;
     $this->base_regular_price = empty($base_regular_price) ? 0.0 : (double) $base_regular_price;
     $this->base_sale_price = empty($base_sale_price) ? 0.0 : (double) $base_sale_price;
     $this->hide_price_html = get_post_meta($this->id, '_bto_hide_shop_price', true) == 'yes' ? true : false;
     if ($this->is_priced_per_product()) {
         $this->price = $this->get_base_price();
     }
 }
开发者ID:ajay786singh,项目名称:viriditas-1,代码行数:25,代码来源:class-wc-product-composite.php

示例2: __construct

 public function __construct($bundle)
 {
     $this->product_type = 'bundle';
     parent::__construct($bundle);
     $this->bundle_data = get_post_meta($this->id, '_bundle_data', true);
     $bundled_item_ids = get_post_meta($this->id, '_bundled_ids', true);
     // Update from 3.X.
     if (empty($this->bundle_data) && !empty($bundled_item_ids)) {
         $this->bundle_data = WC_PB_Helpers::serialize_bundle_meta($this->id);
     }
     $this->contains_nyp = false;
     $this->is_nyp = false;
     $this->contains_sub = false;
     $this->contains_optional = false;
     $this->suppress_range_format = false;
     $this->on_sale = false;
     $this->items_require_input = false;
     $this->all_items_optional = true;
     $this->all_items_visible = true;
     $this->all_items_sold_individually = true;
     $this->all_items_in_stock = true;
     $this->all_items_purchasable = true;
     $this->has_items_on_backorder = false;
     $this->per_product_pricing_active = get_post_meta($this->id, '_per_product_pricing_active', true) === 'yes' ? true : false;
     $this->per_product_shipping_active = get_post_meta($this->id, '_per_product_shipping_active', true) === 'yes' ? true : false;
     $this->base_price = ($base_price = get_post_meta($this->id, '_base_price', true)) ? $base_price : '';
     $this->base_regular_price = ($base_regular_price = get_post_meta($this->id, '_base_regular_price', true)) ? $base_regular_price : '';
     $this->base_sale_price = ($base_sale_price = get_post_meta($this->id, '_base_sale_price', true)) ? $base_sale_price : '';
     // NYP.
     if (WC_PB()->compatibility->is_nyp($this)) {
         $this->is_nyp = true;
     }
     $this->is_synced = false;
 }
开发者ID:alexbaron50,项目名称:Rockk3rs-Lab-Test,代码行数:34,代码来源:class-wc-product-bundle.php

示例3: __construct

 /**
  * __construct function.
  *
  * @access public
  * @param mixed $product
  * 
  */
 public function __construct($product)
 {
     global $sitepress;
     date_default_timezone_set("UTC");
     $this->product_type = 'auction';
     $this->auction_item_condition_array = apply_filters('simple_auction_item_condition', array('new' => __('New', 'wc_simple_auctions'), 'used' => __('Used', 'wc_simple_auctions')));
     parent::__construct($product);
     $this->is_closed();
     $this->is_started();
 }
开发者ID:Omuze,项目名称:barakat,代码行数:17,代码来源:class-wc-product-auction.php

示例4: __construct

 /**
  * __construct function.
  *
  * @access public
  * @param mixed $product
  */
 public function __construct($product = array())
 {
     $this->virtual = 'yes';
     $this->downloadable = 'yes';
     $this->manage_stock = 'yes';
     $this->product_type = 'ticket';
     add_filter('woocommerce_product_data_tabs', array($this, 'remove_tabs'), 10, 1);
     add_filter('product_type_options', array($this, 'add_virtual'), 10, 1);
     $getdir = '';
     parent::__construct($product);
 }
开发者ID:jvcanote,项目名称:woocommerce_simple_tickets,代码行数:17,代码来源:Class_product_ticket_type.php

示例5: __construct

 /**
  * __construct function.
  *
  * @access public
  * @param mixed $product
  */
 public function __construct($product)
 {
     $this->product_type = 'amazon_listing';
     $this->id = 0;
     $this->asin = $product;
     $this->sku = $product;
     // this will show the ASIN on the generated email
     $this->post = new stdClass();
     // prevent non-object warning in /woocommerce/includes/abstracts/abstract-wc-product.php:693
     $this->post->post_status = 'publish';
     // make product purchasable for WooCommerce (?)
     parent::__construct($product);
     // parent::__construct( 0 );
 }
开发者ID:imranshuvo,项目名称:wp-lister-for-amazon,代码行数:20,代码来源:Woo_AmazonProduct.php

示例6: __construct

 /**
  * Initialize a gift card product.
  *
  * @param mixed $product
  */
 public function __construct($product)
 {
     $this->product_type = 'gift-card';
     $this->virtual = true;
     parent::__construct($product);
     global $GIFTS;
     /** @var YWGC_Gift_Cards $GIFTS */
     $this->amounts = $GIFTS->get_gift_card_product_amounts($this->id);
     $this->amounts_count = count($this->amounts);
     if ($count = count($this->amounts)) {
         $this->min_price = $this->amounts[0];
         $this->max_price = $this->amounts[$count - 1];
     }
 }
开发者ID:aelia-co,项目名称:YITH-WooCommerce-Gifts-Cards-Multi-Currency,代码行数:19,代码来源:class.ywgc-product-gift-card.php

示例7: __construct

 /**
      27:      * Constructor
      28:      *
      29:      * @param mixed $product
      30:      */
 public function __construct($product)
 {
     $this->product_type = 'soya_variable';
     parent::__construct($product);
     //grap and assign product features ID
     $this->_features_id = get_post_meta($product->ID, '_soya_features', true);
     // get all features assigned to product features
     $features = new Soya_feature($this->_features_id);
     //make sure all features are updated
     //  parent::$all_features->update_feature_meta(64, 1);
     //set total features price
     $features->set_total_features_price();
     $this->set_regular_price();
     $this->all_features = $features;
     //add_filter('woocommerce_get_regular_price', array($this, 'set_regular_price'));
 }
开发者ID:sabali33,项目名称:customizing-product,代码行数:21,代码来源:class-wc-product-soya-variable.php

示例8: __construct

 public function __construct($bundle_id)
 {
     $this->product_type = 'composite';
     parent::__construct($bundle_id);
     $this->composite_data = get_post_meta($this->id, '_bto_data', true);
     $this->per_product_pricing = get_post_meta($this->id, '_per_product_pricing_bto', true);
     $this->per_product_shipping = get_post_meta($this->id, '_per_product_shipping_bto', true);
     $this->composite_layout = get_post_meta($this->id, '_bto_style', true);
     $this->selections_style = get_post_meta($this->id, '_bto_selection_mode', true);
     $this->contains_nyp = false;
     $this->has_discounts = false;
     $this->base_price = ($base_price = get_post_meta($this->id, '_base_price', true)) ? $base_price : '';
     $this->base_regular_price = ($base_regular_price = get_post_meta($this->id, '_base_regular_price', true)) ? $base_regular_price : '';
     $this->base_sale_price = ($base_sale_price = get_post_meta($this->id, '_base_sale_price', true)) ? $base_sale_price : '';
     $this->hide_price_html = get_post_meta($this->id, '_bto_hide_shop_price', true) === 'yes' ? true : false;
 }
开发者ID:alexbaron50,项目名称:Rockk3rs-Lab-Test,代码行数:16,代码来源:class-wc-product-composite.php

示例9:

 function __construct($bundle)
 {
     global $woocommerce_bundles;
     $this->product_type = 'bundle';
     parent::__construct($bundle);
     $this->bundle_data = get_post_meta($this->id, '_bundle_data', true);
     $bundled_item_ids = get_post_meta($this->id, '_bundled_ids', true);
     // Update from 3.X
     if (empty($this->bundle_data) && !empty($bundled_item_ids)) {
         $this->bundle_data = $woocommerce_bundles->helpers->serialize_bundle_meta($this->id);
     }
     $this->contains_nyp = false;
     $this->is_nyp = false;
     $this->contains_sub = false;
     $this->contains_optional = false;
     $this->contains_min_max_quantities = false;
     $this->on_sale = false;
     $this->has_item_with_variables = false;
     $this->all_items_visible = true;
     $this->all_items_sold_individually = true;
     $this->all_items_in_stock = true;
     $this->all_items_purchasable = true;
     $this->has_items_on_backorder = false;
     $this->per_product_pricing_active = get_post_meta($this->id, '_per_product_pricing_active', true) == 'yes' ? true : false;
     $this->per_product_shipping_active = get_post_meta($this->id, '_per_product_shipping_active', true) == 'yes' ? true : false;
     $this->min_price = get_post_meta($this->id, '_min_bundle_price', true);
     $this->max_price = get_post_meta($this->id, '_max_bundle_price', true);
     if ($this->is_priced_per_product()) {
         $this->price = 0;
     }
     // NYP
     if ($woocommerce_bundles->compatibility->is_nyp($this)) {
         $this->is_nyp = true;
     }
     $this->is_synced = false;
 }
开发者ID:puppy09,项目名称:madC,代码行数:36,代码来源:class-wc-product-bundle.php

示例10: __construct

 /**
  * Merges grouped product data into the parent object.
  * @param int|WC_Product|object $product Product to init.
  */
 public function __construct($product = 0)
 {
     $this->data = array_merge($this->data, $this->extra_data);
     parent::__construct($product);
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:9,代码来源:class-wc-product-grouped.php

示例11: __construct

 /**
  * __construct function.
  *
  * @access public
  * @param mixed $product
  */
 public function __construct($product)
 {
     $this->product_type = 'external';
     parent::__construct($product);
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:11,代码来源:class-wc-product-external.php

示例12: __construct

 /**
  * Constructor
  */
 public function __construct($product)
 {
     $this->product_type = 'resume_package';
     parent::__construct($product);
 }
开发者ID:sabdev1,项目名称:sabstaff,代码行数:8,代码来源:class-wc-product-resume-package.php

示例13: __construct

 public function __construct($product)
 {
     $this->product_type = 'woo_auction';
     parent::__construct($product);
     // add additional functions here
 }
开发者ID:lenguyenitc,项目名称:donations,代码行数:6,代码来源:class-wa-product-type.php

示例14: foreach

 function __construct($bundle_id)
 {
     global $woocommerce_bundles;
     $this->product_type = 'bundle';
     parent::__construct($bundle_id);
     if ($woocommerce_bundles->is_wc_v2()) {
         $this->is_wc_v2 = true;
     }
     $this->bundled_item_ids = get_post_meta($this->id, '_bundled_ids', true);
     $this->has_filters = false;
     $this->has_overrides = false;
     $this->sold_individually = true;
     if ($this->bundled_item_ids) {
         foreach ($this->bundled_item_ids as $bundled_id) {
             // Store 'variation filtering' boolean variables
             if (get_post_meta($this->id, 'filter_variations_' . $bundled_id, 'true') == 'yes') {
                 $this->variation_filters_active[$bundled_id] = true;
                 $this->has_filters = true;
             } else {
                 $this->variation_filters_active[$bundled_id] = false;
             }
             // Store 'override defaults' boolean variables
             if (get_post_meta($this->id, 'override_defaults_' . $bundled_id, 'true') == 'yes') {
                 $this->bundle_defaults_active[$bundled_id] = true;
                 $this->has_overrides = true;
             } else {
                 $this->bundle_defaults_active[$bundled_id] = false;
             }
             // Store bundled item quantities
             $this->bundled_item_quantities[$bundled_id] = get_post_meta($this->id, 'bundle_quantity_' . $bundled_id, 'true');
         }
     }
     if ($this->has_filters) {
         $this->allowed_variations = maybe_unserialize(get_post_meta($this->id, '_allowed_variations', true));
         // create array of attributes based on active variations
         foreach ($this->allowed_variations as $item_id => $allowed_variations) {
             if (!$this->variation_filters_active[$item_id]) {
                 continue;
             }
             $sep = explode('_', $item_id);
             $product_id = $sep[0];
             $attributes = (array) maybe_unserialize(get_post_meta($product_id, '_product_attributes', true));
             // filtered variation attributes (stores attributes of active variations)
             $filtered_attributes = array();
             $this->filtered_variation_attributes[$item_id] = array();
             // make array of active variation attributes
             foreach ($this->allowed_variations[$item_id] as $allowed_variation_id) {
                 // get variation meta of allowed variations
                 $product_custom_fields = get_post_custom($allowed_variation_id);
                 foreach ($product_custom_fields as $name => $value) {
                     if (!strstr($name, 'attribute_')) {
                         continue;
                     }
                     $attribute_name = substr($name, strlen('attribute_'));
                     if (!$value[0]) {
                         $description = 'Any';
                     } else {
                         $term = get_term_by('slug', $value[0], $attribute_name);
                         $description = $term == false ? '' : $term->name;
                     }
                     if (!$description) {
                         $description = $value[0];
                     }
                     if (!isset($filtered_attributes[$attribute_name])) {
                         $filtered_attributes[$attribute_name]['descriptions'][] = $description;
                         $filtered_attributes[$attribute_name]['slugs'][] = $value[0];
                     } elseif (!in_array($description, $filtered_attributes[$attribute_name])) {
                         $filtered_attributes[$attribute_name]['descriptions'][] = $description;
                         $filtered_attributes[$attribute_name]['slugs'][] = $value[0];
                     }
                 }
                 // clean up product attributes
                 foreach ($attributes as $attribute) {
                     if (!$attribute['is_variation']) {
                         continue;
                     }
                     $attribute_name = sanitize_title($attribute['name']);
                     if (array_key_exists($attribute_name, $filtered_attributes) && !in_array('Any', $filtered_attributes[$attribute_name]['descriptions'])) {
                         $this->filtered_variation_attributes[$item_id][$attribute_name] = $filtered_attributes[$attribute_name];
                     }
                 }
             }
         }
     }
     if ($this->has_overrides) {
         $this->bundle_defaults = get_post_meta($this->id, '_bundle_defaults', true);
     }
     $this->per_product_pricing_active = get_post_meta($this->id, '_per_product_pricing_active', true) == 'yes' ? true : false;
     if ($this->per_product_pricing_active) {
         $this->price = 0;
     }
     $this->per_product_shipping_active = get_post_meta($this->id, '_per_product_shipping_active', true) == 'yes' ? true : false;
     if ($this->bundled_item_ids) {
         $this->load_bundle_data();
         $this->availability = $this->bundle_availability();
     }
 }
开发者ID:GarryVeles,项目名称:Artibaltika,代码行数:97,代码来源:class-wc-product-bundle.php

示例15: array

 function __construct($product, $arg = array())
 {
     $this->product_type = 'pack';
     parent::__construct($product);
 }
开发者ID:linniepinski,项目名称:perssistant,代码行数:5,代码来源:ET_WC_Package.php


注:本文中的WC_Product::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。