Xanj
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Woot, never mind I figured it out! 🙂
Don’t ask me how I did it, lots of trial and error lol. Probably many cleaner ways to accomplish this, but it works for exactly what I was trying to do.
Basically I had to change all the ‘add_post_meta’ to ‘update_post_meta’ and create a copy of the $cj_post array, called it $my_post instead. The I added a $getid query that was similar to the $checkid one but had to make it get the post_id and put that in the $my_post array.
Looks something like this now in middle of the cj-functions.php:
if (count ($checkid) > 0) { $getid = $wpdb->get_row ("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='cj_datafeed' AND meta_value='$SKU'", 'ARRAY_A'); $my_post = array( 'ID' => $getid['post_id'], 'post_title' => $cj_opt_title, 'post_content' => $cj_opt_post, 'post_status' => 'publish', 'post_author' => 1, 'post_category' => $cj_category_ids, 'post_type' => 'post', 'ping_status' => 'close', 'tags_input' => $cj_opt_tag, 'comment_status' => 'close' ); // Retrieve Post ID $cj_insert_id1 = wp_update_post( $my_post ); // Add meta_key for double post check update_post_meta($cj_insert_id1, "cj_datafeed", $SKU); // Add raw data for future use like rebuild function update_post_meta($cj_insert_id1, "cj_programname", $PROGRAMNAME); update_post_meta($cj_insert_id1, "cj_programurl", $PROGRAMURL); update_post_meta($cj_insert_id1, "cj_catalogname", $CATALOGNAME); update_post_meta($cj_insert_id1, "cj_lastupdated", $LASTUPDATED); update_post_meta($cj_insert_id1, "cj_name", $NAME); update_post_meta($cj_insert_id1, "cj_keywords", $KEYWORDS); update_post_meta($cj_insert_id1, "cj_description", $DESCRIPTION); update_post_meta($cj_insert_id1, "cj_sku", $SKU); //before v1.5 need to know to support older version ... maybe ( was buggy with cj_manufacturer replace fct and cj_manufacturerid //update_post_meta($cj_insert_id1, "cj_manufacturer", $MANUFACTURER); update_post_meta($cj_insert_id1, "cj_manufacturername", $MANUFACTURER); update_post_meta($cj_insert_id1, "cj_manufacturerid", $MANUFACTURERID); update_post_meta($cj_insert_id1, "cj_upc", $UPC); update_post_meta($cj_insert_id1, "cj_isbn", $ISBN); update_post_meta($cj_insert_id1, "cj_currency", $CURRENCY); update_post_meta($cj_insert_id1, "cj_saleprice", $SALEPRICE); update_post_meta($cj_insert_id1, "cj_price", $PRICE); update_post_meta($cj_insert_id1, "cj_retailprice", $RETAILPRICE); update_post_meta($cj_insert_id1, "cj_fromprice", $FROMPRICE); update_post_meta($cj_insert_id1, "cj_buyurl", $BUYURL); update_post_meta($cj_insert_id1, "cj_impressionurl", $IMPRESSIONURL); update_post_meta($cj_insert_id1, "cj_imageurl", $IMAGEURL); update_post_meta($cj_insert_id1, "cj_advertisercategory", $ADVERTISERCATEGORY); update_post_meta($cj_insert_id1, "cj_thirdpartyid", $THIRDPARTYID); update_post_meta($cj_insert_id1, "cj_thirdpartycategory", $THIRDPARTYCATEGORY); update_post_meta($cj_insert_id1, "cj_author", $AUTHOR); update_post_meta($cj_insert_id1, "cj_artist", $ARTIST); update_post_meta($cj_insert_id1, "cj_title", $TITLE); update_post_meta($cj_insert_id1, "cj_publisher", $PUBLISHER); update_post_meta($cj_insert_id1, "cj_label", $LABEL); update_post_meta($cj_insert_id1, "cj_format", $FORMAT); update_post_meta($cj_insert_id1, "cj_special", $SPECIAL); update_post_meta($cj_insert_id1, "cj_gift", $GIFT); update_post_meta($cj_insert_id1, "cj_promotionaltext", $PROMOTIONALTEXT); update_post_meta($cj_insert_id1, "cj_enddate", $ENDDATE); update_post_meta($cj_insert_id1, "cj_startdate", $STARTDATE); update_post_meta($cj_insert_id1, "cj_offline",$OFFLINE); update_post_meta($cj_insert_id1, "cj_online", $ONLINE); update_post_meta($cj_insert_id1, "cj_instock", $INSTOCK); update_post_meta($cj_insert_id1, "cj_condition", $CONDITION); update_post_meta($cj_insert_id1, "cj_warranty", $WARRANTY); update_post_meta($cj_insert_id1, "cj_standardshippingcost", $STANDARDSHIPPINGCOST); // Display something to the user echo"Updating... $NAME... with post date $cj_future_post...<br> "; echo " $getid[post_id] <br> "; // $cj_message = "Updating... $NAME... with post date $cj_future_post...<br> "; // cj_admin_message($cj_message); }Forum: Plugins
In reply to: [CJ-Datafeed] [Plugin: CJ-Datafeed] Using Time IntervalI have the same exact issue. I need the timestamps to be different otherwise the posts publish in the wrong order and appear to post all on the same date/time.
Viewing 2 replies - 1 through 2 (of 2 total)