Jump to content

Help with ebay call


anilm
Go to solution Solved by tryingtolearn,

Recommended Posts

I have an ebay script which I'm working on, but am not familiar with how to :

call a couple of ebay arrays ($ship for shipping cost, and $cat1 for the product category),

and a couple of other items ($condition to show if it is new,used etc, and $binauc to show if it is a buy it now or auction product)

 

Any help would be appreciated.

 

Here is the relevant part of the script:

                                  $country = isset($result['country'][0]) ? $result['country'][0] : "";

                                  $condition = isset($result['condition'][0]) ? $result['condition'][0] : "";

                                  $ship  = sprintf("%01.2f", $result->shippingInfo->fshippingCost);

                                  $binauc = isset($result['listingInfo'][0]) ? $result['listingInfo'][0] : "";

                                  $cat1  = sprintf($result->primaryCategory->categoryName);

 

 

                                  <div class="col-lg-3 thumbnail"><img class="img-responsive" src="'.$img.'"></div>

                                  <div class="col-lg-4 caption"><a target="_blank" href="'.$url.'"><h3>'.$title.'</h3></a></div>

                                  <div class="col-lg-2"><p class="lead">'.$price.'</p>

                                  <img style="width:30px;height:30px" src="images/flags/'.$country.'.png" />

                                  '.$condition.'

                                  '.$ship.'

                                  '.$binauc.'

                                  '.$cat1.'

                                  </div>

                                  </div>';

 

 

Thanks
Link to comment
Share on other sites

Here is a stab in the dark not seeing your code

You can try:

For  condition use

$cond = $result->condition->conditionDisplayName;
For shipping costs use 
$ship  = sprintf("%01.2f", $result->shippingInfo->shippingServiceCost);
For buy it now available use 
$bina = $result->listingInfo->buyItNowAvailable;
For product category use
$category = $result->primaryCategory->categoryName;
Link to comment
Share on other sites

Thanks, but they didn't work either. Here's everything from that page

 

<div class="container">

<div class="col-lg-3">

</div>

 

 

<div class="col-lg-9">

<div id="myTabs" class="tabbable">

  <ul class="nav nav-tabs">

   <li id="litabAll" class="active"><a title="All" id="atabAll">All</a></li>

   <li id="litab0"><a title="eBay" id="atab0">eBay</a></li>

   <li id="litab1"><a title="Amazon" id="atab1">Amazon</a></li>

