コード例 #1
0
 public function insertVariationListing($var, $product_node, $parent_listing, $account)
 {
     // get variation product data
     // $variation_id         = $var['post_id'];
     // echo "<pre>";print_r($var);echo"</pre>";#die();
     // generate title suffix from attribute values
     $suffix = join(', ', $var->attribute_values);
     // build single variation listing item
     $data = array();
     $data['post_id'] = '';
     // filled in after creating the product
     $data['parent_id'] = $parent_listing->post_id;
     $data['vtheme'] = $var->vtheme;
     $data['listing_title'] = $product_node->AttributeSets->ItemAttributes->Title . ' - ' . $suffix;
     // $data['post_content']  = $post->post_content;
     $data['price'] = $var->price;
     $data['quantity'] = $var->qty;
     $data['sku'] = $var->sku;
     $data['asin'] = $var->asin;
     $data['date_created'] = date('Y-m-d H:i:s', time());
     $data['status'] = 'matched';
     $data['source'] = 'foreign_import';
     $data['account_id'] = $account->id;
     $data['product_type'] = 'variation';
     // $data['profile_id']    = '';
     $lm = new WPLA_ListingsModel();
     $variation_listing_id = $lm->insertListingData($data);
     return $variation_listing_id;
 }