Jump to content

anilm

Members
  • Posts

    12
  • Joined

  • Last visited

anilm's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. That's brilliant. Thanks so much for your time.
  2. 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 != ""){ $econtent = file_get_contents("http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.0.0&SECURITY-APPNAME=$your_ebay_app_id&RESPONSE-DATA-FORMAT=JSON&REST-PAYLOAD&affiliate.networkId=9&affiliate.trackingId=$your_ebay_affiliate_tracking_id&affiliate.customId=$your_ebay_affiliate_custom_id&paginationInput.entriesPerPage=100&paginationInput.pageNumber=1&GLOBAL-ID=$eregion&keywords=".urlencode($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{ $econtent = file_get_contents("http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByCategory&SERVICE-VERSION=1.0.0&SECURITY-APPNAME=$your_ebay_app_id&RESPONSE-DATA-FORMAT=JSON&REST-PAYLOAD&affiliate.networkId=9&affiliate.trackingId=$your_ebay_affiliate_tracking_id&affiliate.customId=$your_ebay_affiliate_custom_id&paginationInput.entriesPerPage=100&paginationInput.pageNumber=1&GLOBAL-ID=$eregion&categoryId=".$ecat); $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>
  3. Yes it is finding the API. I get the images, product descriptions, prices and locations. I'm just not sure what the format should be to call the condition, shipping costs, buy it now available, and product category
  4. Hi. Is this what you are referring to? http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.0.0&SECURITY-APPNAME=$your_ebay_app_id&RESPONSE-DATA-FORMAT=JSON&REST-PAYLOAD&affiliate.networkId=9&affiliate.trackingId=$your_ebay_affiliate_tracking_id&affiliate.customId=$your_ebay_affiliate_custom_id&paginationInput.entriesPerPage=100&paginationInput.pageNumber=1&GLOBAL-ID=$eregion&keywords=".urlencode($keyword));
  5. 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
  6. Hi. I have 2 problems which I'm hopeing someone can help me with. 1. For the following script to change the pages language, I would like it so that whichever option selected is set on the page (i.e. if you select Euskal, the select box stays set as Euskal, and not Espanyol as it does at the moment) <form name="Language" action="" method="post" id="Language"> <div class="btn-group"> <?php $uri = strtok($_SERVER["REQUEST_URI"],'?');; $url="http://".$_SERVER['HTTP_HOST'].$uri; ?> <span class="btn btn-primary"> <select name="lang" onchange="javascript:change_langs(this.form)"> <option value="Esp">Espanyol</option> <option value="Eng">English</option> <option value="Cat">Catalan</option> <option value="Bas">Euskal</option> <option value="Gal">Galego</option> </select> </span> </div></form> 2. I have 2 dropdown lists in the following format: <select class="form-control" name='category'> <option <?php print ((isset($_GET["category"]) && ($_GET["category"]=="A"))?"selected='A'":""); ?> value='A'><?=getlg($lang,"A")?></option> <option <?php print ((isset($_GET["category"]) && ($_GET["category"]=="b"))?"selected='b'":""); ?> value='b'><?=getlg($lang,"b")?></option> <option <?php print ((isset($_GET["category"]) && ($_GET["category"]=="c"))?"selected='c'":""); ?> value='c'><?=getlg($lang,"c")?></option> </select> <select class="form-control" name='category'> <option <?php print ((isset($_GET["category"]) && ($_GET["category"]=="D"))?"selected='D'":""); ?> value='D'><?=getlg($lang,"D")?></option> <option <?php print ((isset($_GET["category"]) && ($_GET["category"]=="e"))?"selected='e'":""); ?> value='e'><?=getlg($lang,"e")?></option> <option <?php print ((isset($_GET["category"]) && ($_GET["category"]=="f"))?"selected='f'":""); ?> value='f'><?=getlg($lang,"f")?></option> </select> However, I require just one dropdown list with catagories A and D as the main item. Catagories b & c should be a sub category of A, and e & f should be a sub category of D Any help would be appreciated. Thanks
  7. Hello. Sorry for the delay getting back about this. I am quite new to programming, so was wondering if you could explain your previous post: At the moment, I now have the following: <script type="text/javascript"> function go(){ location=document.langu. options[document.langu.selectedIndex].value.search.php } </script> <form name='search' action='<?php print $config_baseHREF ?>search.php'> <select class="form-control" name="langu" size="1" onChange="go()"> <option value='es'>Espanyol</option> <option <?php print ((isset($_GET["langu"]) && ($_GET["langu"]=="es"))?"selected='selected'":""); ?> value='en'>English</option> </select> </form> and another file which has: <?php switch($_SERVER["REQUEST_URI"]) { case "/search.php?langu=en": // Spanish $translate["Idioma"] = "Language"; $translate["Nuevo"] = "New"; $translate["Usado"] = "Used";.....etc break; } function translate($text) { global $translate; return (isset($translate[$text])?$translate[$text]:$text); } ?> Sorry to ask such a basic question, but could you tell me how I should incorporate your previous suggestion. Thanks
  8. Sorry, but the 2 urls above should be: mywebsite.es/index.php?lang=es/search.php?location=&type1=&price1=&condition=&category=&q=shoes and mywebsite.es/search.php?location=&type1=&price1=&condition=&category=&q=shoes
  9. Hello. I'm not sure if I'm in the correct forum, but here is the problem. I have registered with Amazon for their API's in all European countries. On my website, I want to consolidate and output the results from these countries when a search has been performed. At the moment I have this, for just 1 country (I've omitted irrelevant stuff), but would there be a php script to help accomplish what I want, and also to print out which amazon website the result came from...i.e. amazon.co.uk, amazon.es, amazon.de....? Thanks <?php $amazonAWSAccessKeyId = "aaa"; $amazonSecretAccessKey = "bbb"; $amazonAssociateTag = "ccc"; function amazonSign($url,$secretAccessKey) { // 0. Append Timestamp parameter $url .= "&Timestamp=".gmdate("Y-m-d\TH:i:s\Z"); // 1a. Sort the UTF-8 query string components by parameter name $urlParts = parse_url($url); parse_str($urlParts["query"],$queryVars); ksort($queryVars); // 1b. URL encode the parameter name and values $encodedVars = array(); foreach($queryVars as $key => $value) { $encodedVars[amazonEncode($key)] = amazonEncode($value); } // 1c. 1d. Reconstruct encoded query $encodedQueryVars = array(); foreach($encodedVars as $key => $value) { $encodedQueryVars[] = $key."=".$value; } $encodedQuery = implode("&",$encodedQueryVars); // 2. Create the string to sign $stringToSign = "GET"; $stringToSign .= "\n".strtolower($urlParts["host"]); $stringToSign .= "\n".$urlParts["path"]; $stringToSign .= "\n".$encodedQuery; // 3. Calculate an RFC 2104-compliant HMAC with the string you just created, // your Secret Access Key as the key, and SHA256 as the hash algorithm. if (function_exists("hash_hmac")) { $hmac = hash_hmac("sha256",$stringToSign,$secretAccessKey,TRUE); } elseif(function_exists("mhash")) { $hmac = mhash(MHASH_SHA256,$stringToSign,$secretAccessKey); } else { die("No hash function available!"); } // 4. Convert the resulting value to base64 $hmacBase64 = base64_encode($hmac); // 5. Use the resulting value as the value of the Signature request parameter // (URL encoded as per step 1b) $url .= "&Signature=".amazonEncode($hmacBase64); return $url; } // $q is set by both search.php and products.php if ($q) { // construct Amazon Web Services REST Query URL $url = "http://webservices.amazon.co.uk/onca/xml?Service=AWSECommerceService"; $url .= "&Version=2009-03-01"; $url .= "&Operation=ItemSearch"; $url .= "&AWSAccessKeyId=".$amazonAWSAccessKeyId; $url .= "&AssociateTag=".$amazonAssociateTag; $url .= "&ResponseGroup=Medium"; // sign $url = amazonSign($url,$amazonSecretAccessKey); $xml = file_get_contents($url);
  10. Hi 1. I have a website , and at the top of the page, there is a dropdown list to let the users specify either English and Spanish as a language. This works fine if the language is the first selection made on the webpage, and the URL changes to http://www.mywebsite.es/index.php?lang=es if Spanish..as it should. However, if I perform a search further down the page using either free text entry, or by any of the other dropdown boxes, then the language part of the URL is not recognized. So, instead of a search result ending up as http://www.mywebsite.es/index.php?lang=es/search.php?location=&type1=&price1=&condition=&category=&q=shoes I get http://www.cocoba.es/search.php?location=&type1=&price1=&condition=&category=&q=shoes Here are snippets of the script I have at the moment: <script type="text/javascript"> function go(){ location=document.lan.langu. options[document.lan.langu.selectedIndex].value } </script> <form name="lan"> <select name="langu" size="1" onChange="go()"> <option><?php print translate("Language"); ?></option> <option value="">English</option> <option value="/index.php?lang=es">EspaƱol</option> </select> </form> <form name='search' action='<?php print $config_baseHREF ?>search.php'> (the search.php files calls up the rest of the URL after the language). 2. Also, if the language is changed half way through a session, is there a way to change the language of the page, so that the existing content on the webpage remains, and does not go back to the home page. Thanks
  11. Hi I need to replace country abbreviations with the appropriate country flag. The php line on the website is a call from an ebay api: print "<h5>".$item["COUNTRY"]."</h5>"; so, if the country is Spain, the result ES is printed I have an image folder with all the countries flags, and this particular case, it is called ES.png. There is also a mySql database in the format: ID, name,abbr (in this case: 1,Spain,ES) Is there an easy way to do this dynamically? Thanks
×
×
  • 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.