|
@@ 174-211 (lines=38) @@
|
| 171 |
|
* Insert data into the database. |
| 172 |
|
* @since 2.6.0 |
| 173 |
|
*/ |
| 174 |
|
public function create() { |
| 175 |
|
parent::create(); |
| 176 |
|
|
| 177 |
|
// Store additonal order data |
| 178 |
|
if ( $this->get_id() ) { |
| 179 |
|
$this->update_post_meta( '_billing_first_name', $this->get_billing_first_name() ); |
| 180 |
|
$this->update_post_meta( '_billing_last_name', $this->get_billing_last_name() ); |
| 181 |
|
$this->update_post_meta( '_billing_company', $this->get_billing_company() ); |
| 182 |
|
$this->update_post_meta( '_billing_address_1', $this->get_billing_address_1() ); |
| 183 |
|
$this->update_post_meta( '_billing_address_2', $this->get_billing_address_2() ); |
| 184 |
|
$this->update_post_meta( '_billing_city', $this->get_billing_city() ); |
| 185 |
|
$this->update_post_meta( '_billing_state', $this->get_billing_state() ); |
| 186 |
|
$this->update_post_meta( '_billing_postcode', $this->get_billing_postcode() ); |
| 187 |
|
$this->update_post_meta( '_billing_country', $this->get_billing_country() ); |
| 188 |
|
$this->update_post_meta( '_billing_email', $this->get_billing_email() ); |
| 189 |
|
$this->update_post_meta( '_billing_phone', $this->get_billing_phone() ); |
| 190 |
|
$this->update_post_meta( '_shipping_first_name', $this->get_shipping_first_name() ); |
| 191 |
|
$this->update_post_meta( '_shipping_last_name', $this->get_shipping_last_name() ); |
| 192 |
|
$this->update_post_meta( '_shipping_company', $this->get_shipping_company() ); |
| 193 |
|
$this->update_post_meta( '_shipping_address_1', $this->get_shipping_address_1() ); |
| 194 |
|
$this->update_post_meta( '_shipping_address_2', $this->get_shipping_address_2() ); |
| 195 |
|
$this->update_post_meta( '_shipping_city', $this->get_shipping_city() ); |
| 196 |
|
$this->update_post_meta( '_shipping_state', $this->get_shipping_state() ); |
| 197 |
|
$this->update_post_meta( '_shipping_postcode', $this->get_shipping_postcode() ); |
| 198 |
|
$this->update_post_meta( '_shipping_country', $this->get_shipping_country() ); |
| 199 |
|
$this->update_post_meta( '_payment_method', $this->get_payment_method() ); |
| 200 |
|
$this->update_post_meta( '_payment_method_title', $this->get_payment_method_title() ); |
| 201 |
|
$this->update_post_meta( '_transaction_id', $this->get_transaction_id() ); |
| 202 |
|
$this->update_post_meta( '_customer_ip_address', $this->get_customer_ip_address() ); |
| 203 |
|
$this->update_post_meta( '_customer_user_agent', $this->get_customer_user_agent() ); |
| 204 |
|
$this->update_post_meta( '_created_via', $this->get_created_via() ); |
| 205 |
|
$this->update_post_meta( '_customer_note', $this->get_customer_note() ); |
| 206 |
|
$this->update_post_meta( '_date_completed', $this->get_date_completed() ); |
| 207 |
|
$this->update_post_meta( '_date_paid', $this->get_date_paid() ); |
| 208 |
|
$this->update_post_meta( '_cart_hash', $this->get_cart_hash() ); |
| 209 |
|
do_action( 'woocommerce_new_order', $this->get_id() ); |
| 210 |
|
} |
| 211 |
|
} |
| 212 |
|
|
| 213 |
|
/** |
| 214 |
|
* Read from the database. |
|
@@ 267-304 (lines=38) @@
|
| 264 |
|
* Update data in the database. |
| 265 |
|
* @since 2.6.0 |
| 266 |
|
*/ |
| 267 |
|
public function update() { |
| 268 |
|
parent::update(); |
| 269 |
|
|
| 270 |
|
// Store additonal order data |
| 271 |
|
$this->update_post_meta( '_billing_first_name', $this->get_billing_first_name() ); |
| 272 |
|
$this->update_post_meta( '_billing_last_name', $this->get_billing_last_name() ); |
| 273 |
|
$this->update_post_meta( '_billing_company', $this->get_billing_company() ); |
| 274 |
|
$this->update_post_meta( '_billing_address_1', $this->get_billing_address_1() ); |
| 275 |
|
$this->update_post_meta( '_billing_address_2', $this->get_billing_address_2() ); |
| 276 |
|
$this->update_post_meta( '_billing_city', $this->get_billing_city() ); |
| 277 |
|
$this->update_post_meta( '_billing_state', $this->get_billing_state() ); |
| 278 |
|
$this->update_post_meta( '_billing_postcode', $this->get_billing_postcode() ); |
| 279 |
|
$this->update_post_meta( '_billing_country', $this->get_billing_country() ); |
| 280 |
|
$this->update_post_meta( '_billing_email', $this->get_billing_email() ); |
| 281 |
|
$this->update_post_meta( '_billing_phone', $this->get_billing_phone() ); |
| 282 |
|
$this->update_post_meta( '_shipping_first_name', $this->get_shipping_first_name() ); |
| 283 |
|
$this->update_post_meta( '_shipping_last_name', $this->get_shipping_last_name() ); |
| 284 |
|
$this->update_post_meta( '_shipping_company', $this->get_shipping_company() ); |
| 285 |
|
$this->update_post_meta( '_shipping_address_1', $this->get_shipping_address_1() ); |
| 286 |
|
$this->update_post_meta( '_shipping_address_2', $this->get_shipping_address_2() ); |
| 287 |
|
$this->update_post_meta( '_shipping_city', $this->get_shipping_city() ); |
| 288 |
|
$this->update_post_meta( '_shipping_state', $this->get_shipping_state() ); |
| 289 |
|
$this->update_post_meta( '_shipping_postcode', $this->get_shipping_postcode() ); |
| 290 |
|
$this->update_post_meta( '_shipping_country', $this->get_shipping_country() ); |
| 291 |
|
$this->update_post_meta( '_payment_method', $this->get_payment_method() ); |
| 292 |
|
$this->update_post_meta( '_payment_method_title', $this->get_payment_method_title() ); |
| 293 |
|
$this->update_post_meta( '_transaction_id', $this->get_transaction_id() ); |
| 294 |
|
$this->update_post_meta( '_customer_ip_address', $this->get_customer_ip_address() ); |
| 295 |
|
$this->update_post_meta( '_customer_user_agent', $this->get_customer_user_agent() ); |
| 296 |
|
$this->update_post_meta( '_created_via', $this->get_created_via() ); |
| 297 |
|
$this->update_post_meta( '_customer_note', $this->get_customer_note() ); |
| 298 |
|
$this->update_post_meta( '_date_completed', $this->get_date_completed() ); |
| 299 |
|
$this->update_post_meta( '_date_paid', $this->get_date_paid() ); |
| 300 |
|
$this->update_post_meta( '_cart_hash', $this->get_cart_hash() ); |
| 301 |
|
|
| 302 |
|
// Handle status change |
| 303 |
|
$this->status_transition(); |
| 304 |
|
} |
| 305 |
|
|
| 306 |
|
/** |
| 307 |
|
* Set order status. |