-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattributes.php
More file actions
29 lines (25 loc) · 761 Bytes
/
attributes.php
File metadata and controls
29 lines (25 loc) · 761 Bytes
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
<?php
//requre init file
require 'init.php';
//get all attributes to the index
$attributes = $db->getAll('attributes')->toArray();
//get all generated variations
$get_variations = $db->getAll('variations')->toArray();
//unserilize the variation meta and save to new array
$variations = [];
if($get_variations){
foreach($get_variations as $variation) {
$variations[] = [
'id' => $variation['id'],
'meta' => unserialize($variation['meta']),
'price' => $variation['price'],
'quantity' => $variation['quantity'],
'default' => $variation['default']
];
}
}
//rendering index.html template to the system
echo $twig->render('attributes.html', [
'attributes' => $attributes,
'variations' => $variations
]);