You are here:  » Ebay api - manual fix


Ebay api - manual fix

Submitted by philstone on Sat, 2017-11-25 16:16 in

Hi David

Some time ago we setup an ASIN field with the amazon api which when specified in admin/productsmap_configure.php overides the EAN auto result, is it possible to do the same with the ebay API, so if i created an ebayitemid field in the product map page, if specified it would overide the ean auto match product?

I'm just trying to find a solution to the following page

{link saved}

Thanks

Phil

Submitted by support on Mon, 2017-11-27 10:27

Hello Phil,

Sure - it can be set-up to work exactly like the modified Amazon API module (itemLookup by ASIN if configured in Product Mapping). Use the following dbmod.php script (run once from top level)

<?php
  
require("includes/common.php");
  
$sql "ALTER TABLE `".$config_databaseTablePrefix."productsmap` ADD ebayitemid VARCHAR(255)";
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

Edit admin/productsmap_configure.php and look for the following code at line 63:

              asin = '".database_safe($_POST["asin"])."'

...and REPLACE with:

              asin = '".database_safe($_POST["asin"])."',
              ebayitemid = '".database_safe($_POST["ebayitemid"])."'

And then the following code at line 96:

  widget_textBox("Amazon ASIN","asin",FALSE,$productmap["asin"],"",6);

...and REPLACE with:

  widget_textBox("Amazon ASIN","asin",FALSE,$productmap["asin"],"",6);
  widget_textBox("eBay Item ID","asin",FALSE,$productmap["ebayitemid"],"",6);

Then referring to previous ebayproduct.php from email, look for the following code beginning at line 53:

  $ebayIdType = "";
  $ebayItemId = "";
  foreach($rows as $row)
  {
    if ($row["sku"])
    {
      $ebayIdType = "EAN";
      $ebayItemId = $row["sku"];
      break;
    }
  }

...and REPLACE with:

  $ebayIdType = "";
  $ebayItemId = "";
  if ($ebayIdType == "")
  {
    $sql = "SELECT ebayitemid FROM `".$config_databaseTablePrefix."productsmap` WHERE ebayitemid <> '' AND name='".database_safe($rows[0]["name"])."'";
    if (database_querySelect($sql,$ebayResult))
    {
      $ebayIdType = "ITEMID";
      $ebayItemId = $ebayResult[0]["ebayitemid"];
    }
  }
  if ($ebayIdType == "")
  {
    foreach($rows as $row)
    {
      if ($row["sku"])
      {
        $ebayIdType = "EAN";
        $ebayItemId = $row["sku"];
        break;
      }
    }
  }

Cheers,
David.
--
PriceTapestry.com

Submitted by philstone on Mon, 2017-11-27 22:05

Perfect David!

Works perfectly!

Thanks so much!