Ejemplo n.º 1
0
// empty variables - end
if ($_GET["username"]) {
    try {
        $shop_details = $api->getShopDetails($_GET["username"]);
        foreach ($shop_details->result->shop->shop_categories as $shop_category) {
            $category_content .= "<li><a href='show.php?username="******"username"] . "&shop_cat=" . $shop_category->id . "'>" . $shop_category->name . "</a></li>";
        }
        $current_page = isset($_GET["page"]) ? $_GET["page"] : 1;
        $shop_category = isset($_GET["shop_cat"]) ? $_GET["shop_cat"] : $shop_details->result->shop->shop_categories[0]->id;
        $products = $api->getProductsForShopCategory($shop_category, array("page" => $current_page));
        $max_page = $products->pages;
        if (count($products->result->products) == 0) {
            $product_content .= "<li>No products in this category.</li>";
        } else {
            foreach ($products->result->products as $product) {
                $product_content .= "<li>" . "<a href='" . $api->getHost() . "/product/{$product->id}' target='_blank'>" . "<img border='0' src='" . $product->default_image->listview . "'>" . "</a>" . "<span>" . substr($product->name, 0, 25) . (strlen($product->name) > 25 ? "..." : "") . "</span>" . "<div style='clear:both'></div>" . "<span>" . substr($product->user->name, 0, 20) . (strlen($product->name) > 20 ? "..." : "") . "</span>" . "<span style='float:right'>" . $product->price->cents / 100 . " " . $product->price->currency_code . "</span>" . "</li>";
            }
        }
    } catch (Exception $e) {
        $error = "Username is invalid!";
    }
}
?>

<html>
  <head><?php 
require "head.php";
?>
</head>
  <body>
    <div id="mainContainer">