Ecwid Ecommerce Shopping Cart - Version 0.3

Version Description

  • [+] Ecwid integration code was updated to the last vesion
  • [+] New product browser parameters: http://kb.ecwid.com/Product-Browser
  • [+] New built-in "ecwid_ProductBrowserURL" feature: http://kb.ecwid.com/ecwid_ProductBrowserURL
Download this release

Release Info

Developer Ecwid
Plugin Icon 128x128 Ecwid Ecommerce Shopping Cart
Version 0.3
Comparing to
See all releases

Code changes from version 0.2 to 0.3

Files changed (2) hide show
  1. ecwid-shopping-cart.php +151 -31
  2. readme.txt +14 -11
ecwid-shopping-cart.php CHANGED
@@ -4,12 +4,10 @@ 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.2
8
  Author URI: http://www.ecwid.com/
9
  */
10
 
11
-
12
-
13
  register_activation_hook( __FILE__, 'ecwid_store_activate' );
14
  register_deactivation_hook( __FILE__, 'ecwid_store_deactivate' );
15
 
@@ -30,7 +28,8 @@ add_shortcode('ecwid_productbrowser', 'ecwid_productbrowser_shortcode');
30
 
31
  function ecwid_script_shortcode() {
32
  $store_id = get_ecwid_store_id();
33
- return "<script type=\"text/javascript\" src=\"http://app.ecwid.com/script.js?$store_id\"></script>";
 
34
  }
35
 
36
 
@@ -70,10 +69,47 @@ EOT;
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
 
@@ -82,9 +118,11 @@ if (empty($ecwid_pb_itemsperpage))
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
  }
