Version Description
[+] New sidebars were added: search box, minicart and vertical categories
[+] New options effecting the store appearance
[!] Minor bugfixes
Download this release
Release Info
Developer | Ecwid |
Plugin | Ecwid Ecommerce Shopping Cart |
Version | 0.2 |
Comparing to | |
See all releases |
Code changes from version 0.1 to 0.2
- ecwid-shopping-cart.php +343 -19
- readme.txt +9 -3
ecwid-shopping-cart.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Ecwid Shopping Cart
|
|
4 |
Plugin URI: http://www.ecwid.com/
|
5 |
Description: Ecwid is free full-fledged shopping cart. It can be easily integreted with any Wordpress blog and takes less than 5 minutes to set up.
|
6 |
Author: Ecwid Team
|
7 |
-
Version: 0.
|
8 |
Author URI: http://www.ecwid.com/
|
9 |
*/
|
10 |
|
@@ -19,6 +19,12 @@ add_action('admin_menu', 'ecwid_options_add_page');
|
|
19 |
add_action('wp_dashboard_setup', 'ecwid_add_dashboard_widgets' );
|
20 |
|
21 |
add_shortcode('ecwid_script', 'ecwid_script_shortcode');
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
|
24 |
|
@@ -27,26 +33,85 @@ function ecwid_script_shortcode() {
|
|
27 |
return "<script type=\"text/javascript\" src=\"http://app.ecwid.com/script.js?$store_id\"></script>";
|
28 |
}
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
function ecwid_store_activate() {
|
31 |
$my_post = array();
|
32 |
$content = <<<EOT
|
33 |
-
<!-- Ecwid code start -->
|
34 |
-
|
35 |
-
<!-- Please do not remove the line below otherwise your Ecwid shopping cart will not work.
|
36 |
-
Start of special code: -->
|
37 |
-
[ecwid_script]
|
38 |
-
<!-- End of special code. -->
|
39 |
-
|
40 |
-
<!-- Feel free to modify the code below: add new widgets, alter the existing ones. -->
|
41 |
-
<div><script type="text/javascript"> xCategories(); </script></div>
|
42 |
-
<div><script type="text/javascript"> xProductBrowser("itemsPerRow=3","itemsPerPage=9","searchResultsItemsPerPage=10"); </script></div>
|
43 |
-
<div><script type="text/javascript"> xMinicart("style=","layout=attachToCategories"); </script></div>
|
44 |
<!-- Ecwid code end -->
|
45 |
|
46 |
EOT;
|
47 |
add_option("ecwid_store_page_id", '', '', 'yes');
|
48 |
add_option("ecwid_store_id", '1003', '', 'yes');
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
$_tmp_page = null;
|
51 |
if (!empty($id) and ($id > 0)) {
|
52 |
$_tmp_page = get_page($id);
|
@@ -92,10 +157,17 @@ function ecwid_store_deactivate() {
|
|
92 |
}
|
93 |
|
94 |
}
|
95 |
-
|
96 |
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
|
101 |
function ecwid_options_add_page() {
|
@@ -104,24 +176,138 @@ function ecwid_options_add_page() {
|
|
104 |
|
105 |
function ecwid_options_do_page() {
|
106 |
$store_id = get_ecwid_store_id();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
?>
|
108 |
<div class="wrap">
|
109 |
<h2>Ecwid settings</h2>
|
110 |
<form method="post" action="options.php">
|
111 |
<?php settings_fields('ecwid_options_page'); ?>
|
112 |
<table class="form-table">
|
113 |
-
<tr
|
114 |
<td><input type="text" name="ecwid_store_id" value="<?php if ($store_id != 1003) echo $store_id; ?>" /></td>
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
</table>
|
117 |
<p class="submit">
|
118 |
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
119 |
</p>
|
|
|
120 |
<style>
|
121 |
-
ul#ecwid-instruction-ul li {
|
122 |
padding-bottom:10px;
|
123 |
}
|
124 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
<div id="ecwid-instruction" >
|
126 |
<h4>Instruction on how to get your free Store ID</h4>
|
127 |
<ul style="padding-left:30px;list-style-type:disc;" id="ecwid-instruction-ul">
|
@@ -175,4 +361,142 @@ function ecwid_add_dashboard_widgets() {
|
|
175 |
}
|
176 |
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
?>
|
4 |
Plugin URI: http://www.ecwid.com/
|
5 |
Description: Ecwid is free full-fledged shopping cart. It can be easily integreted with any Wordpress blog and takes less than 5 minutes to set up.
|
6 |
Author: Ecwid Team
|
7 |
+
Version: 0.2
|
8 |
Author URI: http://www.ecwid.com/
|
9 |
*/
|
10 |
|
19 |
add_action('wp_dashboard_setup', 'ecwid_add_dashboard_widgets' );
|
20 |
|
21 |
add_shortcode('ecwid_script', 'ecwid_script_shortcode');
|
22 |
+
add_shortcode('ecwid_minicart', 'ecwid_minicart_shortcode');
|
23 |
+
|
24 |
+
add_shortcode('ecwid_searchbox', 'ecwid_searchbox_shortcode');
|
25 |
+
add_shortcode('ecwid_categories', 'ecwid_categories_shortcode');
|
26 |
+
add_shortcode('ecwid_productbrowser', 'ecwid_productbrowser_shortcode');
|
27 |
+
|
28 |
|
29 |
|
30 |
|
33 |
return "<script type=\"text/javascript\" src=\"http://app.ecwid.com/script.js?$store_id\"></script>";
|
34 |
}
|
35 |
|
36 |
+
|
37 |
+
function ecwid_minicart_shortcode() {
|
38 |
+
$ecwid_enable_minicart = get_option('ecwid_enable_minicart');
|
39 |
+
if (!empty($ecwid_enable_minicart)) {
|
40 |
+
$s = <<<EOT
|
41 |
+
<div><script type="text/javascript"> xMinicart("style=","layout=attachToCategories"); </script></div>
|
42 |
+
EOT;
|
43 |
+
return $s;
|
44 |
+
} else {
|
45 |
+
return "";
|
46 |
+
}
|
47 |
+
}
|
48 |
+
function ecwid_searchbox_shortcode() {
|
49 |
+
$ecwid_show_search_box = get_option('ecwid_show_search_box');
|
50 |
+
if (!empty($ecwid_show_search_box)) {
|
51 |
+
$s = <<<EOT
|
52 |
+
<div><script type="text/javascript"> xSearchPanel("style="); </script></div>
|
53 |
+
EOT;
|
54 |
+
return $s;
|
55 |
+
} else {
|
56 |
+
return "";
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
function ecwid_categories_shortcode() {
|
61 |
+
$ecwid_show_categories = get_option('ecwid_show_categories');
|
62 |
+
if (!empty($ecwid_show_categories)) {
|
63 |
+
$s = <<<EOT
|
64 |
+
<div><script type="text/javascript"> xCategories("style="); </script></div>
|
65 |
+
EOT;
|
66 |
+
return $s;
|
67 |
+
} else {
|
68 |
+
return "";
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
function ecwid_productbrowser_shortcode() {
|
73 |
+
$ecwid_pb_itemsperrow = get_option('ecwid_pb_itemsperrow');
|
74 |
+
$ecwid_pb_itemsperpage = get_option('ecwid_pb_itemsperpage');
|
75 |
+
$ecwid_pb_searchresultsitemsperpage = get_option('ecwid_pb_searchresultsitemsperpage');
|
76 |
+
|
77 |
+
if (empty($ecwid_pb_itemsperrow))
|
78 |
+
$ecwid_pb_itemsperrow = 3;
|
79 |
+
|
80 |
+
if (empty($ecwid_pb_itemsperpage))
|
81 |
+
$ecwid_pb_itemsperpage = 6;
|
82 |
+
|
83 |
+
if (empty($ecwid_pb_searchresultsitemsperpage))
|
84 |
+
$ecwid_pb_searchresultsitemsperpage = 10;
|
85 |
+
|
86 |
+
$s = <<<EOT
|
87 |
+
<div><script type="text/javascript">xProductBrowser("itemsPerRow=$ecwid_pb_itemsperrow","itemsPerPage=$ecwid_pb_itemsperpage","searchResultsItemsPerPage=$ecwid_pb_searchresultsitemsperpage","style="); </script> </div>
|
88 |
+
EOT;
|
89 |
+
return $s;
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
function ecwid_store_activate() {
|
95 |
$my_post = array();
|
96 |
$content = <<<EOT
|
97 |
+
<!-- Ecwid code start v0.2. Please do not remove the line below otherwise your Ecwid shopping cart will not work. -->
|
98 |
+
[ecwid_script] [ecwid_minicart] [ecwid_searchbox] [ecwid_categories] [ecwid_productbrowser]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
<!-- Ecwid code end -->
|
100 |
|
101 |
EOT;
|
102 |
add_option("ecwid_store_page_id", '', '', 'yes');
|
103 |
add_option("ecwid_store_id", '1003', '', 'yes');
|
104 |
+
|
105 |
+
add_option("ecwid_enable_minicart", 'Y', '', 'yes');
|
106 |
+
add_option("ecwid_show_categories", 'Y', '', 'yes');
|
107 |
+
add_option("ecwid_show_search_box", '', '', 'yes');
|
108 |
+
|
109 |
+
add_option("ecwid_pb_itemsperrow", '3', '', 'yes');
|
110 |
+
add_option("ecwid_pb_itemsperpage", '6', '', 'yes');
|
111 |
+
add_option("ecwid_pb_searchresultsitemsperpage", '10', '', 'yes');
|
112 |
+
|
113 |
+
|
114 |
+
$id = get_option("ecwid_store_page_id");
|
115 |
$_tmp_page = null;
|
116 |
if (!empty($id) and ($id > 0)) {
|
117 |
$_tmp_page = get_page($id);
|
157 |
}
|
158 |
|
159 |
}
|
|
|
160 |
|
161 |
+
function ecwid_settings_api_init() {
|
162 |
+
register_setting('ecwid_options_page', 'ecwid_store_id','intval' );
|
163 |
+
register_setting('ecwid_options_page', 'ecwid_enable_minicart');
|
164 |
+
|
165 |
+
register_setting('ecwid_options_page', 'ecwid_show_categories');
|
166 |
+
register_setting('ecwid_options_page', 'ecwid_show_search_box');
|
167 |
+
|
168 |
+
register_setting('ecwid_options_page', 'ecwid_pb_itemsperrow','intval');
|
169 |
+
register_setting('ecwid_options_page', 'ecwid_pb_itemsperpage','intval');
|
170 |
+
register_setting('ecwid_options_page', 'ecwid_pb_searchresultsitemsperpage','intval');
|
171 |
}
|
172 |
|
173 |
function ecwid_options_add_page() {
|
176 |
|
177 |
function ecwid_options_do_page() {
|
178 |
$store_id = get_ecwid_store_id();
|
179 |
+
$ecwid_enable_minicart = get_option('ecwid_enable_minicart');
|
180 |
+
$ecwid_show_categories = get_option('ecwid_show_categories');
|
181 |
+
$ecwid_show_search_box = get_option('ecwid_show_search_box');
|
182 |
+
|
183 |
+
$ecwid_pb_itemsperrow = get_option('ecwid_pb_itemsperrow');
|
184 |
+
$ecwid_pb_itemsperpage = get_option('ecwid_pb_itemsperpage');
|
185 |
+
$ecwid_pb_searchresultsitemsperpage = get_option('ecwid_pb_searchresultsitemsperpage');
|
186 |
+
|
187 |
+
$ecwid_page_id = get_option("ecwid_store_page_id");
|
188 |
+
$_tmp_page = null;
|
189 |
+
$disabled = false;
|
190 |
+
if (!empty($ecwid_page_id) and ($ecwid_page_id > 0)) {
|
191 |
+
$_tmp_page = get_page($ecwid_page_id);
|
192 |
+
$content = $_tmp_page->post_content;
|
193 |
+
if ( (strpos($content, "[ecwid_productbrowser]") === false) && (strpos($content, "xProductBrowser") !== false) )
|
194 |
+
$disabled = true;
|
195 |
+
}
|
196 |
+
|
197 |
+
if ($disabled)
|
198 |
+
$disabled_str = 'disabled = "disabled"';
|
199 |
+
else
|
200 |
+
$disabled_str = "";
|
201 |
+
|
202 |
+
|
203 |
?>
|
204 |
<div class="wrap">
|
205 |
<h2>Ecwid settings</h2>
|
206 |
<form method="post" action="options.php">
|
207 |
<?php settings_fields('ecwid_options_page'); ?>
|
208 |
<table class="form-table">
|
209 |
+
<tr><th scope="row">Store ID:</th>
|
210 |
<td><input type="text" name="ecwid_store_id" value="<?php if ($store_id != 1003) echo $store_id; ?>" /></td>
|
211 |
+
</tr>
|
212 |
+
|
213 |
+
|
214 |
+
<tr><th scope="row">
|
215 |
+
Enable minicart attached to categories?</th>
|
216 |
+
<td><input type="checkbox" name="ecwid_enable_minicart" <?php if (!empty($ecwid_enable_minicart)) echo "checked=\"checked\"";?> <? echo $disabled_str; ?> />
|
217 |
+
<small>(If you added minicart to your blog's sidebar, please disable this option)</small>
|
218 |
+
|
219 |
+
</td>
|
220 |
+
</tr>
|
221 |
+
<tr><th scope="row">
|
222 |
+
Show horizontal categories? </th>
|
223 |
+
<td><input type="checkbox" name="ecwid_show_categories" <?php if (!empty($ecwid_show_categories)) echo "checked=\"checked\""; echo $disabled_str; ?> />
|
224 |
+
</td>
|
225 |
+
</tr>
|
226 |
+
|
227 |
+
<tr><th scope="row">
|
228 |
+
Show search box? </th>
|
229 |
+
<td><input type="checkbox" name="ecwid_show_search_box" <?php if (!empty($ecwid_show_search_box)) echo "checked=\"checked\"";?> <?php echo $disabled_str;?> />
|
230 |
+
</td>
|
231 |
+
</tr>
|
232 |
+
|
233 |
+
<tr><th scope="row">Products/categories per row</th>
|
234 |
+
<td><input type="text" name="ecwid_pb_itemsperrow" value="<?php echo $ecwid_pb_itemsperrow; ?>" <?php echo $disabled_str;?> /></td>
|
235 |
+
</tr>
|
236 |
+
<tr><th scope="row">Products per page</th>
|
237 |
+
<td><input type="text" name="ecwid_pb_itemsperpage" value="<?php echo $ecwid_pb_itemsperpage; ?>" <?php echo $disabled_str;?> /></td>
|
238 |
+
</tr>
|
239 |
+
<tr><th scope="row">Search result items per page</th>
|
240 |
+
<td><input type="text" name="ecwid_pb_searchresultsitemsperpage" value="<?php echo $ecwid_pb_searchresultsitemsperpage; ?>" <?php echo $disabled_str;?> /></td>
|
241 |
+
</tr>
|
242 |
</table>
|
243 |
<p class="submit">
|
244 |
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
245 |
</p>
|
246 |
+
|
247 |
<style>
|
248 |
+
ul#ecwid-instruction-ul li, ul#ecwid-need-manual-editing-ul li {
|
249 |
padding-bottom:10px;
|
250 |
}
|
251 |
</style>
|
252 |
+
|
253 |
+
|
254 |
+
<?php
|
255 |
+
if ($disabled) {
|
256 |
+
?>
|
257 |
+
|
258 |
+
<div id="ecwid-need-manual-editing" >
|
259 |
+
<h4>Why I cannot change some options?</h4>
|
260 |
+
|
261 |
+
Most likely you've upgraded <strong>Ecwid Shopping Cart</strong> plugin from <strong>v0.1</strong> to the next one. The Ecwid integration code was changed in this new version. So if you want to use the new options you should update the code manually. This procedure isn't that complex and will take just a few minutes.
|
262 |
+
<br />
|
263 |
+
<ul style="padding-left:30px;list-style-type:disc;" id="ecwid-need-manual-editing-ul">
|
264 |
+
<li>
|
265 |
+
Open <a href="page.php?action=edit&post=<?php echo intval($ecwid_page_id); ?>">your store page for editing</a>.
|
266 |
+
</li>
|
267 |
+
|
268 |
+
<li>
|
269 |
+
Make sure that you change edit mode to "HTML" instead of "Visual".
|
270 |
+
</li>
|
271 |
+
|
272 |
+
|
273 |
+
<li>
|
274 |
+
Replace these lines:<br /><br />
|
275 |
+
|
276 |
+
<pre style="background-color:#d3e9e9;">
|
277 |
+
<!-- Ecwid code start -->
|
278 |
+
<!-- Please do not remove the line below otherwise your Ecwid shopping cart will not work.
|
279 |
+
Start of special code: -->
|
280 |
+
[ecwid_script]
|
281 |
+
<!-- End of special code. -->
|
282 |
+
|
283 |
+
<!-- Feel free to modify the code below: add new widgets, alter the existing ones. -->
|
284 |
+
<div><script type="text/javascript"> xCategories(); </script></div>
|
285 |
+
<div><script type="text/javascript"> xProductBrowser("itemsPerRow=3","itemsPerPage=9","searchResultsItemsPerPage=10"); </script></div>
|
286 |
+
<div><script type="text/javascript"> xMinicart("style=","layout=attachToCategories"); </script></div>
|
287 |
+
<!-- Ecwid code end -->
|
288 |
+
</pre>
|
289 |
+
<br /><br />
|
290 |
+
with these ones:
|
291 |
+
<br /><br />
|
292 |
+
<pre style="background-color:#d3e9e9;">
|
293 |
+
<!-- Ecwid code start v0.2. Please do not remove the line below otherwise your Ecwid shopping cart will not work. -->
|
294 |
+
[ecwid_script] [ecwid_minicart] [ecwid_searchbox] [ecwid_categories] [ecwid_productbrowser]
|
295 |
+
<!-- Ecwid code end -->
|
296 |
+
</pre>
|
297 |
+
</li>
|
298 |
+
|
299 |
+
<li>Save the changes</li>
|
300 |
+
|
301 |
+
</ul>
|
302 |
+
|
303 |
+
</div>
|
304 |
+
|
305 |
+
|
306 |
+
<?php
|
307 |
+
|
308 |
+
}
|
309 |
+
|
310 |
+
?>
|
311 |
<div id="ecwid-instruction" >
|
312 |
<h4>Instruction on how to get your free Store ID</h4>
|
313 |
<ul style="padding-left:30px;list-style-type:disc;" id="ecwid-instruction-ul">
|
361 |
}
|
362 |
|
363 |
|
364 |
+
|
365 |
+
class EcwidMinicartWidget extends WP_Widget {
|
366 |
+
|
367 |
+
function EcwidMinicartWidget() {
|
368 |
+
$widget_ops = array('classname' => 'widget_ecwid_minicart', 'description' => __( "Your store's minicart") );
|
369 |
+
$this->WP_Widget('ecwidminicart', __('Ecwid Minicart'), $widget_ops);
|
370 |
+
}
|
371 |
+
|
372 |
+
function widget($args, $instance) {
|
373 |
+
extract($args);
|
374 |
+
$title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title']);
|
375 |
+
|
376 |
+
echo $before_widget;
|
377 |
+
|
378 |
+
if ( $title )
|
379 |
+
echo $before_title . $title . $after_title;
|
380 |
+
|
381 |
+
$store_id = get_ecwid_store_id();
|
382 |
+
echo "<div><script type=\"text/javascript\" src=\"http://app.ecwid.com/script.js?$store_id\"></script>";
|
383 |
+
echo <<<EOT
|
384 |
+
<script type="text/javascript"> xMinicart("style="); </script>
|
385 |
+
</div>
|
386 |
+
EOT;
|
387 |
+
|
388 |
+
echo $after_widget;
|
389 |
+
}
|
390 |
+
|
391 |
+
function update($new_instance, $old_instance){
|
392 |
+
$instance = $old_instance;
|
393 |
+
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
394 |
+
|
395 |
+
return $instance;
|
396 |
+
}
|
397 |
+
|
398 |
+
function form($instance){
|
399 |
+
$instance = wp_parse_args( (array) $instance, array('title'=>'') );
|
400 |
+
|
401 |
+
$title = htmlspecialchars($instance['title']);
|
402 |
+
|
403 |
+
echo '<p><label for="' . $this->get_field_name('title') . '">' . __('Title:') . ' <input style="width:100%;" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . $title . '" /></label></p>';
|
404 |
+
}
|
405 |
+
|
406 |
+
}
|
407 |
+
|
408 |
+
class EcwidSearchWidget extends WP_Widget {
|
409 |
+
|
410 |
+
function EcwidSearchWidget() {
|
411 |
+
$widget_ops = array('classname' => 'widget_ecwid_search', 'description' => __( "Your store's search box") );
|
412 |
+
$this->WP_Widget('ecwidsearch', __('Ecwid Search Box'), $widget_ops);
|
413 |
+
}
|
414 |
+
|
415 |
+
function widget($args, $instance) {
|
416 |
+
extract($args);
|
417 |
+
$title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title']);
|
418 |
+
|
419 |
+
echo $before_widget;
|
420 |
+
|
421 |
+
if ( $title )
|
422 |
+
echo $before_title . $title . $after_title;
|
423 |
+
|
424 |
+
$store_id = get_ecwid_store_id();
|
425 |
+
echo "<div><script type=\"text/javascript\" src=\"http://app.ecwid.com/script.js?$store_id\"></script>";
|
426 |
+
echo <<<EOT
|
427 |
+
<script type="text/javascript"> xSearchPanel("style="); </script>
|
428 |
+
</div>
|
429 |
+
EOT;
|
430 |
+
|
431 |
+
echo $after_widget;
|
432 |
+
}
|
433 |
+
|
434 |
+
function update($new_instance, $old_instance){
|
435 |
+
$instance = $old_instance;
|
436 |
+
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
437 |
+
|
438 |
+
return $instance;
|
439 |
+
}
|
440 |
+
|
441 |
+
function form($instance){
|
442 |
+
$instance = wp_parse_args( (array) $instance, array('title'=>'') );
|
443 |
+
|
444 |
+
$title = htmlspecialchars($instance['title']);
|
445 |
+
|
446 |
+
echo '<p><label for="' . $this->get_field_name('title') . '">' . __('Title:') . ' <input style="width:100%;" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . $title . '" /></label></p>';
|
447 |
+
}
|
448 |
+
|
449 |
+
}
|
450 |
+
|
451 |
+
class EcwidVCategoriesWidget extends WP_Widget {
|
452 |
+
|
453 |
+
function EcwidVCategoriesWidget() {
|
454 |
+
$widget_ops = array('classname' => 'widget_ecwid_vcategories', 'description' => __( "Vertical menu of categories") );
|
455 |
+
$this->WP_Widget('ecwidvcategories', __('Ecwid Vertical Categories'), $widget_ops);
|
456 |
+
}
|
457 |
+
|
458 |
+
function widget($args, $instance) {
|
459 |
+
extract($args);
|
460 |
+
$title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title']);
|
461 |
+
|
462 |
+
echo $before_widget;
|
463 |
+
|
464 |
+
if ( $title )
|
465 |
+
echo $before_title . $title . $after_title;
|
466 |
+
|
467 |
+
$store_id = get_ecwid_store_id();
|
468 |
+
echo "<div><script type=\"text/javascript\" src=\"http://app.ecwid.com/script.js?$store_id\"></script>";
|
469 |
+
echo <<<EOT
|
470 |
+
<script type="text/javascript"> xVCategories("style="); </script>
|
471 |
+
</div>
|
472 |
+
EOT;
|
473 |
+
|
474 |
+
echo $after_widget;
|
475 |
+
}
|
476 |
+
|
477 |
+
function update($new_instance, $old_instance){
|
478 |
+
$instance = $old_instance;
|
479 |
+
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
480 |
+
|
481 |
+
return $instance;
|
482 |
+
}
|
483 |
+
|
484 |
+
function form($instance){
|
485 |
+
$instance = wp_parse_args( (array) $instance, array('title'=>'') );
|
486 |
+
|
487 |
+
$title = htmlspecialchars($instance['title']);
|
488 |
+
|
489 |
+
echo '<p><label for="' . $this->get_field_name('title') . '">' . __('Title:') . ' <input style="width:100%;" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . $title . '" /></label></p>';
|
490 |
+
}
|
491 |
+
|
492 |
+
}
|
493 |
+
|
494 |
+
|
495 |
+
function ecwid_sidebar_widgets_init() {
|
496 |
+
register_widget('EcwidMinicartWidget');
|
497 |
+
register_widget('EcwidSearchWidget');
|
498 |
+
register_widget('EcwidVCategoriesWidget');
|
499 |
+
}
|
500 |
+
add_action('widgets_init', 'ecwid_sidebar_widgets_init');
|
501 |
+
|
502 |
?>
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Ecwid Shopping Cart ===
|
2 |
Contributors: Ecwid Team
|
3 |
Tags: shopping cart, ecommerce, e-commerce, paypal, google checkout, 2checkout, store, shop, product catalog, inventory
|
4 |
-
Requires at least: 2.
|
5 |
Tested up to: 2.8
|
6 |
-
Stable tag: 0.
|
7 |
|
8 |
Ecwid is free full-fledged shopping cart. It can be easily integreted with
|
9 |
Wordpress blog and takes less than 5 minutes to set up.
|
@@ -39,6 +39,12 @@ Full list of features:
|
|
39 |
[http://www.ecwid.com/faq.html](http://www.ecwid.com/faq.html)
|
40 |
|
41 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
= 0.1 =
|
44 |
-
|
1 |
=== Ecwid Shopping Cart ===
|
2 |
Contributors: Ecwid Team
|
3 |
Tags: shopping cart, ecommerce, e-commerce, paypal, google checkout, 2checkout, store, shop, product catalog, inventory
|
4 |
+
Requires at least: 2.8
|
5 |
Tested up to: 2.8
|
6 |
+
Stable tag: 0.2
|
7 |
|
8 |
Ecwid is free full-fledged shopping cart. It can be easily integreted with
|
9 |
Wordpress blog and takes less than 5 minutes to set up.
|
39 |
[http://www.ecwid.com/faq.html](http://www.ecwid.com/faq.html)
|
40 |
|
41 |
== Changelog ==
|
42 |
+
= 0.2 =
|
43 |
+
[+] New sidebars were added: search box, minicart and vertical categories
|
44 |
+
|
45 |
+
[+] New options effecting the store appearance
|
46 |
+
|
47 |
+
[!] Minor bugfixes
|
48 |
|
49 |
= 0.1 =
|
50 |
+
[+] Initial version
|