function save_meta_box($post_id, $post) { $lm = new WPLA_ListingsModel(); if (isset($_POST['wpl_amazon_title'])) { // convert decimal comma for all price fields $_amazon_price = str_replace(',', '.', @$_POST['wpl_amazon_price']); $_amazon_minimum_price = str_replace(',', '.', @$_POST['wpl_amazon_minimum_price']); $_amazon_maximum_price = str_replace(',', '.', @$_POST['wpl_amazon_maximum_price']); // Update post meta update_post_meta($post_id, '_amazon_title', esc_attr(trim(@$_POST['wpl_amazon_title']))); update_post_meta($post_id, '_amazon_price', esc_attr(trim($_amazon_price))); update_post_meta($post_id, '_amazon_minimum_price', esc_attr(trim($_amazon_minimum_price))); update_post_meta($post_id, '_amazon_maximum_price', esc_attr(trim($_amazon_maximum_price))); update_post_meta($post_id, '_amazon_product_id', esc_attr(trim(@$_POST['wpl_amazon_product_id']))); update_post_meta($post_id, '_amazon_id_type', esc_attr(@$_POST['wpl_amazon_id_type'])); update_post_meta($post_id, '_amazon_condition_type', esc_attr(@$_POST['wpl_amazon_condition_type'])); update_post_meta($post_id, '_amazon_condition_note', esc_attr(@$_POST['wpl_amazon_condition_note'])); update_post_meta($post_id, '_amazon_bullet_point1', esc_attr(@$_POST['wpl_amazon_bullet_point1'])); update_post_meta($post_id, '_amazon_bullet_point2', esc_attr(@$_POST['wpl_amazon_bullet_point2'])); update_post_meta($post_id, '_amazon_bullet_point3', esc_attr(@$_POST['wpl_amazon_bullet_point3'])); update_post_meta($post_id, '_amazon_bullet_point4', esc_attr(@$_POST['wpl_amazon_bullet_point4'])); update_post_meta($post_id, '_amazon_bullet_point5', esc_attr(@$_POST['wpl_amazon_bullet_point5'])); update_post_meta($post_id, '_amazon_generic_keywords1', esc_attr(@$_POST['wpl_amazon_generic_keywords1'])); update_post_meta($post_id, '_amazon_generic_keywords2', esc_attr(@$_POST['wpl_amazon_generic_keywords2'])); update_post_meta($post_id, '_amazon_generic_keywords3', esc_attr(@$_POST['wpl_amazon_generic_keywords3'])); update_post_meta($post_id, '_amazon_generic_keywords4', esc_attr(@$_POST['wpl_amazon_generic_keywords4'])); update_post_meta($post_id, '_amazon_generic_keywords5', esc_attr(@$_POST['wpl_amazon_generic_keywords5'])); update_post_meta($post_id, '_amazon_product_description', esc_attr(@$_POST['wpl_amazon_product_description'])); update_post_meta($post_id, '_wpla_asin', esc_attr(trim(@$_POST['wpl_amazon_asin']))); } // create matched listing when ASIN is entered manually $this->auto_match_ASIN($post_id); // update min/max prices in listings table if (isset($_POST['wpl_amazon_minimum_price'])) { $min_price = $_amazon_minimum_price; $max_price = $_amazon_maximum_price; $data = array(); if ($listing = $lm->getItemByPostID($post_id)) { if ($min_price != $listing->min_price) { $data['min_price'] = $min_price; $data['pnq_status'] = 1; // mark as changed } if ($max_price != $listing->max_price) { $data['max_price'] = $max_price; $data['pnq_status'] = 1; // mark as changed } // update listing if (!empty($data)) { $lm->updateWhere(array('id' => $listing->id), $data); } } } // update custom listings title $lm->updateCustomListingTitle($post_id); }