/** * sample_GetCategories::dispatchCall() * * Dispatch the call * * @param array $params array of parameters for the eBay API call * * @return boolean success */ public function dispatchCall($params) { $req = new GetCategoriesRequestType(); $req->setCategoryParent($params['CategoryParent']); $res = $this->proxy->GetCategories($req); if ($this->testValid($res)) { $this->dumpObject($res); return true; } else { return false; } }
$rparen = RPAREN; $detail_level = 'ReturnAll'; $insert = INSERT_INTO . TABLE_EBAY_CATEGORIES . " (name, id, parentid, leaf) VALUES ("; for ($j = 0, $n = count($catRootList); $j < $n; $j++) { $mycattype = $catRootList[$j]; $sqlstring = $insert; $sqlstring .= APOS . addslashes($mycattype->getCategoryName()) . $comma; $sqlstring .= APOS . $mycattype->getCategoryID() . $comma; $sqlstring .= $null; $sqlstring .= APOS . $mycattype->getLeafCategory() . APOS . $rparen; olc_db_query($sqlstring); //subcategories $req1 = new GetCategoriesRequestType(); $req1->DetailLevel = $detail_level; $req1->LevelLimit = 255; $req1->setCategoryParent($mycattype->getCategoryID()); $res1 = $cs->GetCategories($req1); //get subcategories from api and save them $catList = $res1->getCategoryArray(); for ($k = 1, $m = count($catList); $k < $m; $k++) { $mycattype1 = $catList[$k]; $parentid = $mycattype1->getCategoryParentID(); $sqlstring_sub = $insert; $sqlstring_sub .= APOS . addslashes($mycattype1->getCategoryName()) . $comma; $sqlstring_sub .= APOS . $mycattype1->getCategoryID() . $comma; $sqlstring_sub .= APOS . $parentid[0] . $comma; $sqlstring_sub .= APOS . $mycattype1->getLeafCategory() . APOS . $rparen; olc_db_query($sqlstring_sub); } } //update category version and update time in db