private function _prep_whois_report() { $this->data->my = 'whois'; $this->data->report_chart = 'na'; // Separate marketplaces from retailers and // group marketplace_products by marketplace $this->data->marketplaces = array(); $this->data->retailers = array(); $markets = $this->report_info->whoisSwitch === 'marketplace' ? getMarketplaceArray($this->report_info->store_id) : getRetailerArray(false, $this->report_info->store_id); $markets = array_to_lower($markets); foreach ($markets as $market) { $crawl_info = $this->crawl_data_m->last_crawl($market); if ($crawl_info) { $from = $crawl_info->start_datetime; $to = $crawl_info->end_datetime; $marketplace_products = $this->merchant_products_m->getCountByMarketplace($this->report_info->store_id, $market, $from, $to); if (!empty($marketplace_products)) { $this->data->marketplace_products[] = $marketplace_products[0]; } } } if (isset($this->data->marketplace_products)) { for ($i = 0, $n = count($this->data->marketplace_products); $i < $n; $i++) { $marketplace = $this->data->marketplace_products[$i]['marketplace']; if ($this->data->marketplace_products[$i]['is_retailer'] === '1') { $merchant = $this->merchant_products_m->getMerchantDetailsByMarketplace($marketplace); if (isset($merchant[0]['id'])) { $this->data->marketplace_products[$i] = array_merge($this->data->marketplace_products[$i], $merchant[0]); $this->data->retailers[] = $this->data->marketplace_products[$i]; } } else { $this->data->marketplaces[] = $this->data->marketplace_products[$i]; } $this->data->marketplace_products[$marketplace] = $this->data->marketplace_products[$i]; unset($this->data->marketplace_products[$i]); } } // sort by keys $this->data->marketplace_keys = array(); if (!empty($this->data->marketplace_products)) { ksort($this->data->marketplace_products); $this->data->marketplace_keys = array_keys($this->data->marketplace_products); // graph data $this->data->gData = mvFormat::whoIsSellingMyProductDefault($this->data->marketplace_products); } $this->data->Data->retailers = $this->data->retailers; $this->data->Data->marketplaces = $this->data->marketplaces; }
/** * Report on marketplace sellers and how many products they are selling. * * @author unknown * @param string $marketplace * @param unknown_type $id */ function report_marketplace($marketplace, $id = false) { // what is this used for? - Christophe if ($id) { $id = base64_decode(urldecode($id)); $this->setDefaultValues($id); $this->data->report_id = $id; } $this->data->marketplace = $marketplace; $this->data->report_name = marketplace_display_name($marketplace) . ' Sellers'; $this->data->file_name = str_replace(' ', '_', $this->data->report_name . ' ' . date('Y-m-d')); $this->data->report_where = array('report_type' => $this->data->report_type, 'report_function' => 'report_marketplace', 'marketplace' => $marketplace); $crawl = $this->crawl_data_m->last_crawl($marketplace); $merchants = $this->merchant_products_m->getCountByMerchant($this->store_id, $marketplace, $crawl->start_datetime, $crawl->end_datetime); for ($i = 0; $i < count($merchants); $i++) { $merchant_info = $this->merchant_products_m->getMerchantDetailsById($merchants[$i]['id']); $merchants[$i]['marketplace_seller_url'] = $this->merchant_products_m->get_marketplace_seller_url($merchant_info, $marketplace); } //var_dump($merchants); exit(); $this->data->merchantList = $merchants; $this->data->gData = mvFormat::whoIsSellingMerchantFormatdata($this->data->merchantList); $this->javascript('views/whois_selling.js.php'); }