Skip to content

Commit 150d959

Browse files
Merge pull request #67 from aplazame/alexhernandezord/sc-126287/plugins-widget-v5
feat: [sc-126287] [Plugins] Widget v5.
2 parents 8a72368 + 62fb5cc commit 150d959

File tree

7 files changed

+362
-216
lines changed

7 files changed

+362
-216
lines changed

plugin/aplazame.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ class WC_Aplazame_Install {
371371
'cart_widget_primary_color' => '#334bff',
372372
'product_widget_layout' => 'horizontal',
373373
'cart_widget_layout' => 'horizontal',
374-
'widget_legacy' => 'no',
375374
'product_widget_border' => 'yes',
376375
'product_widget_align' => 'center',
377376
'cart_widget_align' => 'center',
@@ -382,6 +381,12 @@ class WC_Aplazame_Install {
382381
'cart_downpayment_info' => 'yes',
383382
'product_widget_max_desired' => 'no',
384383
'cart_widget_max_desired' => 'no',
384+
'product_widget_ver' => 'v5',
385+
'cart_widget_ver' => 'v5',
386+
'product_slider' => 'yes',
387+
'cart_slider' => 'yes',
388+
'product_small_size' => 'no',
389+
'cart_small_size' => 'no',
385390
);
386391

387392
public static function upgrade() {
@@ -410,9 +415,6 @@ public static function upgrade() {
410415
if ( isset( $aplazame->settings['title_instalments'] ) ) {
411416
$aplazame->settings['title'] = $aplazame->settings['title_instalments'];
412417
}
413-
if ( ! isset( $aplazame->settings['widget_legacy'] ) ) {
414-
$aplazame->settings['widget_legacy'] = 'yes';
415-
}
416418
self::save_settings( $aplazame->settings );
417419

418420
self::update_aplazame_version();

plugin/classes/wc-aplazame-gateway.php

Lines changed: 71 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,6 @@ public function init_form_fields() {
232232
),
233233
'default' => WC_Aplazame_Install::$defaultSettings['widget_out_of_limits'],
234234
),
235-
'widget_legacy' => array(
236-
'type' => 'checkbox',
237-
'title' => 'Widget legacy',
238-
'description' => __( 'Use widget legacy instead new widget', 'aplazame' ),
239-
'label' => __( 'Turn on widget legacy', 'aplazame' ),
240-
),
241235
'payment_section' => array(
242236
'title' => __( 'Payment method title and description', 'aplazame' ),
243237
'type' => 'title',
@@ -266,6 +260,17 @@ public function init_form_fields() {
266260
'type' => 'title',
267261
'description' => '',
268262
),
263+
'product_widget_ver' => array(
264+
'type' => 'select',
265+
'title' => __( 'Widget version', 'aplazame' ),
266+
'description' => __( 'Select your desired version for product widget', 'aplazame' ),
267+
'options' => array(
268+
'v3' => __( 'v3', 'aplazame' ),
269+
'v4' => __( 'v4', 'aplazame' ),
270+
'v5' => __( 'v5', 'aplazame' ),
271+
),
272+
'default' => 'v5',
273+
),
269274
'product_widget_action' => array(
270275
'type' => 'select',
271276
'title' => __( 'Place to show', 'aplazame' ),
@@ -285,6 +290,18 @@ public function init_form_fields() {
285290
'description' => __( 'Number of default instalments in product widget', 'aplazame' ),
286291
'placeholder' => __( 'Optional (only numbers)', 'aplazame' ),
287292
),
293+
'product_slider' => array(
294+
'type' => 'checkbox',
295+
'title' => __( 'Slider', 'aplazame' ),
296+
'description' => __( 'Show slider in product widget (only v5)', 'aplazame' ),
297+
'label' => __( 'Show slider info', 'aplazame' ),
298+
),
299+
'product_small_size' => array(
300+
'type' => 'checkbox',
301+
'title' => __( 'Small size', 'aplazame' ),
302+
'description' => __( 'Reduce size of product widget (only v5)', 'aplazame' ),
303+
'label' => __( 'Reduce size', 'aplazame' ),
304+
),
288305
'product_downpayment_info' => array(
289306
'type' => 'checkbox',
290307
'title' => __( 'Downpayment info', 'aplazame' ),
@@ -306,28 +323,19 @@ public function init_form_fields() {
306323
'product_widget_border' => array(
307324
'type' => 'checkbox',
308325
'title' => __( 'Border', 'aplazame' ),
309-
'description' => __( 'Show border in product widget (only new widget)', 'aplazame' ),
326+
'description' => __( 'Show border in product widget (only v4)', 'aplazame' ),
310327
'label' => __( 'Show border', 'aplazame' ),
311328
),
312329
'product_widget_max_desired' => array(
313330
'type' => 'checkbox',
314331
'title' => __( 'Enter maximum instalment', 'aplazame' ),
315-
'description' => __( 'Allow the user to manually enter the maximum instalment they want to pay (only new widget)', 'aplazame' ),
332+
'description' => __( 'Allow the user to manually enter the maximum instalment they want to pay (only v4)', 'aplazame' ),
316333
'label' => __( 'Allow the user to manually enter the maximum instalment', 'aplazame' ),
317334
),
318-
'product_widget_primary_color' => array(
319-
'type' => 'text',
320-
'css' => 'width:100px;',
321-
'class' => 'colorpick',
322-
'title' => __( 'Primary color', 'aplazame' ),
323-
'description' => __( 'Primary color hexadecimal code for product widget (only new widget)', 'aplazame' ),
324-
'default' => WC_Aplazame_Install::$defaultSettings['product_widget_primary_color'],
325-
'placeholder' => WC_Aplazame_Install::$defaultSettings['product_widget_primary_color'],
326-
),
327335
'product_widget_layout' => array(
328336
'type' => 'select',
329337
'title' => __( 'Layout', 'aplazame' ),
330-
'description' => __( 'Layout of product widget (only new widget)', 'aplazame' ),
338+
'description' => __( 'Layout of product widget (only v4)', 'aplazame' ),
331339
'options' => array(
332340
'horizontal' => 'Horizontal',
333341
'vertical' => 'Vertical',
@@ -337,14 +345,23 @@ public function init_form_fields() {
337345
'product_widget_align' => array(
338346
'type' => 'select',
339347
'title' => __( 'Alignment', 'aplazame' ),
340-
'description' => __( 'Product widget alignment (only new widget)', 'aplazame' ),
348+
'description' => __( 'Product widget alignment (only v4/v5)', 'aplazame' ),
341349
'options' => array(
342350
'left' => __( 'Left', 'aplazame' ),
343351
'center' => __( 'Center', 'aplazame' ),
344352
'right' => __( 'Right', 'aplazame' ),
345353
),
346354
'default' => WC_Aplazame_Install::$defaultSettings['product_widget_align'],
347355
),
356+
'product_widget_primary_color' => array(
357+
'type' => 'text',
358+
'css' => 'width:100px;',
359+
'class' => 'colorpick',
360+
'title' => __( 'Primary color', 'aplazame' ),
361+
'description' => __( 'Primary color hexadecimal code for product widget (only v4)', 'aplazame' ),
362+
'default' => WC_Aplazame_Install::$defaultSettings['product_widget_primary_color'],
363+
'placeholder' => WC_Aplazame_Install::$defaultSettings['product_widget_primary_color'],
364+
),
348365
'quantity_selector' => array(
349366
'type' => 'text',
350367
'title' => __( 'Product quantity CSS selector', 'aplazame' ),
@@ -374,6 +391,17 @@ public function init_form_fields() {
374391
'type' => 'title',
375392
'description' => '',
376393
),
394+
'cart_widget_ver' => array(
395+
'type' => 'select',
396+
'title' => __( 'Widget version', 'aplazame' ),
397+
'description' => __( 'Select your desired version for cart widget', 'aplazame' ),
398+
'options' => array(
399+
'v3' => __( 'v3', 'aplazame' ),
400+
'v4' => __( 'v4', 'aplazame' ),
401+
'v5' => __( 'v5', 'aplazame' ),
402+
),
403+
'default' => 'v5',
404+
),
377405
'cart_widget_action' => array(
378406
'type' => 'select',
379407
'title' => __( 'Place to show', 'aplazame' ),
@@ -392,6 +420,18 @@ public function init_form_fields() {
392420
'description' => __( 'Number of default instalments in cart widget', 'aplazame' ),
393421
'placeholder' => __( 'Optional (only numbers)', 'aplazame' ),
394422
),
423+
'cart_slider' => array(
424+
'type' => 'checkbox',
425+
'title' => __( 'Slider', 'aplazame' ),
426+
'description' => __( 'Show slider in cart widget (only v5)', 'aplazame' ),
427+
'label' => __( 'Show slider info', 'aplazame' ),
428+
),
429+
'cart_small_size' => array(
430+
'type' => 'checkbox',
431+
'title' => __( 'Small size', 'aplazame' ),
432+
'description' => __( 'Reduce size of cart widget (only v5)', 'aplazame' ),
433+
'label' => __( 'Reduce size', 'aplazame' ),
434+
),
395435
'cart_downpayment_info' => array(
396436
'type' => 'checkbox',
397437
'title' => __( 'Downpayment info', 'aplazame' ),
@@ -413,22 +453,13 @@ public function init_form_fields() {
413453
'cart_widget_max_desired' => array(
414454
'type' => 'checkbox',
415455
'title' => __( 'Enter maximum instalment', 'aplazame' ),
416-
'description' => __( 'Allow the user to manually enter the maximum instalment they want to pay (only new widget)', 'aplazame' ),
456+
'description' => __( 'Allow the user to manually enter the maximum instalment they want to pay (only v4)', 'aplazame' ),
417457
'label' => __( 'Allow the user to manually enter the maximum instalment', 'aplazame' ),
418458
),
419-
'cart_widget_primary_color' => array(
420-
'type' => 'text',
421-
'css' => 'width:100px;',
422-
'class' => 'colorpick',
423-
'title' => __( 'Primary color', 'aplazame' ),
424-
'description' => __( 'Primary color hexadecimal code for cart widget (only new widget)', 'aplazame' ),
425-
'default' => WC_Aplazame_Install::$defaultSettings['cart_widget_primary_color'],
426-
'placeholder' => WC_Aplazame_Install::$defaultSettings['cart_widget_primary_color'],
427-
),
428459
'cart_widget_layout' => array(
429460
'type' => 'select',
430461
'title' => __( 'Layout', 'aplazame' ),
431-
'description' => __( 'Layout of cart widget (only new widget)', 'aplazame' ),
462+
'description' => __( 'Layout of cart widget (only v4)', 'aplazame' ),
432463
'options' => array(
433464
'horizontal' => 'Horizontal',
434465
'vertical' => 'Vertical',
@@ -438,14 +469,23 @@ public function init_form_fields() {
438469
'cart_widget_align' => array(
439470
'type' => 'select',
440471
'title' => __( 'Alignment', 'aplazame' ),
441-
'description' => __( 'Cart widget alignment (only new widget)', 'aplazame' ),
472+
'description' => __( 'Cart widget alignment (only v4/v5)', 'aplazame' ),
442473
'options' => array(
443474
'left' => __( 'Left', 'aplazame' ),
444475
'center' => __( 'Center', 'aplazame' ),
445476
'right' => __( 'Right', 'aplazame' ),
446477
),
447478
'default' => WC_Aplazame_Install::$defaultSettings['cart_widget_align'],
448479
),
480+
'cart_widget_primary_color' => array(
481+
'type' => 'text',
482+
'css' => 'width:100px;',
483+
'class' => 'colorpick',
484+
'title' => __( 'Primary color', 'aplazame' ),
485+
'description' => __( 'Primary color hexadecimal code for cart widget (only v4)', 'aplazame' ),
486+
'default' => WC_Aplazame_Install::$defaultSettings['cart_widget_primary_color'],
487+
'placeholder' => WC_Aplazame_Install::$defaultSettings['cart_widget_primary_color'],
488+
),
449489

450490
// Button settings
451491
'button_section' => array(
698 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)