</ul>

  <div class="tab-content">

  <div id="tab0" class="tab-pane active">

  <div class="row">

 

  <?php

  if($search != "" && $keyword != ""){

 


$eresults = json_decode($econtent,true);

 

foreach($eresults['findItemsByKeywordsResponse'][0]['searchResult'][0]['item'] as $result){

 

 $title = isset($result['title'][0]) ? $result['title'][0] : "";

 $img = isset($result['galleryURL'][0]) ? $result['galleryURL'][0] : "";

 $url = isset($result['viewItemURL'][0]) ? $result['viewItemURL'][0] : "";

 $price = isset($result['sellingStatus'][0]['currentPrice'][0]["__value__"]) ? $result['sellingStatus'][0]['currentPrice'][0]["__value__"]." ".$result['sellingStatus'][0]['currentPrice'][0]["@currencyId"] : "";

                                  $country = isset($result['country'][0]) ? $result['country'][0] : "";

                                  $condition = isset($result['condition'][0]) ? $result['condition'][0] : "";

                                  $ship  = sprintf("%01.2f", $result->shippingInfo->shippingServiceCost);

                                  $binauc = isset($result['listingInfo'][0]) ? $result['listingInfo'][0] : "";

                                  $cat1  = isset($result['primaryCategory'][0]) ? $result['primaryCategory'][0] : "";

 echo '<div class="row">

                                  <div class="col-lg-3 thumbnail"><img class="img-responsive" src="'.$img.'"></div>

                                  <div class="col-lg-4 caption"><a target="_blank" href="'.$url.'"><h3>'.$title.'</h3></a></div>

                                  <div class="col-lg-2">

                                  <img style="width:30px;height:30px" src="images/flags/'.$country.'.png" />

                                  '.$condition.'

                                  '.$ship.'

                                  '.$binauc.'

                                  '.$cat1.'

                                  </div>

                                  <div class="col-lg-3"><p class="lead">'.$price.'</p></div>

                                  </div>';

}

 

}else{

 


$eresults = json_decode($econtent,true);

$l = 0;

foreach($eresults['findItemsByCategoryResponse'][0]['searchResult'][0]['item'] as $result){

 

 $title = isset($result['title'][0]) ? $result['title'][0] : "";

 $img = isset($result['galleryURL'][0]) ? $result['galleryURL'][0] : "";

 $url = isset($result['viewItemURL'][0]) ? $result['viewItemURL'][0] : "";

 $price = isset($result['sellingStatus'][0]['currentPrice'][0]["__value__"]) ? $result['sellingStatus'][0]['currentPrice'][0]["__value__"]." ".$result['sellingStatus'][0]['currentPrice'][0]["@currencyId"] : "";

                                  $country = isset($result['country'][0]) ? $result['country'][0] : "";

                                  $condition = isset($result['condition'][0]) ? $result['condition'][0] : "";

                                  $ship  = sprintf("%01.2f", $result->shippingInfo->shippingServiceCost);

                                  $binauc = isset($result['listingInfo'][0]) ? $result['listingInfo'][0] : "";

                                  $cat1  = isset($result['primaryCategory'][0]) ? $result['primaryCategory'][0] : "";

 echo '<div class="row">

                                  <div class="col-lg-3 thumbnail"><img class="img-responsive" src="'.$img.'"></div>

                                  <div class="col-lg-4 caption"><a target="_blank" href="'.$url.'"><h3>'.$title.'</h3></a></div>

                                  <div class="col-lg-2">

                                  <img style="width:30px;height:30px" src="images/flags/'.$country.'.png" />

                                  '.$condition.'

                                  '.$ship.'

                                  '.$binauc.'

                                  '.$cat1.'

                                  </div>

                                  <div class="col-lg-3"><p class="lead">'.$price.'</p></div>

                                  </div>';

}

}

  ?>

  </div>

  </div>

 

  <div id="tab1" class="tab-pane active">

  <div class="row">

 

  <?php

  if($search != "" && $keyword != ""){

 

for($i=1;$i<=5;$i++){

$params = array('Operation'=>"ItemSearch",'Service'=>"AWSECommerceService",'ItemPage'=>$i,'ResponseGroup'=>"Medium,OfferFull", 'SearchIndex'=>"All", 'Keywords'=>$keyword);

 

$acontent = file_get_contents_curl(aws_signed_request($aregion, $params, YOUR_AWS_ACCESS_KEY_ID, YOUR_AWS_SECRET_ACCESS_KEY, YOUR_ASSOCIATE_TAG, $version='2011-08-01'));

$xml = simplexml_load_string($acontent);

$json = json_encode($xml);

$aresults = json_decode($json,true);

 

foreach ($aresults['Items']['Item'] as $result) {

 

 $url = $result['DetailPageURL'];

 $img = $result['MediumImage']['URL'];

 $lprice = $result['ItemAttributes']['ListPrice']['FormattedPrice'];

 $title = $result['ItemAttributes']['Title'];

 $offprice = $result['Offers']['Offer']['OfferListing']['Price']['FormattedPrice'];

 if($offprice == "") $price = $lprice;

 else $price = $offprice;

 

                                      echo '<div class="row">

                                  <div class="col-lg-3 thumbnail"><img class="img-responsive" src="'.$img.'"></div>

                                  <div class="col-lg-4 caption"><a target="_blank" href="'.$url.'"><h3>'.$title.'</h3></a></div>

                                  <div class="col-lg-2">

                                  </div>

                                  <div class="col-lg-3"><p class="lead">'.$price.'</p></div>

                                  </div>';

}

if(!isset($aresults['Items']['Item'])) break;

}

 

}else{

 

for($i=1;$i<=5;$i++){

$params = array('Operation'=>"ItemSearch",'Service'=>"AWSECommerceService",'ItemPage'=>$i,'ResponseGroup'=>"Medium,OfferFull", 'SearchIndex'=>$aindex, 'BrowseNode'=>$acat);

 

$acontent = file_get_contents_curl(aws_signed_request($aregion, $params, YOUR_AWS_ACCESS_KEY_ID, YOUR_AWS_SECRET_ACCESS_KEY, YOUR_ASSOCIATE_TAG, $version='2011-08-01'));

$xml = simplexml_load_string($acontent);

$json = json_encode($xml);

$aresults = json_decode($json,true);

 

foreach ($aresults['Items']['Item'] as $result) {

 

 $url = $result['DetailPageURL'];

 $img = $result['MediumImage']['URL'];

 $lprice = $result['ItemAttributes']['ListPrice']['FormattedPrice'];

 $title = $result['ItemAttributes']['Title'];

 $offprice = $result['Offers']['Offer']['OfferListing']['Price']['FormattedPrice'];

 if($offprice == "") $price = $lprice;

 else $price = $offprice;

 

                                      echo '<div class="row">

                                  <div class="col-lg-3 thumbnail"><img class="img-responsive" src="'.$img.'"></div>

                                  <div class="col-lg-4 caption"><a target="_blank" href="'.$url.'"><h3>'.$title.'</h3></a></div>

                                  <div class="col-lg-2">

                                  </div>

                                  <div class="col-lg-3"><p class="lead">'.$price.'</p></div>

                                  </div>';

}

if(!isset($aresults['Items']['Item'])) break;

}

 

}

  ?>

 

 

  </div>

  </div>

 

 

</div>

</div>

 

</div>

</div>

Link to comment
Share on other sites

  • Solution
Hopefully this works better for you..

 

//condition, 



$condition = isset($result['condition'][0]['conditionDisplayName'][0]) ? $result['condition'][0]['conditionDisplayName'][0] : "";


//shipping costs, 



$ship  = sprintf("%01.2f", $result['shippingInfo'][0]['shippingServiceCost'][0]["__value__"]);


buy it now available, 



$binauc = isset($result['buyItNowAvailable'][0]) ? $result['buyItNowAvailable'][0] : "";


product category



$cat1  = isset($result['primaryCategory'][0]['categoryName'][0]) ? $result['primaryCategory'][0]['categoryName'][0] : "";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.