You can implement category navigation using Loop54. This is a fast and easy way to retrieve products and can also be extended with features such as faceting, custom sorting, personal or aggregated popularity sorting and more.
$request = new Loop54_Request("ProductsInCategory");
$request->setValue("RequestEntity",new Loop54_Entity("Category",$_GET{"category"}));
$request->setValue("ProductsInCategory_FromIndex", 0);
$request->setValue("ProductsInCategory_ToIndex", 9);
$response = Loop54_RequestHandling::getResponse("http://helloworld.54proxy.com", $request);
if ($response->success)
{
if($response->hasData("ProductsInCategory"))
{
$results = $response->getCollection("ProductsInCategory");
if(count($results)==0)
echo "There were no items in this category.";
foreach($results as $resultItem)
{
$productId = $resultItem->key->externalId;
$productTitle = $resultItem->key->getStringAttribute("Title");
echo $productId . " " . $productTitle; //render a product on the category listing page
}
}
}
else
{
echo $response->requestId; //log this
}
POST to http://helloworld.54proxy.com/productsincategory
{
"UserId" : "helloworlduser",
"IP" : "127.0.0.1",
"RequestEntity":{
"EntityType":"Category",
"ExternalId":"Fruit"
},
"ProductsInCategory_FromIndex" : 0,
"ProductsInCategory_ToIndex" : 9,
}
Response: 200 OK
{
"Success": true,
"HeroId": "The Count with not enough Writing Sisters",
"Data": {
"ProductsInCategory": [
{
"Key": {
"ExternalId": "1",
"EntityType": "Product",
"Attributes": {
"Manufacturer": [
"The banana company"
],
"Category": [
"Fruit"
],
"Title": [
"Banana"
],
"SubCategory": [
"Musaceae"
]
}
},
"Value": 1
},
{
"Key": {
"ExternalId": "7",
"EntityType": "Product",
"Attributes": {
"Manufacturer": [
"The banana company"
],
"Category": [
"Fruit"
],
"Title": [
"Organic Apple"
],
"SubCategory": [
"Rosaceae"
]
}
},
"Value": 0
},
{
"Key": {
"ExternalId": "3",
"EntityType": "Product",
"Attributes": {
"Manufacturer": [
"Fruits n Veggies"
],
"Category": [
"Fruit"
],
"Title": [
"Apple"
],
"SubCategory": [
"Rosaceae"
]
}
},
"Value": 0
},
{
"Key": {
"ExternalId": "17",
"EntityType": "Product",
"Attributes": {
"Manufacturer": [
"Fruits n Veggies"
],
"Category": [
"Fruit"
],
"Title": [
"Orange"
],
"SubCategory": [
"Citrus"
]
}
},
"Value": 0
}
]
}
}
The API V2X-based Java Connector is no longer supported.
You can view code examples for the V3-based Connector at
https://github.com/LoopFiftyFour/Java-Connector
The API V2X-based .NET Connector is no longer supported.
You can view code examples for the V3-based Connector at
https://github.com/LoopFiftyFour/.NET-Connector
Product overview
Technology