/** * Read from the database. * @since 2.7.0 * @param int $id ID of object to read. */ public function read($id) { parent::read($id); if (!$this->get_id()) { return; } $post_object = get_post($id); $this->set_props(array('amount' => get_post_meta($this->get_id(), '_refund_amount', true), 'refunded_by' => metadata_exists('post', $this->get_id(), '_refunded_by') ? get_post_meta($this->get_id(), '_refunded_by', true) : absint($post_object->post_author), 'reason' => metadata_exists('post', $this->get_id(), '_refund_reason') ? get_post_meta($this->get_id(), '_refund_reason', true) : $post_object->post_excerpt)); }
/** * Read from the database. * @since 2.7.0 * @param int $id ID of object to read. */ public function read($id) { parent::read($id); // Read additonal order data if ($this->get_id()) { $post_object = get_post($id); $this->set_amount(get_post_meta($this->get_id(), '_refund_amount', true)); // post_author was used before refunded_by meta. $this->set_refunded_by(metadata_exists('post', $this->get_id(), '_refunded_by') ? get_post_meta($this->get_id(), '_refunded_by', true) : absint($post_object->post_author)); // post_excerpt was used before refund_reason meta. $this->set_reason(metadata_exists('post', $this->get_id(), '_refund_reason') ? get_post_meta($this->get_id(), '_refund_reason', true) : absint($post_object->post_excerpt)); } }
/** * Read from the database. * @since 2.7.0 * @param int $id ID of object to read. */ public function read($id) { parent::read($id); // Read additonal order data if ($order_id = $this->get_id()) { $post_object = get_post($this->get_id()); $this->set_order_key(get_post_meta($this->get_id(), '_order_key', true)); $this->set_customer_id(get_post_meta($this->get_id(), '_customer_user', true)); $this->set_billing_first_name(get_post_meta($order_id, '_billing_first_name', true)); $this->set_billing_last_name(get_post_meta($order_id, '_billing_last_name', true)); $this->set_billing_company(get_post_meta($order_id, '_billing_company', true)); $this->set_billing_address_1(get_post_meta($order_id, '_billing_address_1', true)); $this->set_billing_address_2(get_post_meta($order_id, '_billing_address_2', true)); $this->set_billing_city(get_post_meta($order_id, '_billing_city', true)); $this->set_billing_state(get_post_meta($order_id, '_billing_state', true)); $this->set_billing_postcode(get_post_meta($order_id, '_billing_postcode', true)); $this->set_billing_country(get_post_meta($order_id, '_billing_country', true)); $this->set_billing_email(get_post_meta($order_id, '_billing_email', true)); $this->set_billing_phone(get_post_meta($order_id, '_billing_phone', true)); $this->set_shipping_first_name(get_post_meta($order_id, '_shipping_first_name', true)); $this->set_shipping_last_name(get_post_meta($order_id, '_shipping_last_name', true)); $this->set_shipping_company(get_post_meta($order_id, '_shipping_company', true)); $this->set_shipping_address_1(get_post_meta($order_id, '_shipping_address_1', true)); $this->set_shipping_address_2(get_post_meta($order_id, '_shipping_address_2', true)); $this->set_shipping_city(get_post_meta($order_id, '_shipping_city', true)); $this->set_shipping_state(get_post_meta($order_id, '_shipping_state', true)); $this->set_shipping_postcode(get_post_meta($order_id, '_shipping_postcode', true)); $this->set_shipping_country(get_post_meta($order_id, '_shipping_country', true)); $this->set_payment_method(get_post_meta($order_id, '_payment_method', true)); $this->set_payment_method_title(get_post_meta($order_id, '_payment_method_title', true)); $this->set_transaction_id(get_post_meta($order_id, '_transaction_id', true)); $this->set_customer_ip_address(get_post_meta($order_id, '_customer_ip_address', true)); $this->set_customer_user_agent(get_post_meta($order_id, '_customer_user_agent', true)); $this->set_created_via(get_post_meta($order_id, '_created_via', true)); $this->set_customer_note(get_post_meta($order_id, '_customer_note', true)); $this->set_date_completed(get_post_meta($order_id, '_completed_date', true)); $this->set_date_paid(get_post_meta($order_id, '_paid_date', true)); $this->set_cart_hash(get_post_meta($order_id, '_cart_hash', true)); $this->set_customer_note($post_object->post_excerpt); // Map user data if (!$this->get_billing_email() && ($user = $this->get_user())) { $this->set_billing_email($user->user_email); } } }
/** * Read from the database. * @since 2.7.0 * @param int $id ID of object to read. */ public function read($id) { parent::read($id); if (!$this->get_id()) { return; } $post_object = get_post($this->get_id()); $this->set_props(array('order_key' => get_post_meta($this->get_id(), '_order_key', true), 'customer_id' => get_post_meta($this->get_id(), '_customer_user', true), 'billing_first_name' => get_post_meta($this->get_id(), '_billing_first_name', true), 'billing_last_name' => get_post_meta($this->get_id(), '_billing_last_name', true), 'billing_company' => get_post_meta($this->get_id(), '_billing_company', true), 'billing_address_1' => get_post_meta($this->get_id(), '_billing_address_1', true), 'billing_address_2' => get_post_meta($this->get_id(), '_billing_address_2', true), 'billing_city' => get_post_meta($this->get_id(), '_billing_city', true), 'billing_state' => get_post_meta($this->get_id(), '_billing_state', true), 'billing_postcode' => get_post_meta($this->get_id(), '_billing_postcode', true), 'billing_country' => get_post_meta($this->get_id(), '_billing_country', true), 'billing_email' => get_post_meta($this->get_id(), '_billing_email', true), 'billing_phone' => get_post_meta($this->get_id(), '_billing_phone', true), 'shipping_first_name' => get_post_meta($this->get_id(), '_shipping_first_name', true), 'shipping_last_name' => get_post_meta($this->get_id(), '_shipping_last_name', true), 'shipping_company' => get_post_meta($this->get_id(), '_shipping_company', true), 'shipping_address_1' => get_post_meta($this->get_id(), '_shipping_address_1', true), 'shipping_address_2' => get_post_meta($this->get_id(), '_shipping_address_2', true), 'shipping_city' => get_post_meta($this->get_id(), '_shipping_city', true), 'shipping_state' => get_post_meta($this->get_id(), '_shipping_state', true), 'shipping_postcode' => get_post_meta($this->get_id(), '_shipping_postcode', true), 'shipping_country' => get_post_meta($this->get_id(), '_shipping_country', true), 'payment_method' => get_post_meta($this->get_id(), '_payment_method', true), 'payment_method_title' => get_post_meta($this->get_id(), '_payment_method_title', true), 'transaction_id' => get_post_meta($this->get_id(), '_transaction_id', true), 'customer_ip_address' => get_post_meta($this->get_id(), '_customer_ip_address', true), 'customer_user_agent' => get_post_meta($this->get_id(), '_customer_user_agent', true), 'created_via' => get_post_meta($this->get_id(), '_created_via', true), 'customer_note' => get_post_meta($this->get_id(), '_customer_note', true), 'date_completed' => get_post_meta($this->get_id(), '_completed_date', true), 'date_paid' => get_post_meta($this->get_id(), '_paid_date', true), 'cart_hash' => get_post_meta($this->get_id(), '_cart_hash', true), 'customer_note' => $post_object->post_excerpt)); $this->maybe_set_user_billing_email(); }