Product constructor setting post incorrectly

This commit is contained in:
Mike Jolley 2015-01-20 14:00:30 +00:00
parent 22f68af061
commit 91de767442
2 changed files with 13 additions and 13 deletions

View File

@ -5,7 +5,7 @@
* The WooCommerce order class handles order data.
*
* @class WC_Order
* @see WP_Post
* @var WP_Post
* @version 2.2.0
* @package WooCommerce/Classes
* @category Class
@ -43,7 +43,7 @@ abstract class WC_Abstract_Order {
public $id = 0;
/**
* @public WP_Post Stores post data for the order
* @public $post Stores post data
* @var WP_Post
*/
public $post = null;
@ -90,7 +90,7 @@ abstract class WC_Abstract_Order {
* should be used. It is possible, but the aforementioned are preferred and are the only
* methods that will be maintained going forward.
*
* @param integer $order
* @param int $order
*/
public function __construct( $order = 0 ) {
$this->prices_include_tax = get_option('woocommerce_prices_include_tax') == 'yes' ? true : false;

View File

@ -5,7 +5,7 @@
* The WooCommerce product class handles individual product data.
*
* @class WC_Product
* @see WP_Post
* @var WP_Post
* @version 2.1.0
* @package WooCommerce/Abstracts
* @category Abstract Class
@ -21,22 +21,22 @@
class WC_Product {
/** @public int The product (post) ID. */
public $id;
public $id = 0;
/**
* @public WP_Post Stores post data for the product
* @var WP_Post
*/
public $post;
* @public $post Stores post data
* @var WP_Post
*/
public $post = null;
/** @public string $product_type The product's type (simple, variable etc). */
public $product_type = null;
public $product_type = null;
/** @protected string $dimensions String of dimensions (imploded with X) */
protected $dimensions = '';
protected $dimensions = '';
/** @protected string $shipping_class Prouduct shipping class */
protected $shipping_class = '';
protected $shipping_class = '';
/** @protected integer $shipping_class_id ID of the shipping class this product has. */
protected $shipping_class_id = 0;
@ -53,7 +53,7 @@ class WC_Product {
$this->post = get_post( $this->id );
} elseif ( $product instanceof WC_Product ) {
$this->id = absint( $product->id );
$this->post = $product;
$this->post = $product->post;
} elseif ( $product instanceof WP_Post || isset( $product->ID ) ) {
$this->id = absint( $product->ID );
$this->post = $product;