|
@@ 172-183 (lines=12) @@
|
| 169 |
|
* Insert data into the database. |
| 170 |
|
* @since 2.7.0 |
| 171 |
|
*/ |
| 172 |
|
public function create() { |
| 173 |
|
global $wpdb; |
| 174 |
|
|
| 175 |
|
$wpdb->insert( $wpdb->prefix . 'woocommerce_order_items', array( |
| 176 |
|
'order_item_name' => $this->get_name(), |
| 177 |
|
'order_item_type' => $this->get_type(), |
| 178 |
|
'order_id' => $this->get_order_id(), |
| 179 |
|
) ); |
| 180 |
|
$this->set_id( $wpdb->insert_id ); |
| 181 |
|
|
| 182 |
|
do_action( 'woocommerce_new_order_item', $this->get_id(), $this, $this->get_order_id() ); |
| 183 |
|
} |
| 184 |
|
|
| 185 |
|
/** |
| 186 |
|
* Update data in the database. |
|
@@ 189-199 (lines=11) @@
|
| 186 |
|
* Update data in the database. |
| 187 |
|
* @since 2.7.0 |
| 188 |
|
*/ |
| 189 |
|
public function update() { |
| 190 |
|
global $wpdb; |
| 191 |
|
|
| 192 |
|
$wpdb->update( $wpdb->prefix . 'woocommerce_order_items', array( |
| 193 |
|
'order_item_name' => $this->get_name(), |
| 194 |
|
'order_item_type' => $this->get_type(), |
| 195 |
|
'order_id' => $this->get_order_id(), |
| 196 |
|
), array( 'order_item_id' => $this->get_id() ) ); |
| 197 |
|
|
| 198 |
|
do_action( 'woocommerce_update_order_item', $this->get_id(), $this, $this->get_order_id() ); |
| 199 |
|
} |
| 200 |
|
|
| 201 |
|
/** |
| 202 |
|
* Read from the database. |