Skip to content

Commit 03354f2

Browse files
Add default instalments option at widgets (#21)
1 parent 7f0a3f0 commit 03354f2

File tree

7 files changed

+98
-44
lines changed

7 files changed

+98
-44
lines changed

plugin/aplazame.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ class WC_Aplazame_Install {
325325
'cart_legal_advice' => 'yes',
326326
'title' => '',
327327
'description' => 'Compra primero y paga después con <a href="https://aplazame.com" target="_blank">Aplazame</a>.',
328+
'product_default_instalments' => '',
329+
'cart_default_instalments' => '',
328330
);
329331

330332
public static function upgrade() {

plugin/classes/wc-aplazame-gateway.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,13 @@ public function init_form_fields() {
253253
),
254254
'default' => 'woocommerce_single_product_summary',
255255
),
256+
'product_default_instalments' => array(
257+
'type' => 'text',
258+
'css' => 'width:200px;',
259+
'title' => __( 'Default instalments', 'aplazame' ),
260+
'description' => __( 'Number of default instalments in product widget', 'aplazame' ),
261+
'placeholder' => __( 'Optional (only numbers)', 'aplazame' ),
262+
),
256263
'product_legal_advice' => array(
257264
'type' => 'checkbox',
258265
'title' => __( 'Legal notice', 'aplazame' ),
@@ -297,6 +304,13 @@ public function init_form_fields() {
297304
),
298305
'default' => 'woocommerce_after_cart_totals',
299306
),
307+
'cart_default_instalments' => array(
308+
'type' => 'text',
309+
'css' => 'width:200px;',
310+
'title' => __( 'Default instalments', 'aplazame' ),
311+
'description' => __( 'Number of default instalments in cart widget', 'aplazame' ),
312+
'placeholder' => __( 'Optional (only numbers)', 'aplazame' ),
313+
),
300314
'cart_legal_advice' => array(
301315
'type' => 'checkbox',
302316
'title' => __( 'Legal notice', 'aplazame' ),
372 Bytes
Binary file not shown.

plugin/i18n/languages/aplazame.po

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
msgid ""
22
msgstr ""
33
"Report-Msgid-Bugs-To: https://github.com/aplazame/woocommerce\n"
4-
"POT-Creation-Date: 2021-01-12 14:55+0000\n"
4+
"POT-Creation-Date: 2021-01-14 09:42+0000\n"
55
"Language: es_ES\n"
66
"MIME-Version: 1.0\n"
77
"Content-Type: text/plain; charset=UTF-8\n"
@@ -101,15 +101,15 @@ msgstr "Descripción del método de pago"
101101
msgid "Product widget"
102102
msgstr "Widget del producto"
103103

104-
#: classes/wc-aplazame-gateway.php:246 classes/wc-aplazame-gateway.php:291
104+
#: classes/wc-aplazame-gateway.php:246 classes/wc-aplazame-gateway.php:298
105105
msgid "Place to show"
106106
msgstr "Lugar a mostrar"
107107

108108
#: classes/wc-aplazame-gateway.php:247
109109
msgid "Widget place on product page"
110110
msgstr "Lugar del widget en la página del producto"
111111

112-
#: classes/wc-aplazame-gateway.php:249 classes/wc-aplazame-gateway.php:294
112+
#: classes/wc-aplazame-gateway.php:249 classes/wc-aplazame-gateway.php:301
113113
msgid "~ Not show ~"
114114
msgstr "~ No mostrar ~"
115115

@@ -125,79 +125,95 @@ msgstr "Después del botón de añadir al carrito"
125125
msgid "After summary"
126126
msgstr "Después del resumen"
127127

128-
#: classes/wc-aplazame-gateway.php:258 classes/wc-aplazame-gateway.php:302
128+
#: classes/wc-aplazame-gateway.php:259 classes/wc-aplazame-gateway.php:310
129+
msgid "Default instalments"
130+
msgstr "Cuotas por defecto"
131+
132+
#: classes/wc-aplazame-gateway.php:260
133+
msgid "Number of default instalments in product widget"
134+
msgstr "Número de cuotas por defecto en el widget del producto"
135+
136+
#: classes/wc-aplazame-gateway.php:261 classes/wc-aplazame-gateway.php:312
137+
msgid "Optional (only numbers)"
138+
msgstr "Opcional (solo números)"
139+
140+
#: classes/wc-aplazame-gateway.php:265 classes/wc-aplazame-gateway.php:316
129141
msgid "Legal notice"
130142
msgstr "Texto legal"
131143

132-
#: classes/wc-aplazame-gateway.php:259
144+
#: classes/wc-aplazame-gateway.php:266
133145
msgid "Show legal notice in product widget"
134146
msgstr "Mostrar texto legal en el widget del producto"
135147

136-
#: classes/wc-aplazame-gateway.php:260 classes/wc-aplazame-gateway.php:304
148+
#: classes/wc-aplazame-gateway.php:267 classes/wc-aplazame-gateway.php:318
137149
msgid "Show legal notice"
138150
msgstr "Mostrar texto legal"
139151

140-
#: classes/wc-aplazame-gateway.php:264
152+
#: classes/wc-aplazame-gateway.php:271
141153
msgid "Product quantity CSS selector"
142154
msgstr "Selector CSS del número de unidades del producto"
143155

144-
#: classes/wc-aplazame-gateway.php:265
156+
#: classes/wc-aplazame-gateway.php:272
145157
msgid "CSS selector pointing to product quantity"
146158
msgstr "Selector CSS para obtener la cantidad de producto"
147159

148-
#: classes/wc-aplazame-gateway.php:270
160+
#: classes/wc-aplazame-gateway.php:277
149161
msgid "Product price CSS selector"
150162
msgstr "Selector CSS del precio del producto"
151163

152-
#: classes/wc-aplazame-gateway.php:271
164+
#: classes/wc-aplazame-gateway.php:278
153165
msgid "CSS selector pointing to product price"
154166
msgstr "Selector CSS para obtener el precio del producto"
155167

156-
#: classes/wc-aplazame-gateway.php:276
168+
#: classes/wc-aplazame-gateway.php:283
157169
msgid "Variable product price CSS selector"
158170
msgstr "Selector CSS del precio variable del producto"
159171

160-
#: classes/wc-aplazame-gateway.php:277
172+
#: classes/wc-aplazame-gateway.php:284
161173
msgid "CSS selector pointing to variable product price"
162174
msgstr "Selector CSS para obtener el precio variable del producto"
163175

164-
#: classes/wc-aplazame-gateway.php:285
176+
#: classes/wc-aplazame-gateway.php:292
165177
msgid "Cart widget"
166178
msgstr "Widget del carrito"
167179

168-
#: classes/wc-aplazame-gateway.php:292
180+
#: classes/wc-aplazame-gateway.php:299
169181
msgid "Widget place on cart page"
170182
msgstr "Lugar del widget en la página del carrito"
171183

172-
#: classes/wc-aplazame-gateway.php:295
184+
#: classes/wc-aplazame-gateway.php:302
173185
msgid "Before cart totals"
174186
msgstr "Antes del total"
175187

176-
#: classes/wc-aplazame-gateway.php:296
188+
#: classes/wc-aplazame-gateway.php:303
177189
msgid "After cart totals"
178190
msgstr "Después del total"
179191

180-
#: classes/wc-aplazame-gateway.php:303
192+
#: classes/wc-aplazame-gateway.php:311
193+
msgid "Number of default instalments in cart widget"
194+
msgstr "Número de cuotas por defecto en el widget del carrito"
195+
196+
#: classes/wc-aplazame-gateway.php:317
181197
msgid "Show legal notice in cart widget"
182198
msgstr "Mostrar texto legal en el widget del carrito"
183199

184-
#: classes/wc-aplazame-gateway.php:307
200+
#: classes/wc-aplazame-gateway.php:321
185201
msgid "Button"
186202
msgstr "Botón"
187203

188-
#: classes/wc-aplazame-gateway.php:313
204+
#: classes/wc-aplazame-gateway.php:327
189205
msgid "Button Selector"
190206
msgstr "Selector del botón"
191207

192-
#: classes/wc-aplazame-gateway.php:314
208+
#: classes/wc-aplazame-gateway.php:328
193209
msgid "Aplazame Button CSS Selector"
194210
msgstr "Selector CSS del botón de pago con Aplazame"
195211

196-
#: classes/wc-aplazame-gateway.php:322
212+
#: classes/wc-aplazame-gateway.php:336
197213
msgid "Button Image"
198214
msgstr "Imagen del botón"
199215

200-
#: classes/wc-aplazame-gateway.php:323
216+
#: classes/wc-aplazame-gateway.php:337
201217
msgid "Aplazame Button Image that you want to show"
202218
msgstr "Imagen del botón de pago con Aplazame que quieres mostrar"
203219

plugin/i18n/languages/aplazame.pot

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: Aplazame v3.0.0\n"
1010
"Report-Msgid-Bugs-To: https://github.com/aplazame/woocommerce\n"
11-
"POT-Creation-Date: 2021-01-12 14:55+0000\n"
11+
"POT-Creation-Date: 2021-01-14 09:47+0000\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: https://github.com/aplazame/woocommerce\n"
@@ -108,15 +108,15 @@ msgstr ""
108108
msgid "Product widget"
109109
msgstr ""
110110

111-
#: classes/wc-aplazame-gateway.php:246 classes/wc-aplazame-gateway.php:291
111+
#: classes/wc-aplazame-gateway.php:246 classes/wc-aplazame-gateway.php:298
112112
msgid "Place to show"
113113
msgstr ""
114114

115115
#: classes/wc-aplazame-gateway.php:247
116116
msgid "Widget place on product page"
117117
msgstr ""
118118

119-
#: classes/wc-aplazame-gateway.php:249 classes/wc-aplazame-gateway.php:294
119+
#: classes/wc-aplazame-gateway.php:249 classes/wc-aplazame-gateway.php:301
120120
msgid "~ Not show ~"
121121
msgstr ""
122122

@@ -132,79 +132,95 @@ msgstr ""
132132
msgid "After summary"
133133
msgstr ""
134134

135-
#: classes/wc-aplazame-gateway.php:258 classes/wc-aplazame-gateway.php:302
135+
#: classes/wc-aplazame-gateway.php:259 classes/wc-aplazame-gateway.php:310
136+
msgid "Default instalments"
137+
msgstr ""
138+
139+
#: classes/wc-aplazame-gateway.php:260
140+
msgid "Number of default instalments in product widget"
141+
msgstr ""
142+
143+
#: classes/wc-aplazame-gateway.php:261 classes/wc-aplazame-gateway.php:312
144+
msgid "Optional (only numbers)"
145+
msgstr ""
146+
147+
#: classes/wc-aplazame-gateway.php:265 classes/wc-aplazame-gateway.php:316
136148
msgid "Legal notice"
137149
msgstr ""
138150

139-
#: classes/wc-aplazame-gateway.php:259
151+
#: classes/wc-aplazame-gateway.php:266
140152
msgid "Show legal notice in product widget"
141153
msgstr ""
142154

143-
#: classes/wc-aplazame-gateway.php:260 classes/wc-aplazame-gateway.php:304
155+
#: classes/wc-aplazame-gateway.php:267 classes/wc-aplazame-gateway.php:318
144156
msgid "Show legal notice"
145157
msgstr ""
146158

147-
#: classes/wc-aplazame-gateway.php:264
159+
#: classes/wc-aplazame-gateway.php:271
148160
msgid "Product quantity CSS selector"
149161
msgstr ""
150162

151-
#: classes/wc-aplazame-gateway.php:265
163+
#: classes/wc-aplazame-gateway.php:272
152164
msgid "CSS selector pointing to product quantity"
153165
msgstr ""
154166

155-
#: classes/wc-aplazame-gateway.php:270
167+
#: classes/wc-aplazame-gateway.php:277
156168
msgid "Product price CSS selector"
157169
msgstr ""
158170

159-
#: classes/wc-aplazame-gateway.php:271
171+
#: classes/wc-aplazame-gateway.php:278
160172
msgid "CSS selector pointing to product price"
161173
msgstr ""
162174

163-
#: classes/wc-aplazame-gateway.php:276
175+
#: classes/wc-aplazame-gateway.php:283
164176
msgid "Variable product price CSS selector"
165177
msgstr ""
166178

167-
#: classes/wc-aplazame-gateway.php:277
179+
#: classes/wc-aplazame-gateway.php:284
168180
msgid "CSS selector pointing to variable product price"
169181
msgstr ""
170182

171-
#: classes/wc-aplazame-gateway.php:285
183+
#: classes/wc-aplazame-gateway.php:292
172184
msgid "Cart widget"
173185
msgstr ""
174186

175-
#: classes/wc-aplazame-gateway.php:292
187+
#: classes/wc-aplazame-gateway.php:299
176188
msgid "Widget place on cart page"
177189
msgstr ""
178190

179-
#: classes/wc-aplazame-gateway.php:295
191+
#: classes/wc-aplazame-gateway.php:302
180192
msgid "Before cart totals"
181193
msgstr ""
182194

183-
#: classes/wc-aplazame-gateway.php:296
195+
#: classes/wc-aplazame-gateway.php:303
184196
msgid "After cart totals"
185197
msgstr ""
186198

187-
#: classes/wc-aplazame-gateway.php:303
199+
#: classes/wc-aplazame-gateway.php:311
200+
msgid "Number of default instalments in cart widget"
201+
msgstr ""
202+
203+
#: classes/wc-aplazame-gateway.php:317
188204
msgid "Show legal notice in cart widget"
189205
msgstr ""
190206

191-
#: classes/wc-aplazame-gateway.php:307
207+
#: classes/wc-aplazame-gateway.php:321
192208
msgid "Button"
193209
msgstr ""
194210

195-
#: classes/wc-aplazame-gateway.php:313
211+
#: classes/wc-aplazame-gateway.php:327
196212
msgid "Button Selector"
197213
msgstr ""
198214

199-
#: classes/wc-aplazame-gateway.php:314
215+
#: classes/wc-aplazame-gateway.php:328
200216
msgid "Aplazame Button CSS Selector"
201217
msgstr ""
202218

203-
#: classes/wc-aplazame-gateway.php:322
219+
#: classes/wc-aplazame-gateway.php:336
204220
msgid "Button Image"
205221
msgstr ""
206222

207-
#: classes/wc-aplazame-gateway.php:323
223+
#: classes/wc-aplazame-gateway.php:337
208224
msgid "Aplazame Button Image that you want to show"
209225
msgstr ""
210226

plugin/templates/widgets/cart.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@
1717
data-view="cart"
1818
data-amount="<?php echo esc_attr( Aplazame_Sdk_Serializer_Decimal::fromFloat( WC()->cart->total )->jsonSerialize() ); ?>"
1919
data-currency="<?php echo esc_attr( get_woocommerce_currency() ); ?>"
20+
<?php if ( ! empty( $aplazame->settings['cart_default_instalments'] ) ) : ?>
21+
data-option-default-instalments="<?php echo esc_attr( $aplazame->settings['cart_default_instalments'] ); ?>"
22+
<?php endif; ?>
2023
data-option-legal-advice="<?php echo esc_attr( $aplazame->settings['cart_legal_advice'] === 'yes' ? 'true' : 'false' ); ?>">
2124
</div>

plugin/templates/widgets/product.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,8 @@
4545
<?php endif; ?>
4646
data-currency="<?php echo esc_attr( get_woocommerce_currency() ); ?>"
4747
data-article-id="<?php echo esc_attr( $product->get_id() ); ?>"
48+
<?php if ( ! empty( $aplazame->settings['product_default_instalments'] ) ) : ?>
49+
data-option-default-instalments="<?php echo esc_attr( $aplazame->settings['product_default_instalments'] ); ?>"
50+
<?php endif; ?>
4851
data-option-legal-advice="<?php echo esc_attr( $aplazame->settings['product_legal_advice'] === 'yes' ? 'true' : 'false' ); ?>">
4952
</div>

0 commit comments

Comments
 (0)