static function updatePendingFeedForAccount($account) { WPLA()->logger->info('updatePendingFeedForAccount(' . $account->id . ') - ' . $account->title); WPLA()->logger->info('------------------------------'); $lm = new WPLA_ListingsModel(); // build feed(s) for updated (changed,prepared,matched) products WPLA()->logger->start('getGroupedPendingProductsForAccount'); $grouped_items = $lm->getPendingProductsForAccount_GroupedByTemplateType($account->id); WPLA()->logger->logTime('getGroupedPendingProductsForAccount'); WPLA()->logger->info('found ' . sizeof($grouped_items) . ' different templates to process...'); // WPLA()->logger->info('grouped items: '.print_r($grouped_items,1)); // echo "<pre>";print_r($grouped_items);echo"</pre>";#die(); // each template $processed_tpl_types = array(); foreach ($grouped_items as $tpl_id => $grouped_inner_items) { // get template $template = $tpl_id ? new WPLA_AmazonFeedTemplate($tpl_id) : false; $template_type = $template ? $template->name : 'Offer'; // each profile foreach ($grouped_inner_items as $profile_id => $items) { WPLA()->logger->info('building listing items feed for profile_id: ' . $profile_id); WPLA()->logger->info('TemplateType: ' . $template_type . ' - tpl_id: ' . $tpl_id); WPLA()->logger->info('number of items: ' . sizeof($items)); // get profile $profile = new WPLA_AmazonProfile($profile_id); // append if a feed with the same template type has been generated just now $append_feed = in_array($template_type, $processed_tpl_types); // build Listing Data or ListingLoader feed WPLA()->logger->start('buildFeed'); $success = WPLA_AmazonFeed::buildFeed('_POST_FLAT_FILE_LISTINGS_DATA_', $items, $account, $profile, $append_feed); WPLA()->logger->logTime('buildFeed'); // if a feed was created, add template type to list of processed templates if ($success) { $processed_tpl_types[] = $template_type; } } // WPLA()->logger->logSpentTime('parseProductColumn'); // WPLA()->logger->logSpentTime('parseProfileShortcode'); // WPLA()->logger->logSpentTime('parseVariationAttributeColumn'); // WPLA()->logger->logSpentTime('processAttributeShortcodes'); // WPLA()->logger->logSpentTime('processCustomMetaShortcodes'); } // foreach $grouped_items // build Price and Quantity feed for this account $items = $lm->getAllProductsForAccountByPnqStatus($account->id, 1); WPLA()->logger->info('number of PNQ items: ' . sizeof($items)); WPLA_AmazonFeed::buildFeed('_POST_FLAT_FILE_PRICEANDQUANTITYONLY_UPDATE_DATA_', $items, $account); // build delete products feed for this account $items = $lm->getAllProductsInTrashForAccount($account->id); WPLA()->logger->info('listings in trash: ' . sizeof($items)); WPLA_AmazonFeed::buildFeed('_POST_FLAT_FILE_INVLOADER_DATA_', $items, $account); }