Reply
 
Thread Tools Display Modes
  #1  
Old 08-08-2018, 01:35 AM
Demi Hou's Avatar
Demi Hou is offline
 
Join Date: Jun 2015
Posts: 18
Default

"Next-gen look and feel of product pages on the storefront" breaks "$('.ecwid-" javascript


If turn on feature Next-gen look and feel of product pages on the storefront,
my javascript (partial shown below) breaks.
I'm guessing the .ecwid syntax has changed. anyone know how to fix?

Ecwid.OnPageLoaded.add(function(page) {

/// MGM/hotel override deliver instructions
if (page.type == "CHECKOUT_PAYMENT_DETAILS") {
document.querySelector(".ecwid-PaymentCommentsBlock .ecwid-Checkout-blockTitle").innerHTML = "Enter optional notes regarding the order. Deliveries start at 10:30am. Orders placed after 10am for same-day will go out starting 4-5pm. For special delivery times, please contact us at 702-423-8590.";
}

// This script used by product Options for custom date picker. it is implemented by defining a Text box name 'Delivery Date'
// for each product you want to support.
// Code should go into header of MGM landing page


// lock in 'Message for Gift Card' to 150 chars
$('.ecwid-productoption-Message_for_gift_card').prop('maxLength','150');

// setup for before 5pm order time
var todayBefore
var dt = new Date();
var time = dt.getHours();
if(time < 17) {
todayBefore = 0
} else {
todayBefore = 1
}

// If MGM (starts with M and has 3 letters before -), must order before 5pm
if (page.type == "PRODUCT" && (SKU.charAt( 0 ) == "M" && SKU.charAt( 3 ) == "-") && !((SKU == "MGW-0004") || (SKU == "MFF-0011") || (SKU == "MGO-0020"))) {
function datepicker() {
$('.ecwid-productoption-Delivery_Date').prop('readOnly', true);
$(".ecwid-productoption-Delivery_Date").datepicker({
showOn: "button",
buttonImage: "http://demisgiftbaskets.com/docs/Calendar.png",
buttonImageOnly: true,
// before 5pm
minDate: todayBefore,
buttonText: "Select MGM delivery date: " + SKU,
firstDay: 1,
beforeShowDay: $.datepicker.Weekends
});
};
datepicker();
}
Reply With Quote
  #2  
Old 08-13-2018, 07:34 AM
Rina S's Avatar
Rina S Rina S is online now
Ecwid Team
 
Join Date: Dec 2017
Posts: 39
Default

Quote:
Originally Posted by Demi Hou View Post
If turn on feature Next-gen look and feel of product pages on the storefront,
my javascript (partial shown below) breaks.
I'm guessing the .ecwid syntax has changed. anyone know how to fix?

Ecwid.OnPageLoaded.add(function(page) {

/// MGM/hotel override deliver instructions
if (page.type == "CHECKOUT_PAYMENT_DETAILS") {
document.querySelector(".ecwid-PaymentCommentsBlock .ecwid-Checkout-blockTitle").innerHTML = "Enter optional notes regarding the order. Deliveries start at 10:30am. Orders placed after 10am for same-day will go out starting 4-5pm. For special delivery times, please contact us at 702-423-8590.";
}

// This script used by product Options for custom date picker. it is implemented by defining a Text box name 'Delivery Date'
// for each product you want to support.
// Code should go into header of MGM landing page


// lock in 'Message for Gift Card' to 150 chars
$('.ecwid-productoption-Message_for_gift_card').prop('maxLength','150');

// setup for before 5pm order time
var todayBefore
var dt = new Date();
var time = dt.getHours();
if(time < 17) {
todayBefore = 0
} else {
todayBefore = 1
}

// If MGM (starts with M and has 3 letters before -), must order before 5pm
if (page.type == "PRODUCT" && (SKU.charAt( 0 ) == "M" && SKU.charAt( 3 ) == "-") && !((SKU == "MGW-0004") || (SKU == "MFF-0011") || (SKU == "MGO-0020"))) {
function datepicker() {
$('.ecwid-productoption-Delivery_Date').prop('readOnly', true);
$(".ecwid-productoption-Delivery_Date").datepicker({
showOn: "button",
buttonImage: "http://demisgiftbaskets.com/docs/Calendar.png",
buttonImageOnly: true,
// before 5pm
minDate: todayBefore,
buttonText: "Select MGM delivery date: " + SKU,
firstDay: 1,
beforeShowDay: $.datepicker.Weekends
});
};
datepicker();
}

Hello!

This is Rina from Ecwid Customer Care team. Thank you for your message!

Yes, you are right. Our new "Next-gen look and feel of product pages on the storefront" feature has different syntax. So your JS code does not work when you enable it.

You should adapt this JS code for your rules which will work with the new design of the product page.

Normally, we do not support JS scripts. You can do it yourself or hire someone. For example, our Customization team can adjust the codes for you on a paid basis. Submit a request here: https://ecwidcom.typeform.com/to/vIlijv and they will email you a quote. Or you can let me know that you need the codes adjustment, I'll escalate your request to the customization team directly.

Hope this helps!
__________________
Rina S
Ecwid Customer Care Team

More tips and hints on Ecwid use in our Help Center

⬇ Please click Thanks if my reply helped you.
Reply With Quote
  #3  
Old 08-13-2018, 11:09 AM
Demi Hou's Avatar
Demi Hou Demi Hou is offline
 
Join Date: Jun 2015
Posts: 18
Default

Can you please then point me to a resource that documents what ecwid syntax changes were made?
Especially as you didn't maintain any backward compatibility.
Yes, I am a paid member.
Reply With Quote
  #4  
Old 08-22-2018, 05:40 PM
Anastasia E's Avatar
Anastasia E Anastasia E is offline
Ecwid Team
 
Join Date: Nov 2017
Posts: 41
Default

Quote:
Originally Posted by Demi Hou View Post
Can you please then point me to a resource that documents what ecwid syntax changes were made?
Especially as you didn't maintain any backward compatibility.
Yes, I am a paid member.
Hi Demi,

Our customization team informed me that this question was already resolved.

If any further questions appear - let us know. Thank you!

Best regards,
Anastasia E.
Ecwid Support Team
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:22 AM.
Powered by vBulletin® Version 3.8.11. Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.