PDA

View Full Version : Just want to do a simple thing... can't get it working


carls
27-10-07, 03:23
Hi,
I tried for ages trying to import the csv data that you can download, but i gave up (every time i converted it to sql something would be wrong). Now im trying to use the api to just write the sql inserts that i need

this is the code i have at the moment
define('API', 'PS');

require_once('classes/class.ClientFactory.php');

// replace with your own credentials
$oClient= ClientFactory::getClient("xx", 'xx', 'affiliate');


$aHotPicksParams = array('iCategoryId'=> 364, 'iLimit'=> 100, 'iOffset'=> 0);
//make the SOAP call
$oHotPicks = $oClient->call('getHotPickProductList', $aHotPicksParams);
//get the products array
$aProducts = $oHotPicks->getHotPickProductListReturn;
//print each product name to the page
foreach ($aProducts as $oProduct) {
echo " INSERT INTO `fridgefreezer` ( `id` , `name` , `desc` , `spec` , `sawdeeplink` , `sawthumb` , `sawimage` , `sthumburl` , `simageurl` , `price` , `delivery`, `sDeepLink`, `iMerchantId` )
VALUES (
NULL , \"$oProduct->sName\", \"$oProduct->sDesc\", \"$oProduct->sSpec\", \"$oProduct->sAwDeepLink\", \"$oProduct->sAwThumbUrl\", \"$oProduct->sAwImageUrl\", \"$oProduct->sThumbUrl\", \"$oProduct->sImageUrl\", \"$oProduct->fSearchPrice\", \"$oProduct->fDeliveryCost\", \"$oProduct->sDeepLink\", \"$oProduct->iMerchantId\"
);" ;
echo '<br />';

}
(username/pw taken out)
which works - but i want it to not show just the getHotPickProductListReturn - i want them all. How can i do this? And where is the actual documentation? I can't find any that actually describes anything handy, just about installing that pre written script

thanks

authcode
27-10-07, 18:24
Hi,

The API docs can be found here (http://www.shopwindowforum.com/showthread.php?t=2).

Try this:

$aProductListParams = array('iCategoryId'=>$CATEGORY_ID, 'sSort'=> 'popular', 'iLimit'=>100, 'iOffset'=> 0, 'bIncludeDescendants'=>true);
//make the call
$oProductList = $oClient->call('getProductList', $aProductListParams);
//get the products array
$aProductList = $oProductList->getProductListReturn;


in place of this:
$aHotPicksParams = array('iCategoryId'=> 364, 'iLimit'=> 100, 'iOffset'=> 0);
//make the SOAP call
$oHotPicks = $oClient->call('getHotPickProductList', $aHotPicksParams);
//get the products array
$aProducts = $oHotPicks->getHotPickProductListReturn;

Just remeber to set $CATEGORY_ID and pick your limit. Should do what you want.

carls
01-11-07, 02:15
thanks :). getting somewhere with it now but still a bit stuck

trying to list all in category 381 (freezers) from currys (1599)

trying to use:
$i = 0;
$aProductListParams = array('iMerchantId' => '1599', "iCategoryId"=>381, 'sSort'=> 'popular', 'iLimit'=>100, 'iOffset'=> $i, 'bIncludeDescendants'=>true);

but then when i do
echo "$oProduct->sName ($oProduct->iMerchantId)";

ie, show the merchant id, it comes up with lots that are not merchant 1599, for example

Beko TLDA521W (272)
FRIGIDAIRE R5303B 5.3CF (1597)
INDESIT TLA1 4.6CF (1597)
KTL15V20 (1311)
Beko RA610W (272)
Fridgemaster MTRL130 (272)
FRIDGEMAST MTRL130 4.59CF (1597)
BEKO TLDA628S 13.0CF (1597)
Hotpoint RL175G (272)
Hotpoint RL175P (272)
RSAV21P (1311)
ZANUSSI ZRT175W (1599)
Hotpoint FFU22K (272)
L5026W (1311)
Miele K2202S-1 (272)


how can i get it to only show it from currys (1599)?

I also have another question - will the data that it returns only return from merchants i am approved for? (so if i ran it as is for me at the moment, showing other merchants products, are those merchants approved for me? or if i went and used those links now would it just be a waste as i wouldn't get commission for some?)

ps - are there any resources with many examples of using this?

carls
01-11-07, 02:26
thanks :). getting somewhere with it now but still a bit stuck

trying to list all in category 381 (freezers) from currys (1599)

trying to use:
$i = 0;
$aProductListParams = array('iMerchantId' => '1599', "iCategoryId"=>381, 'sSort'=> 'popular', 'iLimit'=>100, 'iOffset'=> $i, 'bIncludeDescendants'=>true);

but then when i do
echo "$oProduct->sName ($oProduct->iMerchantId)";

ie, show the merchant id, it comes up with lots that are not merchant 1599, for example



how can i get it to only show it from currys (1599)?

I also have another question - will the data that it returns only return from merchants i am approved for? (so if i ran it as is for me at the moment, showing other merchants products, are those merchants approved for me? or if i went and used those links now would it just be a waste as i wouldn't get commission for some?)

ps - are there any resources with many examples of using this?


Nevermind, think i "fixed" it. aCategoryIds didn't exist for getting the product list only icategoryid