jquerylistadecompras 4.0.28 → 4.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -45
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,6 @@ jQuery plugin of the Lista de Compras platform
|
|
|
6
6
|
[](https://wakatime.com/badge/github/InovacaoMediaBrasil/jQuery.ListaDeCompras)
|
|
7
7
|
[](https://github.com/InovacaoMediaBrasil/jQuery.ListaDeCompras)
|
|
8
8
|
[](https://github.com/InovacaoMediaBrasil/jQuery.ListaDeCompras)
|
|
9
|
-
|
|
10
9
|
[](https://codeclimate.com/github/InovacaoMediaBrasil/jQuery.ListaDeCompras/maintainability)
|
|
11
10
|
[](https://codeclimate.com/github/InovacaoMediaBrasil/jQuery.ListaDeCompras/test_coverage)
|
|
12
11
|
[](https://www.codefactor.io/repository/github/InovacaoMediaBrasil/jQuery.ListaDeCompras)
|
|
@@ -31,7 +30,6 @@ npm i jquerylistadecompras
|
|
|
31
30
|
[](https://www.nuget.org/packages/jquery.listadecompras/)
|
|
32
31
|
[](https://www.nuget.org/packages/jquery.listadecompras/)
|
|
33
32
|
|
|
34
|
-
|
|
35
33
|
```bash
|
|
36
34
|
|
|
37
35
|
dotnet add package jquery.listadecompras
|
|
@@ -46,7 +44,7 @@ Lista de Compras (Editora Inovação) is a application that allows you create a
|
|
|
46
44
|
|
|
47
45
|
With this plugin you can manage your lists, [TODO] account preferences and get the available products for building new lists.
|
|
48
46
|
|
|
49
|
-
[Lista de Compras platform](https://listadecompras.editorainovacao.com.br)
|
|
47
|
+
[Lista de Compras platform](https://listadecompras.editorainovacao.com.br)
|
|
50
48
|
|
|
51
49
|
[Lista de Compras API documentation](http://ti.editorainovacao.com.br/Docs/ListaDeCompras/API.pdf)
|
|
52
50
|
|
|
@@ -60,130 +58,151 @@ And in the Canal do Artesanato:
|
|
|
60
58
|
|
|
61
59
|

|
|
62
60
|
|
|
63
|
-
|
|
61
|
+
---
|
|
64
62
|
|
|
65
|
-
## Usage
|
|
63
|
+
## Usage
|
|
66
64
|
|
|
67
65
|
To simple show a list in your page, creates a simple HTML element and call the plugin:
|
|
68
66
|
|
|
69
67
|
```html
|
|
70
68
|
<div id="showListaDeCompras"></div>
|
|
71
69
|
```
|
|
70
|
+
|
|
72
71
|
Now call the plugin:
|
|
72
|
+
|
|
73
73
|
```js
|
|
74
74
|
var listaDeCompras = $("#showListaDeCompras").listaDeCompras({
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
----------
|
|
81
|
-
|
|
82
|
-
## Options ##
|
|
83
|
-
|
|
84
|
-
You can pass options by the constructor or by the *options* method (see * Methods * above for more info)
|
|
85
|
-
|
|
86
|
-
| Option | Description | Default value | Values |
|
|
87
|
-
|:-:|:-:|:-:|:-:|
|
|
88
|
-
| useProduction | Sets the platform environment | **true** | **boolean**:true\|false |
|
|
89
|
-
| readKey | The platform API key | **null** | **string**:your api key |
|
|
90
|
-
| type | The display type (use table or ul/li elements) | **table** | **string**:table\|list |
|
|
91
|
-
| showPrices | Flag to show products prices or not | **true** | **boolean**:true\|false |
|
|
92
|
-
| listLoadSuccesfullyCallback | A callback function to trigger when the lists load succesfully | **null** | **function** |
|
|
93
|
-
| listLoadErrorCallback | A callback function to trigger when cannot load the list (error \| list dosen't exists) | **null** | **function** |
|
|
94
|
-
| debug | A flag to enable or disable debugging | **false** | **boolean**:true\|false |
|
|
95
|
-
| maxProducts | Limit the maximum number of products displayed in the list | **-1** | **integer**: -1 show all \| N shows N |
|
|
96
|
-
| theme | The plugin CSS theme | **default** | **string**: red, orange, blue, green, oliveDrab, default |
|
|
97
|
-
| customCampaign | The utm_campaign string for the buy link | **null** | **string** |
|
|
98
|
-
| headerText | The plugin header text | **null** | **string** |
|
|
99
|
-
| css | This option allows you set custom CSS classes for some items of the plugin | ** default plugin classes ** | **object**: see table below |
|
|
75
|
+
readKey: "your-read-key",
|
|
76
|
+
listId: 1, //The list ID
|
|
77
|
+
theme: "oliveDrab", //The list theme (availables: red, orange, green, blue, oliveDrab and default)
|
|
78
|
+
});
|
|
79
|
+
```
|
|
100
80
|
|
|
101
|
-
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Options
|
|
84
|
+
|
|
85
|
+
You can pass options by the constructor or by the _options_ method (see _ Methods _ above for more info)
|
|
86
|
+
|
|
87
|
+
| Option | Description | Default value | Values |
|
|
88
|
+
| :-------------------------: | :-------------------------------------------------------------------------------------: | :--------------------------: | :------------------------------------------------------: |
|
|
89
|
+
| useProduction | Sets the platform environment | **true** | **boolean**:true\|false |
|
|
90
|
+
| readKey | The platform API key | **null** | **string**:your api key |
|
|
91
|
+
| type | The display type (use table or ul/li elements) | **table** | **string**:table\|list |
|
|
92
|
+
| showPrices | Flag to show products prices or not | **true** | **boolean**:true\|false |
|
|
93
|
+
| listLoadSuccesfullyCallback | A callback function to trigger when the lists load succesfully | **null** | **function** |
|
|
94
|
+
| listLoadErrorCallback | A callback function to trigger when cannot load the list (error \| list dosen't exists) | **null** | **function** |
|
|
95
|
+
| debug | A flag to enable or disable debugging | **false** | **boolean**:true\|false |
|
|
96
|
+
| maxProducts | Limit the maximum number of products displayed in the list | **-1** | **integer**: -1 show all \| N shows N |
|
|
97
|
+
| theme | The plugin CSS theme | **default** | **string**: red, orange, blue, green, oliveDrab, default |
|
|
98
|
+
| customCampaign | The utm_campaign string for the buy link | **null** | **string** |
|
|
99
|
+
| headerText | The plugin header text | **null** | **string** |
|
|
100
|
+
| css | This option allows you set custom CSS classes for some items of the plugin | ** default plugin classes ** | **object**: see table below |
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
|:-:|:-:|:-:|:-:|
|
|
105
|
-
| itemQuantity | The item quantity field | **quantity** |
|
|
106
|
-
| itemQuantityPlus | The item quantity increase button | **plus** |
|
|
107
|
-
| itemQuantityLess | The item quantity decrease button | **less** |
|
|
108
|
-
| itemAvailability | The item availability class to enable\|disable the quantity field & buttons | **availability** |
|
|
109
|
-
| itemAvailabilityIcon | The item availability icon | **stockIcon** |
|
|
110
|
-
| buyButton | The buy button | **buy** |
|
|
111
|
-
| cartTotal | The cart total descriptor | **amount** |
|
|
102
|
+
** The CSS classes ** can be overrrinding by setting the CSS option with the following object:
|
|
112
103
|
|
|
104
|
+
| Property | Description | Default value |
|
|
105
|
+
| :------------------: | :-------------------------------------------------------------------------: | :--------------: |
|
|
106
|
+
| itemQuantity | The item quantity field | **quantity** |
|
|
107
|
+
| itemQuantityPlus | The item quantity increase button | **plus** |
|
|
108
|
+
| itemQuantityLess | The item quantity decrease button | **less** |
|
|
109
|
+
| itemAvailability | The item availability class to enable\|disable the quantity field & buttons | **availability** |
|
|
110
|
+
| itemAvailabilityIcon | The item availability icon | **stockIcon** |
|
|
111
|
+
| buyButton | The buy button | **buy** |
|
|
112
|
+
| cartTotal | The cart total descriptor | **amount** |
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
---
|
|
115
115
|
|
|
116
|
-
## Methods
|
|
116
|
+
## Methods
|
|
117
117
|
|
|
118
118
|
There are a few methods that can be called to operate the plugin programmatically
|
|
119
119
|
|
|
120
120
|
**init**: Initializes the plugin
|
|
121
|
+
|
|
121
122
|
```js
|
|
122
123
|
$("#target").listaDeCompras("init");
|
|
123
124
|
```
|
|
124
125
|
|
|
125
126
|
**destroy**: Destroys the plugin (the list itself is also removed from the page)
|
|
127
|
+
|
|
126
128
|
```js
|
|
127
129
|
$("#target").listaDeCompras("destroy");
|
|
128
130
|
```
|
|
131
|
+
|
|
129
132
|
**load**: Loads a specific list by it's id
|
|
133
|
+
|
|
130
134
|
```js
|
|
131
135
|
$("#target").listaDeCompras("load", 1234); //try to load the list 1234
|
|
132
136
|
```
|
|
133
137
|
|
|
134
138
|
**updateQuantity**: Updates the selected quantity for a specified SKU in the list
|
|
139
|
+
|
|
135
140
|
```js
|
|
136
141
|
$("#target").listaDeCompras("updateQuantity", 1, 10); //updates the quantity of SKU 1 to 10 units
|
|
137
142
|
```
|
|
138
143
|
|
|
139
144
|
**addToCart**: adds a sku to the cart, this is the same of adding 1 item of the product
|
|
145
|
+
|
|
140
146
|
```js
|
|
141
|
-
$("#target").listaDeCompras(
|
|
147
|
+
$("#target").listaDeCompras(
|
|
148
|
+
"addToCart",
|
|
149
|
+
new { SalesChannelId: 1000001, Stock: 10, Quantity: 1, Price: 10.9 }(),
|
|
150
|
+
); //You should pass the sales channel id, available quantity, desired quantity and the price of the SKU
|
|
142
151
|
```
|
|
152
|
+
|
|
143
153
|
**clearCart**: Removes all products from the cart
|
|
154
|
+
|
|
144
155
|
```js
|
|
145
156
|
$("#target").listaDeCompras("clearCart");
|
|
146
157
|
```
|
|
147
158
|
|
|
148
159
|
**addEventListeners**: Add event listeners to the plugin increase & decrease buttons, quantity fields and buy button
|
|
160
|
+
|
|
149
161
|
```js
|
|
150
162
|
$("#target").listaDeCompras("addEventListeners");
|
|
151
163
|
```
|
|
152
164
|
|
|
153
165
|
**getBuyLink**: Gets the link to the store cart (with all sku & quantity) selecteds and the SEO params
|
|
166
|
+
|
|
154
167
|
```js
|
|
155
168
|
var link = $("#target").listaDeCompras("getBuyLink");
|
|
156
169
|
window.open(link);
|
|
157
170
|
```
|
|
158
171
|
|
|
159
172
|
**getCartTotal**: Gets the current cart total
|
|
173
|
+
|
|
160
174
|
```js
|
|
161
175
|
var total = $("#target").listaDeCompras("getCartTotal");
|
|
162
176
|
window.alert("Current cart is R$ " + total);
|
|
163
177
|
```
|
|
164
178
|
|
|
165
179
|
**updateCartTotal**: Updates the cart total (only if **showPrices** option is set to true), usefull when you add products or change the quantity of a product via JS
|
|
180
|
+
|
|
166
181
|
```js
|
|
167
182
|
$("#target").listaDeCompras("updateCartTotal");
|
|
168
183
|
```
|
|
169
184
|
|
|
170
185
|
**set**: Sets an option after the plugin has been initialized
|
|
186
|
+
|
|
171
187
|
```js
|
|
172
188
|
$("#target").listaDeCompras("set", "optionName", "optionValue");
|
|
173
189
|
```
|
|
174
190
|
|
|
175
191
|
**get**: Gets the current value for a option
|
|
192
|
+
|
|
176
193
|
```js
|
|
177
|
-
$("#target").listaDeCompras("get","optionName");
|
|
194
|
+
$("#target").listaDeCompras("get", "optionName");
|
|
178
195
|
```
|
|
179
196
|
|
|
180
197
|
**debug**: Debugs the current plugin to the console.log
|
|
198
|
+
|
|
181
199
|
```js
|
|
182
200
|
$("#target").listaDeCompras("debug");
|
|
183
201
|
```
|
|
202
|
+
|
|
184
203
|
---
|
|
185
204
|
|
|
186
|
-
Developed by [Guilherme Branco Stracini](https://www.guilhermebranco.com.br) for [Editora Inovação](https://www.editorainovacao.com.br)
|
|
205
|
+
Developed by [Guilherme Branco Stracini](https://www.guilhermebranco.com.br) for [Editora Inovação](https://www.editorainovacao.com.br)
|
|
187
206
|
|
|
188
207
|
© 2016 ~ 2018 All rights reserved.
|
|
189
208
|
|