PluginProbe
Datafeedr API / 1.4.3
Datafeedr API v1.4.3
1.4.3 1.4.2 1.0.125 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 1.0.25 1.0.26 1.0.27 1.0.28 1.0.29 1.0.3 1.0.30 1.0.31 1.0.32 All 182 releases
← All changes | classes/class-dfrapi-searchform.php +666 -392 1.0.25 → 1.4.3 View file →
@@ -1,227 +1,366 @@
1 1 <?php
2 2
3 +defined( 'ABSPATH' ) || exit;
3 4
4 5
5 6 class Dfrapi_SearchForm
6 7 {
7 8 function fields() {
8 - $opFulltext = array(
9 - 'contain' => __( 'contains', DFRAPI_DOMAIN ),
10 - 'not_contain' => __( 'doesn\'t contain', DFRAPI_DOMAIN ),
11 - 'start' => __( 'starts with', DFRAPI_DOMAIN ),
12 - 'end' => __( 'ends with', DFRAPI_DOMAIN ),
13 - 'match' => __( 'matches', DFRAPI_DOMAIN )
14 - );
15 - $opFulltextExact = array_merge($opFulltext, array(
16 - 'is' => __( 'is', DFRAPI_DOMAIN )
17 - ));
18 - $opRange = array(
19 - 'lt' => __( 'less than', DFRAPI_DOMAIN ),
20 - 'gt' => __( 'greater than', DFRAPI_DOMAIN ),
21 - 'between' => __( 'between', DFRAPI_DOMAIN )
22 - );
23 - $opIs = array(
24 - 'is' => __( 'is', DFRAPI_DOMAIN )
25 - );
26 - $opIsIsnt = array(
27 - 'is' => __( 'is', DFRAPI_DOMAIN ),
28 - 'is_not' => __( 'isn\'t', DFRAPI_DOMAIN )
29 - );
30 - $opYesNo = array(
31 - 'yes' => __( 'yes', DFRAPI_DOMAIN ),
32 - 'no' => __( 'no', DFRAPI_DOMAIN )
33 - );
34 9
35 - $sortOpts = array(
36 - '' => __( 'Relevance', DFRAPI_DOMAIN ),
37 - '+price' => __( 'Price Ascending', DFRAPI_DOMAIN ),
38 - '-price' => __( 'Price Decending', DFRAPI_DOMAIN ),
39 - '+saleprice' => __( 'Sale Price Ascending', DFRAPI_DOMAIN ),
40 - '-saleprice' => __( 'Sale Price Decending', DFRAPI_DOMAIN ),
41 - '+salediscount' => __( 'Discount Ascending', DFRAPI_DOMAIN ),
42 - '-salediscount' => __( 'Discount Decending', DFRAPI_DOMAIN ),
43 - '+merchant' => __( 'Merchant', DFRAPI_DOMAIN ),
44 - '+time_updated' => __( 'Last Updated Ascending', DFRAPI_DOMAIN ),
45 - '-time_updated' => __( 'Last Updated Decending', DFRAPI_DOMAIN )
46 - );
10 + $opFulltext = array(
11 + 'match' => __( 'matches', 'datafeedr-api' ),
12 + 'contain' => __( 'contains', 'datafeedr-api' ),
13 + 'not_contain' => __( 'doesn\'t contain', 'datafeedr-api' ),
14 + 'start' => __( 'starts with', 'datafeedr-api' ),
15 + 'end' => __( 'ends with', 'datafeedr-api' ),
16 + );
47 17
48 - return array(
49 - array(
50 - 'title' => __( 'Any Field', DFRAPI_DOMAIN ),
51 - 'name' => 'any',
52 - 'input' => 'text',
53 - 'operator' => $opFulltext,
54 - 'help' => $this->help('any')
55 - ),
56 - array(
57 - 'title' => __( 'Product Name', DFRAPI_DOMAIN ),
58 - 'name' => 'name',
59 - 'input' => 'text',
60 - 'operator' => $opFulltextExact,
61 - 'help' => $this->help('name')
62 - ),
63 - array(
64 - 'title' => __( 'Brand', DFRAPI_DOMAIN ),
65 - 'name' => 'brand',
66 - 'input' => 'text',
67 - 'operator' => $opFulltextExact,
68 - 'help' => $this->help('brand')
69 - ),
70 - array(
71 - 'title' => __( 'Description', DFRAPI_DOMAIN ),
72 - 'name' => 'description',
73 - 'input' => 'text',
74 - 'operator' => $opFulltext,
75 - 'help' => $this->help('description')
76 - ),
77 - array(
78 - 'title' => __( 'Tags', DFRAPI_DOMAIN ),
79 - 'name' => 'tags',
80 - 'input' => 'text',
81 - 'operator' => array(
82 - 'in' => __( 'contain', DFRAPI_DOMAIN ),
83 - 'not_in' => __( 'don\'t contain', DFRAPI_DOMAIN )
84 - ),
85 - 'help' => $this->help('tags')
86 - ),
87 - array(
88 - 'title' => __( 'Category', DFRAPI_DOMAIN ),
89 - 'name' => 'category',
90 - 'input' => 'text',
91 - 'operator' => $opFulltext,
92 - 'help' => $this->help('category')
93 - ),
94 - array(
95 - 'title' => __( 'Product Type', DFRAPI_DOMAIN ),
96 - 'name' => 'type',
97 - 'input' => 'select',
98 - 'options' => array(
99 - 'products' => __( 'Product', DFRAPI_DOMAIN ),
100 - 'coupons' => __( 'Coupon', DFRAPI_DOMAIN )
101 - ),
102 - 'operator' => $opIs,
103 - 'help' => $this->help('type')
104 - ),
105 - array(
106 - 'title' => __( 'Currency', DFRAPI_DOMAIN ),
107 - 'name' => 'currency',
108 - 'input' => 'select',
109 - 'options' => array(
110 - 'AUD' => 'AUD',
111 - 'CAD' => 'CAD',
112 - 'CHF' => 'CHF',
113 - 'DKK' => 'DKK',
114 - 'EUR' => 'EUR',
115 - 'GBP' => 'GBP',
116 - 'NOK' => 'NOK',
117 - 'NZD' => 'NZD',
118 - 'SEK' => 'SEK',
119 - 'TRY' => 'TRY',
120 - 'USD' => 'USD',
121 - ),
122 - 'operator' => $opIsIsnt,
123 - 'help' => $this->help('currency')
124 - ),
125 - array(
126 - 'title' => __( 'Price', DFRAPI_DOMAIN ),
127 - 'name' => 'price',
128 - 'input' => 'range',
129 - 'operator' => $opRange,
130 - 'help' => $this->help('price')
131 - ),
132 - array(
133 - 'title' => __( 'Sale Price', DFRAPI_DOMAIN ),
134 - 'name' => 'saleprice',
135 - 'input' => 'range',
136 - 'operator' => $opRange,
137 - 'help' => $this->help('saleprice')
138 - ),
139 - array(
140 - 'title' => __( 'Network', DFRAPI_DOMAIN ),
141 - 'name' => 'source_id',
142 - 'input' => 'network',
143 - 'operator' => $opIsIsnt,
144 - 'help' => $this->help('source_id')
145 - ),
146 - array(
147 - 'title' => __( 'Merchant', DFRAPI_DOMAIN ),
148 - 'name' => 'merchant_id',
149 - 'input' => 'merchant',
150 - 'operator' => $opIsIsnt,
151 - 'help' => $this->help('merchant_id')
152 - ),
153 - array(
154 - 'title' => __( 'On Sale', DFRAPI_DOMAIN ),
155 - 'name' => 'onsale',
156 - 'input' => 'none',
157 - 'operator' => $opYesNo,
158 - 'help' => $this->help('onsale')
159 - ),
160 - array(
161 - 'title' => __( 'Discount', DFRAPI_DOMAIN ),
162 - 'name' => 'salediscount',
163 - 'input' => 'range',
164 - 'operator' => $opRange,
165 - 'help' => $this->help('salediscount')
166 - ),
167 - array(
168 - 'title' => __( 'Has Image', DFRAPI_DOMAIN ),
169 - 'name' => 'image',
170 - 'input' => 'none',
171 - 'operator' => $opYesNo,
172 - 'help' => $this->help('image')
173 - ),
174 - array(
175 - 'title' => __( 'Last Updated', DFRAPI_DOMAIN ),
176 - 'name' => 'time_updated',
177 - 'input' => 'range',
178 - 'operator' => array('lt' => 'before', 'gt' => 'after', 'between' => 'between'),
179 - 'help' => $this->help('time_updated')
180 - ),
181 - array(
182 - 'title' => __( 'Limit', DFRAPI_DOMAIN ),
183 - 'name' => 'limit',
184 - 'input' => 'text',
185 - 'operator' => array('is' => 'is'),
186 - 'help' => $this->help('limit')
187 - ),
188 - array(
189 - 'title' => __( 'Sort By', DFRAPI_DOMAIN ),
190 - 'name' => 'sort',
191 - 'input' => 'none',
192 - 'operator' => $sortOpts,
193 - 'help' => $this->help('sort')
194 - ),
195 - array(
196 - 'title' => __( 'Exclude Duplicates', DFRAPI_DOMAIN ),
197 - 'name' => 'duplicates',
198 - 'input' => 'text',
199 - 'operator' => array(
200 - 'is' => __( 'matching these fields', DFRAPI_DOMAIN ),
201 - ),
202 - 'help' => $this->help('duplicates')
203 - )
204 - );
18 + $opFulltextExact = array_merge( $opFulltext, array(
19 + 'is' => __( 'is', 'datafeedr-api' )
20 + ) );
21 +
22 + $opRange = array(
23 + 'eq' => __( 'equal to', 'datafeedr-api' ),
24 + 'lt' => __( 'less than', 'datafeedr-api' ),
25 + 'lte' => __( 'less than or equal to', 'datafeedr-api' ),
26 + 'gt' => __( 'greater than', 'datafeedr-api' ),
27 + 'gte' => __( 'greater than or equal to', 'datafeedr-api' ),
28 + 'between' => __( 'between', 'datafeedr-api' )
29 + );
30 +
31 + $opIs = array(
32 + 'is' => __( 'is', 'datafeedr-api' )
33 + );
34 +
35 + $opIsIsnt = array(
36 + 'is' => __( 'is', 'datafeedr-api' ),
37 + 'is_not' => __( 'isn\'t', 'datafeedr-api' )
38 + );
39 +
40 + $opYesNo = array(
41 + 'yes' => __( 'yes', 'datafeedr-api' ),
42 + 'no' => __( 'no', 'datafeedr-api' )
43 + );
44 +
45 + $opInStock = array(
46 + 'yes_unknown' => __( 'yes or unknown', 'datafeedr-api' ),
47 + 'yes' => __( 'yes', 'datafeedr-api' ),
48 + 'no' => __( 'no', 'datafeedr-api' ),
49 + );
50 +
51 + $sortOpts = array(
52 + '' => __( 'Relevance', 'datafeedr-api' ),
53 + '+price' => __( 'Price Ascending', 'datafeedr-api' ),
54 + '-price' => __( 'Price Descending', 'datafeedr-api' ),
55 + '+saleprice' => __( 'Sale Price Ascending', 'datafeedr-api' ),
56 + '-saleprice' => __( 'Sale Price Descending', 'datafeedr-api' ),
57 + '+finalprice' => __( 'Final Price Ascending', 'datafeedr-api' ),
58 + '-finalprice' => __( 'Final Price Descending', 'datafeedr-api' ),
59 + '+salediscount' => __( 'Discount Ascending', 'datafeedr-api' ),
60 + '-salediscount' => __( 'Discount Descending', 'datafeedr-api' ),
61 + '+merchant' => __( 'Merchant', 'datafeedr-api' ),
62 + '+time_updated' => __( 'Last Updated Ascending', 'datafeedr-api' ),
63 + '-time_updated' => __( 'Last Updated Descending', 'datafeedr-api' ),
64 + '+_id' => __( 'Product ID Ascending', 'datafeedr-api' ),
65 + '-_id' => __( 'Product ID Descending', 'datafeedr-api' ),
66 + );
67 +
68 + return array(
69 + array(
70 + 'title' => __( 'Any Field', 'datafeedr-api' ),
71 + 'name' => 'any',
72 + 'input' => 'text',
73 + 'operator' => $opFulltext,
74 + 'help' => $this->help( 'any' )
75 + ),
76 + array(
77 + 'title' => __( 'Product Name', 'datafeedr-api' ),
78 + 'name' => 'name',
79 + 'input' => 'text',
80 + 'operator' => $opFulltextExact,
81 + 'help' => $this->help( 'name' )
82 + ),
83 + array(
84 + 'title' => __( 'Product ID', 'datafeedr-api' ),
85 + 'name' => 'id',
86 + 'input' => 'text',
87 + 'operator' => $opIsIsnt,
88 + 'help' => $this->help( 'id' )
89 + ),
90 + array(
91 + 'title' => __( 'Barcode', 'datafeedr-api' ),
92 + 'name' => 'barcode',
93 + 'input' => 'text',
94 + 'operator' => $opIsIsnt,
95 + 'help' => $this->help( 'barcode' )
96 + ),
97 + array(
98 + 'title' => __( 'Brand', 'datafeedr-api' ),
99 + 'name' => 'brand',
100 + 'input' => 'text',
101 + 'operator' => $opFulltextExact,
102 + 'help' => $this->help( 'brand' )
103 + ),
104 + array(
105 + 'title' => __( 'Color', 'datafeedr-api' ),
106 + 'name' => 'color',
107 + 'input' => 'text',
108 + 'operator' => $opFulltextExact,
109 + 'help' => $this->help( 'color' )
110 + ),
111 + array(
112 + 'title' => __( 'Material', 'datafeedr-api' ),
113 + 'name' => 'material',
114 + 'input' => 'text',
115 + 'operator' => $opFulltextExact,
116 + 'help' => $this->help( 'material' )
117 + ),
118 + array(
119 + 'title' => __( 'Size', 'datafeedr-api' ),
120 + 'name' => 'size',
121 + 'input' => 'text',
122 + 'operator' => $opFulltextExact,
123 + 'help' => $this->help( 'size' )
124 + ),
125 + array(
126 + 'title' => __( 'Gender', 'datafeedr-api' ),
127 + 'name' => 'gender',
128 + 'input' => 'text',
129 + 'operator' => $opFulltextExact,
130 + 'help' => $this->help( 'gender' )
131 + ),
132 + array(
133 + 'title' => __( 'SKU', 'datafeedr-api' ),
134 + 'name' => 'sku',
135 + 'input' => 'text',
136 + 'operator' => $opFulltextExact,
137 + 'help' => $this->help( 'sku' )
138 + ),
139 + array(
140 + 'title' => __( 'Condition', 'datafeedr-api' ),
141 + 'name' => 'condition',
142 + 'input' => 'text',
143 + 'operator' => $opFulltextExact,
144 + 'help' => $this->help( 'condition' )
145 + ),
146 + array(
147 + 'title' => __( 'Description', 'datafeedr-api' ),
148 + 'name' => 'description',
149 + 'input' => 'text',
150 + 'operator' => $opFulltext,
151 + 'help' => $this->help( 'description' )
152 + ),
153 + array(
154 + 'title' => __( 'Tags', 'datafeedr-api' ),
155 + 'name' => 'tags',
156 + 'input' => 'text',
157 + 'operator' => array(
158 + 'in' => __( 'contain', 'datafeedr-api' ),
159 + 'not_in' => __( 'don\'t contain', 'datafeedr-api' )
160 + ),
161 + 'help' => $this->help( 'tags' )
162 + ),
163 + array(
164 + 'title' => __( 'Category', 'datafeedr-api' ),
165 + 'name' => 'category',
166 + 'input' => 'text',
167 + 'operator' => $opFulltext,
168 + 'help' => $this->help( 'category' )
169 + ),
170 + array(
171 + 'title' => __( 'Product Type', 'datafeedr-api' ),
172 + 'name' => 'type',
173 + 'input' => 'select',
174 + 'options' => array(
175 + 'products' => __( 'Product', 'datafeedr-api' ),
176 + 'coupons' => __( 'Coupon', 'datafeedr-api' )
177 + ),
178 + 'operator' => $opIs,
179 + 'help' => $this->help( 'type' )
180 + ),
181 + array(
182 + 'title' => __( 'Currency', 'datafeedr-api' ),
183 + 'name' => 'currency',
184 + 'input' => 'select',
185 + 'options' => array(
186 + 'AUD' => 'AUD',
187 + 'BRL' => 'BRL',
188 + 'CAD' => 'CAD',
189 + 'CHF' => 'CHF',
190 + 'CZK' => 'CZK',
191 + 'DKK' => 'DKK',
192 + 'EUR' => 'EUR',
193 + 'GBP' => 'GBP',
194 + 'INR' => 'INR',
195 + 'NOK' => 'NOK',
196 + 'NZD' => 'NZD',
197 + 'PLN' => 'PLN',
198 + 'SEK' => 'SEK',
199 + 'TRY' => 'TRY',
200 + 'USD' => 'USD',
201 + ),
202 + 'operator' => $opIsIsnt,
203 + 'help' => $this->help( 'currency' )
204 + ),
205 + array(
206 + 'title' => __( 'Price', 'datafeedr-api' ),
207 + 'name' => 'price',
208 + 'input' => 'range',
209 + 'operator' => $opRange,
210 + 'help' => $this->help( 'price' )
211 + ),
212 + array(
213 + 'title' => __( 'Sale Price', 'datafeedr-api' ),
214 + 'name' => 'saleprice',
215 + 'input' => 'range',
216 + 'operator' => $opRange,
217 + 'help' => $this->help( 'saleprice' )
218 + ),
219 + array(
220 + 'title' => __( 'Final Price', 'datafeedr-api' ),
221 + 'name' => 'finalprice',
222 + 'input' => 'range',
223 + 'operator' => $opRange,
224 + 'help' => $this->help( 'finalprice' )
225 + ),
226 + array(
227 + 'title' => __( 'Discount', 'datafeedr-api' ),
228 + 'name' => 'salediscount',
229 + 'input' => 'range',
230 + 'operator' => $opRange,
231 + 'help' => $this->help( 'salediscount' )
232 + ),
233 + array(
234 + 'title' => __( 'Network', 'datafeedr-api' ),
235 + 'name' => 'source_id',
236 + 'input' => 'network',
237 + 'operator' => $opIsIsnt,
238 + 'help' => $this->help( 'source_id' )
239 + ),
240 + array(
241 + 'title' => __( 'Merchant', 'datafeedr-api' ),
242 + 'name' => 'merchant_id',
243 + 'input' => 'merchant',
244 + 'operator' => $opIsIsnt,
245 + 'help' => $this->help( 'merchant_id' )
246 + ),
247 + array(
248 + 'title' => __( 'On Sale', 'datafeedr-api' ),
249 + 'name' => 'onsale',
250 + 'input' => 'none',
251 + 'operator' => $opYesNo,
252 + 'help' => $this->help( 'onsale' )
253 + ),
254 + array(
255 + 'title' => __( 'In Stock', 'datafeedr-api' ),
256 + 'name' => 'instock',
257 + 'input' => 'none',
258 + 'operator' => $opInStock,
259 + 'help' => $this->help( 'instock' )
260 + ),
261 + array(
262 + 'title' => __( 'Stock Quantity', 'datafeedr-api' ),
263 + 'name' => 'stockquantity',
264 + 'input' => 'range',
265 + 'operator' => $opRange,
266 + 'help' => $this->help( 'instock' )
267 + ),
268 + array(
269 + 'title' => __( 'Has Direct URL', 'datafeedr-api' ),
270 + 'name' => 'direct_url',
271 + 'input' => 'none',
272 + 'operator' => $opYesNo,
273 + 'help' => $this->help( 'direct_url' )
274 + ),
275 + array(
276 + 'title' => __( 'Has Image', 'datafeedr-api' ),
277 + 'name' => 'image',
278 + 'input' => 'none',
279 + 'operator' => $opYesNo,
280 + 'help' => $this->help( 'image' )
281 + ),
282 + array(
283 + 'title' => __( 'Has Barcode', 'datafeedr-api' ),
284 + 'name' => 'has_barcode',
285 + 'input' => 'none',
286 + 'operator' => $opYesNo,
287 + 'help' => $this->help( 'has_barcode' )
288 + ),
289 + array(
290 + 'title' => __( 'Last Updated', 'datafeedr-api' ),
291 + 'name' => 'time_updated',
292 + 'input' => 'range',
293 + 'operator' => array( 'lt' => 'before', 'gt' => 'after', 'between' => 'between' ),
294 + 'help' => $this->help( 'time_updated' )
295 + ),
296 + array(
297 + 'title' => __( 'Limit', 'datafeedr-api' ),
298 + 'name' => 'limit',
299 + 'input' => 'text',
300 + 'operator' => array( 'is' => 'is' ),
301 + 'help' => $this->help( 'limit' )
302 + ),
303 + array(
304 + 'title' => __( 'Merchant Limit', 'datafeedr-api' ),
305 + 'name' => 'merchant_limit',
306 + 'input' => 'select',
307 + 'options' => array_filter( range( 0, 10 ), function ( $num ) {
308 + return $num != 0;
309 + } ),
310 + 'operator' => array( 'is' => 'is' ),
311 + 'help' => $this->help( 'merchant_limit' )
312 + ),
313 + array(
314 + 'title' => __( 'Sort By', 'datafeedr-api' ),
315 + 'name' => 'sort',
316 + 'input' => 'none',
317 + 'operator' => $sortOpts,
318 + 'help' => $this->help( 'sort' )
319 + ),
320 + array(
321 + 'title' => __( 'Exclude Duplicates', 'datafeedr-api' ),
322 + 'name' => 'duplicates',
323 + 'input' => 'text',
324 + 'operator' => array(
325 + 'is' => __( 'matching these fields', 'datafeedr-api' ),
326 + ),
327 + 'help' => $this->help( 'duplicates' )
328 + )
329 + );
205 330 }
206 331
207 - function defaults() {
208 - return array(
209 - 'any' => array('operator' => 'contain', 'value'=> ''),
210 - 'name' => array('operator' => 'contain', 'value'=> ''),
211 - 'type' => array('value'=> 'product'),
212 - 'currency' => array('value'=> 'USD'),
213 - 'price' => array('operator' => 'between', 'value'=> '0', 'value2' => '999999'),
214 - 'saleprice' => array('operator' => 'between', 'value'=> '0', 'value2' => '999999'),
215 - 'source_id' => array('value'=> array()),
216 - 'merchant_id' => array('value'=> array()),
217 - 'onsale' => array('value'=> '1'),
218 - 'image' => array('value'=> '1'),
219 - 'thumbnail' => array('value'=> '1'),
220 - 'time_updated' => array('operator' => 'lt', 'value'=> 'today'),
221 - 'limit' => array('value'=> 1000),
222 - );
223 - }
332 + function defaults() {
333 + return array(
334 + 'any' => array( 'operator' => 'match', 'value' => '' ),
335 + 'id' => array( 'operator' => 'is', 'value' => '' ),
336 + 'barcode' => array( 'operator' => 'is', 'value' => '' ),
337 + 'name' => array( 'operator' => 'match', 'value' => '' ),
338 + 'brand' => array( 'operator' => 'match', 'value' => '' ),
339 + 'color' => array( 'operator' => 'match', 'value' => '' ),
340 + 'material' => array( 'operator' => 'match', 'value' => '' ),
341 + 'size' => array( 'operator' => 'match', 'value' => '' ),
342 + 'gender' => array( 'operator' => 'match', 'value' => '' ),
343 + 'sku' => array( 'operator' => 'match', 'value' => '' ),
344 + 'condition' => array( 'operator' => 'match', 'value' => '' ),
345 + 'type' => array( 'value' => 'product' ),
346 + 'currency' => array( 'value' => 'USD' ),
347 + 'price' => array( 'operator' => 'between', 'value' => '0', 'value2' => '999999' ),
348 + 'saleprice' => array( 'operator' => 'between', 'value' => '0', 'value2' => '999999' ),
349 + 'source_id' => array( 'value' => array() ),
350 + 'merchant_id' => array( 'value' => array() ),
351 + 'onsale' => array( 'value' => '1' ),
352 + 'instock' => array( 'value' => 'yes_unknown' ),
353 + 'stockquantity' => array( 'operator' => 'between', 'value' => '0', 'value2' => '100' ),
354 + 'direct_url' => array( 'value' => '1' ),
355 + 'image' => array( 'value' => '1' ),
356 + 'has_barcode' => array( 'value' => '1' ),
357 + 'thumbnail' => array( 'value' => '1' ),
358 + 'time_updated' => array( 'operator' => 'lt', 'value' => 'today' ),
359 + 'limit' => array( 'value' => 1000 ),
360 + 'merchant_limit' => array( 'value' => 5 ),
361 + );
362 + }
224 363
225 364 public $useSelected;
226 365 public $prefix;
227 366
@@ -277,19 +416,19 @@
277 416 if(isset($selected[$net['_id']]))
278 417 $lst []= $net;
279 418 return $lst;
280 419 }
281 -
420 +
282 421 function groupClass($nid) {
283 - if (empty($nid)) { return ''; }
284 - $networks = $this->allNetworks();
285 - foreach($networks as $network) {
286 - if ($network['_id'] == $nid) {
287 - $name = str_replace( array( " ", "-", "." ), "", $network['group'] );
288 - $type = ( $network['type'] == 'coupons' ) ? '_coupons' : '';
289 - return 'network_logo_16x16_' . strtolower( $name . $type );
290 - }
291 - }
422 + if (empty($nid)) { return ''; }
423 + $networks = $this->allNetworks();
424 + foreach($networks as $network) {
425 + if ($network['_id'] == $nid) {
426 + $name = str_replace( array( " ", "-", "." ), "", $network['group'] );
427 + $type = ( $network['type'] == 'coupons' ) ? '_coupons' : '';
428 + return 'network_logo_16x16_' . strtolower( $name . $type );
429 + }
430 + }
292 431 }
293 432
294 433 function selectedMerchants() {
295 434 $selected = $this->get(get_option( 'dfrapi_merchants' ), 'ids');
@@ -305,13 +444,13 @@
305 444 }
306 445
307 446 function networksMerchantsPopup($kind, $value) {
308 447 $title = array(
309 - 'network' => __( 'Select Networks', DFRAPI_DOMAIN ),
310 - 'merchant' => __( 'Select Merchants', DFRAPI_DOMAIN )
448 + 'network' => __( 'Select Networks', 'datafeedr-api' ),
449 + 'merchant' => __( 'Select Merchants', 'datafeedr-api' )
311 450 );
312 - $clear = __( 'Clear search', DFRAPI_DOMAIN );
313 - $ok = __( 'OK', DFRAPI_DOMAIN );
451 + $clear = __( 'Clear search', 'datafeedr-api' );
452 + $ok = __( 'OK', 'datafeedr-api' );
314 453 $cells = "";
315 454
316 455 $all = ($kind == 'network') ?
317 456 ($this->useSelected ? $this->selectedNetworks() : $this->allNetworks()) :
@@ -317,13 +456,13 @@
317 456 ($this->useSelected ? $this->selectedNetworks() : $this->allNetworks()) :
318 457 $this->selectedMerchants();
319 458
320 459 foreach($all as $obj) {
321 - $id = $obj['_id'];
322 - $nid = ($kind == 'network') ? $obj['_id'] : $obj['source_id'];
323 - $group_class = $this->groupClass($nid);
460 + $id = absint($obj['_id']);
461 + $nid = absint(($kind == 'network') ? $obj['_id'] : $obj['source_id']);
462 + $group_class = esc_attr($this->groupClass($nid));
324 463
325 - $name = $obj['name'];
464 + $name = esc_html($obj['name']);
326 465 $checked = in_array($id, $value) ? "checked='checked'" : "";
327 466
328 467 $cells .= "
329 468 <div class='inline_frame_element nid_{$nid}'>
@@ -355,9 +494,9 @@
355 494 $all = ($kind == 'network') ? $this->allNetworks() : dfrapi_api_get_merchants_by_id($value);
356 495 $names = array();
357 496 foreach($all as $obj) {
358 497 if(in_array($obj['_id'], $value)) {
359 - $names []= "<span>{$obj['name']}</span>";
498 + $names []= '<span>' . esc_html($obj['name']) . '</span>';
360 499 if(count($names) >= $maxNames)
361 500 break;
362 501 }
363 502 }
@@ -362,9 +501,9 @@
362 501 }
363 502 }
364 503 $html = implode(', ', $names);
365 504 if(count($value) - count($names)) {
366 - $html .= ' ' . sprintf(__( 'and %s more', DFRAPI_DOMAIN ), count($value) - count($names));
505 + $html .= ' ' . sprintf(__( 'and %s more', 'datafeedr-api' ), count($value) - count($names));
367 506 }
368 507 return $html;
369 508 }
370 509
@@ -369,10 +508,10 @@
369 508 }
370 509
371 510 function chooseBox($kind, $field, $index, $value) {
372 511 $pfx = $this->inputPrefix($index);
373 - $value = implode(',', $this->ary($value));
374 - $choose = __( 'choose', DFRAPI_DOMAIN );
512 + $value = esc_attr(implode(',', $this->ary($value)));
513 + $choose = __( 'choose', 'datafeedr-api' );
375 514 return "
376 515 <div class='dfrapi_choose_box' rel='{$kind}'>
377 516 <span class='names'></span>
378 517 <a class='button choose_{$kind}'>{$choose}</a>
@@ -380,26 +519,43 @@
380 519 </div>
381 520 ";
382 521 }
383 522
384 - function ajaxHandler() {
385 - $command = $this->get($_POST, 'command');
386 - $value = $this->ary($this->get($_POST, 'value'));
387 - $this->useSelected = intval($this->get($_POST, 'useSelected', 1));
523 + function ajaxHandler() {
524 + $command = $this->get( $_POST, 'command' );
525 + $value = array_values( array_unique( array_filter( array_map( 'absint', $this->ary( $this->get( $_POST, 'value' ) ) ) ) ) );
526 + $this->useSelected = (int) $this->get( $_POST, 'useSelected', 1 );
388 527
389 - switch($command) {
390 - case "choose_network":
391 - return $this->networksMerchantsPopup('network', $value);
392 - case "choose_merchant":
393 - return $this->networksMerchantsPopup('merchant', $value);
394 - case "names_network":
395 - return $this->networksMerchantsNames('network', $value);
396 - case "names_merchant":
397 - return $this->networksMerchantsNames('merchant', $value);
398 - }
399 - return "";
400 - }
528 + if ( $command === 'choose_network' ) {
529 + return $this->networksMerchantsPopup( 'network', $value );
530 + }
401 531
532 + if ( $command === 'choose_merchant' ) {
533 + return $this->networksMerchantsPopup( 'merchant', $value );
534 + }
535 +
536 + if ( $command === 'names_network' ) {
537 + return $this->networksMerchantsNames( 'network', $value );
538 + }
539 +
540 + if ( $command === 'names_merchant' && ! empty( $value ) ) {
541 + return $this->networksMerchantsNames( 'merchant', $value );
542 + }
543 +
544 +// switch ( $command ) {
545 +// case "choose_network":
546 +// return $this->networksMerchantsPopup( 'network', $value );
547 +// case "choose_merchant":
548 +// return $this->networksMerchantsPopup( 'merchant', $value );
549 +// case "names_network":
550 +// return $this->networksMerchantsNames( 'network', $value );
551 +// case "names_merchant":
552 +// return $this->networksMerchantsNames( 'merchant', $value );
553 +// }
554 +
555 + return '';
556 + }
557 +
402 558 function renderField($field, $index, $params) {
403 559 $pfx = $this->inputPrefix($index);
404 560 $value = $this->get($params, 'value');
405 561 $operator = $this->get($params, 'operator');
@@ -417,9 +573,9 @@
417 573 break;
418 574 case 'range':
419 575 $value = htmlspecialchars($value);
420 576 $value2 = htmlspecialchars($this->get($params, 'value2'));
421 - $and = __( 'and', DFRAPI_DOMAIN );
577 + $and = __( 'and', 'datafeedr-api' );
422 578 $input = "
423 579 <input class='short' name='{$pfx}[value]' type='text' value=\"$value\"/>{$percent_sign}
424 580 <span class='value2' style='display:none'>
425 581 $and
@@ -476,9 +632,9 @@
476 632 </div>
477 633 ";
478 634 }
479 635
480 - function render($prefix, $query, $useSelected=TRUE) {
636 + function render($prefix, $query, $useSelected=true) {
481 637 $this->prefix = $prefix;
482 638 $this->useSelected = intval($useSelected);
483 639 if(!$query)
484 640 $query = array(
@@ -500,9 +656,9 @@
500 656 $field = $this->get($fieldMap, $this->get($params, 'field'));
501 657 if(!$field)
502 658 continue;
503 659 $fieldUsed[$field['name']] = 1;
504 - $form .= $this->renderRow($field, $index++, $params, TRUE);
660 + $form .= $this->renderRow($field, $index++, $params, true);
505 661 }
506 662 $show = ($index == 0); // if none shown, show the first
507 663 foreach($fieldMap as $field) {
508 664 $name = $field['name'];
@@ -511,10 +667,10 @@
511 667 $show = FALSE;
512 668 }
513 669 }
514 670
515 - $loading = __( 'Loading, please wait', DFRAPI_DOMAIN );
516 - $add = __( 'add filter', DFRAPI_DOMAIN );
671 + $loading = __( 'Loading, please wait', 'datafeedr-api' );
672 + $add = __( 'add filter', 'datafeedr-api' );
517 673 return "
518 674 <div id='dfrapi_search_form'>
519 675 <input type='hidden' id='dfrapi_useSelected' value='{$this->useSelected}' />
520 676 <div id='dfprs_loading_content' style='display:none'>
@@ -535,9 +691,9 @@
535 691 return current($lst);
536 692 $lst = call_user_func_array($func, $lst);
537 693 return count($lst) ? $lst : NULL;
538 694 }
539 -
695 +
540 696 function idFilter($inList, $exList) {
541 697 $inList = $this->combineLists($inList, 'array_intersect');
542 698 $exList = $this->combineLists($exList, 'array_merge');
543 699
@@ -603,9 +759,17 @@
603 759 switch($fname) {
604 760 case 'any':
605 761 case 'name':
606 762 case 'brand':
763 + case 'color':
764 + case 'material':
765 + case 'size':
766 + case 'gender':
767 + case 'sku':
768 + case 'condition':
607 769 case 'description':
770 + case 'merchant':
771 + case 'source':
608 772 case 'category':
609 773 $s = $this->fulltextFilter($operator, $value);
610 774 if(!is_null($s[0])) {
611 775 $filters []= "{$fname} {$s[0]} {$s[1]}";
@@ -615,14 +779,22 @@
615 779 $operator = ($operator == 'in') ? "LIKE" : "!LIKE";
616 780 $filters []= "{$fname} {$operator} {$value}";
617 781 break;
618 782 case 'currency':
619 - $filters []= "{$fname} = {$value}";
783 + $op = ($operator == 'is') ? '=' : '!=';
784 + $filters []= "{$fname} $op {$value}";
620 785 break;
786 + case 'id':
787 + case 'barcode':
788 + $op = ($operator == 'is') ? 'IN' : '!IN';
789 + $filters []= "{$fname} $op {$value}";
790 + break;
621 791 case 'price':
792 + case 'finalprice':
622 793 case 'saleprice':
623 794 case 'salediscount':
624 - $conv = $fname == 'salediscount' ? 'intval' : 'dfrapi_price_to_int';
795 + case 'stockquantity':
796 + $conv = in_array( $fname, [ 'salediscount', 'stockquantity' ] ) ? 'intval' : 'dfrapi_price_to_int';
625 797 $value = $conv($value);
626 798 switch($operator) {
627 799 case 'between':
628 800 $value2 = $conv($value2);
@@ -628,14 +800,23 @@
628 800 $value2 = $conv($value2);
629 801 $filters []= "{$fname} > {$value}";
630 802 $filters []= "{$fname} < {$value2}";
631 803 break;
804 + case 'eq':
805 + $filters []= "{$fname} = {$value}";
806 + break;
632 807 case 'lt':
633 808 $filters []= "{$fname} < {$value}";
634 809 break;
810 + case 'lte':
811 + $filters []= "{$fname} <= {$value}";
812 + break;
635 813 case 'gt':
636 814 $filters []= "{$fname} > {$value}";
637 815 break;
816 + case 'gte':
817 + $filters []= "{$fname} >= {$value}";
818 + break;
638 819 }
639 820 break;
640 821 case 'source_id':
641 822 case 'merchant_id':
@@ -653,13 +834,32 @@
653 834 case 'onsale':
654 835 $value = ($operator == 'yes') ? '1' : '0';
655 836 $filters []= "{$fname} = {$value}";
656 837 break;
657 - case 'image':
658 - case 'thumbnail':
838 + case 'instock':
839 + if ( $operator == 'yes' ) {
840 + $filters [] = "{$fname} = 1";
841 + break;
842 + } elseif ( $operator == 'no' ) {
843 + $filters [] = "{$fname} = 0";
844 + break;
845 + } else {
846 + $filters [] = "{$fname} > 0";
847 + break;
848 + }
849 + case 'direct_url':
659 850 $operator = ($operator == 'yes') ? '!EMPTY' : 'EMPTY';
660 - $filters []= "image {$operator}";
851 + $filters []= "{$fname} {$operator}";
661 852 break;
853 + case 'image':
854 + case 'thumbnail':
855 + $operator = ($operator == 'yes') ? '!EMPTY' : 'EMPTY';
856 + $filters []= "image {$operator}";
857 + break;
858 + case 'has_barcode':
859 + $operator = ( $operator === 'yes') ? '!EMPTY' : 'EMPTY';
860 + $filters []= "barcode {$operator}";
861 + break;
662 862 case 'time_updated':
663 863 $value = @date('Y-m-d H:i:s', strtotime($value));
664 864 switch($operator) {
665 865 case 'between':
@@ -686,177 +886,251 @@
686 886
687 887 $s = $this->idFilter($selected['in:merchant_id'], $selected['ex:merchant_id']);
688 888 if(is_null($s))
689 889 return array('error' => 'No merchants selected');
690 - if(!is_null($s[0]))
691 - $filters []= "merchant_id {$s[0]} ". implode(',', $s[1]);
890 + if(!is_null($s[0])) {
891 + $m = implode(',', $s[1]);
892 + if ($m)
893 + $filters []= "merchant_id {$s[0]} $m";
894 + }
692 895
693 896 return $filters;
694 897
695 898 }
696 -
899 +
697 900 function help_tip($tip) {
698 - return '
901 + return '
699 902 <div class="dfrapi_search_tip">
700 903 <span class="dashicons dashicons-lightbulb"></span>
701 904 <p>
702 - <strong>' . __( 'TIP:', DFRAPI_DOMAIN ) . '</strong> ' .
703 - $tip . '
905 + <strong>' . __( 'TIP:', 'datafeedr-api' ) . '</strong> ' .
906 + $tip . '
704 907 </p>
705 908 </div>
706 909 ';
707 910 }
708 -
911 +
709 912 function help_operators() {
710 - return '
913 + return '
711 914 <p>
712 915 <span class="dashicons dashicons-info"></span>
713 916 <em>
714 - <a href="https://v4.datafeedr.com/node/620" target="_blank">' . __('Learn more', DFRAPI_DOMAIN ) . '</a> ' .
715 - __('about advanced uses of this field.', DFRAPI_DOMAIN ) . '
917 + <a href="https://datafeedrapi.helpscoutdocs.com/article/216-search-operators" target="_blank">' . __('Learn more', 'datafeedr-api' ) . '</a> ' .
918 + __('about advanced uses of this field.', 'datafeedr-api' ) . '
716 919 </em>
717 920 </p>
718 921 ';
719 922 }
720 -
923 +
721 924 function help($field) {
722 -
723 - $help = array();
724 -
725 - // Any
726 - $help['any'] = '<h3>' . __('Any Field', DFRAPI_DOMAIN ) . '</h3>';
727 - $help['any'] .= '<p>' . __( 'Search all indexed text fields at once to return a broad set of results.', DFRAPI_DOMAIN ) . '</p>';
728 - $help['any'] .= '<p>' . __( 'The fields listed below are indexed as text fields and searchable using Any Field. Image, currency, and price fields are not searched.', DFRAPI_DOMAIN ) . '</p>';
729 - $help['any'] .= '<p><em>' . __( '*Note that not all merchants and networks provide every field. ', DFRAPI_DOMAIN ) . '</em></p>';
730 - $help['any'] .= '<p>' . __( 'Fields searched using Any Field:', DFRAPI_DOMAIN ) . '</p>';
731 - $help['any'] .= '<table width="100%" border="0" style="margin-bottom:20px"><tr><td width="33%" valign="top">accommodationtype<br />address<br />artist<br />author<br />bestsellers<br />brand<br />category<br />city<br />color<br />commissiontype<br />condition<br />country<br />county<br />description<br />destination<br />discount</td><td width="33%" valign="top">discounttype<br />ean<br />fabric<br />featured<br />flavour<br />gender<br />genre<br />isbn<br />language<br />location<br />manufacturer<br />manufacturerid<br />material<br />model<br />mpn<br />name</td><td width="33%" valign="top">offercode<br />offertype<br />platform<br />productnumber<br />promo<br />publisher<br />rating<br />region<br />size<br />sku<br />stars<br />state<br />subcategory<br />tags<br />upc<br />weight</td></tr></table>';
732 - $help['any'] .= $this->help_operators();
733 -
734 - // Name
735 - $help['name'] = '<h3>' . __('Product Name', DFRAPI_DOMAIN ) . '</h3>';
736 - $help['name'] .= '<p>' . __( 'Search by product name to narrow your results.', DFRAPI_DOMAIN ) . '</p>';
737 - $help['name'] .= $this->help_tip( __( 'Some merchants include color, size, gender, product codes, sale information and promotions in the product name field.', DFRAPI_DOMAIN ) );
738 - $help['name'] .= $this->help_operators();
739 925
740 - // Brand
741 - $help['brand'] = '<h3>' . __('Brand', DFRAPI_DOMAIN ) . '</h3>';
742 - $help['brand'] .= '<p>' . __( 'Search by brand name to get specific results. Not every item has a brand name.', DFRAPI_DOMAIN ) . '</p>';
743 - $help['brand'] .= $this->help_tip( __( 'Enter the shorter version of a brand name in this field. Omit words such as "Incorporated", "Limited" and their abbreviations like Inc., Ltd. and so on.', DFRAPI_DOMAIN ) );
744 - $help['brand'] .= $this->help_operators();
926 + $help = array();
745 927
746 - // Description
747 - $help['description'] = '<h3>' . __('Description', DFRAPI_DOMAIN ) . '</h3>';
748 - $help['description'] .= '<p>' . __( 'Search the description field for product attributes such as size, color, material, or usage.', DFRAPI_DOMAIN ) . '</p>';
749 - $help['description'] .= $this->help_tip( __( 'Most merchants provide a product description. Some product details may only appear in the description and not in any other field. However, some merchants duplicate the product name or product code in the description field without supplying additional details or leave the product description blank.', DFRAPI_DOMAIN ) );
750 - $help['description'] .= $this->help_operators();
928 + // Any
929 + $help['any'] = '<h3>' . __('Any Field', 'datafeedr-api' ) . '</h3>';
930 + $help['any'] .= '<p>' . __( 'Search all indexed text fields at once to return a broad set of results.', 'datafeedr-api' ) . '</p>';
931 + $help['any'] .= '<p>' . __( 'The fields listed below are indexed as text fields and searchable using Any Field. Image, currency, and price fields are not searched.', 'datafeedr-api' ) . '</p>';
932 + $help['any'] .= '<p><em>' . __( '*Note that not all merchants and networks provide every field. ', 'datafeedr-api' ) . '</em></p>';
933 + $help['any'] .= '<p>' . __( 'Fields searched using Any Field:', 'datafeedr-api' ) . '</p>';
934 + $help['any'] .= '<table width="100%" border="0" style="margin-bottom:20px"><tr><td width="33%" valign="top">accommodationtype<br />address<br />artist<br />author<br />bestsellers<br />brand<br />category<br />city<br />color<br />commissiontype<br />condition<br />country<br />county<br />description<br />destination<br />discount</td><td width="33%" valign="top">discounttype<br />ean<br />fabric<br />featured<br />flavour<br />gender<br />genre<br />isbn<br />language<br />location<br />manufacturer<br />manufacturerid<br />material<br />size<br />gender<br />model<br />mpn<br />name</td><td width="33%" valign="top">offercode<br />offertype<br />platform<br />productnumber<br />promo<br />publisher<br />rating<br />region<br />size<br />sku<br />stars<br />state<br />subcategory<br />tags<br />upc<br />weight</td></tr></table>';
935 + $help['any'] .= $this->help_operators();
751 936
752 - // Tags
753 - $help['tags'] = '<h3>' . __('Tags', DFRAPI_DOMAIN ) . '</h3>';
754 - $help['tags'] .= '<p>' . __( 'Limit search results based on product tag and keyword information.', DFRAPI_DOMAIN ) . '</p>';
755 - $help['tags'] .= $this->help_tip( __( 'This field contains data from various keyword-related fields provided by the merchant. This field does not always exist.', DFRAPI_DOMAIN ) );
937 + // Name
938 + $help['name'] = '<h3>' . __('Product Name', 'datafeedr-api' ) . '</h3>';
939 + $help['name'] .= '<p>' . __( 'Search by product name to narrow your results.', 'datafeedr-api' ) . '</p>';
940 + $help['name'] .= $this->help_tip( __( 'Some merchants include color, size, gender, product codes, sale information and promotions in the product name field.', 'datafeedr-api' ) );
941 + $help['name'] .= $this->help_operators();
756 942
757 - // Category
758 - $help['category'] = '<h3>' . __('Category', DFRAPI_DOMAIN ) . '</h3>';
759 - $help['category'] .= '<p>' . __( 'Limit search results based on category information.', DFRAPI_DOMAIN ) . '</p>';
760 - $help['category'] .= $this->help_tip( __( 'This field contains data from various category-related fields provided by the merchant. This field does not always exist.', DFRAPI_DOMAIN ) );
761 - $help['category'] .= $this->help_operators();
943 + // ID
944 + $help['id'] = '<h3>' . __('Product ID', 'datafeedr-api' ) . '</h3>';
945 + $help['id'] .= '<p>' . __( 'Search by Product ID to find specific products.', 'datafeedr-api' ) . '</p>';
946 + $help['id'] .= $this->help_tip( __( 'Separate each product ID with a comma "," to search for multiple products by their IDs.<br /><br />Example: <strong>4088900432286084, 8177000167015036, 2651801988581531</strong>', 'datafeedr-api' ) );
947 + $help['id'] .= '<p>' . __( 'Product IDs are assigned by Datafeedr and are not related to any IDs merchants use to identify their products. Each product in the Datafeedr product database has a unique Product ID.', 'datafeedr-api' ) . '</p>';
948 +// $help['id'] .= $this->help_operators();
762 949
763 - // Type
764 - $help['type'] = '<h3>' . __('Product Type', DFRAPI_DOMAIN ) . '</h3>';
765 - $help['type'] .= '<p>' . __( 'Limit your search results to one type of item, either Product or Coupon.', DFRAPI_DOMAIN ) . '</p>';
766 - $help['type'] .= $this->help_tip( __( 'In order to use this filter, you must have already selected merchants that provide that type of item. For example, if you choose "Product type: Coupon" but have not selected any merchants that offer coupons, your search will return an error.', DFRAPI_DOMAIN ) );
950 + // Barcode
951 + $help['barcode'] = '<h3>' . __('Barcode', 'datafeedr-api' ) . '</h3>';
952 + $help['barcode'] .= '<p>' . __( 'Search for products by their barcode (ie. EAN, UPC or GTIN value).', 'datafeedr-api' ) . '</p>';
953 + $help['barcode'] .= $this->help_tip( __( 'Separate each barcode with a comma "," to search for multiple products by their barcodes.<br /><br />Example: <strong>889169871993, 889169900167, 889169488559</strong>', 'datafeedr-api' ) );
954 + $help['barcode'] .= '<p>' . __( 'The Barcode search filter ignores leading zeros. Therefore, searching for <strong>889169871993</strong> and searching for <strong>00889169871993</strong> will return the same results.', 'datafeedr-api' ) . '</p>';
767 955
768 - // Currency
769 - $help['currency'] = '<h3>' . __('Currency', DFRAPI_DOMAIN ) . '</h3>';
770 - $help['currency'] .= '<p>' . __( 'Limit your search results to items with a specific currency code.', DFRAPI_DOMAIN ) . '</p>';
771 - $help['currency'] .= $this->help_tip( __( 'Selecting a currency code is one way to limit your search results to items from a specific country. However, not every item has been given a currency code value by the merchant. Items without a currency code will be excluded from your search results.', DFRAPI_DOMAIN ) );
956 + // Brand
957 + $help['brand'] = '<h3>' . __('Brand', 'datafeedr-api' ) . '</h3>';
958 + $help['brand'] .= '<p>' . __( 'Search by brand name to get specific results. Not every item has a brand name.', 'datafeedr-api' ) . '</p>';
959 + $help['brand'] .= $this->help_tip( __( 'Enter the shorter version of a brand name in this field. Omit words such as "Incorporated", "Limited" and their abbreviations like Inc., Ltd. and so on.', 'datafeedr-api' ) );
960 + $help['brand'] .= $this->help_operators();
772 961
773 - // Price
774 - $help['price'] = '<h3>' . __('Price', DFRAPI_DOMAIN ) . '</h3>';
775 - $help['price'] .= '<p>' . __( 'Filter your search results based on price. Return products less than, greater than, or within a price range that you set.', DFRAPI_DOMAIN ) . '</p>';
776 - $help['price'] .= $this->help_tip( __( 'This field does not search on sale price. If you set a price range to less than 30, you will exclude an item with a regular price of 40 that is on sale for less than 30.', DFRAPI_DOMAIN ) );
962 + // Color
963 + $help['color'] = '<h3>' . __('Color', 'datafeedr-api' ) . '</h3>';
964 + $help['color'] .= '<p>' . __( 'Search by color to get specific results. Not every item has a color field.', 'datafeedr-api' ) . '</p>';
777 965
778 - // Sale Price
779 - $help['saleprice'] = '<h3>' . __('Sale Price', DFRAPI_DOMAIN ) . '</h3>';
780 - $help['saleprice'] .= '<p>' . __( 'Filter your search results based on sale price. Return items less than, greater than, or within a sale price range that you set.', DFRAPI_DOMAIN ) . '</p>';
781 - $help['saleprice'] .= $this->help_tip( __( 'This field does not search on regular price. If you set a sale price range to between 50 and 100, an item with a sale price of 40 will be excluded even if it\'s regular price matches the range you set.', DFRAPI_DOMAIN ) );
966 + // Material
967 + $help['material'] = '<h3>' . __('Material', 'datafeedr-api' ) . '</h3>';
968 + $help['material'] .= '<p>' . __( 'Search by material to get specific results. Not every item has a material field.', 'datafeedr-api' ) . '</p>';
782 969
783 - // Network
784 - $help['source_id'] = '<h3>' . __('Network', DFRAPI_DOMAIN ) . '</h3>';
785 - $help['source_id'] .= '<p>' . __( 'Limit your search results to items from one or more affiliate networks.', DFRAPI_DOMAIN ) . '</p>';
786 - $help['source_id'] .= $this->help_tip( __( 'Affiliate networks are generally country-specific. Using the Network filter is one way to limit your search results by country.', DFRAPI_DOMAIN ) );
970 + // Size
971 + $help['size'] = '<h3>' . __('Size', 'datafeedr-api' ) . '</h3>';
972 + $help['size'] .= '<p>' . __( 'Search by size to get specific results. Not every item has a size field.', 'datafeedr-api' ) . '</p>';
787 973
788 - // Merchant
789 - $help['merchant_id'] = '<h3>' . __('Merchant', DFRAPI_DOMAIN ) . '</h3>';
790 - $help['merchant_id'] .= '<p>' . __( 'Limit your search results to items from one or more merchants.', DFRAPI_DOMAIN ) . '</p>';
791 - $help['merchant_id'] .= $this->help_tip( __( 'Using the Merchant filter is a quick way to exclude unrelated products and reduce the number of API requests made when building a Product Set. For example, if you are creating a Product Set related to cat products, exclude all merchants that only sell dog products.', DFRAPI_DOMAIN ) );
974 + // Gender
975 + $help['gender'] = '<h3>' . __('Gender', 'datafeedr-api' ) . '</h3>';
976 + $help['gender'] .= '<p>' . __( 'Search by gender to get specific results. Not every item has a gender field.', 'datafeedr-api' ) . '</p>';
792 977
793 - // On Sale
794 - $help['onsale'] = '<h3>' . __('On Sale', DFRAPI_DOMAIN ) . '</h3>';
795 - $help['onsale'] .= '<p>' . __( 'Set this field to "<strong>yes</strong>" to return only items which are on sale. To exclude products which are on sale, set this field to "<strong>no</strong>".', DFRAPI_DOMAIN ) . '</p>';
978 + // SKU
979 + $help['sku'] = '<h3>' . __('SKU', 'datafeedr-api' ) . '</h3>';
980 + $help['sku'] .= '<p>' . __( 'Search by SKU to get specific results. Not every item has a SKU field.', 'datafeedr-api' ) . '</p>';
796 981
797 - // Discount
798 - $help['salediscount'] = '<h3>' . __('Discount', DFRAPI_DOMAIN ) . '</h3>';
799 - $help['salediscount'] .= '<p>' . __( 'Limit your search results to items with a specified discount. Enter the number in terms of percentage (1 - 100) to indicate a discount less than, greater than, or between a given range. You do not need to enter the percentage sign.', DFRAPI_DOMAIN ) . '</p>';
800 - $help['salediscount'] .= $this->help_tip( __( 'To display, for example, only products that are on sale for a discount of 20% or more, choose the "greater than" operator and type "19".', DFRAPI_DOMAIN ) );
982 + // Condition
983 + $help['condition'] = '<h3>' . __('Condition', 'datafeedr-api' ) . '</h3>';
984 + $help['condition'] .= '<p>' . __( 'Search by condition to get specific results. Not every item has a condition field.', 'datafeedr-api' ) . '</p>';
801 985
802 - // Has Image
803 - $help['image'] = '<h3>' . __('Has Image', DFRAPI_DOMAIN ) . '</h3>';
804 - $help['image'] .= '<p>' . __( 'Limit your search results to items which have an image (or which don\'t).', DFRAPI_DOMAIN ) . '</p>';
805 - $help['image'] .= $this->help_tip( __( 'Sometimes the image URL in the merchant\'s data feed is broken. Items with broken images will still return in search results even though there appears to be no image.', DFRAPI_DOMAIN ) );
986 + // Description
987 + $help['description'] = '<h3>' . __('Description', 'datafeedr-api' ) . '</h3>';
988 + $help['description'] .= '<p>' . __( 'Search the description field for product attributes such as size, color, material, gender or usage.', 'datafeedr-api' ) . '</p>';
989 + $help['description'] .= $this->help_tip( __( 'Most merchants provide a product description. Some product details may only appear in the description and not in any other field. However, some merchants duplicate the product name or product code in the description field without supplying additional details or leave the product description blank.', 'datafeedr-api' ) );
990 + $help['description'] .= $this->help_operators();
806 991
807 - // Last Updated
808 - $help['time_updated'] = '<h3>' . __('Last Updated', DFRAPI_DOMAIN ) . '</h3>';
809 - $help['time_updated'] .= '<p>' . __( 'Filter products by the last time they were updated by the merchant. Enter an English textual datetime description using PHP\'s <a href="http://www.php.net/strtotime" target="_blank">strtotime()</a> function.', DFRAPI_DOMAIN ) . '</p>';
810 - $help['time_updated'] .= '<h3>' . __('Examples', DFRAPI_DOMAIN ) . '</h3>';
811 - $help['time_updated'] .= '<p>';
812 - $help['time_updated'] .= '<tt>' . __('last week', DFRAPI_DOMAIN ) . '</tt><br />';
813 - $help['time_updated'] .= '<tt>' . __('2 days ago', DFRAPI_DOMAIN ) . '</tt><br />';
814 - $help['time_updated'] .= '<tt>' . __('1 month ago', DFRAPI_DOMAIN ) . '</tt>';
815 - $help['time_updated'] .= '</p>';
816 - $help['time_updated'] .= '<p>' . __( '', DFRAPI_DOMAIN ) . '</p>';
817 - $help['time_updated'] .= $this->help_tip( __( 'An item\'s Last Updated date will not change if the merchant does not change any product information during a data feed update.', DFRAPI_DOMAIN ) );
992 + // Tags
993 + $help['tags'] = '<h3>' . __('Tags', 'datafeedr-api' ) . '</h3>';
994 + $help['tags'] .= '<p>' . __( 'Limit search results based on product tag and keyword information.', 'datafeedr-api' ) . '</p>';
995 + $help['tags'] .= $this->help_tip( __( 'This field contains data from various keyword-related fields provided by the merchant. This field does not always exist.', 'datafeedr-api' ) );
818 996
819 - // Limit
820 - $help['limit'] = '<h3>' . __('Limit', DFRAPI_DOMAIN ) . '</h3>';
821 - $help['limit'] .= '<p>' . __( 'Limit the number of items returned in your search results. The maximum number of products that can be returned is 10,000.', DFRAPI_DOMAIN ) . '</p>';
822 - $help['limit'] .= $this->help_tip( __( 'Limiting the number of products returned helps reduce the number of API requests made during searching and updating Product Sets.', DFRAPI_DOMAIN ) );
997 + // Category
998 + $help['category'] = '<h3>' . __('Category', 'datafeedr-api' ) . '</h3>';
999 + $help['category'] .= '<p>' . __( 'Limit search results based on category information.', 'datafeedr-api' ) . '</p>';
1000 + $help['category'] .= $this->help_tip( __( 'This field contains data from various category-related fields provided by the merchant. This field does not always exist.', 'datafeedr-api' ) );
1001 + $help['category'] .= $this->help_operators();
823 1002
824 - // Sort By
825 - $help['sort'] = '<h3>' . __('Sort By', DFRAPI_DOMAIN ) . '</h3>';
826 - $help['sort'] .= '<p>' . __( 'Change the sort criteria by which items are displayed in your search results.', DFRAPI_DOMAIN ) . '</p>';
827 - $help['sort'] .= $this->help_tip( __( 'By default, search results are sorted by relevance. You can change that to sort by price, sale price, discount, or last updated date in ascending order (lowest to highest) or descending order (highest to lowest). You can also sort by merchant, which lists items alphabetically by merchant name.', DFRAPI_DOMAIN ) );
1003 + // Type
1004 + $help['type'] = '<h3>' . __('Product Type', 'datafeedr-api' ) . '</h3>';
1005 + $help['type'] .= '<p>' . __( 'Limit your search results to one type of item, either Product or Coupon.', 'datafeedr-api' ) . '</p>';
1006 + $help['type'] .= $this->help_tip( __( 'In order to use this filter, you must have already selected merchants that provide that type of item. For example, if you choose "Product type: Coupon" but have not selected any merchants that offer coupons, your search will return an error.', 'datafeedr-api' ) );
828 1007
829 - // Exclude Duplicates
830 - $help['duplicates'] = '<h3>' . __('Exclude Duplicates', DFRAPI_DOMAIN ) . '</h3>';
831 - $help['duplicates'] .= '<p>' . __( 'Exclude items that contain identical product names, image URLs, etc. Enter one or more terms from the list below. Separate terms by a space (meaning AND) or | (pipe symbol, meaning OR).', DFRAPI_DOMAIN ) . '<br />';
832 - $help['duplicates'] .= '<p>' . __( 'Enter one of these terms to exclude duplicates matching these fields:', DFRAPI_DOMAIN ) . '<br />';
833 - $help['duplicates'] .= '<tt>' . __('name', DFRAPI_DOMAIN ) . '</tt><br />';
834 - $help['duplicates'] .= '<tt>' . __('brand', DFRAPI_DOMAIN ) . '</tt><br />';
835 - $help['duplicates'] .= '<tt>' . __('currency', DFRAPI_DOMAIN ) . '</tt><br />';
836 - $help['duplicates'] .= '<tt>' . __('price', DFRAPI_DOMAIN ) . '</tt><br />';
837 - $help['duplicates'] .= '<tt>' . __('saleprice', DFRAPI_DOMAIN ) . '</tt><br />';
838 - $help['duplicates'] .= '<tt>' . __('source_id', DFRAPI_DOMAIN ) . '</tt><br />';
839 - $help['duplicates'] .= '<tt>' . __('merchant_id', DFRAPI_DOMAIN ) . '</tt><br />';
840 - $help['duplicates'] .= '<tt>' . __('onsale', DFRAPI_DOMAIN ) . '</tt><br />';
841 - $help['duplicates'] .= '<tt>' . __('image', DFRAPI_DOMAIN ) . '</tt><br />';
842 - $help['duplicates'] .= '<tt>' . __('thumbnail', DFRAPI_DOMAIN ) . '</tt>';
843 - $help['duplicates'] .= '</p>';
844 - $help['duplicates'] .= '<h3>' . __('Examples', DFRAPI_DOMAIN ) . '</h3>';
845 - $help['duplicates'] .= '<p>';
846 - $help['duplicates'] .= '<tt>' . __('image</tt> - Exclude items which have the same image URL.', DFRAPI_DOMAIN ) . '<br />';
847 - $help['duplicates'] .= '<tt>' . __('name image</tt> - Exclude items with the same name AND the same image URL.', DFRAPI_DOMAIN ) . '<br />';
848 - $help['duplicates'] .= '<tt>' . __('name|image</tt> - Exclude items with the same name OR the same image URL.', DFRAPI_DOMAIN ) . '<br />';
849 - $help['duplicates'] .= '<tt>' . __('merchant_id name|image</tt> - Exclude items which have the same merchant id AND (product name OR image URL).', DFRAPI_DOMAIN ) . '<br />';
850 - $help['duplicates'] .= '</p>';
851 - $help['duplicates'] .= $this->help_tip( __( 'By excluding duplicates, you will eliminate all but one item. For example, if 20 products have identical image URLs and you exclude duplicates matching the <strong>image</strong> field, <em>one</em> item will be returned and 19 items will be excluded.', DFRAPI_DOMAIN ) );
1008 + // Currency
1009 + $help['currency'] = '<h3>' . __('Currency', 'datafeedr-api' ) . '</h3>';
1010 + $help['currency'] .= '<p>' . __( 'Limit your search results to items with a specific currency code.', 'datafeedr-api' ) . '</p>';
1011 + $help['currency'] .= $this->help_tip( __( 'Selecting a currency code is one way to limit your search results to items from a specific country. However, not every item has been given a currency code value by the merchant. Items without a currency code will be excluded from your search results.', 'datafeedr-api' ) );
852 1012
853 -
854 - if (isset($help[$field])) {
855 - return $help[$field];
856 - } else {
857 - return '';
858 - }
859 -
1013 + // Price
1014 + $help['price'] = '<h3>' . __('Price', 'datafeedr-api' ) . '</h3>';
1015 + $help['price'] .= '<p>' . __( 'Filter your search results based on price. Return products less than, greater than, or within a price range that you set.', 'datafeedr-api' ) . '</p>';
1016 + $help['price'] .= $this->help_tip( __( 'This field does not search on sale price. If you set a price range to less than 30, you will exclude an item with a regular price of 40 that is on sale for less than 30.', 'datafeedr-api' ) );
1017 +
1018 + // Sale Price
1019 + $help['saleprice'] = '<h3>' . __('Sale Price', 'datafeedr-api' ) . '</h3>';
1020 + $help['saleprice'] .= '<p>' . __( 'Filter your search results based on sale price. Return items less than, greater than, or within a sale price range that you set.', 'datafeedr-api' ) . '</p>';
1021 + $help['saleprice'] .= $this->help_tip( __( 'This field does not search on regular price. If you set a sale price range to between 50 and 100, an item with a sale price of 40 will be excluded even if it\'s regular price matches the range you set.', 'datafeedr-api' ) );
1022 +
1023 + // Final Price
1024 + $help['finalprice'] = '<h3>' . __('Final Price', 'datafeedr-api' ) . '</h3>';
1025 + $help['finalprice'] .= '<p>' . __( 'Filter your search results based on the final price. Return items less than, greater than, or within a sale price range that you set.', 'datafeedr-api' ) . '</p>';
1026 + $help['finalprice'] .= $this->help_tip( __( 'The final price is the lower price when comparing the regular price and sale price field.', 'datafeedr-api' ) );
1027 +
1028 + // Discount
1029 + $help['salediscount'] = '<h3>' . __('Discount', 'datafeedr-api' ) . '</h3>';
1030 + $help['salediscount'] .= '<p>' . __( 'Limit your search results to items with a specified discount. Enter the number in terms of percentage (1 - 100) to indicate a discount less than, greater than, or between a given range. You do not need to enter the percentage sign.', 'datafeedr-api' ) . '</p>';
1031 + $help['salediscount'] .= $this->help_tip( __( 'To display, for example, only products that are on sale for a discount of 20% or more, choose the "greater than" operator and type "19".', 'datafeedr-api' ) );
1032 +
1033 + // Network
1034 + $help['source_id'] = '<h3>' . __('Network', 'datafeedr-api' ) . '</h3>';
1035 + $help['source_id'] .= '<p>' . __( 'Limit your search results to items from one or more affiliate networks.', 'datafeedr-api' ) . '</p>';
1036 + $help['source_id'] .= $this->help_tip( __( 'Affiliate networks are generally country-specific. Using the Network filter is one way to limit your search results by country.', 'datafeedr-api' ) );
1037 +
1038 + // Merchant
1039 + $help['merchant_id'] = '<h3>' . __('Merchant', 'datafeedr-api' ) . '</h3>';
1040 + $help['merchant_id'] .= '<p>' . __( 'Limit your search results to items from one or more merchants.', 'datafeedr-api' ) . '</p>';
1041 + $help['merchant_id'] .= $this->help_tip( __( 'Using the Merchant filter is a quick way to exclude unrelated products and reduce the number of API requests made when building a Product Set. For example, if you are creating a Product Set related to cat products, exclude all merchants that only sell dog products.', 'datafeedr-api' ) );
1042 +
1043 + // On Sale
1044 + $help['onsale'] = '<h3>' . __('On Sale', 'datafeedr-api' ) . '</h3>';
1045 + $help['onsale'] .= '<p>' . __( 'Set this field to "<strong>yes</strong>" to return only items which are on sale. To exclude products which are on sale, set this field to "<strong>no</strong>".', 'datafeedr-api' ) . '</p>';
1046 +
1047 + // In Stock
1048 + $help['instock'] = '<h3>' . __('In Stock', 'datafeedr-api' ) . '</h3>';
1049 + $help['instock'] .= '<p>' . __( 'This allows you to filter products by stock status.', 'datafeedr-api' ) . '</p>';
1050 + $help['instock'] .= '<p>' . __( '<strong>yes or unknown</strong>: This will return products which are explicitly set as "in-stock" or products which have no field containing stock-related information.', 'datafeedr-api' ) . '</p>';
1051 + $help['instock'] .= '<p>' . __( '<strong>yes</strong>: This will only return products which are explicitly set as "in-stock".', 'datafeedr-api' ) . '</p>';
1052 + $help['instock'] .= '<p>' . __( '<strong>no</strong>: This will only return products which are explicitly set as NOT "in-stock".', 'datafeedr-api' ) . '</p>';
1053 + $help['instock'] .= $this->help_tip( __( 'Not all products contain stock-related information. Therefore selecting "yes or unknown" is the recommended choice when you want to find products which are "in-stock".', 'datafeedr-api' ) );
1054 +
1055 + // Stock Quantity
1056 + $help['instock'] = '<h3>' . __('Stock Quantity', 'datafeedr-api' ) . '</h3>';
1057 + $help['instock'] .= '<p>' . __( 'This allows you to filter products by the number of products in stock.', 'datafeedr-api' ) . '</p>';
1058 + $help['instock'] .= '<p>' . __( '<strong>NOTE</strong>: Not all products have a "Stock Quantity" value. Therefore, searching for a product with a stock quantity greater than or equal to "0" will eliminate all products which have an unknow "Stock Quantity".', 'datafeedr-api' ) . '</p>';
1059 + $help['instock'] .= '<p>' . __( 'To search for products which either have a stock quantity in a specific range AND also include products which do not have a stock quantity value, use the "between" search option and enter "-1" for the first option and enter the upper limit (ie. 100) for the second value.', 'datafeedr-api' ) . '</p>';
1060 +
1061 + // Has Direct URL
1062 + $help['direct_url'] = '<h3>' . __('Has Direct URL', 'datafeedr-api' ) . '</h3>';
1063 + $help['direct_url'] .= '<p>' . __( 'Limit your search results to items which have a direct URL (or which don\'t).', 'datafeedr-api' ) . '</p>';
1064 + $help['direct_url'] .= $this->help_tip( __( 'A "Direct URL" is a URL directly to the product page on the merchant\'s website. By default, the "Direct URL" is never used as the URL in your "Buy" links. However, if you need the products in your store to contain a "Direct URL" to the product page on the merchants\' websites, then you should use this filter. This is most useful if you are using Skimlinks (or similar service) to generate your affiliate links instead of the affiliate networks.', 'datafeedr-api' ) );
1065 +
1066 + // Has Image
1067 + $help['image'] = '<h3>' . __('Has Image', 'datafeedr-api' ) . '</h3>';
1068 + $help['image'] .= '<p>' . __( 'Limit your search results to items which have an image (or which don\'t).', 'datafeedr-api' ) . '</p>';
1069 + $help['image'] .= $this->help_tip( __( 'Sometimes the image URL in the merchant\'s data feed is broken. Items with broken images will still return in search results even though there appears to be no image.', 'datafeedr-api' ) );
1070 +
1071 + // Has Barcode
1072 + $help['has_barcode'] = '<h3>' . __('Has Barcode', 'datafeedr-api' ) . '</h3>';
1073 + $help['has_barcode'] .= '<p>' . __( 'Limit your search results to products which have a barcode (ie. a UPC, EAN or GTIN value).', 'datafeedr-api' ) . '</p>';
1074 +
1075 + // Last Updated
1076 + $help['time_updated'] = '<h3>' . __('Last Updated', 'datafeedr-api' ) . '</h3>';
1077 + $help['time_updated'] .= '<p>' . __( 'Filter products by the last time they were updated by the merchant. Enter an English textual datetime description using PHP\'s <a href="http://www.php.net/strtotime" target="_blank">strtotime()</a> function.', 'datafeedr-api' ) . '</p>';
1078 + $help['time_updated'] .= '<h3>' . __('Examples', 'datafeedr-api' ) . '</h3>';
1079 + $help['time_updated'] .= '<p>';
1080 + $help['time_updated'] .= '<tt>' . __('last week', 'datafeedr-api' ) . '</tt><br />';
1081 + $help['time_updated'] .= '<tt>' . __('2 days ago', 'datafeedr-api' ) . '</tt><br />';
1082 + $help['time_updated'] .= '<tt>' . __('1 month ago', 'datafeedr-api' ) . '</tt>';
1083 + $help['time_updated'] .= '</p>';
1084 + $help['time_updated'] .= '<p>' . __( '', 'datafeedr-api' ) . '</p>';
1085 + $help['time_updated'] .= $this->help_tip( __( 'An item\'s Last Updated date will not change if the merchant does not change any product information during a data feed update.', 'datafeedr-api' ) );
1086 +
1087 + // Limit
1088 + $help['limit'] = '<h3>' . __('Limit', 'datafeedr-api' ) . '</h3>';
1089 + $help['limit'] .= '<p>' . __( 'Limit the number of items returned in your search results. The maximum number of products that can be returned is 10,000.', 'datafeedr-api' ) . '</p>';
1090 + $help['limit'] .= $this->help_tip( __( 'Limiting the number of products returned helps reduce the number of API requests made during searching and updating Product Sets.', 'datafeedr-api' ) );
1091 +
1092 + // Merchant Limit
1093 + $help['merchant_limit'] = '<h3>' . __('Merchant Limit', 'datafeedr-api' ) . '</h3>';
1094 + $help['merchant_limit'] .= '<p>' . __( 'Limit the number of items returned per merchant. The number must be between 1 and 10.', 'datafeedr-api' ) . '</p>';
1095 + $help['merchant_limit'] .= $this->help_tip( __( 'This is useful to use when you have one merchant which has many products that match your search but other merchants have fewer of those same products and you want equal distribution between all merchants.', 'datafeedr-api' ) );
1096 +
1097 + // Sort By
1098 + $help['sort'] = '<h3>' . __('Sort By', 'datafeedr-api' ) . '</h3>';
1099 + $help['sort'] .= '<p>' . __( 'Change the sort criteria by which items are displayed in your search results.', 'datafeedr-api' ) . '</p>';
1100 + $help['sort'] .= $this->help_tip( __( 'By default, search results are sorted by relevance. You can change that to sort by price, sale price, discount, or last updated date in ascending order (lowest to highest) or descending order (highest to lowest). You can also sort by merchant, which lists items alphabetically by merchant name.', 'datafeedr-api' ) );
1101 +
1102 + // Exclude Duplicates
1103 + $help['duplicates'] = '<h3>' . __('Exclude Duplicates', 'datafeedr-api' ) . '</h3>';
1104 + $help['duplicates'] .= '<p>' . __( 'Exclude items that contain identical product names, image URLs, etc. Enter one or more terms from the list below. Separate terms by a space (meaning AND) or | (pipe symbol, meaning OR).', 'datafeedr-api' ) . '<br />';
1105 + $help['duplicates'] .= '<p>' . __( 'Enter one of these terms to exclude duplicates matching these fields:', 'datafeedr-api' ) . '<br />';
1106 + $help['duplicates'] .= '<tt>' . __('name', 'datafeedr-api' ) . '</tt><br />';
1107 + $help['duplicates'] .= '<tt>' . __('brand', 'datafeedr-api' ) . '</tt><br />';
1108 + $help['duplicates'] .= '<tt>' . __('description', 'datafeedr-api' ) . '</tt><br />';
1109 + $help['duplicates'] .= '<tt>' . __('currency', 'datafeedr-api' ) . '</tt><br />';
1110 + $help['duplicates'] .= '<tt>' . __('price', 'datafeedr-api' ) . '</tt><br />';
1111 + $help['duplicates'] .= '<tt>' . __('saleprice', 'datafeedr-api' ) . '</tt><br />';
1112 + $help['duplicates'] .= '<tt>' . __('source_id', 'datafeedr-api' ) . '</tt><br />';
1113 + $help['duplicates'] .= '<tt>' . __('merchant_id', 'datafeedr-api' ) . '</tt><br />';
1114 + $help['duplicates'] .= '<tt>' . __('direct_url', 'datafeedr-api' ) . '</tt><br />';
1115 + $help['duplicates'] .= '<tt>' . __('onsale', 'datafeedr-api' ) . '</tt><br />';
1116 + $help['duplicates'] .= '<tt>' . __('image', 'datafeedr-api' ) . '</tt><br />';
1117 + $help['duplicates'] .= '<tt>' . __('thumbnail', 'datafeedr-api' ) . '</tt>';
1118 + $help['duplicates'] .= '</p>';
1119 + $help['duplicates'] .= '<h3>' . __('Examples', 'datafeedr-api' ) . '</h3>';
1120 + $help['duplicates'] .= '<p>';
1121 + $help['duplicates'] .= '<tt>' . __('image</tt> - Exclude items which have the same image URL.', 'datafeedr-api' ) . '<br />';
1122 + $help['duplicates'] .= '<tt>' . __('name image</tt> - Exclude items with the same name AND the same image URL.', 'datafeedr-api' ) . '<br />';
1123 + $help['duplicates'] .= '<tt>' . __('name|image</tt> - Exclude items with the same name OR the same image URL.', 'datafeedr-api' ) . '<br />';
1124 + $help['duplicates'] .= '<tt>' . __('merchant_id name|image</tt> - Exclude items which have the same merchant id AND (product name OR image URL).', 'datafeedr-api' ) . '<br />';
1125 + $help['duplicates'] .= '</p>';
1126 + $help['duplicates'] .= $this->help_tip( __( 'By excluding duplicates, you will eliminate all but one item. For example, if 20 products have identical image URLs and you exclude duplicates matching the <strong>image</strong> field, <em>one</em> item will be returned and 19 items will be excluded.', 'datafeedr-api' ) );
1127 +
1128 + if (isset($help[$field])) {
1129 + return $help[$field];
1130 + } else {
1131 + return '';
1132 + }
1133 +
860 1134 } // help()
861 1135
862 1136 }