Version Notes
Version 2.1.1:
* Improve stability on newer versions of PHP
* Cleanup some code
* Improve checks in admin panel
Download this release
Release Info
Developer | stockinchannel |
Extension | stockinthechannel2012 |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.9 to 2.1.1
- app/code/local/Bintime/Sinchimport/Block/Adminhtml/Catalog/Product/Sinchdistributors.php +25 -25
- app/code/local/Bintime/Sinchimport/Block/Importenvironment.php +210 -210
- app/code/local/Bintime/Sinchimport/Block/Layer/Filter/Feature.php +17 -17
- app/code/local/Bintime/Sinchimport/Block/Layer/View.php +48 -48
- app/code/local/Bintime/Sinchimport/Block/List.php +159 -159
- app/code/local/Bintime/Sinchimport/Helper/Image.php +73 -73
- app/code/local/Bintime/Sinchimport/Model/Image.php +118 -118
- app/code/local/Bintime/Sinchimport/Model/Layer.php +49 -49
- app/code/local/Bintime/Sinchimport/Model/Layer/Filter/Feature.php +248 -260
- app/code/local/Bintime/Sinchimport/Model/Layer/Filter/Price.php +189 -194
- app/code/local/Bintime/Sinchimport/Model/Resource/Layer/Filter/Price.php +1 -2
- app/code/local/Bintime/Sinchimport/Model/Resource/Mysql4/Layer/Filter/Feature.php +381 -383
- app/code/local/Bintime/Sinchimport/Model/Sinch.php +48 -21
- app/code/local/Bintime/Sinchimport/Model/System/Config/ServerList.php +26 -26
- app/code/local/Bintime/Sinchimport/etc/api.xml +34 -34
- app/code/local/Bintime/Sinchimport/etc/config.xml +267 -267
- app/code/local/Bintime/Sinchimport/etc/system.xml +194 -194
- app/code/local/Bintime/Sinchimport/sinch_import_start_ajax.php +13 -13
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/filter_sinch_products_s.sql +207 -207
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-install-0.1.0.php +142 -142
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-0.1.0-0.1.1.php +67 -67
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-0.1.1-0.1.2.php +63 -63
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-0.1.2-0.1.3.php +133 -133
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-0.1.3-0.1.4.php +53 -53
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-0.1.4-0.1.5.php +33 -33
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-0.1.5-0.1.6.php +15 -15
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-0.1.6-0.1.7.php +274 -274
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-0.1.7-0.1.8.php +108 -108
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-0.1.8-0.1.9.php +16 -16
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-0.1.9-0.2.0.php +123 -123
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-0.2.0-0.2.1.php +108 -108
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-0.2.1-0.2.2.php +230 -230
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-3.0.0-3.0.1.php +307 -307
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-3.0.1-3.0.2.php +108 -108
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-3.0.2-3.0.3.php +42 -42
- app/code/local/Bintime/Sinchimport/sql/sinchimport_setup/mysql4-upgrade-3.0.3-3.0.4.php +50 -50
- app/code/local/Bintime/Sinchimport/stock_price_sinch_import_start_ajax.php +14 -14
- package.xml +8 -6
app/code/local/Bintime/Sinchimport/Block/Adminhtml/Catalog/Product/Sinchdistributors.php
CHANGED
@@ -1,25 +1,25 @@
|
|
1 |
-
<?php
|
2 |
-
class Bintime_Sinchimport_Block_Adminhtml_Catalog_Product_Sinchdistributors extends Mage_Core_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
3 |
-
{
|
4 |
-
public function __construct(){
|
5 |
-
$this->setTemplate('sinchimport/sinchdistributors.phtml');
|
6 |
-
parent::__construct();
|
7 |
-
}
|
8 |
-
|
9 |
-
//Label to be shown in the tab
|
10 |
-
public function getTabLabel(){
|
11 |
-
return Mage::helper('core')->__('Suppliers');
|
12 |
-
}
|
13 |
-
|
14 |
-
public function getTabTitle(){
|
15 |
-
return Mage::helper('core')->__('Suppliers');
|
16 |
-
}
|
17 |
-
|
18 |
-
public function canShowTab(){
|
19 |
-
return true;
|
20 |
-
}
|
21 |
-
|
22 |
-
public function isHidden(){
|
23 |
-
return false;
|
24 |
-
}
|
25 |
-
}
|
1 |
+
<?php
|
2 |
+
class Bintime_Sinchimport_Block_Adminhtml_Catalog_Product_Sinchdistributors extends Mage_Core_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
3 |
+
{
|
4 |
+
public function __construct(){
|
5 |
+
$this->setTemplate('sinchimport/sinchdistributors.phtml');
|
6 |
+
parent::__construct();
|
7 |
+
}
|
8 |
+
|
9 |
+
//Label to be shown in the tab
|
10 |
+
public function getTabLabel(){
|
11 |
+
return Mage::helper('core')->__('Suppliers');
|
12 |
+
}
|
13 |
+
|
14 |
+
public function getTabTitle(){
|
15 |
+
return Mage::helper('core')->__('Suppliers');
|
16 |
+
}
|
17 |
+
|
18 |
+
public function canShowTab(){
|
19 |
+
return true;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function isHidden(){
|
23 |
+
return false;
|
24 |
+
}
|
25 |
+
}
|
app/code/local/Bintime/Sinchimport/Block/Importenvironment.php
CHANGED
@@ -1,210 +1,210 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
class Bintime_Sinchimport_Block_Importenvironment extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
12 |
-
$this->setElement($element);
|
13 |
-
$url = $this->getUrl('sinchimport/index');
|
14 |
-
$this->setElement($element);
|
15 |
-
|
16 |
-
$html = '';
|
17 |
-
|
18 |
-
//$html .= '<div class="comment"><H3>'.("Your Stock In The Channel Environment Check Summary" ).'</H3></div>';
|
19 |
-
|
20 |
-
//$html .= '<div class="comment"><H3>'.("In order for this extension to work, your server needs to be configured in a particular way and have sufficient memory." ).'</H3></div>';
|
21 |
-
|
22 |
-
|
23 |
-
$html .= '
|
24 |
-
<table class="history">
|
25 |
-
<thead>
|
26 |
-
<tr>
|
27 |
-
<th>Checked</th>
|
28 |
-
<th>Necessary, Error And Fix</th>
|
29 |
-
|
30 |
-
</tr>
|
31 |
-
</thead><tbody>';
|
32 |
-
// <th>Necessary</th>
|
33 |
-
// <th>Fix</th>
|
34 |
-
|
35 |
-
$errors_count = 0;
|
36 |
-
|
37 |
-
// Memory total
|
38 |
-
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkMemory();
|
39 |
-
if ($status == 'error') $errors_count++;
|
40 |
-
if ($status == 'error') {
|
41 |
-
$html .= // $caption: $value $measure
|
42 |
-
"
|
43 |
-
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
44 |
-
<tr> <td nowrap> {$this->_colored('Necessary:', 'blue')} $critical $measure </td> </tr>
|
45 |
-
<tr> <td nowrap> {$this->_colored('Notice:', 'blue')} $errmsg </td> </tr>
|
46 |
-
<tr> <td nowrap> {$this->_colored('Fix:', 'blue')} $fixmsg </td> </tr>
|
47 |
-
";
|
48 |
-
};
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
// Mysql parameter LOCAL DATA LOCAL
|
53 |
-
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkLoaddata();
|
54 |
-
if ($status == 'error') $errors_count++;
|
55 |
-
if ($status == 'error') {
|
56 |
-
$html .= // $caption: $value $measure
|
57 |
-
"
|
58 |
-
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
59 |
-
<tr> <td nowrap> {$this->_colored('Necessary:', 'red')} $critical $measure </td> </tr>
|
60 |
-
<tr> <td nowrap> {$this->_colored('Error:', 'red')} $errmsg </td> </tr>
|
61 |
-
<tr> <td nowrap> {$this->_colored('Fix:', 'red')} $fixmsg </td> </tr>
|
62 |
-
";
|
63 |
-
};
|
64 |
-
|
65 |
-
|
66 |
-
// PHP safe mode
|
67 |
-
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkPhpsafemode();
|
68 |
-
if ($status == 'error') $errors_count++;
|
69 |
-
if ($status == 'error') {
|
70 |
-
$html .= // $caption: $value $measure
|
71 |
-
"
|
72 |
-
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
73 |
-
<tr> <td nowrap> {$this->_colored('Necessary:', 'red')} $critical $measure </td> </tr>
|
74 |
-
<tr> <td nowrap> {$this->_colored('Error:', 'red')} $errmsg </td> </tr>
|
75 |
-
<tr> <td nowrap> {$this->_colored('Fix:', 'red')} $fixmsg </td> </tr>
|
76 |
-
";
|
77 |
-
};
|
78 |
-
|
79 |
-
|
80 |
-
// Mysql parameter wait_timeout
|
81 |
-
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkWaittimeout();
|
82 |
-
if ($status == 'error') $errors_count++;
|
83 |
-
if ($status == 'error') {
|
84 |
-
$html .= // $caption: $value $measure
|
85 |
-
"
|
86 |
-
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
87 |
-
<tr> <td nowrap> {$this->_colored('Necessary:', 'blue')} $critical $measure </td> </tr>
|
88 |
-
<tr> <td nowrap> {$this->_colored('Notice:', 'blue')} $errmsg </td> </tr>
|
89 |
-
<tr> <td nowrap> {$this->_colored('Fix:', 'blue')} $fixmsg </td> </tr>
|
90 |
-
";
|
91 |
-
};
|
92 |
-
|
93 |
-
|
94 |
-
// Mysql parameter innodb_buffer_pool_size
|
95 |
-
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkInnodbbufferpoolsize();
|
96 |
-
if ($status == 'error') $errors_count++;
|
97 |
-
if ($status == 'error') {
|
98 |
-
$html .= // $caption: $value $measure
|
99 |
-
"
|
100 |
-
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
101 |
-
<tr> <td nowrap> {$this->_colored('Necessary:', 'blue')} $critical $measure </td> </tr>
|
102 |
-
<tr> <td nowrap> {$this->_colored('Notice:', 'blue')} $errmsg </td> </tr>
|
103 |
-
<tr> <td nowrap> {$this->_colored('Fix:', 'blue')} $fixmsg </td> </tr>
|
104 |
-
";
|
105 |
-
};
|
106 |
-
|
107 |
-
|
108 |
-
// Conflict with installed module
|
109 |
-
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkConflictsWithInstalledModules();
|
110 |
-
if ($status == 'error') $errors_count++;
|
111 |
-
if ($status == 'error') {
|
112 |
-
$html .= // $caption: $value $measure
|
113 |
-
"
|
114 |
-
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
115 |
-
<tr> <td nowrap> {$this->_colored('Necessary:', 'blue')} $critical $measure </td> </tr>
|
116 |
-
<tr> <td nowrap> {$this->_colored('Notice:', 'blue')} $errmsg </td> </tr>
|
117 |
-
<tr> <td nowrap> {$this->_colored('Fix:', 'blue')} $fixmsg </td> </tr>
|
118 |
-
";
|
119 |
-
};
|
120 |
-
|
121 |
-
|
122 |
-
// PHP run string
|
123 |
-
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkPhprunstring();
|
124 |
-
if ($status == 'error') $errors_count++;
|
125 |
-
if ($status == 'error') {
|
126 |
-
$html .= // $caption: $value $measure
|
127 |
-
"
|
128 |
-
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
129 |
-
<tr> <td nowrap> {$this->_colored('Necessary:', 'red')} $critical $measure </td> </tr>
|
130 |
-
<tr> <td nowrap> {$this->_colored('Error:', 'red')} $errmsg </td> </tr>
|
131 |
-
<tr> <td nowrap> {$this->_colored('Fix:', 'red')} $fixmsg </td> </tr>
|
132 |
-
";
|
133 |
-
};
|
134 |
-
|
135 |
-
|
136 |
-
// Chmod wget file
|
137 |
-
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkChmodwgetdatafile();
|
138 |
-
if ($status == 'error') $errors_count++;
|
139 |
-
if ($status == 'error') {
|
140 |
-
$html .= // $caption: $value $measure
|
141 |
-
"
|
142 |
-
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
143 |
-
<tr> <td nowrap> {$this->_colored('Necessary:', 'red')} $critical $measure </td> </tr>
|
144 |
-
<tr> <td nowrap> {$this->_colored('Error:', 'red')} $errmsg </td> </tr>
|
145 |
-
<tr> <td nowrap> {$this->_colored('Fix:', 'red')} $fixmsg </td> </tr>
|
146 |
-
";
|
147 |
-
};
|
148 |
-
|
149 |
-
|
150 |
-
// Chmod wget cron.php file
|
151 |
-
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkChmodwgetcronphpfile();
|
152 |
-
if ($status == 'error') $errors_count++;
|
153 |
-
if ($status == 'error') {
|
154 |
-
$html .= // $caption: $value $measure
|
155 |
-
"
|
156 |
-
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
157 |
-
<tr> <td nowrap> {$this->_colored('Necessary:', 'red')} $critical $measure </td> </tr>
|
158 |
-
<tr> <td nowrap> {$this->_colored('Error:', 'red')} $errmsg </td> </tr>
|
159 |
-
<tr> <td nowrap> {$this->_colored('Fix:', 'red')} $fixmsg </td> </tr>
|
160 |
-
";
|
161 |
-
};
|
162 |
-
|
163 |
-
// Chmod wget cron.sh file
|
164 |
-
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkChmodwgetcronshfile();
|
165 |
-
if ($status == 'error') $errors_count++;
|
166 |
-
if ($status == 'error') {
|
167 |
-
$html .= // $caption: $value $measure
|
168 |
-
"
|
169 |
-
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
170 |
-
<tr> <td nowrap> {$this->_colored('Necessary:', 'red')} $critical $measure </td> </tr>
|
171 |
-
<tr> <td nowrap> {$this->_colored('Error:', 'red')} $errmsg </td> </tr>
|
172 |
-
<tr> <td nowrap> {$this->_colored('Fix:', 'red')} $fixmsg </td> </tr>
|
173 |
-
";
|
174 |
-
};
|
175 |
-
|
176 |
-
// Mysql stored procedure filter_sinch_products_s
|
177 |
-
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkProcedure();
|
178 |
-
if ($status == 'error') $errors_count++;
|
179 |
-
if ($status == 'error') {
|
180 |
-
$html .= // $caption: $value $measure
|
181 |
-
"
|
182 |
-
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
183 |
-
<tr> <td nowrap> {$this->_colored('Necessary:', 'red')} $critical $measure </td> </tr>
|
184 |
-
<tr> <td nowrap> {$this->_colored('Error:', 'red')} $errmsg </td> </tr>
|
185 |
-
<tr> <td nowrap> {$this->_colored('Fix:', 'red')} $fixmsg </td> </tr>
|
186 |
-
";
|
187 |
-
};
|
188 |
-
|
189 |
-
|
190 |
-
$html .= '
|
191 |
-
</tbody>
|
192 |
-
</table>';
|
193 |
-
|
194 |
-
$html .= '<div class="comment"><H3>'.("There are $errors_count notices." ).'</H3></div>';
|
195 |
-
|
196 |
-
// all checks
|
197 |
-
return $html;
|
198 |
-
|
199 |
-
} // protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
200 |
-
|
201 |
-
protected function _colored($str, $color){
|
202 |
-
return "<b><span style='color:{$color}'>{$str}</span></b>";
|
203 |
-
}
|
204 |
-
|
205 |
-
|
206 |
-
} // class Bintime_Sinchimport_Block_Importenvironment extends Mage_Adminhtml_Block_System_Config_Form_Field
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
class Bintime_Sinchimport_Block_Importenvironment extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
12 |
+
$this->setElement($element);
|
13 |
+
$url = $this->getUrl('sinchimport/index');
|
14 |
+
$this->setElement($element);
|
15 |
+
|
16 |
+
$html = '';
|
17 |
+
|
18 |
+
//$html .= '<div class="comment"><H3>'.("Your Stock In The Channel Environment Check Summary" ).'</H3></div>';
|
19 |
+
|
20 |
+
//$html .= '<div class="comment"><H3>'.("In order for this extension to work, your server needs to be configured in a particular way and have sufficient memory." ).'</H3></div>';
|
21 |
+
|
22 |
+
|
23 |
+
$html .= '
|
24 |
+
<table class="history">
|
25 |
+
<thead>
|
26 |
+
<tr>
|
27 |
+
<th>Checked</th>
|
28 |
+
<th>Necessary, Error And Fix</th>
|
29 |
+
|
30 |
+
</tr>
|
31 |
+
</thead><tbody>';
|
32 |
+
// <th>Necessary</th>
|
33 |
+
// <th>Fix</th>
|
34 |
+
|
35 |
+
$errors_count = 0;
|
36 |
+
|
37 |
+
// Memory total
|
38 |
+
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkMemory();
|
39 |
+
if ($status == 'error') $errors_count++;
|
40 |
+
if ($status == 'error') {
|
41 |
+
$html .= // $caption: $value $measure
|
42 |
+
"
|
43 |
+
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
44 |
+
<tr> <td nowrap> {$this->_colored('Necessary:', 'blue')} $critical $measure </td> </tr>
|
45 |
+
<tr> <td nowrap> {$this->_colored('Notice:', 'blue')} $errmsg </td> </tr>
|
46 |
+
<tr> <td nowrap> {$this->_colored('Fix:', 'blue')} $fixmsg </td> </tr>
|
47 |
+
";
|
48 |
+
};
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
// Mysql parameter LOCAL DATA LOCAL
|
53 |
+
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkLoaddata();
|
54 |
+
if ($status == 'error') $errors_count++;
|
55 |
+
if ($status == 'error') {
|
56 |
+
$html .= // $caption: $value $measure
|
57 |
+
"
|
58 |
+
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
59 |
+
<tr> <td nowrap> {$this->_colored('Necessary:', 'red')} $critical $measure </td> </tr>
|
60 |
+
<tr> <td nowrap> {$this->_colored('Error:', 'red')} $errmsg </td> </tr>
|
61 |
+
<tr> <td nowrap> {$this->_colored('Fix:', 'red')} $fixmsg </td> </tr>
|
62 |
+
";
|
63 |
+
};
|
64 |
+
|
65 |
+
|
66 |
+
// PHP safe mode
|
67 |
+
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkPhpsafemode();
|
68 |
+
if ($status == 'error') $errors_count++;
|
69 |
+
if ($status == 'error') {
|
70 |
+
$html .= // $caption: $value $measure
|
71 |
+
"
|
72 |
+
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
73 |
+
<tr> <td nowrap> {$this->_colored('Necessary:', 'red')} $critical $measure </td> </tr>
|
74 |
+
<tr> <td nowrap> {$this->_colored('Error:', 'red')} $errmsg </td> </tr>
|
75 |
+
<tr> <td nowrap> {$this->_colored('Fix:', 'red')} $fixmsg </td> </tr>
|
76 |
+
";
|
77 |
+
};
|
78 |
+
|
79 |
+
|
80 |
+
// Mysql parameter wait_timeout
|
81 |
+
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkWaittimeout();
|
82 |
+
if ($status == 'error') $errors_count++;
|
83 |
+
if ($status == 'error') {
|
84 |
+
$html .= // $caption: $value $measure
|
85 |
+
"
|
86 |
+
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
87 |
+
<tr> <td nowrap> {$this->_colored('Necessary:', 'blue')} $critical $measure </td> </tr>
|
88 |
+
<tr> <td nowrap> {$this->_colored('Notice:', 'blue')} $errmsg </td> </tr>
|
89 |
+
<tr> <td nowrap> {$this->_colored('Fix:', 'blue')} $fixmsg </td> </tr>
|
90 |
+
";
|
91 |
+
};
|
92 |
+
|
93 |
+
|
94 |
+
// Mysql parameter innodb_buffer_pool_size
|
95 |
+
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkInnodbbufferpoolsize();
|
96 |
+
if ($status == 'error') $errors_count++;
|
97 |
+
if ($status == 'error') {
|
98 |
+
$html .= // $caption: $value $measure
|
99 |
+
"
|
100 |
+
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
101 |
+
<tr> <td nowrap> {$this->_colored('Necessary:', 'blue')} $critical $measure </td> </tr>
|
102 |
+
<tr> <td nowrap> {$this->_colored('Notice:', 'blue')} $errmsg </td> </tr>
|
103 |
+
<tr> <td nowrap> {$this->_colored('Fix:', 'blue')} $fixmsg </td> </tr>
|
104 |
+
";
|
105 |
+
};
|
106 |
+
|
107 |
+
|
108 |
+
// Conflict with installed module
|
109 |
+
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkConflictsWithInstalledModules();
|
110 |
+
if ($status == 'error') $errors_count++;
|
111 |
+
if ($status == 'error') {
|
112 |
+
$html .= // $caption: $value $measure
|
113 |
+
"
|
114 |
+
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
115 |
+
<tr> <td nowrap> {$this->_colored('Necessary:', 'blue')} $critical $measure </td> </tr>
|
116 |
+
<tr> <td nowrap> {$this->_colored('Notice:', 'blue')} $errmsg </td> </tr>
|
117 |
+
<tr> <td nowrap> {$this->_colored('Fix:', 'blue')} $fixmsg </td> </tr>
|
118 |
+
";
|
119 |
+
};
|
120 |
+
|
121 |
+
|
122 |
+
// PHP run string
|
123 |
+
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkPhprunstring();
|
124 |
+
if ($status == 'error') $errors_count++;
|
125 |
+
if ($status == 'error') {
|
126 |
+
$html .= // $caption: $value $measure
|
127 |
+
"
|
128 |
+
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
129 |
+
<tr> <td nowrap> {$this->_colored('Necessary:', 'red')} $critical $measure </td> </tr>
|
130 |
+
<tr> <td nowrap> {$this->_colored('Error:', 'red')} $errmsg </td> </tr>
|
131 |
+
<tr> <td nowrap> {$this->_colored('Fix:', 'red')} $fixmsg </td> </tr>
|
132 |
+
";
|
133 |
+
};
|
134 |
+
|
135 |
+
|
136 |
+
// Chmod wget file
|
137 |
+
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkChmodwgetdatafile();
|
138 |
+
if ($status == 'error') $errors_count++;
|
139 |
+
if ($status == 'error') {
|
140 |
+
$html .= // $caption: $value $measure
|
141 |
+
"
|
142 |
+
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
143 |
+
<tr> <td nowrap> {$this->_colored('Necessary:', 'red')} $critical $measure </td> </tr>
|
144 |
+
<tr> <td nowrap> {$this->_colored('Error:', 'red')} $errmsg </td> </tr>
|
145 |
+
<tr> <td nowrap> {$this->_colored('Fix:', 'red')} $fixmsg </td> </tr>
|
146 |
+
";
|
147 |
+
};
|
148 |
+
|
149 |
+
|
150 |
+
// Chmod wget cron.php file
|
151 |
+
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkChmodwgetcronphpfile();
|
152 |
+
if ($status == 'error') $errors_count++;
|
153 |
+
if ($status == 'error') {
|
154 |
+
$html .= // $caption: $value $measure
|
155 |
+
"
|
156 |
+
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
157 |
+
<tr> <td nowrap> {$this->_colored('Necessary:', 'red')} $critical $measure </td> </tr>
|
158 |
+
<tr> <td nowrap> {$this->_colored('Error:', 'red')} $errmsg </td> </tr>
|
159 |
+
<tr> <td nowrap> {$this->_colored('Fix:', 'red')} $fixmsg </td> </tr>
|
160 |
+
";
|
161 |
+
};
|
162 |
+
|
163 |
+
// Chmod wget cron.sh file
|
164 |
+
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkChmodwgetcronshfile();
|
165 |
+
if ($status == 'error') $errors_count++;
|
166 |
+
if ($status == 'error') {
|
167 |
+
$html .= // $caption: $value $measure
|
168 |
+
"
|
169 |
+
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
170 |
+
<tr> <td nowrap> {$this->_colored('Necessary:', 'red')} $critical $measure </td> </tr>
|
171 |
+
<tr> <td nowrap> {$this->_colored('Error:', 'red')} $errmsg </td> </tr>
|
172 |
+
<tr> <td nowrap> {$this->_colored('Fix:', 'red')} $fixmsg </td> </tr>
|
173 |
+
";
|
174 |
+
};
|
175 |
+
|
176 |
+
// Mysql stored procedure filter_sinch_products_s
|
177 |
+
list($status, $caption, $critical, $value, $measure, $errmsg, $fixmsg) = Mage::getModel('sinchimport/sinch')->checkProcedure();
|
178 |
+
if ($status == 'error') $errors_count++;
|
179 |
+
if ($status == 'error') {
|
180 |
+
$html .= // $caption: $value $measure
|
181 |
+
"
|
182 |
+
<tr> <td nowrap rowspan=4> $caption </td> </tr>
|
183 |
+
<tr> <td nowrap> {$this->_colored('Necessary:', 'red')} $critical $measure </td> </tr>
|
184 |
+
<tr> <td nowrap> {$this->_colored('Error:', 'red')} $errmsg </td> </tr>
|
185 |
+
<tr> <td nowrap> {$this->_colored('Fix:', 'red')} $fixmsg </td> </tr>
|
186 |
+
";
|
187 |
+
};
|
188 |
+
|
189 |
+
|
190 |
+
$html .= '
|
191 |
+
</tbody>
|
192 |
+
</table>';
|
193 |
+
|
194 |
+
$html .= '<div class="comment"><H3>'.("There are $errors_count notices." ).'</H3></div>';
|
195 |
+
|
196 |
+
// all checks
|
197 |
+
return $html;
|
198 |
+
|
199 |
+
} // protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
200 |
+
|
201 |
+
protected function _colored($str, $color){
|
202 |
+
return "<b><span style='color:{$color}'>{$str}</span></b>";
|
203 |
+
}
|
204 |
+
|
205 |
+
|
206 |
+
} // class Bintime_Sinchimport_Block_Importenvironment extends Mage_Adminhtml_Block_System_Config_Form_Field
|
207 |
+
|
208 |
+
|
209 |
+
|
210 |
+
|
app/code/local/Bintime/Sinchimport/Block/Layer/Filter/Feature.php
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Bintime_Sinchimport_Block_Layer_Filter_Feature extends Mage_Catalog_Block_Layer_Filter_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
public function __construct()
|
7 |
-
{
|
8 |
-
parent::__construct();
|
9 |
-
$this->_filterModelName = 'sinchimport/layer_filter_feature';
|
10 |
-
}
|
11 |
-
|
12 |
-
protected function _prepareFilter()
|
13 |
-
{
|
14 |
-
$this->_filter->setAttributeModel($this->getAttributeModel());
|
15 |
-
return $this;
|
16 |
-
}
|
17 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Bintime_Sinchimport_Block_Layer_Filter_Feature extends Mage_Catalog_Block_Layer_Filter_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->_filterModelName = 'sinchimport/layer_filter_feature';
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _prepareFilter()
|
13 |
+
{
|
14 |
+
$this->_filter->setAttributeModel($this->getAttributeModel());
|
15 |
+
return $this;
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Bintime/Sinchimport/Block/Layer/View.php
CHANGED
@@ -1,48 +1,48 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Bintime_Sinchimport_Block_Layer_View extends Mage_Catalog_Block_Layer_View
|
4 |
-
{
|
5 |
-
|
6 |
-
protected $filterableFeatures = array();
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Prepare child blocks
|
10 |
-
*
|
11 |
-
* @return Mage_Catalog_Block_Layer_View
|
12 |
-
*/
|
13 |
-
protected function _prepareLayout()
|
14 |
-
{
|
15 |
-
//получение списка фич, по которым строися навигация
|
16 |
-
$filterableFeatures = $this->getLayer()->getFilterableFeatures();
|
17 |
-
$filterBlockName = 'sinchimport/layer_filter_feature'; //block
|
18 |
-
foreach ($filterableFeatures as $feature) {
|
19 |
-
$this->filterableFeatures[] = $feature;
|
20 |
-
$featureBlock = $this->getLayout()->createBlock($filterBlockName)
|
21 |
-
->setLayer($this->getLayer())
|
22 |
-
->setAttributeModel($feature)
|
23 |
-
->init();
|
24 |
-
$this->setChild('feature_' . $feature['feature_id'] . '_filter',
|
25 |
-
$featureBlock
|
26 |
-
);
|
27 |
-
}
|
28 |
-
/* ------------ */
|
29 |
-
return parent::_prepareLayout();
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Get all layer filters
|
34 |
-
*
|
35 |
-
* @return array
|
36 |
-
*/
|
37 |
-
public function getFilters()
|
38 |
-
{
|
39 |
-
$filters = parent::getFilters();
|
40 |
-
/* ------------ */
|
41 |
-
foreach ($this->filterableFeatures as $feature) {
|
42 |
-
$filters[] = $this->getChild('feature_' . $feature['feature_id'] . '_filter');
|
43 |
-
}
|
44 |
-
/* ------------ */
|
45 |
-
|
46 |
-
return $filters;
|
47 |
-
}
|
48 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Bintime_Sinchimport_Block_Layer_View extends Mage_Catalog_Block_Layer_View
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $filterableFeatures = array();
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Prepare child blocks
|
10 |
+
*
|
11 |
+
* @return Mage_Catalog_Block_Layer_View
|
12 |
+
*/
|
13 |
+
protected function _prepareLayout()
|
14 |
+
{
|
15 |
+
//получение списка фич, по которым строися навигация
|
16 |
+
$filterableFeatures = $this->getLayer()->getFilterableFeatures();
|
17 |
+
$filterBlockName = 'sinchimport/layer_filter_feature'; //block
|
18 |
+
foreach ($filterableFeatures as $feature) {
|
19 |
+
$this->filterableFeatures[] = $feature;
|
20 |
+
$featureBlock = $this->getLayout()->createBlock($filterBlockName)
|
21 |
+
->setLayer($this->getLayer())
|
22 |
+
->setAttributeModel($feature)
|
23 |
+
->init();
|
24 |
+
$this->setChild('feature_' . $feature['feature_id'] . '_filter',
|
25 |
+
$featureBlock
|
26 |
+
);
|
27 |
+
}
|
28 |
+
/* ------------ */
|
29 |
+
return parent::_prepareLayout();
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Get all layer filters
|
34 |
+
*
|
35 |
+
* @return array
|
36 |
+
*/
|
37 |
+
public function getFilters()
|
38 |
+
{
|
39 |
+
$filters = parent::getFilters();
|
40 |
+
/* ------------ */
|
41 |
+
foreach ($this->filterableFeatures as $feature) {
|
42 |
+
$filters[] = $this->getChild('feature_' . $feature['feature_id'] . '_filter');
|
43 |
+
}
|
44 |
+
/* ------------ */
|
45 |
+
|
46 |
+
return $filters;
|
47 |
+
}
|
48 |
+
}
|
app/code/local/Bintime/Sinchimport/Block/List.php
CHANGED
@@ -1,159 +1,159 @@
|
|
1 |
-
<?php
|
2 |
-
class Bintime_Sinchimport_Block_List extends Mage_Catalog_Block_Product_Compare_List
|
3 |
-
{
|
4 |
-
var $goods;
|
5 |
-
var $_compareSinchStoreProd;
|
6 |
-
public function getSinchAttributes()
|
7 |
-
{
|
8 |
-
$items = array();
|
9 |
-
foreach ($this->getItems() as $_item) {
|
10 |
-
$items[] = $_item->getId();
|
11 |
-
}
|
12 |
-
$to_compare=implode(',', $items);
|
13 |
-
$tmp_table_sorted = Mage::getSingleton('core/resource')->getTableName('$tmp_table_sorted_').time();
|
14 |
-
$this->tep_db_query("DROP TABLE IF EXISTS $tmp_table_sorted");
|
15 |
-
$this->tep_db_query("CREATE TABLE $tmp_table_sorted (
|
16 |
-
id int(11) not null PRIMARY KEY AUTO_INCREMENT,
|
17 |
-
store_category_id int(11) not null default 0,
|
18 |
-
store_product_id int(11) not null default 0,
|
19 |
-
sinch_product_id int(11) not null default 0,
|
20 |
-
category_feature_id int(11) not null default 0,
|
21 |
-
feature_name varchar(255) not null default '',
|
22 |
-
restricted_value_id int(11) not null default 0,
|
23 |
-
text varchar(255) not null default '',
|
24 |
-
KEY(category_feature_id),
|
25 |
-
KEY(store_product_id),
|
26 |
-
unique key(sinch_product_id, feature_name)
|
27 |
-
)");
|
28 |
-
|
29 |
-
|
30 |
-
$query = "SELECT p.sinch_product_id, p.store_product_id, p.specifications, pm.entity_id
|
31 |
-
FROM ".Mage::getSingleton('core/resource')->getTableName('stINch_products')." p
|
32 |
-
JOIN ".Mage::getSingleton('core/resource')->getTableName('stINch_products_mapping')." pm
|
33 |
-
ON pm.shop_store_product_id = p.store_product_id AND
|
34 |
-
pm.shop_sinch_product_id=p.sinch_product_id
|
35 |
-
WHERE pm.entity_id IN ( $to_compare )";
|
36 |
-
$sinch = $this->tep_db_query($query);
|
37 |
-
while($data = $sinch->fetch(PDO::FETCH_ASSOC)){
|
38 |
-
$this->ins_from_htm($data['sinch_product_id'],$data['store_product_id'],$data['specifications'],$tmp_table_sorted);
|
39 |
-
$sinch_products_array[] = $data['sinch_product_id'];
|
40 |
-
$this->_compareSinchStoreProd[$data['entity_id']]=$data['sinch_product_id'];
|
41 |
-
}
|
42 |
-
$sinch_products = implode(',', $sinch_products_array);
|
43 |
-
if(!$sinch_products){
|
44 |
-
$sinch_products = "''";
|
45 |
-
}
|
46 |
-
$this->tep_db_query("INSERT IGNORE INTO $tmp_table_sorted (
|
47 |
-
store_category_id,
|
48 |
-
sinch_product_id,
|
49 |
-
category_feature_id,
|
50 |
-
feature_name,
|
51 |
-
restricted_value_id,
|
52 |
-
text
|
53 |
-
)(SELECT
|
54 |
-
cf.store_category_id,
|
55 |
-
pf.sinch_product_id,
|
56 |
-
cf.category_feature_id,
|
57 |
-
cf.feature_name,
|
58 |
-
rv.restricted_value_id,
|
59 |
-
rv.text
|
60 |
-
FROM ".Mage::getSingleton('core/resource')->getTableName('stINch_categories_features')." cf
|
61 |
-
JOIN ".Mage::getSingleton('core/resource')->getTableName('stINch_restricted_values')." rv
|
62 |
-
ON cf.category_feature_id=rv.category_feature_id
|
63 |
-
JOIN ".Mage::getSingleton('core/resource')->getTableName('stINch_product_features')." pf
|
64 |
-
ON rv.restricted_value_id=pf.restricted_value_id
|
65 |
-
WHERE sinch_product_id in (".$sinch_products.")
|
66 |
-
ORDER BY
|
67 |
-
cf.display_order_number,
|
68 |
-
pf.sinch_product_id)
|
69 |
-
");
|
70 |
-
$this->tep_db_query("UPDATE $tmp_table_sorted t
|
71 |
-
JOIN ".Mage::getSingleton('core/resource')->getTableName('stINch_products')." p
|
72 |
-
ON t.sinch_product_id=p.sinch_product_id
|
73 |
-
SET t.store_product_id=p.store_product_id");
|
74 |
-
|
75 |
-
$this->goods = array();
|
76 |
-
|
77 |
-
$product_query = $this->tep_db_query("select store_product_id, sinch_product_id, category_feature_id, store_category_id, feature_name, text
|
78 |
-
FROM $tmp_table_sorted
|
79 |
-
ORDER BY id ASC");
|
80 |
-
while($data = $product_query->fetch(PDO::FETCH_ASSOC)){
|
81 |
-
$this->goods[$data['sinch_product_id']]['category_features'][$data['feature_name']] = array(
|
82 |
-
|
83 |
-
|
84 |
-
'category_feature_id' => $data['category_feature_id'],
|
85 |
-
'value' => $data['text'],
|
86 |
-
|
87 |
-
|
88 |
-
'feature_name' => $data['feature_name'],
|
89 |
-
);
|
90 |
-
}
|
91 |
-
$catfeats = $this->tep_db_query("SELECT category_feature_id, feature_name FROM $tmp_table_sorted
|
92 |
-
GROUP BY feature_name
|
93 |
-
ORDER BY category_feature_id");
|
94 |
-
while($fdata = $catfeats->fetch(PDO::FETCH_ASSOC)){
|
95 |
-
$cf[] = $fdata;
|
96 |
-
}
|
97 |
-
return $cf;
|
98 |
-
}
|
99 |
-
|
100 |
-
public function GetSinchCompareProdAttributes(){
|
101 |
-
return $this->goods;
|
102 |
-
}
|
103 |
-
|
104 |
-
public function getSinchAttributeName($cf)
|
105 |
-
{
|
106 |
-
return $cf['feature_name'];
|
107 |
-
}
|
108 |
-
|
109 |
-
public function getSinchProductAttributeValue($product, $cf)
|
110 |
-
{
|
111 |
-
|
112 |
-
$prod = $this->_compareSinchStoreProd[$product->getID()];
|
113 |
-
$feature_name = $cf['feature_name'];
|
114 |
-
$data = $this->goods[$prod]['category_features'][$feature_name]['value'];
|
115 |
-
$data = Mage::getModel('sinchimport/sinch')->valid_utf($data);
|
116 |
-
return $data;
|
117 |
-
}
|
118 |
-
|
119 |
-
private function ins_from_htm($sinch_product_id, $store_product_id, $htm, $tmp_table_sorted){
|
120 |
-
if($htm){
|
121 |
-
/** создаем новый dom-объект **/
|
122 |
-
$dom = new domDocument;
|
123 |
-
/** загружаем html в объект **/
|
124 |
-
$dom->loadHTML($htm);
|
125 |
-
$dom->preserveWhiteSpace = false;
|
126 |
-
|
127 |
-
/** элемент по тэгу **/
|
128 |
-
$tables = $dom->getElementsByTagName('table');
|
129 |
-
|
130 |
-
/** получаем все строки таблицы **/
|
131 |
-
$rows = $tables->item(0)->getElementsByTagName('tr');
|
132 |
-
|
133 |
-
/** цикл по строкам **/
|
134 |
-
$i=0;
|
135 |
-
foreach ($rows as $row)
|
136 |
-
{
|
137 |
-
/** все ячейки по тэгу **/
|
138 |
-
$cols = $row->getElementsByTagName('td');
|
139 |
-
/** выводим значения **/
|
140 |
-
$name = $cols->item(0)->nodeValue;
|
141 |
-
$value = $cols->item(1)->nodeValue;
|
142 |
-
|
143 |
-
if($value && $i){
|
144 |
-
$q=" insert ignore into ".$tmp_table_sorted." (store_product_id, sinch_product_id, feature_name, text) values(".$store_product_id.",".$sinch_product_id.",'".$name."','".$value."')";
|
145 |
-
$this->tep_db_query($q);
|
146 |
-
}
|
147 |
-
//mysqli_real_escape_string($name)
|
148 |
-
$i++;
|
149 |
-
}
|
150 |
-
}
|
151 |
-
}
|
152 |
-
private function tep_db_query($q){
|
153 |
-
$resource = Mage::getResourceSingleton('catalog/product');
|
154 |
-
$connection = $resource->getReadConnection();
|
155 |
-
$result = $connection->query($q);
|
156 |
-
return($result);
|
157 |
-
}
|
158 |
-
|
159 |
-
}
|
1 |
+
<?php
|
2 |
+
class Bintime_Sinchimport_Block_List extends Mage_Catalog_Block_Product_Compare_List
|
3 |
+
{
|
4 |
+
var $goods;
|
5 |
+
var $_compareSinchStoreProd;
|
6 |
+
public function getSinchAttributes()
|
7 |
+
{
|
8 |
+
$items = array();
|
9 |
+
foreach ($this->getItems() as $_item) {
|
10 |
+
$items[] = $_item->getId();
|
11 |
+
}
|
12 |
+
$to_compare=implode(',', $items);
|
13 |
+
$tmp_table_sorted = Mage::getSingleton('core/resource')->getTableName('$tmp_table_sorted_').time();
|
14 |
+
$this->tep_db_query("DROP TABLE IF EXISTS $tmp_table_sorted");
|
15 |
+
$this->tep_db_query("CREATE TABLE $tmp_table_sorted (
|
16 |
+
id int(11) not null PRIMARY KEY AUTO_INCREMENT,
|
17 |
+
store_category_id int(11) not null default 0,
|
18 |
+
store_product_id int(11) not null default 0,
|
19 |
+
sinch_product_id int(11) not null default 0,
|
20 |
+
category_feature_id int(11) not null default 0,
|
21 |
+
feature_name varchar(255) not null default '',
|
22 |
+
restricted_value_id int(11) not null default 0,
|
23 |
+
text varchar(255) not null default '',
|
24 |
+
KEY(category_feature_id),
|
25 |
+
KEY(store_product_id),
|
26 |
+
unique key(sinch_product_id, feature_name)
|
27 |
+
)");
|
28 |
+
|
29 |
+
|
30 |
+
$query = "SELECT p.sinch_product_id, p.store_product_id, p.specifications, pm.entity_id
|
31 |
+
FROM ".Mage::getSingleton('core/resource')->getTableName('stINch_products')." p
|
32 |
+
JOIN ".Mage::getSingleton('core/resource')->getTableName('stINch_products_mapping')." pm
|
33 |
+
ON pm.shop_store_product_id = p.store_product_id AND
|
34 |
+
pm.shop_sinch_product_id=p.sinch_product_id
|
35 |
+
WHERE pm.entity_id IN ( $to_compare )";
|
36 |
+
$sinch = $this->tep_db_query($query);
|
37 |
+
while($data = $sinch->fetch(PDO::FETCH_ASSOC)){
|
38 |
+
$this->ins_from_htm($data['sinch_product_id'],$data['store_product_id'],$data['specifications'],$tmp_table_sorted);
|
39 |
+
$sinch_products_array[] = $data['sinch_product_id'];
|
40 |
+
$this->_compareSinchStoreProd[$data['entity_id']]=$data['sinch_product_id'];
|
41 |
+
}
|
42 |
+
$sinch_products = implode(',', $sinch_products_array);
|
43 |
+
if(!$sinch_products){
|
44 |
+
$sinch_products = "''";
|
45 |
+
}
|
46 |
+
$this->tep_db_query("INSERT IGNORE INTO $tmp_table_sorted (
|
47 |
+
store_category_id,
|
48 |
+
sinch_product_id,
|
49 |
+
category_feature_id,
|
50 |
+
feature_name,
|
51 |
+
restricted_value_id,
|
52 |
+
text
|
53 |
+
)(SELECT
|
54 |
+
cf.store_category_id,
|
55 |
+
pf.sinch_product_id,
|
56 |
+
cf.category_feature_id,
|
57 |
+
cf.feature_name,
|
58 |
+
rv.restricted_value_id,
|
59 |
+
rv.text
|
60 |
+
FROM ".Mage::getSingleton('core/resource')->getTableName('stINch_categories_features')." cf
|
61 |
+
JOIN ".Mage::getSingleton('core/resource')->getTableName('stINch_restricted_values')." rv
|
62 |
+
ON cf.category_feature_id=rv.category_feature_id
|
63 |
+
JOIN ".Mage::getSingleton('core/resource')->getTableName('stINch_product_features')." pf
|
64 |
+
ON rv.restricted_value_id=pf.restricted_value_id
|
65 |
+
WHERE sinch_product_id in (".$sinch_products.")
|
66 |
+
ORDER BY
|
67 |
+
cf.display_order_number,
|
68 |
+
pf.sinch_product_id)
|
69 |
+
");
|
70 |
+
$this->tep_db_query("UPDATE $tmp_table_sorted t
|
71 |
+
JOIN ".Mage::getSingleton('core/resource')->getTableName('stINch_products')." p
|
72 |
+
ON t.sinch_product_id=p.sinch_product_id
|
73 |
+
SET t.store_product_id=p.store_product_id");
|
74 |
+
|
75 |
+
$this->goods = array();
|
76 |
+
|
77 |
+
$product_query = $this->tep_db_query("select store_product_id, sinch_product_id, category_feature_id, store_category_id, feature_name, text
|
78 |
+
FROM $tmp_table_sorted
|
79 |
+
ORDER BY id ASC");
|
80 |
+
while($data = $product_query->fetch(PDO::FETCH_ASSOC)){
|
81 |
+
$this->goods[$data['sinch_product_id']]['category_features'][$data['feature_name']] = array(
|
82 |
+
|
83 |
+
|
84 |
+
'category_feature_id' => $data['category_feature_id'],
|
85 |
+
'value' => $data['text'],
|
86 |
+
|
87 |
+
|
88 |
+
'feature_name' => $data['feature_name'],
|
89 |
+
);
|
90 |
+
}
|
91 |
+
$catfeats = $this->tep_db_query("SELECT category_feature_id, feature_name FROM $tmp_table_sorted
|
92 |
+
GROUP BY feature_name
|
93 |
+
ORDER BY category_feature_id");
|
94 |
+
while($fdata = $catfeats->fetch(PDO::FETCH_ASSOC)){
|
95 |
+
$cf[] = $fdata;
|
96 |
+
}
|
97 |
+
return $cf;
|
98 |
+
}
|
99 |
+
|
100 |
+
public function GetSinchCompareProdAttributes(){
|
101 |
+
return $this->goods;
|
102 |
+
}
|
103 |
+
|
104 |
+
public function getSinchAttributeName($cf)
|
105 |
+
{
|
106 |
+
return $cf['feature_name'];
|
107 |
+
}
|
108 |
+
|
109 |
+
public function getSinchProductAttributeValue($product, $cf)
|
110 |
+
{
|
111 |
+
|
112 |
+
$prod = $this->_compareSinchStoreProd[$product->getID()];
|
113 |
+
$feature_name = $cf['feature_name'];
|
114 |
+
$data = $this->goods[$prod]['category_features'][$feature_name]['value'];
|
115 |
+
$data = Mage::getModel('sinchimport/sinch')->valid_utf($data);
|
116 |
+
return $data;
|
117 |
+
}
|
118 |
+
|
119 |
+
private function ins_from_htm($sinch_product_id, $store_product_id, $htm, $tmp_table_sorted){
|
120 |
+
if($htm){
|
121 |
+
/** создаем новый dom-объект **/
|
122 |
+
$dom = new domDocument;
|
123 |
+
/** загружаем html в объект **/
|
124 |
+
$dom->loadHTML($htm);
|
125 |
+
$dom->preserveWhiteSpace = false;
|
126 |
+
|
127 |
+
/** элемент по тэгу **/
|
128 |
+
$tables = $dom->getElementsByTagName('table');
|
129 |
+
|
130 |
+
/** получаем все строки таблицы **/
|
131 |
+
$rows = $tables->item(0)->getElementsByTagName('tr');
|
132 |
+
|
133 |
+
/** цикл по строкам **/
|
134 |
+
$i=0;
|
135 |
+
foreach ($rows as $row)
|
136 |
+
{
|
137 |
+
/** все ячейки по тэгу **/
|
138 |
+
$cols = $row->getElementsByTagName('td');
|
139 |
+
/** выводим значения **/
|
140 |
+
$name = $cols->item(0)->nodeValue;
|
141 |
+
$value = $cols->item(1)->nodeValue;
|
142 |
+
|
143 |
+
if($value && $i){
|
144 |
+
$q=" insert ignore into ".$tmp_table_sorted." (store_product_id, sinch_product_id, feature_name, text) values(".$store_product_id.",".$sinch_product_id.",'".$name."','".$value."')";
|
145 |
+
$this->tep_db_query($q);
|
146 |
+
}
|
147 |
+
//mysqli_real_escape_string($name)
|
148 |
+
$i++;
|
149 |
+
}
|
150 |
+
}
|
151 |
+
}
|
152 |
+
private function tep_db_query($q){
|
153 |
+
$resource = Mage::getResourceSingleton('catalog/product');
|
154 |
+
$connection = $resource->getReadConnection();
|
155 |
+
$result = $connection->query($q);
|
156 |
+
return($result);
|
157 |
+
}
|
158 |
+
|
159 |
+
}
|
app/code/local/Bintime/Sinchimport/Helper/Image.php
CHANGED
@@ -1,73 +1,73 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Catalog
|
23 |
-
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Catalog image helper
|
29 |
-
*
|
30 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
31 |
-
*/
|
32 |
-
class Bintime_Sinchimport_Helper_Image extends Mage_Catalog_Helper_Image
|
33 |
-
{
|
34 |
-
|
35 |
-
public function __toString()
|
36 |
-
{
|
37 |
-
try {
|
38 |
-
if( $this->getImageFile() ) {
|
39 |
-
$this->_getModel()->setBaseFile( $this->getImageFile() );
|
40 |
-
} else {
|
41 |
-
$this->_getModel()->setBaseFile( $this->getProduct()->getData($this->_getModel()->getDestinationSubdir()) );
|
42 |
-
}
|
43 |
-
if (substr($this->_getModel()->getNewFile(),0,4) != 'http') {
|
44 |
-
if( $this->_getModel()->isCached() ) {
|
45 |
-
return $this->_getModel()->getUrl();
|
46 |
-
} else {
|
47 |
-
if( $this->_scheduleRotate ) {
|
48 |
-
$this->_getModel()->rotate( $this->getAngle() );
|
49 |
-
}
|
50 |
-
|
51 |
-
if ($this->_scheduleResize) {
|
52 |
-
$this->_getModel()->resize();
|
53 |
-
}
|
54 |
-
|
55 |
-
if( $this->getWatermark() ) {
|
56 |
-
$this->_getModel()->setWatermark($this->getWatermark());
|
57 |
-
}
|
58 |
-
|
59 |
-
$url = $this->_getModel()->saveFile()->getUrl();
|
60 |
-
}
|
61 |
-
}
|
62 |
-
else {
|
63 |
-
return $this->_getModel()->getNewFile();
|
64 |
-
}
|
65 |
-
} catch( Exception $e ) {
|
66 |
-
$url = Mage::getDesign()->getSkinUrl($this->getPlaceholder());
|
67 |
-
}
|
68 |
-
return $url;
|
69 |
-
}
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Catalog
|
23 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Catalog image helper
|
29 |
+
*
|
30 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
31 |
+
*/
|
32 |
+
class Bintime_Sinchimport_Helper_Image extends Mage_Catalog_Helper_Image
|
33 |
+
{
|
34 |
+
|
35 |
+
public function __toString()
|
36 |
+
{
|
37 |
+
try {
|
38 |
+
if( $this->getImageFile() ) {
|
39 |
+
$this->_getModel()->setBaseFile( $this->getImageFile() );
|
40 |
+
} else {
|
41 |
+
$this->_getModel()->setBaseFile( $this->getProduct()->getData($this->_getModel()->getDestinationSubdir()) );
|
42 |
+
}
|
43 |
+
if (substr($this->_getModel()->getNewFile(),0,4) != 'http') {
|
44 |
+
if( $this->_getModel()->isCached() ) {
|
45 |
+
return $this->_getModel()->getUrl();
|
46 |
+
} else {
|
47 |
+
if( $this->_scheduleRotate ) {
|
48 |
+
$this->_getModel()->rotate( $this->getAngle() );
|
49 |
+
}
|
50 |
+
|
51 |
+
if ($this->_scheduleResize) {
|
52 |
+
$this->_getModel()->resize();
|
53 |
+
}
|
54 |
+
|
55 |
+
if( $this->getWatermark() ) {
|
56 |
+
$this->_getModel()->setWatermark($this->getWatermark());
|
57 |
+
}
|
58 |
+
|
59 |
+
$url = $this->_getModel()->saveFile()->getUrl();
|
60 |
+
}
|
61 |
+
}
|
62 |
+
else {
|
63 |
+
return $this->_getModel()->getNewFile();
|
64 |
+
}
|
65 |
+
} catch( Exception $e ) {
|
66 |
+
$url = Mage::getDesign()->getSkinUrl($this->getPlaceholder());
|
67 |
+
}
|
68 |
+
return $url;
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
}
|
app/code/local/Bintime/Sinchimport/Model/Image.php
CHANGED
@@ -1,118 +1,118 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Bintime_Sinchimport_Model_Image extends Mage_Catalog_Model_Product_Image {
|
4 |
-
|
5 |
-
public function setBaseFile($file)
|
6 |
-
{
|
7 |
-
$this->_isBaseFilePlaceholder = false;
|
8 |
-
if (substr($file,0,4) != 'http') {
|
9 |
-
if (($file) && (0 !== strpos($file, '/', 0))) {
|
10 |
-
$file = '/' . $file;
|
11 |
-
}
|
12 |
-
$baseDir = Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath();
|
13 |
-
if ('/no_selection' == $file) {
|
14 |
-
$file = null;
|
15 |
-
}
|
16 |
-
if ($file) {
|
17 |
-
if ((!file_exists($baseDir . $file)) || !$this->_checkMemory($baseDir . $file)) {
|
18 |
-
$file = null;
|
19 |
-
}
|
20 |
-
}
|
21 |
-
if (!$file) {
|
22 |
-
// check if placeholder defined in config
|
23 |
-
$isConfigPlaceholder = Mage::getStoreConfig("catalog/placeholder/{$this->getDestinationSubdir()}_placeholder");
|
24 |
-
$configPlaceholder = '/placeholder/' . $isConfigPlaceholder;
|
25 |
-
if ($isConfigPlaceholder && file_exists($baseDir . $configPlaceholder)) {
|
26 |
-
$file = $configPlaceholder;
|
27 |
-
}
|
28 |
-
else {
|
29 |
-
// replace file with skin or default skin placeholder
|
30 |
-
$skinBaseDir = Mage::getDesign()->getSkinBaseDir();
|
31 |
-
$skinPlaceholder = "/images/catalog/product/placeholder/{$this->getDestinationSubdir()}.jpg";
|
32 |
-
$file = $skinPlaceholder;
|
33 |
-
if (file_exists($skinBaseDir . $file)) {
|
34 |
-
$baseDir = $skinBaseDir;
|
35 |
-
}
|
36 |
-
else {
|
37 |
-
$baseDir = Mage::getDesign()->getSkinBaseDir(array('_theme' => 'default'));
|
38 |
-
if (!file_exists($baseDir . $file)) {
|
39 |
-
$baseDir = Mage::getDesign()->getSkinBaseDir(array('_theme' => 'default', '_package' => 'base'));
|
40 |
-
}
|
41 |
-
}
|
42 |
-
}
|
43 |
-
$this->_isBaseFilePlaceholder = true;
|
44 |
-
}
|
45 |
-
|
46 |
-
$baseFile = $baseDir . $file;
|
47 |
-
}
|
48 |
-
else {
|
49 |
-
$baseFile =$file;
|
50 |
-
}
|
51 |
-
if ((!$file) AND (!file_exists($baseFile)) AND substr($baseFile,0,4) != 'http') {
|
52 |
-
throw new Exception(Mage::helper('catalog')->__('Image file not found'));
|
53 |
-
}
|
54 |
-
|
55 |
-
$this->_baseFile = $baseFile;
|
56 |
-
if (substr($baseFile,0,4) != 'http') {
|
57 |
-
// build new filename (most important params)
|
58 |
-
$path = array(
|
59 |
-
Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath(),
|
60 |
-
'cache',
|
61 |
-
Mage::app()->getStore()->getId(),
|
62 |
-
$path[] = $this->getDestinationSubdir()
|
63 |
-
);
|
64 |
-
if((!empty($this->_width)) || (!empty($this->_height)))
|
65 |
-
$path[] = "{$this->_width}x{$this->_height}";
|
66 |
-
|
67 |
-
// add misk params as a hash
|
68 |
-
$miscParams = array(
|
69 |
-
($this->_keepAspectRatio ? '' : 'non') . 'proportional',
|
70 |
-
($this->_keepFrame ? '' : 'no') . 'frame',
|
71 |
-
($this->_keepTransparency ? '' : 'no') . 'transparency',
|
72 |
-
($this->_constrainOnly ? 'do' : 'not') . 'constrainonly',
|
73 |
-
$this->_rgbToString($this->_backgroundColor),
|
74 |
-
'angle' . $this->_angle,
|
75 |
-
'quality' . $this->_quality
|
76 |
-
);
|
77 |
-
|
78 |
-
// if has watermark add watermark params to hash
|
79 |
-
if ($this->getWatermarkFile()) {
|
80 |
-
$miscParams[] = $this->getWatermarkFile();
|
81 |
-
$miscParams[] = $this->getWatermarkImageOpacity();
|
82 |
-
$miscParams[] = $this->getWatermarkPosition();
|
83 |
-
$miscParams[] = $this->getWatermarkWidth();
|
84 |
-
$miscParams[] = $this->getWatermarkHeigth();
|
85 |
-
}
|
86 |
-
|
87 |
-
$path[] = md5(implode('_', $miscParams));
|
88 |
-
}
|
89 |
-
else {
|
90 |
-
$path[] = $file;
|
91 |
-
}
|
92 |
-
|
93 |
-
|
94 |
-
// append prepared filename
|
95 |
-
if (substr($file,0,4) != 'http') {
|
96 |
-
$this->_newFile = implode('/', $path) . $file; // the $file contains heading slash
|
97 |
-
}
|
98 |
-
else {
|
99 |
-
$this->_newFile = $file;
|
100 |
-
}
|
101 |
-
return $this;
|
102 |
-
}
|
103 |
-
|
104 |
-
protected function _rgbToString($rgbArray)
|
105 |
-
{
|
106 |
-
$result = array();
|
107 |
-
foreach ($rgbArray as $value) {
|
108 |
-
if (null === $value) {
|
109 |
-
$result[] = 'null';
|
110 |
-
}
|
111 |
-
else {
|
112 |
-
$result[] = sprintf('%02s', dechex($value));
|
113 |
-
}
|
114 |
-
}
|
115 |
-
return implode($result);
|
116 |
-
}
|
117 |
-
|
118 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Bintime_Sinchimport_Model_Image extends Mage_Catalog_Model_Product_Image {
|
4 |
+
|
5 |
+
public function setBaseFile($file)
|
6 |
+
{
|
7 |
+
$this->_isBaseFilePlaceholder = false;
|
8 |
+
if (substr($file,0,4) != 'http') {
|
9 |
+
if (($file) && (0 !== strpos($file, '/', 0))) {
|
10 |
+
$file = '/' . $file;
|
11 |
+
}
|
12 |
+
$baseDir = Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath();
|
13 |
+
if ('/no_selection' == $file) {
|
14 |
+
$file = null;
|
15 |
+
}
|
16 |
+
if ($file) {
|
17 |
+
if ((!file_exists($baseDir . $file)) || !$this->_checkMemory($baseDir . $file)) {
|
18 |
+
$file = null;
|
19 |
+
}
|
20 |
+
}
|
21 |
+
if (!$file) {
|
22 |
+
// check if placeholder defined in config
|
23 |
+
$isConfigPlaceholder = Mage::getStoreConfig("catalog/placeholder/{$this->getDestinationSubdir()}_placeholder");
|
24 |
+
$configPlaceholder = '/placeholder/' . $isConfigPlaceholder;
|
25 |
+
if ($isConfigPlaceholder && file_exists($baseDir . $configPlaceholder)) {
|
26 |
+
$file = $configPlaceholder;
|
27 |
+
}
|
28 |
+
else {
|
29 |
+
// replace file with skin or default skin placeholder
|
30 |
+
$skinBaseDir = Mage::getDesign()->getSkinBaseDir();
|
31 |
+
$skinPlaceholder = "/images/catalog/product/placeholder/{$this->getDestinationSubdir()}.jpg";
|
32 |
+
$file = $skinPlaceholder;
|
33 |
+
if (file_exists($skinBaseDir . $file)) {
|
34 |
+
$baseDir = $skinBaseDir;
|
35 |
+
}
|
36 |
+
else {
|
37 |
+
$baseDir = Mage::getDesign()->getSkinBaseDir(array('_theme' => 'default'));
|
38 |
+
if (!file_exists($baseDir . $file)) {
|
39 |
+
$baseDir = Mage::getDesign()->getSkinBaseDir(array('_theme' => 'default', '_package' => 'base'));
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
$this->_isBaseFilePlaceholder = true;
|
44 |
+
}
|
45 |
+
|
46 |
+
$baseFile = $baseDir . $file;
|
47 |
+
}
|
48 |
+
else {
|
49 |
+
$baseFile =$file;
|
50 |
+
}
|
51 |
+
if ((!$file) AND (!file_exists($baseFile)) AND substr($baseFile,0,4) != 'http') {
|
52 |
+
throw new Exception(Mage::helper('catalog')->__('Image file not found'));
|
53 |
+
}
|
54 |
+
|
55 |
+
$this->_baseFile = $baseFile;
|
56 |
+
if (substr($baseFile,0,4) != 'http') {
|
57 |
+
// build new filename (most important params)
|
58 |
+
$path = array(
|
59 |
+
Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath(),
|
60 |
+
'cache',
|
61 |
+
Mage::app()->getStore()->getId(),
|
62 |
+
$path[] = $this->getDestinationSubdir()
|
63 |
+
);
|
64 |
+
if((!empty($this->_width)) || (!empty($this->_height)))
|
65 |
+
$path[] = "{$this->_width}x{$this->_height}";
|
66 |
+
|
67 |
+
// add misk params as a hash
|
68 |
+
$miscParams = array(
|
69 |
+
($this->_keepAspectRatio ? '' : 'non') . 'proportional',
|
70 |
+
($this->_keepFrame ? '' : 'no') . 'frame',
|
71 |
+
($this->_keepTransparency ? '' : 'no') . 'transparency',
|
72 |
+
($this->_constrainOnly ? 'do' : 'not') . 'constrainonly',
|
73 |
+
$this->_rgbToString($this->_backgroundColor),
|
74 |
+
'angle' . $this->_angle,
|
75 |
+
'quality' . $this->_quality
|
76 |
+
);
|
77 |
+
|
78 |
+
// if has watermark add watermark params to hash
|
79 |
+
if ($this->getWatermarkFile()) {
|
80 |
+
$miscParams[] = $this->getWatermarkFile();
|
81 |
+
$miscParams[] = $this->getWatermarkImageOpacity();
|
82 |
+
$miscParams[] = $this->getWatermarkPosition();
|
83 |
+
$miscParams[] = $this->getWatermarkWidth();
|
84 |
+
$miscParams[] = $this->getWatermarkHeigth();
|
85 |
+
}
|
86 |
+
|
87 |
+
$path[] = md5(implode('_', $miscParams));
|
88 |
+
}
|
89 |
+
else {
|
90 |
+
$path[] = $file;
|
91 |
+
}
|
92 |
+
|
93 |
+
|
94 |
+
// append prepared filename
|
95 |
+
if (substr($file,0,4) != 'http') {
|
96 |
+
$this->_newFile = implode('/', $path) . $file; // the $file contains heading slash
|
97 |
+
}
|
98 |
+
else {
|
99 |
+
$this->_newFile = $file;
|
100 |
+
}
|
101 |
+
return $this;
|
102 |
+
}
|
103 |
+
|
104 |
+
protected function _rgbToString($rgbArray)
|
105 |
+
{
|
106 |
+
$result = array();
|
107 |
+
foreach ($rgbArray as $value) {
|
108 |
+
if (null === $value) {
|
109 |
+
$result[] = 'null';
|
110 |
+
}
|
111 |
+
else {
|
112 |
+
$result[] = sprintf('%02s', dechex($value));
|
113 |
+
}
|
114 |
+
}
|
115 |
+
return implode($result);
|
116 |
+
}
|
117 |
+
|
118 |
+
}
|
app/code/local/Bintime/Sinchimport/Model/Layer.php
CHANGED
@@ -1,49 +1,49 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Bintime_Sinchimport_Model_Layer extends Mage_Catalog_Model_Layer
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* Возвращает фичи, по которым следует строить навигацию для данной категории.
|
7 |
-
*
|
8 |
-
* @return mixed
|
9 |
-
*/
|
10 |
-
public function getFilterableFeatures()
|
11 |
-
{
|
12 |
-
Varien_Profiler::start(__METHOD__);
|
13 |
-
|
14 |
-
$category = Mage::registry('current_category');
|
15 |
-
if( empty($category) ) { $category = Mage::getModel('catalog/category')->load( Mage::app()->getStore()->getRootCategoryId() ); }
|
16 |
-
$categoryId = $category->getEntityId();
|
17 |
-
$resource = Mage::getSingleton('core/resource');
|
18 |
-
$tCategor = $resource->getTableName('stINch_categories');
|
19 |
-
$tCatFeature = $resource->getTableName('stINch_categories_features');
|
20 |
-
$tRestrictedVal = $resource->getTableName('stINch_restricted_values');
|
21 |
-
$tCategMapp = $resource->getTableName('stINch_categories_mapping');
|
22 |
-
|
23 |
-
$select = new Varien_Db_Select(Mage::getSingleton('core/resource')->getConnection('core_read'));
|
24 |
-
$select->from(array('cf' => $tCatFeature))
|
25 |
-
->joinInner(
|
26 |
-
array('rv' => $tRestrictedVal),
|
27 |
-
'cf.category_feature_id = rv.category_feature_id'
|
28 |
-
)
|
29 |
-
->joinInner(
|
30 |
-
array('cm' => $tCategMapp),
|
31 |
-
'cf.store_category_id = cm.store_category_id'
|
32 |
-
)
|
33 |
-
->where('cm.shop_entity_id = '.$categoryId)
|
34 |
-
->group('cf.feature_name')
|
35 |
-
->order('cf.display_order_number', 'asc')
|
36 |
-
->order('cf.feature_name', 'asc')
|
37 |
-
->order('rv.display_order_number', 'asc');
|
38 |
-
;
|
39 |
-
$select->columns('cf.feature_name AS name');
|
40 |
-
$select->columns('cf.category_feature_id as feature_id');
|
41 |
-
$select->columns('GROUP_CONCAT(`rv`.`text` SEPARATOR "\n") as restricted_values');
|
42 |
-
$result = $select->query();
|
43 |
-
// echo $select->__toString();
|
44 |
-
//exit;
|
45 |
-
Varien_Profiler::stop(__METHOD__);
|
46 |
-
return $result;
|
47 |
-
}
|
48 |
-
|
49 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Bintime_Sinchimport_Model_Layer extends Mage_Catalog_Model_Layer
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Возвращает фичи, по которым следует строить навигацию для данной категории.
|
7 |
+
*
|
8 |
+
* @return mixed
|
9 |
+
*/
|
10 |
+
public function getFilterableFeatures()
|
11 |
+
{
|
12 |
+
Varien_Profiler::start(__METHOD__);
|
13 |
+
|
14 |
+
$category = Mage::registry('current_category');
|
15 |
+
if( empty($category) ) { $category = Mage::getModel('catalog/category')->load( Mage::app()->getStore()->getRootCategoryId() ); }
|
16 |
+
$categoryId = $category->getEntityId();
|
17 |
+
$resource = Mage::getSingleton('core/resource');
|
18 |
+
$tCategor = $resource->getTableName('stINch_categories');
|
19 |
+
$tCatFeature = $resource->getTableName('stINch_categories_features');
|
20 |
+
$tRestrictedVal = $resource->getTableName('stINch_restricted_values');
|
21 |
+
$tCategMapp = $resource->getTableName('stINch_categories_mapping');
|
22 |
+
|
23 |
+
$select = new Varien_Db_Select(Mage::getSingleton('core/resource')->getConnection('core_read'));
|
24 |
+
$select->from(array('cf' => $tCatFeature))
|
25 |
+
->joinInner(
|
26 |
+
array('rv' => $tRestrictedVal),
|
27 |
+
'cf.category_feature_id = rv.category_feature_id'
|
28 |
+
)
|
29 |
+
->joinInner(
|
30 |
+
array('cm' => $tCategMapp),
|
31 |
+
'cf.store_category_id = cm.store_category_id'
|
32 |
+
)
|
33 |
+
->where('cm.shop_entity_id = '.$categoryId)
|
34 |
+
->group('cf.feature_name')
|
35 |
+
->order('cf.display_order_number', 'asc')
|
36 |
+
->order('cf.feature_name', 'asc')
|
37 |
+
->order('rv.display_order_number', 'asc');
|
38 |
+
;
|
39 |
+
$select->columns('cf.feature_name AS name');
|
40 |
+
$select->columns('cf.category_feature_id as feature_id');
|
41 |
+
$select->columns('GROUP_CONCAT(`rv`.`text` SEPARATOR "\n") as restricted_values');
|
42 |
+
$result = $select->query();
|
43 |
+
// echo $select->__toString();
|
44 |
+
//exit;
|
45 |
+
Varien_Profiler::stop(__METHOD__);
|
46 |
+
return $result;
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
app/code/local/Bintime/Sinchimport/Model/Layer/Filter/Feature.php
CHANGED
@@ -1,260 +1,248 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Bintime_Sinchimport_Model_Layer_Filter_Feature extends Mage_Catalog_Model_Layer_Filter_Abstract
|
4 |
-
{
|
5 |
-
protected $_resource;
|
6 |
-
|
7 |
-
protected $dont_panic = true;
|
8 |
-
|
9 |
-
const LESS = 1;
|
10 |
-
const GREATER = 2;
|
11 |
-
/**
|
12 |
-
* Construct attribute filter
|
13 |
-
*
|
14 |
-
*/
|
15 |
-
public function __construct()
|
16 |
-
{
|
17 |
-
parent::__construct();
|
18 |
-
$this->_requestVar = 'ice_feature';
|
19 |
-
}
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Задаёт атрибут и строку запроса для текущего фильтра
|
23 |
-
* @param Фича из Icecat'a
|
24 |
-
* @return Bintime_Icelayered_Model_Layer_Filter_Feature
|
25 |
-
*/
|
26 |
-
public function setAttributeModel($attribute)
|
27 |
-
{
|
28 |
-
$this->setRequestVar('feature_' . $attribute['category_feature_id']);
|
29 |
-
$this->setData('attribute_model', $attribute);
|
30 |
-
return $this;
|
31 |
-
}
|
32 |
-
|
33 |
-
public function getName()
|
34 |
-
{
|
35 |
-
$attribute = $this->getAttributeModel();
|
36 |
-
return $attribute['name'];
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Retrieve resource instance
|
41 |
-
*
|
42 |
-
* @return Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Attribute
|
43 |
-
*/
|
44 |
-
protected function _getResource()
|
45 |
-
{
|
46 |
-
|
47 |
-
if (is_null($this->_resource)) {
|
48 |
-
$this->_resource = Mage::getResourceModel('sinchimport/layer_filter_feature');
|
49 |
-
}
|
50 |
-
return $this->_resource;
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Get option text from frontend model by option id
|
55 |
-
*
|
56 |
-
* @param int $optionId
|
57 |
-
* @return unknown
|
58 |
-
*/
|
59 |
-
protected function _getOptionText($optionId)
|
60 |
-
{
|
61 |
-
$feature = $this->getAttributeModel();
|
62 |
-
return $optionId;
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Apply attribute option filter to product collection
|
67 |
-
*
|
68 |
-
* @param Zend_Controller_Request_Abstract $request
|
69 |
-
* @param Varien_Object $filterBlock
|
70 |
-
* @return Mage_Catalog_Model_Layer_Filter_Attribute
|
71 |
-
*/
|
72 |
-
public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
|
73 |
-
{
|
74 |
-
$filter = $request->getParam($this->_requestVar);
|
75 |
-
if (is_array($filter)) {
|
76 |
-
return $this;
|
77 |
-
}
|
78 |
-
|
79 |
-
$text = $this->_getOptionText($filter);
|
80 |
-
if ($filter && $text) {
|
81 |
-
$this->_getResource()->applyFilterToCollection($this, $filter);
|
82 |
-
$this->getLayer()->getState()->addFilter($this->_createItem($text, $filter));
|
83 |
-
$this->_items = array();
|
84 |
-
}
|
85 |
-
|
86 |
-
return $this;
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Check whether specified attribute can be used in LN
|
91 |
-
*
|
92 |
-
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
|
93 |
-
* @return bool
|
94 |
-
*/
|
95 |
-
protected function _getIsFilterableAttribute($attribute)
|
96 |
-
{
|
97 |
-
if ($this->dont_panic) return null;
|
98 |
-
die(__METHOD__);
|
99 |
-
return $attribute->getIsFilterable();
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Возвращает массив с информацией по опциям фильтра.
|
104 |
-
* @return array
|
105 |
-
*/
|
106 |
-
protected function _getItemsData()
|
107 |
-
{
|
108 |
-
Varien_Profiler::start(__METHOD__);
|
109 |
-
|
110 |
-
$feature = $this->getAttributeModel();
|
111 |
-
$this->_requestVar = 'feature_' . $feature['category_feature_id'];
|
112 |
-
$limitDirection = $feature['limit_direction'];
|
113 |
-
|
114 |
-
$data = array();
|
115 |
-
$options = explode("\n", $feature['restricted_values']);
|
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 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
INNER JOIN ".Mage::getSingleton('core/resource')->getTableName('catalog_product_index_price')." AS price_index
|
250 |
-
ON price_index.entity_id = e.entity_id
|
251 |
-
AND price_index.website_id = '1'
|
252 |
-
AND price_index.customer_group_id = 0
|
253 |
-
INNER JOIN ".Mage::getSingleton('core/resource')->getTableName('stINch_products_feature_'.$feature['category_feature_id'])." AS idx_".$category_feature_id."
|
254 |
-
ON idx_".$category_feature_id.".entity_id = e.icecat_product_id;
|
255 |
-
";
|
256 |
-
|
257 |
-
return Mage::getSingleton('core/resource')->getConnection('core_read')->fetchCol($select);
|
258 |
-
}
|
259 |
-
|
260 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Bintime_Sinchimport_Model_Layer_Filter_Feature extends Mage_Catalog_Model_Layer_Filter_Abstract
|
4 |
+
{
|
5 |
+
protected $_resource;
|
6 |
+
|
7 |
+
protected $dont_panic = true;
|
8 |
+
|
9 |
+
const LESS = 1;
|
10 |
+
const GREATER = 2;
|
11 |
+
/**
|
12 |
+
* Construct attribute filter
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
public function __construct()
|
16 |
+
{
|
17 |
+
parent::__construct();
|
18 |
+
$this->_requestVar = 'ice_feature';
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Задаёт атрибут и строку запроса для текущего фильтра
|
23 |
+
* @param Фича из Icecat'a
|
24 |
+
* @return Bintime_Icelayered_Model_Layer_Filter_Feature
|
25 |
+
*/
|
26 |
+
public function setAttributeModel($attribute)
|
27 |
+
{
|
28 |
+
$this->setRequestVar('feature_' . $attribute['category_feature_id']);
|
29 |
+
$this->setData('attribute_model', $attribute);
|
30 |
+
return $this;
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getName()
|
34 |
+
{
|
35 |
+
$attribute = $this->getAttributeModel();
|
36 |
+
return $attribute['name'];
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Retrieve resource instance
|
41 |
+
*
|
42 |
+
* @return Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Attribute
|
43 |
+
*/
|
44 |
+
protected function _getResource()
|
45 |
+
{
|
46 |
+
|
47 |
+
if (is_null($this->_resource)) {
|
48 |
+
$this->_resource = Mage::getResourceModel('sinchimport/layer_filter_feature');
|
49 |
+
}
|
50 |
+
return $this->_resource;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Get option text from frontend model by option id
|
55 |
+
*
|
56 |
+
* @param int $optionId
|
57 |
+
* @return unknown
|
58 |
+
*/
|
59 |
+
protected function _getOptionText($optionId)
|
60 |
+
{
|
61 |
+
$feature = $this->getAttributeModel();
|
62 |
+
return $optionId;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Apply attribute option filter to product collection
|
67 |
+
*
|
68 |
+
* @param Zend_Controller_Request_Abstract $request
|
69 |
+
* @param Varien_Object $filterBlock
|
70 |
+
* @return Mage_Catalog_Model_Layer_Filter_Attribute
|
71 |
+
*/
|
72 |
+
public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
|
73 |
+
{
|
74 |
+
$filter = $request->getParam($this->_requestVar);
|
75 |
+
if (is_array($filter)) {
|
76 |
+
return $this;
|
77 |
+
}
|
78 |
+
|
79 |
+
$text = $this->_getOptionText($filter);
|
80 |
+
if ($filter && $text) {
|
81 |
+
$this->_getResource()->applyFilterToCollection($this, $filter);
|
82 |
+
$this->getLayer()->getState()->addFilter($this->_createItem($text, $filter));
|
83 |
+
$this->_items = array();
|
84 |
+
}
|
85 |
+
|
86 |
+
return $this;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Check whether specified attribute can be used in LN
|
91 |
+
*
|
92 |
+
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
|
93 |
+
* @return bool
|
94 |
+
*/
|
95 |
+
protected function _getIsFilterableAttribute($attribute)
|
96 |
+
{
|
97 |
+
if ($this->dont_panic) return null;
|
98 |
+
die(__METHOD__);
|
99 |
+
return $attribute->getIsFilterable();
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Возвращает массив с информацией по опциям фильтра.
|
104 |
+
* @return array
|
105 |
+
*/
|
106 |
+
protected function _getItemsData()
|
107 |
+
{
|
108 |
+
Varien_Profiler::start(__METHOD__);
|
109 |
+
|
110 |
+
$feature = $this->getAttributeModel();
|
111 |
+
$this->_requestVar = 'feature_' . $feature['category_feature_id'];
|
112 |
+
$limitDirection = isset($feature['limit_direction']) ? $feature['limit_direction'] : 0;
|
113 |
+
|
114 |
+
$data = array();
|
115 |
+
$options = explode("\n", $feature['restricted_values']);
|
116 |
+
if (count($options) == 0) {
|
117 |
+
Varien_Profiler::stop(__METHOD__);
|
118 |
+
return $data;
|
119 |
+
}
|
120 |
+
if (isset($feature['order_val']) && $feature['order_val'] == '2') {
|
121 |
+
$options = array_reverse($options);
|
122 |
+
}
|
123 |
+
if ($limitDirection != self::LESS && $limitDirection != self::GREATER) {
|
124 |
+
|
125 |
+
$optionsCount = $this->_getResource()->getCount($this);
|
126 |
+
foreach ($options as $option) {
|
127 |
+
if ($pos = strpos($option, '::')) {
|
128 |
+
$value = substr($option, 0, $pos);
|
129 |
+
$presentation_value = substr($option, $pos + 2);
|
130 |
+
}
|
131 |
+
else {
|
132 |
+
$value = $presentation_value = $option;
|
133 |
+
}
|
134 |
+
if (isset($optionsCount[$value]) && $optionsCount[$value] > 0) {
|
135 |
+
$data[] = array(
|
136 |
+
'label' => $presentation_value,
|
137 |
+
'value' => $value,
|
138 |
+
'count' => $optionsCount[$value],
|
139 |
+
);
|
140 |
+
}
|
141 |
+
}
|
142 |
+
} else {
|
143 |
+
$oCount = count($options);
|
144 |
+
$intervals = array();
|
145 |
+
if ($feature['order_val'] == '2') {
|
146 |
+
for ($i = 0; $i < $oCount -1; $i++) {
|
147 |
+
$intervals[$i]['high'] = $options[$i];
|
148 |
+
$intervals[$i]['low'] = $options[$i +1];
|
149 |
+
}
|
150 |
+
} else {
|
151 |
+
for ($i = 0; $i < $oCount -1; $i++) {
|
152 |
+
$intervals[$i]['low'] = $options[$i];
|
153 |
+
$intervals[$i]['high'] = $options[$i +1];
|
154 |
+
}
|
155 |
+
}
|
156 |
+
//FIXME: this is ugly
|
157 |
+
if ($feature['order_val'] == '2') {
|
158 |
+
array_push ($intervals, array(
|
159 |
+
'high' => $options[$oCount -1],
|
160 |
+
));
|
161 |
+
array_unshift($intervals, array(
|
162 |
+
'low' => $options[0],
|
163 |
+
));
|
164 |
+
} else {
|
165 |
+
array_push ($intervals, array(
|
166 |
+
'low' => $options[$oCount -1],
|
167 |
+
));
|
168 |
+
array_unshift($intervals, array(
|
169 |
+
'high' => $options[0],
|
170 |
+
));
|
171 |
+
}
|
172 |
+
|
173 |
+
$this->setData('intervals', $intervals);
|
174 |
+
|
175 |
+
$defaultSign = $feature['default_sign'];
|
176 |
+
for($i = 0; $i < count($intervals); $i++) {
|
177 |
+
if ($feature['order_val'] == '2') {
|
178 |
+
$interval = $intervals[$i];
|
179 |
+
$label = isset($interval['high']) ? $interval['high'] . " $defaultSign" : '>';
|
180 |
+
if ($label == '>' && isset($intervals[$i + 1])) {
|
181 |
+
$pad = strlen($intervals[$i + 1]['high'] . $defaultSign) + 2;
|
182 |
+
$label = str_pad($label, $pad*2, ' ', STR_PAD_LEFT);
|
183 |
+
$label = str_replace(' ', ' ', $label);
|
184 |
+
}
|
185 |
+
$label .= isset($interval['high'], $interval['high']) ? ' - ' : ' ';
|
186 |
+
$label .= isset($interval['low']) ? $interval['low'] . " $defaultSign" : '>';
|
187 |
+
$value = isset($interval['low']) ? $interval['low'] : '-';
|
188 |
+
$value .= ',';
|
189 |
+
$value .= isset($interval['high']) ? $interval['high'] : '-';
|
190 |
+
if (isset($interval['high']) AND !isset($interval['low'])) { $value = '-,'.$interval['high'];}
|
191 |
+
if ($this->_getResource()->getIntervalsCountDescending($this, $interval) > 0){
|
192 |
+
$data[] = array(
|
193 |
+
'label' => $label,
|
194 |
+
'value' => $value,
|
195 |
+
'count' => $this->_getResource()->getIntervalsCountDescending($this, $interval),
|
196 |
+
);
|
197 |
+
}
|
198 |
+
} else {
|
199 |
+
$interval = $intervals[$i];
|
200 |
+
$label = isset($interval['low']) ? $interval['low'] . " $defaultSign" : '<';
|
201 |
+
if ($label == '<' && isset($intervals[$i + 1])) {
|
202 |
+
$pad = strlen($intervals[$i + 1]['low'] . $defaultSign) + 2;
|
203 |
+
$label = str_pad($label, $pad*2, ' ', STR_PAD_LEFT);
|
204 |
+
$label = str_replace(' ', ' ', $label);
|
205 |
+
}
|
206 |
+
$label .= isset($interval['low'], $interval['high']) ? ' - ' : ' ';
|
207 |
+
$label .= isset($interval['high']) ? $interval['high'] . " $defaultSign" : '<';
|
208 |
+
|
209 |
+
$value = isset($interval['low']) ? $interval['low'] : '-';
|
210 |
+
$value .= ',';
|
211 |
+
$value .= isset($interval['high']) ? $interval['high'] : '-';
|
212 |
+
if ($this->_getResource()->getIntervalsCount($this, $interval) > 0){
|
213 |
+
$data[] = array(
|
214 |
+
'label' => $label,
|
215 |
+
'value' => $value,
|
216 |
+
'count' => $this->_getResource()->getIntervalsCount($this, $interval),
|
217 |
+
);
|
218 |
+
}
|
219 |
+
}
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
Varien_Profiler::stop(__METHOD__);
|
224 |
+
return $data;
|
225 |
+
}
|
226 |
+
|
227 |
+
public function getOrderValues($category_feature_id,$categoryId)
|
228 |
+
{
|
229 |
+
$select = "
|
230 |
+
SELECT COUNT(e.entity_id) AS count
|
231 |
+
FROM ".Mage::getSingleton('core/resource')->getTableName('catalog_product_entity')." AS e
|
232 |
+
INNER JOIN ".Mage::getSingleton('core/resource')->getTableName('catalog_category_product_index')." AS cat_index
|
233 |
+
ON cat_index.product_id=e.entity_id
|
234 |
+
AND cat_index.store_id='1'
|
235 |
+
AND cat_index.visibility IN(2, 4)
|
236 |
+
AND cat_index.category_id='".$categoryId."'
|
237 |
+
INNER JOIN ".Mage::getSingleton('core/resource')->getTableName('catalog_product_index_price')." AS price_index
|
238 |
+
ON price_index.entity_id = e.entity_id
|
239 |
+
AND price_index.website_id = '1'
|
240 |
+
AND price_index.customer_group_id = 0
|
241 |
+
INNER JOIN ".Mage::getSingleton('core/resource')->getTableName('stINch_products_feature_'.$feature['category_feature_id'])." AS idx_".$category_feature_id."
|
242 |
+
ON idx_".$category_feature_id.".entity_id = e.icecat_product_id;
|
243 |
+
";
|
244 |
+
|
245 |
+
return Mage::getSingleton('core/resource')->getConnection('core_read')->fetchCol($select);
|
246 |
+
}
|
247 |
+
|
248 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Bintime/Sinchimport/Model/Layer/Filter/Price.php
CHANGED
@@ -1,194 +1,189 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* price filter - override price breaks for customer price grouping
|
5 |
-
*
|
6 |
-
* @category Mage
|
7 |
-
* @package Mage_Catalog
|
8 |
-
* @author Sergey Stepanchuk
|
9 |
-
*/
|
10 |
-
class Bintime_Sinchimport_Model_Layer_Filter_Price extends Mage_Catalog_Model_Layer_Filter_Price
|
11 |
-
{
|
12 |
-
/**
|
13 |
-
* Get price range for building filter steps
|
14 |
-
*
|
15 |
-
* @return int
|
16 |
-
*//*
|
17 |
-
public function getPriceRange()
|
18 |
-
{
|
19 |
-
|
20 |
-
$range = $this->getData('price_range');
|
21 |
-
if (is_null($range)) {
|
22 |
-
$maxPrice = $this->getMaxPriceInt();
|
23 |
-
$index = 2;
|
24 |
-
if ($maxPrice<1000) {
|
25 |
-
$index = 1;
|
26 |
-
}
|
27 |
-
do {
|
28 |
-
$range = pow(10, (strlen(floor($maxPrice))-$index));
|
29 |
-
$items = $this->getRangeItemCounts($range);
|
30 |
-
$index++;
|
31 |
-
}
|
32 |
-
while($range>self::MIN_RANGE_POWER && count($items)<2);
|
33 |
-
|
34 |
-
$this->setData('price_range', $range);
|
35 |
-
}
|
36 |
-
return $range;
|
37 |
-
}
|
38 |
-
|
39 |
-
*/
|
40 |
-
/**
|
41 |
-
* Apply price range filter to collection
|
42 |
-
*
|
43 |
-
* @param Zend_Controller_Request_Abstract $request
|
44 |
-
* @param $filterBlock
|
45 |
-
*
|
46 |
-
* @return Mage_Catalog_Model_Layer_Filter_Price
|
47 |
-
*/
|
48 |
-
public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
|
49 |
-
{
|
50 |
-
/**
|
51 |
-
* Filter must be string: $index,$range
|
52 |
-
*/
|
53 |
-
$filter = $request->getParam($this->getRequestVar());
|
54 |
-
if (!$filter) {
|
55 |
-
return $this;
|
56 |
-
}
|
57 |
-
/* echo "<pre>";
|
58 |
-
var_dump($filter);
|
59 |
-
echo "</pre>";
|
60 |
-
*/
|
61 |
-
if(strstr($filter, ',')){
|
62 |
-
$filter = explode(',', $filter);
|
63 |
-
if (count($filter) != 2) {
|
64 |
-
return $this;
|
65 |
-
}
|
66 |
-
list($index, $range) = $filter;
|
67 |
-
// echo $index.$range."AAAAAAAa";
|
68 |
-
if ((int)$index && (int)$range) {
|
69 |
-
$this->setPriceRange((int)$range);
|
70 |
-
|
71 |
-
$this->_applyToCollection($range, $index);
|
72 |
-
$this->getLayer()->getState()->addFilter(
|
73 |
-
$this->_createItem($this->_renderItemLabel($range, $index), $filter)
|
74 |
-
);
|
75 |
-
|
76 |
-
$this->_items = array();
|
77 |
-
}
|
78 |
-
|
79 |
-
}elseif(strstr($filter, '-')){
|
80 |
-
$filter = explode('-', $filter);
|
81 |
-
if (count($filter) != 2) {
|
82 |
-
return $this;
|
83 |
-
}
|
84 |
-
|
85 |
-
list($minPrice, $maxPrice) = $filter;
|
86 |
-
// echo $minPrice."BBBBBB".$maxPrice;
|
87 |
-
|
88 |
-
// if ((int)$minPrice && (int)$maxPrice) {
|
89 |
-
if(((int)$minPrice || $minPrice==0) && ((int)$maxPrice || $maxPrice=='*')){
|
90 |
-
// $this->setPriceRange((int)$range);
|
91 |
-
|
92 |
-
$this->_applyToCollectionMinMaxPrice($minPrice, $maxPrice);
|
93 |
-
$this->getLayer()->getState()->addFilter(
|
94 |
-
$this->_createItem($this->_renderItemLabelMinMaxPrice($minPrice, $maxPrice), $filter)
|
95 |
-
);
|
96 |
-
|
97 |
-
$this->_items = array();
|
98 |
-
}
|
99 |
-
|
100 |
-
}
|
101 |
-
|
102 |
-
return $this;
|
103 |
-
}
|
104 |
-
/**
|
105 |
-
* Prepare text of item label
|
106 |
-
*
|
107 |
-
* @param int $fromPrice
|
108 |
-
* @param int
|
109 |
-
* @return string
|
110 |
-
*/
|
111 |
-
|
112 |
-
protected function _renderItemLabelMinMaxPrice($fromPrice, $toPrice)
|
113 |
-
{
|
114 |
-
$store = Mage::app()->getStore();
|
115 |
-
$toPriceLabel=$toPrice;
|
116 |
-
$fromPrice = $store->formatPrice($fromPrice);
|
117 |
-
$toPrice = $store->formatPrice($toPrice);
|
118 |
-
$label= Mage::helper('catalog')->__('%s - %s', $fromPrice, $toPrice);
|
119 |
-
if( $toPriceLabel=='' || $toPriceLabel=='*'){
|
120 |
-
$label=$fromPrice." + ";
|
121 |
-
}
|
122 |
-
|
123 |
-
return $label;
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Get data for build price filter items
|
128 |
-
*
|
129 |
-
* @return array
|
130 |
-
*/
|
131 |
-
protected function _getItemsData()
|
132 |
-
{
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
$price_breaks
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
$
|
143 |
-
if($
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
$this->_getResource()->applyFilterToCollectionMinMaxPrice($this, $minPrice, $maxPrice);
|
191 |
-
return $this;
|
192 |
-
}
|
193 |
-
|
194 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* price filter - override price breaks for customer price grouping
|
5 |
+
*
|
6 |
+
* @category Mage
|
7 |
+
* @package Mage_Catalog
|
8 |
+
* @author Sergey Stepanchuk
|
9 |
+
*/
|
10 |
+
class Bintime_Sinchimport_Model_Layer_Filter_Price extends Mage_Catalog_Model_Layer_Filter_Price
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Get price range for building filter steps
|
14 |
+
*
|
15 |
+
* @return int
|
16 |
+
*//*
|
17 |
+
public function getPriceRange()
|
18 |
+
{
|
19 |
+
|
20 |
+
$range = $this->getData('price_range');
|
21 |
+
if (is_null($range)) {
|
22 |
+
$maxPrice = $this->getMaxPriceInt();
|
23 |
+
$index = 2;
|
24 |
+
if ($maxPrice<1000) {
|
25 |
+
$index = 1;
|
26 |
+
}
|
27 |
+
do {
|
28 |
+
$range = pow(10, (strlen(floor($maxPrice))-$index));
|
29 |
+
$items = $this->getRangeItemCounts($range);
|
30 |
+
$index++;
|
31 |
+
}
|
32 |
+
while($range>self::MIN_RANGE_POWER && count($items)<2);
|
33 |
+
|
34 |
+
$this->setData('price_range', $range);
|
35 |
+
}
|
36 |
+
return $range;
|
37 |
+
}
|
38 |
+
|
39 |
+
*/
|
40 |
+
/**
|
41 |
+
* Apply price range filter to collection
|
42 |
+
*
|
43 |
+
* @param Zend_Controller_Request_Abstract $request
|
44 |
+
* @param $filterBlock
|
45 |
+
*
|
46 |
+
* @return Mage_Catalog_Model_Layer_Filter_Price
|
47 |
+
*/
|
48 |
+
public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
|
49 |
+
{
|
50 |
+
/**
|
51 |
+
* Filter must be string: $index,$range
|
52 |
+
*/
|
53 |
+
$filter = $request->getParam($this->getRequestVar());
|
54 |
+
if (!$filter) {
|
55 |
+
return $this;
|
56 |
+
}
|
57 |
+
/* echo "<pre>";
|
58 |
+
var_dump($filter);
|
59 |
+
echo "</pre>";
|
60 |
+
*/
|
61 |
+
if(strstr($filter, ',')){
|
62 |
+
$filter = explode(',', $filter);
|
63 |
+
if (count($filter) != 2) {
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
list($index, $range) = $filter;
|
67 |
+
// echo $index.$range."AAAAAAAa";
|
68 |
+
if ((int)$index && (int)$range) {
|
69 |
+
$this->setPriceRange((int)$range);
|
70 |
+
|
71 |
+
$this->_applyToCollection($range, $index);
|
72 |
+
$this->getLayer()->getState()->addFilter(
|
73 |
+
$this->_createItem($this->_renderItemLabel($range, $index), $filter)
|
74 |
+
);
|
75 |
+
|
76 |
+
$this->_items = array();
|
77 |
+
}
|
78 |
+
|
79 |
+
}elseif(strstr($filter, '-')){
|
80 |
+
$filter = explode('-', $filter);
|
81 |
+
if (count($filter) != 2) {
|
82 |
+
return $this;
|
83 |
+
}
|
84 |
+
|
85 |
+
list($minPrice, $maxPrice) = $filter;
|
86 |
+
// echo $minPrice."BBBBBB".$maxPrice;
|
87 |
+
|
88 |
+
// if ((int)$minPrice && (int)$maxPrice) {
|
89 |
+
if(((int)$minPrice || $minPrice==0) && ((int)$maxPrice || $maxPrice=='*')){
|
90 |
+
// $this->setPriceRange((int)$range);
|
91 |
+
|
92 |
+
$this->_applyToCollectionMinMaxPrice($minPrice, $maxPrice);
|
93 |
+
$this->getLayer()->getState()->addFilter(
|
94 |
+
$this->_createItem($this->_renderItemLabelMinMaxPrice($minPrice, $maxPrice), $filter)
|
95 |
+
);
|
96 |
+
|
97 |
+
$this->_items = array();
|
98 |
+
}
|
99 |
+
|
100 |
+
}
|
101 |
+
|
102 |
+
return $this;
|
103 |
+
}
|
104 |
+
/**
|
105 |
+
* Prepare text of item label
|
106 |
+
*
|
107 |
+
* @param int $fromPrice
|
108 |
+
* @param int
|
109 |
+
* @return string
|
110 |
+
*/
|
111 |
+
|
112 |
+
protected function _renderItemLabelMinMaxPrice($fromPrice, $toPrice)
|
113 |
+
{
|
114 |
+
$store = Mage::app()->getStore();
|
115 |
+
$toPriceLabel=$toPrice;
|
116 |
+
$fromPrice = $store->formatPrice($fromPrice);
|
117 |
+
$toPrice = $store->formatPrice($toPrice);
|
118 |
+
$label= Mage::helper('catalog')->__('%s - %s', $fromPrice, $toPrice);
|
119 |
+
if( $toPriceLabel=='' || $toPriceLabel=='*'){
|
120 |
+
$label=$fromPrice." + ";
|
121 |
+
}
|
122 |
+
|
123 |
+
return $label;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Get data for build price filter items
|
128 |
+
*
|
129 |
+
* @return array
|
130 |
+
*/
|
131 |
+
protected function _getItemsData()
|
132 |
+
{
|
133 |
+
$import=Mage::getModel('sinchimport/sinch');
|
134 |
+
$price_breaks=$import->price_breaks_filter;
|
135 |
+
|
136 |
+
if(strpos($price_breaks, ';') !== false){
|
137 |
+
$price_ranges = explode(';', $price_breaks);
|
138 |
+
foreach ($price_ranges as $price_range) {
|
139 |
+
$price_range_value=trim($price_range);
|
140 |
+
if($price_range_value == '' || strpos($price_range_value, "-") === false) continue;
|
141 |
+
$price_range_value = explode('-', $price_range_value);
|
142 |
+
list($minPrice, $maxPrice) = $price_range_value;
|
143 |
+
if(is_numeric($minPrice) && (is_numeric($maxPrice) || $maxPrice=='*')){
|
144 |
+
$count=$this->_getResource()->getCountMinMaxPrice($this, $minPrice, $maxPrice);
|
145 |
+
if($count){
|
146 |
+
$data[] = array(
|
147 |
+
'label' => $this->_renderItemLabelMinMaxPrice($minPrice, $maxPrice),
|
148 |
+
'value' =>$price_range_value,
|
149 |
+
'count' => $count,
|
150 |
+
);
|
151 |
+
}
|
152 |
+
}
|
153 |
+
}
|
154 |
+
if($data){
|
155 |
+
return $data;
|
156 |
+
}
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
$range = $this->getPriceRange();
|
161 |
+
$dbRanges = $this->getRangeItemCounts($range);
|
162 |
+
$data = array();
|
163 |
+
|
164 |
+
foreach ($dbRanges as $index=>$count) {
|
165 |
+
$data[] = array(
|
166 |
+
'label' => $this->_renderItemLabel($range, $index),
|
167 |
+
'value' => $index . ',' . $range,
|
168 |
+
'count' => $count,
|
169 |
+
);
|
170 |
+
}
|
171 |
+
|
172 |
+
return $data;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Apply filter value to product collection based on customer price breaks and selected value
|
177 |
+
*
|
178 |
+
* @param int $minPrice
|
179 |
+
* @param int $maxPrice
|
180 |
+
* @return Mage_Catalog_Model_Layer_Filter_Price
|
181 |
+
*/
|
182 |
+
|
183 |
+
protected function _applyToCollectionMinMaxPrice($minPrice, $maxPrice)
|
184 |
+
{
|
185 |
+
$this->_getResource()->applyFilterToCollectionMinMaxPrice($this, $minPrice, $maxPrice);
|
186 |
+
return $this;
|
187 |
+
}
|
188 |
+
|
189 |
+
}
|
|
|
|
|
|
|
|
|
|
app/code/local/Bintime/Sinchimport/Model/Resource/Layer/Filter/Price.php
CHANGED
@@ -56,8 +56,7 @@ class Bintime_Sinchimport_Model_Resource_Layer_Filter_Price extends Mage_Catalo
|
|
56 |
'count' => $countExpr
|
57 |
));
|
58 |
|
59 |
-
$
|
60 |
-
return key($count);
|
61 |
}
|
62 |
|
63 |
protected function _getSelect($filter)
|
56 |
'count' => $countExpr
|
57 |
));
|
58 |
|
59 |
+
return $connection->fetchOne($select);
|
|
|
60 |
}
|
61 |
|
62 |
protected function _getSelect($filter)
|
app/code/local/Bintime/Sinchimport/Model/Resource/Mysql4/Layer/Filter/Feature.php
CHANGED
@@ -1,383 +1,381 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Bintime_Sinchimport_Model_Resource_Mysql4_Layer_Filter_Feature extends Mage_Core_Model_Mysql4_Abstract
|
4 |
-
{
|
5 |
-
protected $resultTable = 'SinchFilterResult';
|
6 |
-
|
7 |
-
protected static $lastResultTable = false;
|
8 |
-
|
9 |
-
protected $filterAplied = false;
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Initialize connection and define main table name
|
13 |
-
*
|
14 |
-
*/
|
15 |
-
protected function _construct()
|
16 |
-
{
|
17 |
-
$this->_init('catalog/ice_feature', 'category_feature_id');
|
18 |
-
}
|
19 |
-
|
20 |
-
protected function _getTableName($type, $id = 0)
|
21 |
-
{
|
22 |
-
$tablePrefix = (string)Mage::getConfig()->getTablePrefix();
|
23 |
-
switch ($type) {
|
24 |
-
case 'result':
|
25 |
-
$id = (int)$id;
|
26 |
-
return $tablePrefix . $this->resultTable . "_$id";
|
27 |
-
break;
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
*
|
41 |
-
*
|
42 |
-
* @param
|
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 |
-
|
75 |
-
$sql = "TRUNCATE TABLE {$resultTable}";
|
76 |
-
$connection->exec($sql);
|
77 |
-
|
78 |
-
$featuresTable = $this->_getTableName('FilterListOfFeatures');
|
79 |
-
$sql = "TRUNCATE TABLE `$featuresTable`";
|
80 |
-
$connection->exec($sql);
|
81 |
-
|
82 |
-
$feature = $filter->getAttributeModel();
|
83 |
-
if ($feature['limit_direction'] != 1 && $feature['limit_direction'] != 2) {
|
84 |
-
if (!is_null($value)) {
|
85 |
-
$sql = "INSERT INTO `$featuresTable` (category_feature_id, feature_value) VALUES (?)";
|
86 |
-
$sql = $connection->quoteInto($sql, array($cfid, $value));
|
87 |
-
$connection->exec($sql);
|
88 |
-
}
|
89 |
-
$params = 'null, null';
|
90 |
-
}
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
$params
|
95 |
-
$params .= '
|
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 |
-
$select->reset(Zend_Db_Select::
|
148 |
-
$select->reset(Zend_Db_Select::
|
149 |
-
$
|
150 |
-
$
|
151 |
-
$
|
152 |
-
|
153 |
-
$
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
array(
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
$
|
168 |
-
$
|
169 |
-
$featureTables
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
}
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
$select->reset(Zend_Db_Select::
|
195 |
-
$select->reset(Zend_Db_Select::
|
196 |
-
|
197 |
-
$
|
198 |
-
|
199 |
-
$
|
200 |
-
|
201 |
-
$
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
array(
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
$count
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
$select->reset(Zend_Db_Select::
|
236 |
-
$select->reset(Zend_Db_Select::
|
237 |
-
|
238 |
-
$
|
239 |
-
|
240 |
-
$
|
241 |
-
|
242 |
-
$
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
array(
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
*
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
$
|
294 |
-
|
295 |
-
$
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
$
|
301 |
-
$
|
302 |
-
$featureTables
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
`
|
329 |
-
`
|
330 |
-
`
|
331 |
-
`
|
332 |
-
`
|
333 |
-
`
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
$
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
INNER JOIN ".Mage::getSingleton('core/resource')->getTableName('
|
353 |
-
ON
|
354 |
-
INNER JOIN ".Mage::getSingleton('core/resource')->getTableName('
|
355 |
-
ON
|
356 |
-
INNER JOIN ".Mage::getSingleton('core/resource')->getTableName('
|
357 |
-
ON (PR.
|
358 |
-
INNER JOIN ".Mage::getSingleton('core/resource')->getTableName('
|
359 |
-
ON (
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
*
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
$
|
377 |
-
|
378 |
-
|
379 |
-
$query
|
380 |
-
|
381 |
-
|
382 |
-
}
|
383 |
-
}
|
1 |
+
<?php
|
2 |