42868d70
andryeyev
Создал GIT
|
1
|
<?php
|
42868d70
andryeyev
Создал GIT
|
2
|
|
e8fe9e4a
andryeyev
+ format price.php
|
3
4
5
6
7
8
9
10
|
set_time_limit (0);
header ("Content-Type: text/xml");
require ("./libs/setup.php");
$setup = new setup ();
$db = $setup->db;
$objCatalogs = $setup->setupClass ("Catalogs");
function escapeLoc ($loc)
|
42868d70
andryeyev
Создал GIT
|
11
|
{
|
e8fe9e4a
andryeyev
+ format price.php
|
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
$patterns = array ();
$patterns[0] = '/&/';
$patterns[1] = '/\'/';
$patterns[2] = '/"/';
$patterns[3] = '/>/';
$patterns[4] = '/</';
$replacements = array ();
$replacements[4] = '&';
$replacements[3] = ''';
$replacements[2] = '"';
$replacements[1] = '>';
$replacements[0] = '<';
$loc = preg_replace ($patterns, $replacements, $loc);
return $loc;
|
42868d70
andryeyev
Создал GIT
|
27
28
|
}
|
e8fe9e4a
andryeyev
+ format price.php
|
29
30
31
32
|
function nohtml ($string)
{
return preg_replace ('/[^a-zà-ÿ¸\.\,\?\! 0-9]/i', '', $string);
}
|
42868d70
andryeyev
Создал GIT
|
33
|
|
e8fe9e4a
andryeyev
+ format price.php
|
34
35
36
37
38
39
40
|
function modCodeNew ($product_id)
{
global $objCatalogs;
return $objCatalogs->db->getOne ('select new_code from catalogs_modifications where active=1 and product_id=? and new_code<>""', array (
$product_id
));
}
|
42868d70
andryeyev
Создал GIT
|
41
|
|
e8fe9e4a
andryeyev
+ format price.php
|
42
43
44
45
46
47
|
print '<?xml version="1.0" encoding="windows-1251" ?>';
print "<price>";
print "<date>" . date ("Y-m-d h:m") . "</date>";
print "<firmName>ExtremStyle</firmName>";
print "<firmId></firmId>";
print "<rate></rate>";
|
42868d70
andryeyev
Создал GIT
|
48
|
|
e8fe9e4a
andryeyev
+ format price.php
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
$res = $db->getAll ("select * from catalogs_rubrics where is_xml=?", array (
0
), DB_FETCHMODE_ASSOC);
// print_r($res);
$rubrics = array ();
print "<categories>";
foreach ($res as $row)
{
$rubrics[] = $row['id'];
print "<category>";
print "<id>" . $row['id'] . "</id>";
print "<parentId>" . $row['parent_id'] . "</parentId>";
print "<name>" . $row['name'] . "</name>";
print "</category>";
|
42868d70
andryeyev
Создал GIT
|
63
|
}
|
e8fe9e4a
andryeyev
+ format price.php
|
64
|
print "</categories>";
|
42868d70
andryeyev
Создал GIT
|
65
|
|
e8fe9e4a
andryeyev
+ format price.php
|
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
print "<items>";
foreach ($rubrics as $rub)
{
$res = $db->getAll ("
select p.*,r.translit as rubric_translit,r.is_xml2,b.name as brend,r.list_name
from catalogs_products p
LEFT JOIN catalogs_rubrics r ON r.id=p.rubric_id
LEFT JOIN catalogs_brends b ON b.id=p.brend_id
where p.rubric_id=?
and p.count_modifications>0",
array (
$rub
), DB_FETCHMODE_ASSOC);
foreach ($res as $row)
{
print "<item>";
print "<id>" . $row['id'] . "</id>";
print "<categoryId>" . $row['rubric_id'] . "</categoryId>";
if ($row['rubric_id'] != 14055)
print "<group_id>0" . $row['id'] . "</group_id>";
print "<code></code>";
print "<vendor>" . htmlspecialchars (escapeLoc ($row['brend'])) . "</vendor>";
$row['ph1'] = $objCatalogs->getFilterPh1 ($row['id']);
$f = $objCatalogs->viewFilterProduct ($row['id']);
$f_arr = array ();
foreach ($f as $_f)
{
$f_arr[] = $_f['name'];
}
$f_str = (count ($f_arr) > 0) ? implode (', ', $f_arr) : '';
print "<name>" . htmlspecialchars (escapeLoc ($row['ph1'])) . ' ' . htmlspecialchars (escapeLoc ($row['list_name'])) . ' ' . htmlspecialchars (escapeLoc ($row['brend'])) . ' ' . htmlspecialchars (escapeLoc ($row['name'])) . ' ' . htmlspecialchars (escapeLoc ($f_str)) . ' ' . modCodeNew ($row['id']) . "</name>";
print "<description>" . htmlspecialchars (nohtml (stripcslashes ($row['text']))) . "</description>";
print "<url>http://extremstyle.ua/" . htmlspecialchars (escapeLoc ($row['rubric_translit'])) . "-catalogs/" . htmlspecialchars (escapeLoc ($row['translit'])) . "-" . $row['id'] . "/</url>";
print "<image>http://extremstyle.ua/uploaded/pic/catalogs/products/" . $row['pic'] . "</image>";
print "<priceRUAH>" . round ($row['cine'] - ($row['cine'] * $row['salepc'] / 100)) . "</priceRUAH>";
// print"<priceRUAH>" . $row['cine'] . "</priceRUAH>";
print "<oldprice>" . $row['cine'] . "</oldprice>";
print "<priceRUSD></priceRUSD>";
print "<stock>Íà ñêëàäå</stock>";
print "<guarantee></guarantee>";
IF ($row['is_xml2'] == 1 && $row['rubric_id'] != 14055)
{
if ($row['sex'] == 1)
$sex = 'Ìóæñêîé';
elseif ($row['sex'] == 2)
$sex = 'Æåíñêèé';
elseif ($row['sex'] == 3)
$sex = 'Äåòñêèé';
elseif ($row['sex'] == 4)
$sex = 'Óíèñåêñ';
else
$sex = '';
$res_m = $db->getAll ("
select *
from catalogs_modifications
where active=1
and product_id=?", array (
$row['id']
), DB_FETCHMODE_ASSOC);
foreach ($res_m as $row_m)
{
print '<param name="Ðàçìåð" unit="INT">' . $row_m['size'] . '</param>';
print '<param name="Öâåò">' . (($row['rubric_id'] == 14055) ? $row_m['color'] : $row_m['color2']) . '</param>';
print '<param name="Ïîë">' . $sex . '</param>';
print '<param name="Âîçðàñò"></param>';
print '<param name="Ðåïëèêà"></param>';
print '<param name="Òèï">' . htmlspecialchars (escapeLoc ($row['list_name'])) . '</param>';
print '<param name="Ìàòåðèàë"></param>';
print '<param name="Êàïþøîí"></param>';
print '<param name="Êàðìàíû"></param>';
}
}
print "</item>";
}
}
|
42868d70
andryeyev
Создал GIT
|
151
|
|
e8fe9e4a
andryeyev
+ format price.php
|
152
|
print "</items>";
|
42868d70
andryeyev
Создал GIT
|
153
|
|
e8fe9e4a
andryeyev
+ format price.php
|
154
|
print "</price>";
|
42868d70
andryeyev
Создал GIT
|
155
|
?>
|