Thanks for the help!
]]>First of all, thank you for great plugin – I’ve been using it for years. Really appreciate your work & effort.
Now to the issue – I have fresh WordPress + WooCommerce site that’s using Savoy theme. Language is set to Latvian lv
. I set up it’s child theme and I translated only parent theme, but translation strings didn’t show up. Same happens with WooCommerce.
I inspected one string “Load More” within themes includes files, and it is defined like so esc_html_e( 'Load More', 'nm-framework' )
. I checked parent theme configuration within Loco Translate and it is as follows:
– Domain name nm-framework
– POT file languages/savoy.pot
– Domain path languages
I double checked, domain is being loaded in functions.php
and file indeed exists.
Now, what catched my eye, was that the nm-framework-lv.po
file’s header didn’t contain transation function, so I edited POT file with POEdit and added the function. I tried updating POT file and recreating language file, translated the string, but with no luck yet again.
Btw, here is example of .po
files header:
"Plural-Forms: nplurals=3; plural=n%10==0||( n%100 >= 11 && n%100<=19)? 0 :"
"(n%10==1 && n%100!=11 ? 1 : 2);\n"
"Project-Id-Version: Savoy Theme\n"
"POT-Creation-Date: 2019-09-25 19:22+0200\n"
"PO-Revision-Date: 2022-11-04 07:10+0000\n"
"Last-Translator: \n"
"Language-Team: Latvie?u valoda\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Loco https://localise.biz/\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
"X-Poedit-WPHeader: style.css\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.js\n"
"X-Poedit-SearchPathExcluded-1: includes/theme-plugins\n"
"X-Poedit-SearchPathExcluded-2: includes/tgmpa\n"
"X-Poedit-SearchPathExcluded-3: includes/options\n"
"X-Poedit-SearchPathExcluded-4: includes/setup\n"
"X-Poedit-SearchPathExcluded-5: includes/visual-composer/elements\n"
"X-Poedit-SearchPathExcluded-6: includes/visual-composer/params\n"
"X-Poedit-SearchPathExcluded-7: includes/woocommerce/admin\n"
"X-Poedit-SearchPathExcluded-8: includes/woocommerce/widgets\n"
"X-Poedit-SearchPathExcluded-9: includes/visual-composer/elements-config.php\n"
"X-Poedit-SearchPathExcluded-10: includes/visual-composer/init.php\n"
"X-Poedit-SearchPathExcluded-11: woocommerce\n"
"X-Poedit-SearchPathExcluded-12: includes/visual-"
"composer/deprecated/elements\n"
"X-Poedit-SearchPathExcluded-13: includes/woocommerce/deprecated\n"
"X-Poedit-SearchPathExcluded-14: includes/woocommerce/search-suggestions.php\n"
"X-Poedit-SearchPathExcluded-15: includes/admin-meta.php\n"
"Report-Msgid-Bugs-To: \n"
"Language: lv\n"
"X-Loco-Version: 2.6.3; wp-6.1"
Finally, I deleted translation file and POT file and recreated one with Loco translate. And again, no translated strings show up.. for both theme and WooCommerce, however I have to point out – previously defined translations for WooCommerce DO work. Things just don’t propagate/update.
My last try was disabling caching plugin and reloading page on incognito, but the issue was still there.
Am I missing something? I followed thoughtfully your documentation and did everything “by the book”.
]]>I have been trying to add product variations to a certain product on the single product page underneath the description. Of what i see it should be an easy task, I followed a couple of guides to set this up but every time the result is not what i’m looking for.
I want the variations to be shown as a simple dropdown menu where u can choose the size of clothing u want. The result at the moment is that for every variation a radio button is produced with an image and the price right next to it. I also found it weird that it says ”Choose pricing option” instead of choose size. Is there a way that so that it displays as a simple dropdown menu, or as buttons via the ‘swatches’ plugin for example.
Thank you in advance!
]]>It does not matter what I try to get the plugin version of the reviews displayed on the product page, I can’t. I tried the procedure in the FAQ’s of the plugin and everything on this page: https://help.cusrev.com/support/solutions/articles/43000033867-reviews-not-showing-on-product-page , but it didn’t help.
I am using the savoy Theme.
Greetings,
JaffaCake
who has faced such a problem? what are the options for translating these files in a child theme?
Thanks!
screen: https://joxi.ru/1A5OwOEtGQPPwm
]]>Can you help me to get the plugin working with the Savoy-theme? I have tried to disable the Savoy-theme and the plug-in is working great when the theme is disabled.
Best,
]]>First of all, thanks for your work in this great plugin!
After some debugging, I have detected that there’s an incompatibility with Savoy theme.
Specifically, the problem is in the “add to cart” button. Savoy forbids its associated events from launching.
I have detected that the problem is at nm-shop-add-to-cart.min.js at Savoy, as if I comment all the code, your plugin works correctly. Expanded contents of the file at the bottom of this post.
I have checked that your plugin works with a vanilla woocommerce installation but doesn’t work in any circumstance when Savoy is active, even deactivating all other plugins. I have written to the author of the theme but I have yet to get a reply.
Do you know if I could edit a specific part of the file or a hint of what to check to let gtm4wp work?
Thanks!
Marc
(function($) {
'use strict';
// Extend core script
$.extend($.nmTheme, {
/**
* Initialize scripts
*/
atc_init: function() {
var self = this;
self.atcBind();
},
/**
* Bind
*/
atcBind: function() {
var self = this;
// Bind: Single product "add to cart" buttons
self.$body.on('click', '.single_add_to_cart_button', function(e) {
var $thisButton = $(this);
// Make sure the add-to-cart button isn't disabled
if ( $thisButton.is('.disabled') ) { console.log('NM: Add-to-cart button disabled'); return; }
// Only allow simple and variable product types
if ($thisButton.hasClass('nm-simple-add-to-cart-button') || $thisButton.hasClass('nm-variable-add-to-cart-button')) {
e.preventDefault();
// Is the quick view open?
self.quickviewOpen = self.quickviewIsOpen();
if (self.quickviewOpen) {
$thisButton.addClass('nm-loader nm-loader-light'); // Add preloader to quick view button
}
// Set button disabled state
$thisButton.attr('disabled', 'disabled');
var $productForm = $thisButton.closest('form');
if (!$productForm.length) {
return;
}
var data = {
product_id: $productForm.find("[name*='add-to-cart']").val(),
product_variation_data: $productForm.serialize()
};
// Trigger "adding_to_cart" event
self.$body.trigger('adding_to_cart', [$thisButton, data]);
// Submit product form via Ajax
self.atcAjaxSubmitForm($thisButton, data);
}
});
},
/**
* Submit product form via Ajax
*/
atcAjaxSubmitForm: function($thisButton, data) {
var self = this;
if (!data.product_id) {
console.log('NM (Error): No product id found');
return;
}
// Use WooCommerce AJAX endpoint URL
if (typeof wc_add_to_cart_params !== 'undefined') {
var ajaxUrl = wc_add_to_cart_params.wc_ajax_url;
} else {
console.log('NM: "wc_add_to_cart_params" undefined - WooCommerce AJAX atc disabled');
var ajaxUrl = nm_wp_vars.woocommerceAjaxUrl;
}
ajaxUrl = ajaxUrl.toString().replace('wc-ajax=%%endpoint%%', 'add-to-cart=' + data.product_id + '&nm-ajax-add-to-cart=1');
// Submit product form via Ajax
$.ajax({
type: 'POST',
url: ajaxUrl,
data: data.product_variation_data,
dataType: 'html',
cache: false,
headers: {'cache-control': 'no-cache'},
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log('NM: AJAX error - atcAjaxSubmitForm() - ' + errorThrown);
},
success: function(response) {
var $response = $('<div>' + response + '</div>'), // Wrap the returned HTML string so we can get the replacement elements
$shopNotices = $response.find('#nm-shop-notices-wrap'), // Shop notices
hasError = ($shopNotices.find('.woocommerce-error').length) ? true : false, // Is there an error notice?
cartHash = ''; // Note: Add the cart-hash to an element (data attribute) in the redirect template?
// Get replacement elements/values
// Note: Using ".prop('outerHTML')" to convert the jQuery objects/elements into strings (since they are passed to the "added_to_cart" event below)
var fragments = {
'.nm-menu-cart-count': $response.find('.nm-menu-cart-count').prop('outerHTML'), // Header menu cart count
'#nm-shop-notices-wrap': $shopNotices.prop('outerHTML'),
'#nm-cart-panel': $response.find('#nm-cart-panel').prop('outerHTML') // Cart panel
};
// Replace cart/shop fragments
self.shopReplaceFragments(fragments);
// Trigger "added_to_cart" event
// Note: The "fragments" object is passed to make sure the various shop/cart fragments are updated
self.$body.trigger('added_to_cart', [fragments, cartHash]);
if (self.quickviewOpen) {
// Close quickview modal
$.magnificPopup.close();
if (hasError) {
if (self.isShop) {
// Smooth-scroll to shop-top
self.shopScrollToTop();
}
} else {
// Is widget/cart panel enabled?
if (self.$widgetPanel.length) {
// Only show widget/cart panel if no error notice is returned
setTimeout(function() {
self.widgetPanelShow(false, true); // Args: showLoader, addingToCart
}, 350);
}
}
} else {
// Remove button disabled state
$thisButton.removeAttr('disabled');
if (hasError) {
setTimeout(function() {
// Hide cart panel and overlay
$('#nm-widget-panel-overlay').trigger('click');
if (self.isShop) {
// Smooth-scroll to shop-top
self.shopScrollToTop();
}
}, 500);
}
}
$response.empty();
}
});
}
});
// Add extension so it can be called from $.nmThemeExtensions
$.nmThemeExtensions.add_to_cart = $.nmTheme.atc_init;
})(jQuery);
]]>