-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
62 lines (52 loc) · 1.79 KB
/
Copy pathindex.php
File metadata and controls
62 lines (52 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
error_reporting(~E_ALL);
require_once 'EJParser.php';
require_once 'EJTemplate.php';
require_once 'AltoRouter.php';
$Page = new stdClass();
$Page->url = ""; //base url or sub-folder name
$Page->location->templates = "./templates";
$Page->EJ = (object) array(
"clientId"=> XXXXX, #your e-junkie client ID
"maxRelated"=> 5,
"pref" => array( # Item numbers in respective array
"pinned" => [],
"pinned_down" => [],
"hidden" => [],
"hide_out_of_stock"=> true,
),
"apiKey"=> null #provide key to show all products, you can get it from Seller Admin > Products API
);
$Page->EJ->selectedCategory = null;
$Page->EJ->selectedProduct = null;
$Page->EJ->showTags = true;
$Page->EJ->showSearch = true;
$Page->EJ->shop = "?shop"; #shop page url, ex. store, products, shop
$Page->EJ->product = "?product="; #product page url prefix
if($_GET['shop'] || $_GET['tag'])
$Page->name == "shop"; #If shop page or tag page should be rendered
else if($_GET['product'])
$Page->name == "product"; #If product page should be rendered
if(!isset($_GET['page']))
$Page->pageNo = 1;
else
$Page->pageNo = intval($_GET['page']);
if($Page->pageNo == 0) $Page->pageNo++;
#Set Product or Tag is any is present
if(isset($_GET['product'])) $Page->EJ->selectedProduct = $_GET['product'];
if(isset($_GET['tag'])) $Page->EJ->selectedCategory = $_GET['tag'];
$EJ = new EJParser($Page->EJ->clientId, $Page->EJ->selectedCategory, $Page->EJ->selectedProduct, $Page, $Page->EJ->apiKey);
$EJT = new EJTemplate($Page, null, $EJ);
if(isset($_GET['shop']))
$EJ->getProducts();
else if(isset($_GET['tag']))
$EJ->getTagProducts();
else if(isset($_GET['product']))
$EJ->getProduct();
if(count($EJ->products) == 0){
header("HTTP/1.1 404 Not Found");
die("No products found");
}else{
$EJT->generateShop();
}
die();