You are here:  » Unmapped


Unmapped

Submitted by wesse249 on Mon, 2017-03-13 12:15 in

Hello David,

This is my unmapped script. This script shows all unmapped categories of all merchants.

Is it possible to customize the script so that i can see for the merchant seperatly the unmapped categories.

Like http://example.com/unmapped.php?=merchantname

This is my script:

<?php
  
require("includes/common.php");
  
$atoz["items"] = array();
  
$sql "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products_all` WHERE categoryid='0' ORDER BY category";
  if (
database_querySelect($sql,$rows))
  {
    foreach(
$rows as $product)
    {
      if (
$product["category"])
      {
        
$item = array();
        
$item["name"] = $product["category"];
        
$item["href"] = "search.php?q=feedcategory:".urlencode($product["category"]);
        
$atoz["items"][] = $item;
      }
    }
  }
  
$banner["h2"] = "<strong>Unmapped Categories</strong>";
  require(
"html/menu.php");
  require(
"html/searchform.php");
  require(
"html/banner.php");
  require(
"html/atoz.php");
  require(
"html/footer.php");
?>

Thanks Jan Roel

Submitted by support on Mon, 2017-03-13 15:24

Hello Jan,

Sure - have a go with the following;

<?php
  
require("includes/common.php");
  
$merchant = (isset($_GET["merchant"])?$_GET["merchant"]:"");
  
$atoz["items"] = array();
  
$where " categoryid='0' ";
  if (
$merchant)
  {
    
$where .= " AND merchant='".database_safe($merchant)."' ";
  }
  
$sql "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products_all` WHERE ".$where." ORDER BY category";
  if (
database_querySelect($sql,$rows))
  {
    foreach(
$rows as $product)
    {
      if (
$product["category"])
      {
        
$item = array();
        
$item["name"] = $product["category"];
        
$item["href"] = "search.php?q=feedcategory:".urlencode($product["category"]);
        
$atoz["items"][] = $item;
      }
    }
  }
  
$banner["h2"] = "<strong>Unmapped Categories</strong>";
  require(
"html/menu.php");
  require(
"html/searchform.php");
  require(
"html/banner.php");
  require(
"html/atoz.php");
  require(
"html/footer.php");
?>

...and use:

http://example.com/unmapped.php?merchant=merchantname

Cheers,
David.
--
PriceTapestry.com