Skip to content

Commit

Permalink
Bugfix: Product-to-variant conversion not working
Browse files Browse the repository at this point in the history
- Fixed a regression whereas the product-to-variant conversion did not appear or work
- Adding locale string and i18n support
  • Loading branch information
aldavigdis committed Aug 5, 2024
1 parent 3b2d2c4 commit a2452dd
Show file tree
Hide file tree
Showing 9 changed files with 275 additions and 271 deletions.
13 changes: 3 additions & 10 deletions js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class NineteenEightyWoo {
make_credit_invoice: Boolean( formData.get( 'make_credit_invoice' ) ),
domestic_customer_ledger_code: formData.get( 'domestic_customer_ledger_code' ),
international_customer_ledger_code: formData.get( 'international_customer_ledger_code' ),
product_convertion_to_variation_enabled: Boolean( formData.get( 'product_conversion' ) ),
fetch_products: true
}

Expand Down Expand Up @@ -128,22 +129,14 @@ window.addEventListener(
'DOMContentLoaded',
() => {
if (document.body) {
if (
document.body.classList.contains(
'woocommerce_page_1984-dk-woo'
)
) {
if ( NineteenEightyWoo.settingsForm() ) {
NineteenEightyWoo.settingsForm().addEventListener(
'submit',
NineteenEightyWoo.onSettingsFormSubmit
);
}

if (
document.body.classList.contains(
'post-type-product'
)
) {
if ( NineteenEightyWoo.settingsForm() ) {
NineteenEightyWoo.settingsForm().addEventListener(
'submit',
NineteenEightyWoo.onSettingsFormSubmit
Expand Down
18 changes: 11 additions & 7 deletions js/products.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { __, _x, _n, _nx } = wp.i18n;

class NineteenEightyWooProducts {
static actionSelect() {
return document.getElementById( 'bulk-action-selector-top' );
Expand All @@ -12,7 +14,7 @@ class NineteenEightyWooProducts {
productIdInput.setAttribute( 'type', 'text' );
productIdInput.setAttribute( 'name', 'action_post_id' );
productIdInput.setAttribute( 'id', 'action_post_id_input' );
productIdInput.setAttribute( 'placeholder', 'Parent ID' );
productIdInput.setAttribute( 'placeholder', __( 'Parent ID', '1984-dk-woo' ) );

actionsContainer.insertBefore( productIdInput, actionButton );
actionsContainer.insertBefore( spacerTextNode, actionButton );
Expand All @@ -38,11 +40,13 @@ class NineteenEightyWooProducts {
window.addEventListener(
'DOMContentLoaded',
() => {
NineteenEightyWooProducts.actionSelect().addEventListener(
'change',
( e ) => {
NineteenEightyWooProducts.selectMenuEvent( e );
}
);
if ( NineteenEightyWooProducts.actionSelect() ) {
NineteenEightyWooProducts.actionSelect().addEventListener(
'change',
( e ) => {
NineteenEightyWooProducts.selectMenuEvent( e );
}
);
}
}
);
18 changes: 18 additions & 0 deletions languages/1984-dk-woo-is_IS-5084815748766cbac9c011a6556f8683.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"translation-revision-date": "2024-08-05 15:41+0000",
"generator": "Loco https://localise.biz/",
"source": "js/products.js",
"domain": "1984-dk-woo",
"locale_data": {
"1984-dk-woo": {
"": {
"domain": "",
"lang": "is_IS",
"plural-forms": "nplurals=2; plural=n != 1;"
},
"Parent ID": [
"ID-n\u00famer m\u00f3\u00f0ur"
]
}
}
}
3 changes: 2 additions & 1 deletion languages/1984-dk-woo-is_IS.l10n.php

Large diffs are not rendered by default.

Binary file modified languages/1984-dk-woo-is_IS.mo
Binary file not shown.
Loading

0 comments on commit a2452dd

Please sign in to comment.