<th>Retail</th> <th>MAP</th> <th>Price</th> <th>Violation</th> <th>URL</th> </tr> </thead> <tbody> <?php $_mNames = array(); ?> <?php for ($i = 0, $n = sizeof($violations); $i < $n; $i++) { ?> <?php $mName = marketplace_display_name($violations[$i]['original_name']); ?> <tr> <td> <?php echo ucfirst($violations[$i]['title']); ?> </td> <td> <a href="/merchants/profile/<?php echo $violations[$i]['merchant']['id']; ?> "><?php echo $mName; ?> </a>
?> <?php $mName = $violations[$i]['original_name']; /* $merchant = $this->merchant_products_m->getMerchantDetailsBySellerId($violations[$i]['merchant_id'], $violations[$i]['marketplace']); if ( ! $merchant) { $mName = 'Unknown'; } else $mName = empty($merchant['original_name']) ? $merchant['merchant_name'] : $merchant['original_name']; */ ?> <tr> <td><?php echo marketplace_display_name($violations[$i]['marketplace']); ?> </td> <td><?php echo isset($violations[$i]['merchant_id']) ? '<a href="' . base_url() . 'violationoverview/violator_report/' . $violations[$i]['merchant_id'] . '">' . $mName . '</a>' : 'Unknown'; ?> </td> <td><?php echo date('m/d/Y', $violations[$i]['timestamp']); ?> </td> <td><?php echo date('h:i A', $violations[$i]['timestamp']); ?> </td> <td>$<?php
?> <img src="<?php echo frontImageUrl(); ?> market_logos/<?php echo $key; ?> .png" alt="<?php echo marketplace_display_name($key); ?> "> <?php } else { ?> <div style="float:left"><?php echo marketplace_display_name($key); ?> </div> <?php } ?> <span class="violationCount"><?php echo $violation_count; ?> </span> </a> <?php } } } ?>
</strong> </h3> </div> <div class="panel-body"> <div id="panel-breadcrumbs"> <i class="fa fa-caret-square-o-right"></i> <a href="/">Home</a> <i class="fa fa-angle-right"></i> Market Visibility <i class="fa fa-angle-right"></i> Who's Selling My Products <i class="fa fa-angle-right"></i> <a href="<?php echo base_url() . 'whois'; ?> " id="breadMarket">Marketplaces</a> <i class="fa fa-angle-right"></i> <?php echo marketplace_display_name($marketplace); ?> </div> <?php if (count($merchantList) > 0) { ?> <div id="repChartContainer"></div> <div id="reports-top-area"> <div id="report-save-options"> <?php echo $this->load->view('components/save_options', '', TRUE); ?> <div class="clear"></div>
?> " onclick="hideShowSeries(this, <?php echo $marektPlaceListCount; ?> )" class="mt27 mr5"> </span> <span class="mt27 mr5 bar-gar-options" style="display: inline-block; margin-left: 2px;"> <span class="squareKey" style="background-color:#<?php echo marketplace_graph_color($val); ?> "></span> <a href="javascript:;" class="chart_filter" rel="<?php echo $key; ?> "><?php echo marketplace_display_name($val); ?> </a> </span><br /><?php } } } else { $search_product_ids = $this->input->post("products"); $search_product_names = $this->input->post("product_name"); if (!empty($search_product_ids)) { if (!is_array($search_product_ids)) { $search_product_ids = array($search_product_ids); } if (!is_array($search_product_names)) { $search_product_names = array($search_product_names); }
function getMarketHTML($markertArr, $markets, $mode = 0) { //debug('Markets',$markets,2); //debug('MarketsArr',$markertArr,2); //echo "MODE=>".$mode; if ($mode == 1) { $html = '<div class="select_report" id="market_container"> <div class="select_report_left" style="margin-top:4px;"> <p>Select Markets</p> </div> <div class="select_report_right"> <div class="input_bg fl" style="margin:0;"> <span class="lft_area"></span><span class="rgt_area"><div class="fl data_txt" id="market_box_txt">ALL MARKETS</div> <a href="javascript:void(0);" onclick="ShowFilterOptions(\'all_markets\');" class="arrow"></a></span> </div> <div class="clear"></div> <div class="check_list2" id="all_markets" style="display:none;"> <ul>'; } else { $html = ' <div class="fl"> <div class="input_bg fl"> <span class="lft_area"></span><span class="rgt_area"><div class="fl data_txt" id="market_box_txt">ALL MARKETS</div> <a href="javascript:void(0);" onclick="ShowFilterOptions(\'all_markets\');" class="arrow"></a></span> </div> <div class="clear"></div> <div class="check_list" id="all_markets" style="display:none;"> <ul>'; } if ($markertArr) { if (isset($markets) && in_array('all', $markets)) { $html .= '<li class="merchant_all"><input type="checkbox" class="mrChk" name="markets[]" value="all" checked="checked" onclick="textChange(this,\'mrChk\',\'market_box_txt\',\'ALL MARKETS\');" rel="all" /> ALL MARKETS</li>'; } else { if (isset($markets) && count($markets) > 0 && !in_array('all', $markets)) { $html .= '<li class="merchant_all"><input type="checkbox" class="mrChk" name="markets[]" value="all" onclick="textChange(this,\'mrChk\',\'market_box_txt\',\'ALL MARKETS\');" rel="all" /> ALL MARKETS</li>'; } else { $html .= '<li class="merchant_all"><input type="checkbox" class="mrChk" name="markets[]" value="all" checked="checked" onclick="textChange(this,\'mrChk\',\'market_box_txt\',\'ALL MARKETS\');" rel="all" /> ALL MARKETS</li>'; } } foreach ($markertArr as $val) { $checked = ''; if (isset($markets) && (in_array(strtolower($val), $markets) || in_array($val, $markets))) { $checked = 'checked="checked"'; } $html .= '<li class="merchant_' . strtolower($val) . '"><input type="checkbox" class="mrChk" name="markets[]" value="' . $val . '" ' . $checked . ' onclick="textChange(this,\'mrChk\',\'market_box_txt\',\'ALL MARKETS\');" rel="' . strtolower($val) . '"/> ' . marketplace_display_name($val) . '</li>'; } } if ($mode == 1) { $html .= '</ul></div></div></div>'; } else { $html .= '</ul></div></div>'; } return $html; }
/** * * function whoIsSellingMyProductDefault * * @param array $gData * * */ public static function whoIsSellingMyProductDefault($gData) { $series = $includedCols = $includedColors = array(); foreach ($gData as $val) { $series[] = array('name' => marketplace_display_name($val['marketplace']), 'data' => array((int) $val['total_products']), 'dashStyle' => 'Dot', 'color' => '#' . marketplace_graph_color($val['marketplace']), 'id' => 'merchant_count'); array_push($includedCols, $val['marketplace']); array_push($includedColors, '#' . marketplace_graph_color($val['marketplace'])); } /* For Google Charts */ $googleDataArray = array(array_merge(array('Date'), array_map('marketplace_display_name', $includedCols))); $maxValue = 0; $cat = array(date('Y-m-d')); foreach ($cat as $keyCat => $vCat) { $googleDataArray[$keyCat + 1][] = $vCat; foreach ($series as $seriesData) { $valueForDisplay = isset($seriesData['data'][$keyCat]) ? $seriesData['data'][$keyCat] : 0; $googleDataArray[$keyCat + 1][] = $valueForDisplay; if ($valueForDisplay > $maxValue) { $maxValue = $valueForDisplay; } } } $graph_data = array('data' => $series, 'y_title' => 'Products', 'x_title' => 'Date', 'cat' => $cat, 'type' => 'column', 'googleData' => $googleDataArray, 'googleDataColors' => array_values($includedColors), 'maxValue' => $maxValue); /* END FOR Google Charts */ return $graph_data; }
/** * * @author unknown * @param string $marketplace * @param int $merchantId * @param int $reportId */ function report_merchant($marketplace, $merchantId, $reportId = false) { $this->data->retailer = $this->marketplace_m->is_retailer($marketplace); $this->data->marketplace = $marketplace; $merchant_details = $this->merchant_products_m->getMerchantDetailsById($merchantId); $this->data->merchant = $this->data->original_name = trim($merchant_details['original_name']); $this->data->show_notify_resource = $merchantId; $this->data->report_where = array('report_type' => $this->data->report_type, 'is_retailer' => $this->data->retailer, 'report_function' => 'report_merchant', 'marketplace' => $marketplace, 'merchant_id' => $merchantId, 'time_frame' => '24'); if ($reportId) { $this->data->report_id = base64_decode(urldecode($reportId)); } $this->data->report_name = $this->data->retailer ? marketplace_display_name($marketplace) . ' Product Listing' : marketplace_display_name($marketplace) . ' Seller: ' . marketplace_display_name($this->data->merchant) . ' Product Listing'; $this->data->file_name = str_replace(' ', '_', $this->data->report_name); //view data $this->data->time_frame = '24'; $lastCrawl = $this->crawl_data_m->last_crawl($marketplace); //var_dump($lastCrawl); exit(); $this->crawl_range = $this->crawl_data_m->last_crawl_range(); $this->data->crawl_range = $this->crawl_range; if ($this->config->item('environment') == 'local') { $crawl_range_from_int = strtotime('2015-08-01 00:00:00'); $crawl_range_to_int = strtotime('2015-08-02 00:00:00'); } else { $crawl_range_from_int = strtotime($this->crawl_range['from']); $crawl_range_to_int = strtotime($this->crawl_range['to']); } //TODO //this should occur in the reports model... //now setup the product data $productQuery = "SELECT\n\t\t\t\tptn.um as hashKey,\n\t\t\t\tcmn.seller_id,\n\t\t\t\tp.upc_code,\n\t\t\t\tp.sku,\n\t\t\t\tp.title,\n\t\t\t\tp.retail_price,\n\t\t\t\tp.wholesale_price,\n\t\t\t\tcmn.merchant_name,\n\t\t\t\tcmn.original_name,\n\t\t\t\tptn.dt\n\t\t\tFROM\n\t\t\t\t{$this->_table_products_trends} ptn\n\t\t\tINNER JOIN {$this->_table_crowl_merchant_name} cmn ON cmn.id = ptn.mid\n\t\t\tLEFT JOIN {$this->_table_products} p ON p.id = ptn.pid\n\t\t\tWHERE p.store_id IN (" . getStoreIdList($this->store_id, TRUE) . ")\n\t\t\t\tAND ptn.ar = '{$marketplace}'\n\t\t\t\tAND cmn.id = {$merchantId}\n\t\t\t\tAND ptn.dt >= {$crawl_range_from_int}\n\t\t\t\tAND ptn.dt <= {$crawl_range_to_int}\n\t\t\tGROUP BY hashKey"; //echo "<PRE>"; //echo $productQuery; //exit; $products = $this->db->query($productQuery)->result(); $finalProductsArray = array(); $gData = array('violoation' => 0, 'non_violoation' => 0); $hashes = array(); if (empty($products)) { } else { foreach ($products as $product) { $hashes[] = $product->hashKey; $products_assoc[$product->hashKey] = $product; } $priceTrends = $this->ProductsTrends->get_all_by_hashkeys_and_date_range($hashes, strtotime($lastCrawl->start_datetime), strtotime($lastCrawl->end_datetime)); foreach ($priceTrends->result_object() as $priceTrend) { if ((double) $priceTrend->mpo >= (double) $priceTrend->ap) { $gData['non_violoation']++; } else { $gData['violoation']++; } $violationArray = array('productId' => (int) $priceTrend->pid, 'upc_code' => (string) $priceTrend->upc, 'retail' => $priceTrend->rp ? (double) $priceTrend->rp : $products_assoc[$priceTrend->um]->retail_price, 'wholesale' => $priceTrend->wp ? (double) $priceTrend->wp : $products_assoc[$priceTrend->um]->wholesale_price, 'price' => (double) $priceTrend->mpo, 'map' => (double) $priceTrend->ap, 'title' => (string) $priceTrend->t, 'title2' => (string) $products_assoc[$priceTrend->um]->title, 'marketplace' => (string) $priceTrend->ar, 'url' => (string) $priceTrend->l, 'timestamp' => (int) $priceTrend->dt, 'hash_key' => (string) $priceTrend->um, 'hashKey' => (string) $priceTrend->um, 'merchant_id' => (string) $products_assoc[$priceTrend->um]->seller_id, 'original_name' => (string) $products_assoc[$priceTrend->um]->original_name, 'sku' => (string) $products_assoc[$priceTrend->um]->sku, 'date' => (string) date('m/d/Y G:i:s', (int) $priceTrend->dt), 'shot' => (string) $priceTrend->ss); $finalProductsArray[$priceTrend->pid] = $violationArray; } } $googleDataArray = array(); $googleDataArray[0] = array('State', 'Count'); $googleDataArray[] = array('Non Violation', $gData['non_violoation']); $googleDataArray[] = array('Violation', $gData['violoation']); $gData['googleData'] = $googleDataArray; $gData['type'] = 'pie'; $this->data->Data = $finalProductsArray; $this->data->gData = $gData; // violator notification data $this->data->merchant_id = $merchantId; $this->data->show_notify_resource = $merchantId; $this->data->violator_notification = $this->store_m->get_violator_notification_by_seller($merchantId, $this->store_id); $this->data->smtp = $this->store_m->get_store_smtp_by_store($this->store_id); $this->data->default_email_from = $this->Store->get_smtp_email($this->data->smtp); //array_push($this->javascript_files, 'views/merchant_report.php'); }