Correct scope, remove use of var.

- class-wc-product-variable.php
This commit is contained in:
Warren Holmes 2012-12-14 23:52:46 +02:00
parent 5b0297d181
commit 0e491d6ffe
1 changed files with 29 additions and 29 deletions

View File

@ -13,29 +13,29 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class WC_Product_Variable extends WC_Product {
/** @var array Array of child products/posts/variations. */
var $children;
/** @public array Array of child products/posts/variations. */
public $children;
/** @var string The product's total stock, including that of its children. */
var $total_stock;
/** @public string The product's total stock, including that of its children. */
public $total_stock;
/** @var string Used for variation prices. */
var $min_variation_price;
/** @public string Used for variation prices. */
public $min_variation_price;
/** @var string Used for variation prices. */
var $max_variation_price;
/** @public string Used for variation prices. */
public $max_variation_price;
/** @var string Used for variation prices. */
var $min_variation_regular_price;
/** @public string Used for variation prices. */
public $min_variation_regular_price;
/** @var string Used for variation prices. */
var $max_variation_regular_price;
/** @public string Used for variation prices. */
public $max_variation_regular_price;
/** @var string Used for variation prices. */
var $min_variation_sale_price;
/** @public string Used for variation prices. */
public $min_variation_sale_price;
/** @var string Used for variation prices. */
var $max_variation_sale_price;
/** @public string Used for variation prices. */
public $max_variation_sale_price;
/**
* __construct function.
@ -44,7 +44,7 @@ class WC_Product_Variable extends WC_Product {
* @param mixed $product
* @param array $args Contains arguments to set up this product
*/
function __construct( $product, $args ) {
public function __construct( $product, $args ) {
parent::__construct( $product );
@ -89,7 +89,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return int
*/
function get_total_stock() {
public function get_total_stock() {
if ( is_null( $this->total_stock ) ) {
@ -121,7 +121,7 @@ class WC_Product_Variable extends WC_Product {
* @param int $by (default: 1) Amount to reduce by.
* @return int Stock
*/
function reduce_stock( $by = 1 ) {
public function reduce_stock( $by = 1 ) {
global $woocommerce;
if ( $this->managing_stock() ) {
@ -147,7 +147,7 @@ class WC_Product_Variable extends WC_Product {
* @param int $by (default: 1) Amount to increase by
* @return int Stock
*/
function increase_stock( $by = 1 ) {
public function increase_stock( $by = 1 ) {
global $woocommerce;
if ($this->managing_stock()) :
@ -172,7 +172,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return array
*/
function get_children() {
public function get_children() {
if ( ! is_array( $this->children ) ) {
@ -201,7 +201,7 @@ class WC_Product_Variable extends WC_Product {
* @param mixed $child_id
* @return object WC_Product or WC_Product_variation
*/
function get_child( $child_id ) {
public function get_child( $child_id ) {
return get_product( $child_id, array(
'parent_id' => $this->id,
'parent' => $this,
@ -216,7 +216,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return bool
*/
function has_child() {
public function has_child() {
return sizeof( $this->get_children() ) ? true : false;
}
@ -227,7 +227,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return bool
*/
function is_on_sale() {
public function is_on_sale() {
if ( $this->has_child() ) {
foreach ( $this->get_children() as $child_id ) {
@ -252,7 +252,7 @@ class WC_Product_Variable extends WC_Product {
* @param string $price (default: '')
* @return string
*/
function get_price_html( $price = '' ) {
public function get_price_html( $price = '' ) {
// Ensure variation prices are synced with variations
if ( $this->min_variation_price === '' || $this->min_variation_regular_price === '' ) {
@ -319,7 +319,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return array of attributes and their available values
*/
function get_variation_attributes() {
public function get_variation_attributes() {
$variation_attributes = array();
@ -387,7 +387,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return array
*/
function get_variation_default_attributes() {
public function get_variation_default_attributes() {
$default = isset( $this->product_custom_fields['_default_attributes'][0] ) ? $this->product_custom_fields['_default_attributes'][0] : '';
@ -400,7 +400,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return array
*/
function get_available_variations() {
public function get_available_variations() {
$available_variations = array();
@ -463,7 +463,7 @@ class WC_Product_Variable extends WC_Product {
* @access public
* @return void
*/
function variable_product_sync() {
public function variable_product_sync() {
global $woocommerce;
$children = get_posts( array(