With PopShops you can create a dynamic website or multi-category site out of a single shop. Here's how.
We have had several people asking how to easily make a dynamic site without having to hand pick everything. I'm going to outline a very basic approach that could be taken.
Note:You will need an enterprise account and a search enabled shop.
I just saw Iron Man last night :-), so I'm going to go with a superhero themed shop.
The final result will be a site with a home page, and four categories: Superman, Batman, Iron Man, Incredible Hulk
All we need is two pages: index.php, category.php
The index page will contain a static shop I have hand picked the products for, that also has search enabled. The categories will be dynamically generated based on keywords.
First we will create the categories:
<? $categories = array('Superman', 'Batman', 'Iron Man', 'Incredible Hulk'); ?>
Now we will use the categories to create some navigation links. All this is doing is taking the categories and adding them as psps_search parameters onto links pointing to the category page.
<h2>Categories:</h2>
<? foreach ($categories as $category) { ?>
<a href="/category.php?psps_search=<?= urlencode($category) ?>"><?= $category ?></a><br/>
<? } ?>
The category.php will contain the same shop snippet. When the category.php page is loaded with the parameter psps_search, it automatically does a search and brings back the search results.
And now this site has dynamic pages created from one shop targeting specific 'categories' of products based on keywords.
Note: The search ONLY searches merchants that have been added to the shop in shopbuilder. You will have to handpick at least one product from every merchant you want in the search.And here is the entire code for the site (The CSS in this code can be ignored. It was for overriding the CSS in the shop to make the site even more unique):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>PickPacks.com</title>
<style type="text/css" media="screen">
body { background: #000; }
body #PopShop47229 .pspsPager{text-align:left;padding:10px;}
body #PopShop47229 .pspsPager a,
body #PopShop47229 .pspsPager span{color: #fff;font-weight:normal;text-decoration:none;padding:2px;border:none;}
body #PopShop47229 .pspsPager .pspsCurrentPage{background-color:#286ea8;color:#fff;}
body #PopShop47229 .pspsPager .pspsInactivePage{color:#fff;}
body, body p {
color: #959595;
font-family: "Lucida Grande",Geneva,Arial,Verdana;
font-size: 12px;
line-height: 16px;
}
body #PopShop47229 {
background: #2f2f2f;
padding: 21px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
body #PopShop47229 td.pspsCell a, a {
color: #286ea8;
text-decoration:none;
}
body #PopShop47229 td.pspsCell img {
background: #161616;
padding: 14px;
margin-left:7px;
border-width:0;
width: 125px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
body #PopShop47229 td.pspsCell .pspsText a {
background: #161616;
display:block;
padding: 7px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
body #PopShop47229 td.pspsCell a:hover, a:hover {
color: #f3a201
}
body #PopShop47229 td.pspsCell {
background:#232323;
border:none;
color: #fff;
font-size: 12px;
padding: 14px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
body #PopShop47229 p.pspsText a {
color: #f3a201;
font-weight:bold;
}
body #PopShop47229 .pspsMain, body #PopShop47229 .pspsText {
margin: 0 auto;
width: 100%;
}
h1 { font-size: 24px; line-height: 32px; color:#f3a201;}
.categories { width: 200px; position:absolute; margin-left: 700px;}
.shop-canvas { margin-right: 200px; width: 675px; }
</style>
</head>
<body>
<div class="head">
<h1>PickPacks.com</h1>
</div>
<div class="categories">
<?
# START THE CATEGORIES
# This is a basic example of what you can do to create dynamic
# categories in your site. The following code simply defines
# several categories and then loops through them creating
# links back to this page adding the category as a parameter.
?>
<? $categories = array('Laptop Backpack', 'Mountaineering BackPack', 'Adidas Backpack', 'Kid Backpack', 'Plush Backpack', 'Picnic Backpack'); ?>
<h2>Categories:</h2>
<? foreach ($categories as $category) { ?>
<a href="index.php?psps_search=<?= urlencode($category) ?>"><?= $category ?></a><br/>
<? } # /END OF THE CATEGORIES ?>
</div>
<div class="shop-canvas">
<?php
# This is the normal php snippet that you would get from
# the Pop It In tab. You would just replace this with your snippet.
if(!isset($_SERVER['REQUEST_URI'])) {
$psps_base_url = $_SERVER['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $psps_base_url .= $HTTP_SERVER_VARS['QUERY_STRING']; }
} else {
$psps_base_url = $_SERVER['REQUEST_URI'];
}
$psps_parameters = '';
foreach ($_REQUEST as $key => $value) {
if (strpos($key,"psps_") > -1 ) {
$psps_parameters .= '&'.$key.'='.urlencode($value);
$psps_base_url = str_replace('&'.$key.'='.urlencode($value), "", $psps_base_url);
$psps_base_url = str_replace($key.'='.urlencode($value), "", $psps_base_url);
}
}
$psps_parameters .= "&psps_show_search=true";
$psps_parameters .= "&psps_show_navigation=true";
$psps_parameters .= "&psps_show_products=true";
$psps_url = "?psps_base_url=".urlencode($psps_base_url);
$psps_url="http://shops.popshops.com/shops/php/7yfnyoa5f41j04abid8ippjy1$psps_url$psps_parameters";
# Include the shop
if (function_exists('curl_init')) {
$shop=curl_init();
curl_setopt($shop,CURLOPT_URL,$psps_url);
curl_exec($shop);
curl_close($shop);
} else {
readfile($psps_url);
}
?>
</div>
</body>
</html>