Skip to content

Instantly share code, notes, and snippets.

@bigin

bigin/products2.php

Last active Feb 13, 2017
Embed
What would you like to do?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Basic catalog skeleton :: Products</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="<?php get_theme_url(); ?>/css/normalize.css">
<link rel="stylesheet" href="<?php get_theme_url(); ?>/css/skeleton.css">
</head>
<body>
<div class="container">
<h1>MY PRETTY CATALOG</h1>
<?php
// Show product list
if(!empty($categoryItems)) { ?>
<h6>Select a product</h6>
<hr>
<?php
foreach($categoryItems as $product) { ?>
<div class="row">
<div class="eight columns">
<h2><a href="./?product=<?php echo $product->id; ?>"><?php echo $product->name; ?></a></h2>
<div>
<p><?php echo '<a href="./?product='.$product->id.'">'.getResized($product->fields->images, 300).'</a>'; ?></p>
<div class="category_text"><?php echo $product->fields->summary->value; ?>
<a href="./?product=<?php echo $product->id; ?>">Products details</a>
</div>
</div>
<hr>
</div>
</div>
<?php }
}
// Schow product details
if(!empty($currentProduct)) { ?>
<h6>Product details</h6>
<hr>
<div class="row">
<div class="eight columns">
<div>
<p><?php echo getResized($currentProduct->fields->images, 500); ?></p>
<h2><?php echo $currentProduct->name; ?></h2>
<div class="category_text"><?php echo $currentProduct->fields->description->value; ?>
<div class="price">Price: <?php echo money_format('%!n €', $currentProduct->fields->price->value); ?></div>
<div class="created">Created: <?php echo date('l jS \of F Y', $currentProduct->fields->date->value); ?></div>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment