-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstore.php
More file actions
74 lines (65 loc) · 1.99 KB
/
Copy pathstore.php
File metadata and controls
74 lines (65 loc) · 1.99 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
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/**
* Created by PhpStorm.
* User: OMAR BARA
* Date: 01/01/2018
* Time: 11:39 PM
*
*/
session_start();
include "functions.php";
include "header.php";
include 'classes.php';
?>
<body>
<div class="container">
<?php
//function to { read category file} $$ { phonexx file }
$category_content = file_get_contents("Products/categories.txt");
$singleCategory = explode("\n",$category_content);
//call function display item
$counter = 0;
$co = count($singleCategory);
//populate the (index.php)
foreach ( $singleCategory as $item ) {
$co--;
if (isset($item[0])) {
$elements = explode(",", $item);
$id = $elements[0];
$name = $elements[3];
$imagePath = $elements[1];
$filePath = $elements[2];
$Category = new Category($id, $name, $imagePath, $filePath);
//call function search for match id and return price & color
$arr = find_phone_info($filePath,$id);
$price = $arr[1];
$color = $arr[0];
$sale = $arr[2];//chek if there is a Sale??????
if ($sale == 'sale'){
$sale = 0.3 * $price;
}else $sale = 0;
$Category->setColor($color);
$Category->setPrice($price);
$Category->setSale($sale);
/*function to display 3 item in each rows*/
if ($counter == 2 ) {
echo $Category->outputTable();
$counter = 0;
echo '</div><div><br><br><br><hr width="50%" size=".9">';
}else if ($counter == 0) {
echo '<div class="row" >';echo $Category->outputTable();
$counter++;
}else if ($counter == 1 ) {
echo $Category->outputTable();$counter++;
}else if (($counter == 0 || $counter = 1) && ($co == 1)) {
echo '</div>';
}
}
}
echo '</div>'
?>
</div>
<br><br>
</body>
<?php include 'footer.php';
?>