@@ -105,12 +143,22 @@ EOT;
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)) {
@@ -157,17 +205,33 @@ function ecwid_store_deactivate() {
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() {
@@ -179,10 +243,19 @@ function ecwid_options_do_page() {
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;
@@ -230,14 +303,44 @@ Enable minicart attached to categories?</th>
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">
@@ -370,23 +473,30 @@ class EcwidMinicartWidget extends WP_Widget {
370
  }
371
 
372
  function widget($args, $instance) {
373
- extract($args);
374
- $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $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;
@@ -423,6 +533,11 @@ class EcwidSearchWidget extends WP_Widget {
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>
@@ -466,6 +581,11 @@ class EcwidVCategoriesWidget extends WP_Widget {
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>
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.3
8
  Author URI: http://www.ecwid.com/
9
  */
10
 
 
 
11
  register_activation_hook( __FILE__, 'ecwid_store_activate' );
12
  register_deactivation_hook( __FILE__, 'ecwid_store_deactivate' );
13
 
28
 
29
  function ecwid_script_shortcode() {
30
  $store_id = get_ecwid_store_id();
31
+ $s = "<div><script type=\"text/javascript\" src=\"http://app.ecwid.com/script.js?$store_id\"></script></div>";
32
+ return $s;
33
  }
34
 
35
 
69
  }
70
 
71
  function ecwid_productbrowser_shortcode() {
72
+ $store_id = get_ecwid_store_id();
73
+ $list_of_views = array('list','grid','table');
74
+
75
+ /*
76
  $ecwid_pb_itemsperrow = get_option('ecwid_pb_itemsperrow');
77
  $ecwid_pb_itemsperpage = get_option('ecwid_pb_itemsperpage');
78
  $ecwid_pb_searchresultsitemsperpage = get_option('ecwid_pb_searchresultsitemsperpage');
79
+ */
80
+
81
+ $ecwid_pb_categoriesperrow = get_option('ecwid_pb_categoriesperrow');
82
+ $ecwid_pb_productspercolumn_grid = get_option('ecwid_pb_productspercolumn_grid');
83
+ $ecwid_pb_productsperrow_grid = get_option('ecwid_pb_productsperrow_grid');
84
+ $ecwid_pb_productsperpage_list = get_option('ecwid_pb_productsperpage_list');
85
+ $ecwid_pb_productsperpage_table = get_option('ecwid_pb_productsperpage_table');
86
+ $ecwid_pb_defaultview = get_option('ecwid_pb_defaultview');
87
+ $ecwid_pb_searchview = get_option('ecwid_pb_searchview');
88
+
89
+ if (empty($ecwid_pb_categoriesperrow)) {
90
+ $ecwid_pb_categoriesperrow = 3;
91
+ }
92
+ if (empty($ecwid_pb_productspercolumn_grid)) {
93
+ $ecwid_pb_productspercolumn_grid = 3;
94
+ }
95
+ if (empty($ecwid_pb_productsperrow_grid)) {
96
+ $ecwid_pb_productsperrow_grid = 3;
97
+ }
98
+ if (empty($ecwid_pb_productsperpage_list)) {
99
+ $ecwid_pb_productsperpage_list = 10;
100
+ }
101
+ if (empty($ecwid_pb_productsperpage_table)) {
102
+ $ecwid_pb_productsperpage_table = 20;
103
+ }
104
+
105
+ if (empty($ecwid_pb_defaultview) || !in_array($ecwid_pb_defaultview, $list_of_views)) {
106
+ $ecwid_pb_defaultview = 'grid';
107
+ }
108
+ if (empty($ecwid_pb_searchview) || !in_array($ecwid_pb_searchview, $list_of_views)) {
109
+ $ecwid_pb_searchview = 'list';
110
+ }
111
 
112
+ /*
113
  if (empty($ecwid_pb_itemsperrow))
114
  $ecwid_pb_itemsperrow = 3;
115
 
118
 
119
  if (empty($ecwid_pb_searchresultsitemsperpage))
120
  $ecwid_pb_searchresultsitemsperpage = 10;
121
+ */
122
 
123
  $s = <<<EOT
124
+ <div> <script type="text/javascript"> xProductBrowser("categoriesPerRow=$ecwid_pb_categoriesperrow","views=grid($ecwid_pb_productspercolumn_grid,$ecwid_pb_productsperrow_grid) list($ecwid_pb_productsperpage_list) table($ecwid_pb_productsperpage_table)","categoryView=$ecwid_pb_defaultview","searchView=$ecwid_pb_searchview","style=");</script></div>
125
+ <noscript>Your browser does not support JavaScript.<a href="http://app.ecwid.com/jsp/{$store_id}/catalog">HTML version of this store</a></noscript>
126
  EOT;
127
  return $s;
128
  }
143
  add_option("ecwid_enable_minicart", 'Y', '', 'yes');
144
  add_option("ecwid_show_categories", 'Y', '', 'yes');
145
  add_option("ecwid_show_search_box", '', '', 'yes');
 
 
 
 
146
 
147
+ /* old */
148
+ #add_option("ecwid_pb_itemsperrow", '3', '', 'yes');
149
+ #add_option("ecwid_pb_itemsperpage", '6', '', 'yes');
150
+ #add_option("ecwid_pb_searchresultsitemsperpage", '10', '', 'yes');
151
+
152
+ add_option("ecwid_pb_categoriesperrow", '3', '', 'yes');
153
+
154
+ add_option("ecwid_pb_productspercolumn_grid", '3', '', 'yes');
155
+ add_option("ecwid_pb_productsperrow_grid", '3', '', 'yes');
156
+ add_option("ecwid_pb_productsperpage_list", '10', '', 'yes');
157
+ add_option("ecwid_pb_productsperpage_table", '20', '', 'yes');
158
+
159
+ add_option("ecwid_pb_defaultview", 'grid', '', 'yes');
160
+ add_option("ecwid_pb_searchview", 'list', '', 'yes');
161
+
162
  $id = get_option("ecwid_store_page_id");
163
  $_tmp_page = null;
164
  if (!empty($id) and ($id > 0)) {
205
  }
206
 
207
  }
208
+
209
+ function ecwid_abs_intval($value) {
210
+ return abs(intval($value));
211
+ }
212
+
213
  function ecwid_settings_api_init() {
214
+ register_setting('ecwid_options_page', 'ecwid_store_id','ecwid_abs_intval' );
215
  register_setting('ecwid_options_page', 'ecwid_enable_minicart');
216
 
217
  register_setting('ecwid_options_page', 'ecwid_show_categories');
218
  register_setting('ecwid_options_page', 'ecwid_show_search_box');
219
+
220
+ register_setting('ecwid_options_page', 'ecwid_pb_categoriesperrow', 'ecwid_abs_intval');
221
+ register_setting('ecwid_options_page', 'ecwid_pb_productspercolumn_grid', 'ecwid_abs_intval');
222
+ register_setting('ecwid_options_page', 'ecwid_pb_productsperrow_grid', 'ecwid_abs_intval');
223
+ register_setting('ecwid_options_page', 'ecwid_pb_productsperpage_list', 'ecwid_abs_intval');
224
+ register_setting('ecwid_options_page', 'ecwid_pb_productsperpage_table', 'ecwid_abs_intval');
225
+ register_setting('ecwid_options_page', 'ecwid_pb_defaultview');
226
+ register_setting('ecwid_options_page', 'ecwid_pb_searchview');
227
+
228
+ /*
229
  register_setting('ecwid_options_page', 'ecwid_pb_itemsperrow','intval');
230
  register_setting('ecwid_options_page', 'ecwid_pb_itemsperpage','intval');
231
  register_setting('ecwid_options_page', 'ecwid_pb_searchresultsitemsperpage','intval');
232
+ */
233
+
234
+
235
  }
236
 
237
  function ecwid_options_add_page() {
243
  $ecwid_enable_minicart = get_option('ecwid_enable_minicart');
244
  $ecwid_show_categories = get_option('ecwid_show_categories');
245
  $ecwid_show_search_box = get_option('ecwid_show_search_box');
246
+ /*
247
  $ecwid_pb_itemsperrow = get_option('ecwid_pb_itemsperrow');
248
  $ecwid_pb_itemsperpage = get_option('ecwid_pb_itemsperpage');
249
  $ecwid_pb_searchresultsitemsperpage = get_option('ecwid_pb_searchresultsitemsperpage');
250
+ */
251
+
252
+ $ecwid_pb_categoriesperrow = get_option('ecwid_pb_categoriesperrow');
253
+ $ecwid_pb_productspercolumn_grid = get_option('ecwid_pb_productspercolumn_grid');
254
+ $ecwid_pb_productsperrow_grid = get_option('ecwid_pb_productsperrow_grid');
255
+ $ecwid_pb_productsperpage_list = get_option('ecwid_pb_productsperpage_list');
256
+ $ecwid_pb_productsperpage_table = get_option('ecwid_pb_productsperpage_table');
257
+ $ecwid_pb_defaultview = get_option('ecwid_pb_defaultview');
258
+ $ecwid_pb_searchview = get_option('ecwid_pb_searchview');
259
 
260
  $ecwid_page_id = get_option("ecwid_store_page_id");
261
  $_tmp_page = null;
303
  </td>
304
  </tr>
305
 
306
+ <tr><th scope="row">Categories per page</th>
307
+ <td><input type="text" name="ecwid_pb_categoriesperrow" value="<?php echo $ecwid_pb_categoriesperrow; ?>" <?php echo $disabled_str;?> /></td>
308
  </tr>
309
+
310
+ <tr><th scope="row">Products per column in grid mode</th>
311
+ <td><input type="text" name="ecwid_pb_productspercolumn_grid" value="<?php echo $ecwid_pb_productspercolumn_grid; ?>" <?php echo $disabled_str;?> /></td>
312
+ </tr> <tr><th scope="row">Products per row in grid mode</th>
313
+
314
+ <td><input type="text" name="ecwid_pb_productsperrow_grid" value="<?php echo $ecwid_pb_productsperrow_grid; ?>" <?php echo $disabled_str;?> /></td>
315
+ </tr>
316
+
317
+ <tr><th scope="row">Products per page in list mode</th>
318
+ <td><input type="text" name="ecwid_pb_productsperpage_list" value="<?php echo $ecwid_pb_productsperpage_list; ?>" <?php echo $disabled_str;?> /></td>
319
+ </tr>
320
+
321
+ <tr><th scope="row">Products per page in table mode</th>
322
+ <td><input type="text" name="ecwid_pb_productsperpage_table" value="<?php echo $ecwid_pb_productsperpage_table; ?>" <?php echo $disabled_str;?> /></td>
323
+ </tr>
324
+
325
+
326
+ <tr><th scope="row">Default view mode on product pages</th>
327
+ <td>
328
+ <select name="ecwid_pb_defaultview" <?php echo $disabled_str;?> >
329
+ <option value="grid" <?php if($ecwid_pb_defaultview == 'grid') echo 'selected="selected"' ?> >Grid mode</option>
330
+ <option value="list" <?php if($ecwid_pb_defaultview == 'list') echo 'selected="selected"' ?> >List mode</option>
331
+ <option value="table" <?php if($ecwid_pb_defaultview == 'table') echo 'selected="selected"' ?> >Table mode</option>
332
+ </select>
333
+ </td>
334
  </tr>
335
+
336
+ <tr><th scope="row">Default view mode on search results</th>
337
+ <td>
338
+ <select name="ecwid_pb_searchview" <?php echo $disabled_str;?> >
339
+ <option value="grid" <?php if($ecwid_pb_searchview == 'grid') echo 'selected="selected"' ?> >Grid mode</option>
340
+ <option value="list" <?php if($ecwid_pb_searchview == 'list') echo 'selected="selected"' ?> >List mode</option>
341
+ <option value="table" <?php if($ecwid_pb_searchview == 'table') echo 'selected="selected"' ?> >Table mode</option>
342
+ </select>
343
+ </td>
344
  </tr>
345
  </table>
346
  <p class="submit">
473
  }
474
 
475
  function widget($args, $instance) {
476
+ extract($args);
477
+ $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
478
 
479
+ echo $before_widget;
480
 
481
+ if ( $title )
482
+ echo $before_title . $title . $after_title;
483
 
484
  $store_id = get_ecwid_store_id();
485
  echo "<div><script type=\"text/javascript\" src=\"http://app.ecwid.com/script.js?$store_id\"></script>";
486
+
487
+
488
+ $ecwid_page_id = get_option("ecwid_store_page_id");
489
+ $page_url = get_page_link($ecwid_page_id);
490
+ $_tmp_page = get_page($ecwid_page_id);
491
+ if (!empty($page_url) && $_tmp_page != null)
492
+ echo "<script>var ecwid_ProductBrowserURL = \"$page_url\";</script>";
493
+ echo <<<EOT
494
+ <script type="text/javascript"> xMinicart("style="); </script>
495
+ </div>
496
  EOT;
497
+
498
+ echo $after_widget;
499
+ }
500
 
501
  function update($new_instance, $old_instance){
502
  $instance = $old_instance;
533
 
534
  $store_id = get_ecwid_store_id();
535
  echo "<div><script type=\"text/javascript\" src=\"http://app.ecwid.com/script.js?$store_id\"></script>";
536
+ $ecwid_page_id = get_option("ecwid_store_page_id");
537
+ $page_url = get_page_link($ecwid_page_id);
538
+ $_tmp_page = get_page($ecwid_page_id);
539
+ if (!empty($page_url) && $_tmp_page != null)
540
+ echo "<script>var ecwid_ProductBrowserURL = \"$page_url\";</script>";
541
  echo <<<EOT
542
  <script type="text/javascript"> xSearchPanel("style="); </script>
543
  </div>
581
 
582
  $store_id = get_ecwid_store_id();
583
  echo "<div><script type=\"text/javascript\" src=\"http://app.ecwid.com/script.js?$store_id\"></script>";
584
+ $ecwid_page_id = get_option("ecwid_store_page_id");
585
+ $page_url = get_page_link($ecwid_page_id);
586
+ $_tmp_page = get_page($ecwid_page_id);
587
+ if (!empty($page_url) && $_tmp_page != null)
588
+ echo "<script>var ecwid_ProductBrowserURL = \"$page_url\";</script>";
589
  echo <<<EOT
590
  <script type="text/javascript"> xVCategories("style="); </script>
591
  </div>
readme.txt CHANGED
@@ -2,14 +2,14 @@
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.
10
 
11
  == Description ==
12
- Ecwid is free full-fledged shopping cart that can be easily add to any blog.
13
  It offers the performance and flexibility you need,
14
  with none of the hassles you don't.
15
 
@@ -39,12 +39,15 @@ Full list of features:
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
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.9
6
+ Stable tag: 0.3
7
 
8
+ Ecwid is a free full-fledged shopping cart that can easily be added to any blog
9
+ and takes less than 5 minutes to set up.
10
 
11
  == Description ==
12
+ Ecwid is a free full-fledged shopping cart that can easily be added to any blog.
13
  It offers the performance and flexibility you need,
14
  with none of the hassles you don't.
15
 
39
  [http://www.ecwid.com/faq.html](http://www.ecwid.com/faq.html)
40
 
41
  == Changelog ==
42
+ = 0.3 =
43
+ - [+] Ecwid integration code was updated to the last vesion
44
+ - [+] New product browser parameters: http://kb.ecwid.com/Product-Browser
45
+ - [+] New built-in "ecwid_ProductBrowserURL" feature: http://kb.ecwid.com/ecwid_ProductBrowserURL
46
 
47
+ = 0.2 =
48
+ - [+] New sidebars were added: search box, minicart and vertical categories
49
+ - [+] New options effecting the store appearance
50
+ - [!] Minor bugfixes
51
 
52
  = 0.1 =
53
+ - [+] Initial version