Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Calendar - Datepicker

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 03-22-2017, 04:59 PM
  kvatchinsky's Avatar 
kvatchinsky kvatchinsky is offline
 

Newbie
  
Join Date: Nov 2016
Posts: 7
 

Default Calendar - Datepicker

Hi, is there anyone who use x-cart 5.x.x, that could help us find working datepicker - calendar for product attribute or could give us some idea how to add this customization. The goal is to be able to add local attribute calendar as next option after text, filed and yes/no select, the calendar display should be only for the front side, the admin side should get the selected date as regular text input, so it could be combination of existing text filed for admin side and showing .js datepiker for front end
__________________
X-Cart Free 5.3.2.9
Braintree payment gateway 5.3.2.1
MailChimp Integration with Ecommerce-360 support 5.3.2.3
Reply With Quote
  #2  
Old 03-30-2017, 01:34 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Calendar - Datepicker

As far as I know there is a built-in datepicker field (\XLite\View\FormField\Input\Text\Date). However, I'm not sure if it can be easily used to replace the input field for a particular attribute.
Perhaps, it will be easier to add a custom product field and display it along with regular attributes in the storefront.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #3  
Old 04-04-2017, 11:06 AM
  kvatchinsky's Avatar 
kvatchinsky kvatchinsky is offline
 

Newbie
  
Join Date: Nov 2016
Posts: 7
 

Default Re: Calendar - Datepicker

OK, thanks for that, is there any option to use that existing date picker so on the front end the customer see date picker to select date, however all the selected information is transfer to the admin side as text input, which actually is, if you use js date picker this is how is set in a first place is just form of presentation, instead the customer to type the date, they selected it from calendar and on the back end is displayed as text entry MM/DD/YYYY
__________________
X-Cart Free 5.3.2.9
Braintree payment gateway 5.3.2.1
MailChimp Integration with Ecommerce-360 support 5.3.2.3
Reply With Quote
  #4  
Old 04-04-2017, 11:27 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Calendar - Datepicker

I'm not sure 100%. I believe the built-in date picker sends the date to the server either in a text form, or as a unix timestamp number.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #5  
Old 04-05-2017, 03:07 AM
  kvatchinsky's Avatar 
kvatchinsky kvatchinsky is offline
 

Newbie
  
Join Date: Nov 2016
Posts: 7
 

Default Re: Calendar - Datepicker

here is the js i did and load fine, I tried to add as custom JS section of the X-Cart 5, in this particular js date piker, the calendar is just form of display for actual text entry, all data input is processed and transferred to the server as text input, so should work, the issue i have is that I'm getting error from x-cart 5 that the link / script.src = / the javascript source file should be allowed in the X-Cart settings file / authorized. I dont have idea how to do that without getting errors after every next new update.

The attribute ID=93 is the existing text filed attribute ID and using javascript DOM we can replace the current front end display with the javascript date picker, the data input is text by nature so it will be pass and displayed by the server in back side as is done now

Code:
var script = document.createElement('script'); script.src = "https://cdnjs.cloudflare.com/ajax/libs/pickadate.js/3.5.6/compressed/picker.js"; script.onload = function () { $(document).ready(function () { $('textarea[data-attribute-id="93"]').datepicker(); }); console.log("script loaded") }; document.head.appendChild(script);

Do you have any idea if that can be make to work?

Thanks !!
__________________
X-Cart Free 5.3.2.9
Braintree payment gateway 5.3.2.1
MailChimp Integration with Ecommerce-360 support 5.3.2.3
Reply With Quote
  #6  
Old 04-05-2017, 10:16 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Calendar - Datepicker

Can you share the full text of the error message that X-Cart displays?

Do you mean this one?
Quote:
Warning: The form could not be identified as a form generated by X-Cart. The reason may be that a substantial period of time has elapsed since you opened the page with this form or the page was opened in more than one browser tab. If you did not open the page with this form, you might be under a CSRF attack.

If so, you should either disable the protection for your action, or build the URL from your PHP code and pass it to your JavaScript function like this.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
kvatchinsky (04-06-2017)
  #7  
Old 04-06-2017, 04:42 AM
  kvatchinsky's Avatar 
kvatchinsky kvatchinsky is offline
 

Newbie
  
Join Date: Nov 2016
Posts: 7
 

Default Re: Calendar - Datepicker

Thanks that should help!
__________________
X-Cart Free 5.3.2.9
Braintree payment gateway 5.3.2.1
MailChimp Integration with Ecommerce-360 support 5.3.2.3
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:39 AM.

   

 
X-Cart forums © 2001-2020