Post by yorgil » Sat Mar 19, 2016 12:08 am

Hello,

It is my first post so please forgive me if this question is trivial...
I use OpenCart 2.1.0.2 hosted on Siteground

In Poland we have standard calendars with Sunday as last day of week instead of first. But in my OC shop (even i have set it to polish) my calendar has Sunday as first day of week and it is in english (not translated). I cant find any texts in language directory files to make a translation. But more important issue is with days of week. How can i change week format to make Monday first day and Sunday 7th?

Regards
Przemek

Newbie

Posts

Joined
Sat Mar 19, 2016 12:00 am

User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by yorgil » Sun Mar 20, 2016 10:36 pm

Thank you, but this is post about different datapicker - by eternicode.
I have installation of Opencart 2.1.0.2 where is datapicker eonasdan version 3.1.3
https://github.com/Eonasdan/bootstrap-datetimepicker
It doesnt support weekStart option.

It seems i can use code like this:

Code: Select all

$('#DateTime').datetimepicker({
        language: "pl"
    });
But i have no idea where I have to add this option - there are many file where .datetimepicker({ exists.
I tried also to change moment.js file and set there:

Code: Select all

_week : {
            dow : 1, 
            doy : 6  
        },
but id doesnt work too.

Also here is discussion that with this datpicker is very hard or imposible to change week format:
http://stackoverflow.com/questions/2441 ... -at-monday

Is there any chance to switch to another datapicker? And if you be so kind, how can i do it?

Newbie

Posts

Joined
Sat Mar 19, 2016 12:00 am

Post by ocart777 » Sun Mar 20, 2016 11:55 pm

well im not sure if this will cause any error, but this do the trick for me. if you want to take the risk simply follow this steps.

admin/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js

search for

Code: Select all

if (moment().localeData()._week.dow === 0) {
change to

Code: Select all

if (moment().localeData()._week.dow === 1) {
catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js

search for

Code: Select all

0===b().localeData()._week.dow)
replace with

Code: Select all

1===b().localeData()._week.dow)

You can't control the weather, but you can change your mood.
You can't modify the visage, but you can show your smile.
You can't command someone else, but you can hold yourself.
You can't forecast tomorrow, but you can using today.
You can't obtain thanks, but you can exert yourself in everything.


OCEXTENSION.COM - YOUR PROFESSIONAL OPENCART EXTENSION STORE


User avatar
Active Member

Posts

Joined
Mon Jun 10, 2013 4:57 pm
Location - Malaysia

Post by yorgil » Mon Mar 21, 2016 12:18 am

It not exactly what I awant to achieve. Those modifications change daysnames at top of calendar but entire calendar stays as it was before - so daynames dont correspond with proper dates.

I think there is necessity to change language/local of that datapicker. Even when i change week format i still need translated whole calendar.

Newbie

Posts

Joined
Sat Mar 19, 2016 12:00 am

Post by ocart777 » Mon Mar 21, 2016 12:36 am

ok, i've found the solution for this after reading their docs file. all you need is pick your locale from https://github.com/moment/moment/tree/develop/locale and save the (.js) file into your "admin/view/javascript/jquery/datetimepicker/" directory. as example my locale file name is "ms-my.js", so..

admin/view/template/common/header.tpl
after

Code: Select all

<script src="view/javascript/jquery/datetimepicker/moment.js" type="text/javascript">
add

Code: Select all

<script src="view/javascript/jquery/datetimepicker/ms-my.js" type="text/javascript"></script>
<script type="text/javascript"><!--
moment.locale('ms-my');
//--></script>
please note that you also need to do this for catalog(front end)

You can't control the weather, but you can change your mood.
You can't modify the visage, but you can show your smile.
You can't command someone else, but you can hold yourself.
You can't forecast tomorrow, but you can using today.
You can't obtain thanks, but you can exert yourself in everything.


OCEXTENSION.COM - YOUR PROFESSIONAL OPENCART EXTENSION STORE


User avatar
Active Member

Posts

Joined
Mon Jun 10, 2013 4:57 pm
Location - Malaysia

Post by yorgil » Mon Mar 21, 2016 1:40 am

Please forgive me but im not sure what i have to do.

I uploaded pl.js file

I cant find

Code: Select all

<script src="view/javascript/jquery/datetimepicker/moment.js" type="text/javascript">
in catalog/view/theme/default/template/common/header.tpl

And in admin - why there are those comments? And should not there be

Code: Select all

</script>
tag at the end of line after which i have to add rest of your code?

Newbie

Posts

Joined
Sat Mar 19, 2016 12:00 am

Post by ocart777 » Mon Mar 21, 2016 2:18 am

in catalog header.tpl, you can add before "<?php foreach ($analytics as $analytic) { ?>", it isn't showing directly but you still can see them by viewing page source. just make sure that you pointing to the pl.js correctly

You can't control the weather, but you can change your mood.
You can't modify the visage, but you can show your smile.
You can't command someone else, but you can hold yourself.
You can't forecast tomorrow, but you can using today.
You can't obtain thanks, but you can exert yourself in everything.


OCEXTENSION.COM - YOUR PROFESSIONAL OPENCART EXTENSION STORE


User avatar
Active Member

Posts

Joined
Mon Jun 10, 2013 4:57 pm
Location - Malaysia

Post by yorgil » Mon Mar 21, 2016 6:13 pm

I dont know what is wrong wuth me... I cant make it working...

I uploaded file pl.js to
/admin/view/javascript/jquery/datetimepicker
and to
/catalog/view/javascript/jquery/datetimepicker

Then as suggested i edited file /admin/view/template/common/header.tpl
After line

Code: Select all

<script type="text/javascript" src="view/javascript/summernote/summernote.js"></script>
i have now

Code: Select all

<script src="view/javascript/jquery/datetimepicker/moment.js" type="text/javascript">
<script src="view/javascript/jquery/datetimepicker/pl.js" type="text/javascript"></script>
<script type="text/javascript"><!--moment.locale('pl');//--></script>
</script>
<script src="view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
<link href="view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css" type="text/css" rel="stylesheet" media="screen" />
Then i edited file /catalog/view/theme/default/template/common/header.tpl
Before line

Code: Select all

<?php foreach ($analytics as $analytic) { ?>
I have now

Code: Select all

<script src="view/javascript/jquery/datetimepicker/pl.js" type="text/javascript"></script>
<script type="text/javascript"><!--moment.locale('pl');//--></script>
I wonder what for are those comments there. After whole weekend with this im resigned... And it still doesnt work.

Newbie

Posts

Joined
Sat Mar 19, 2016 12:00 am

Post by yorgil » Mon Mar 21, 2016 9:12 pm

OK, i tried to rework all modifications again and i have partial success.

In admin/view/template/common/header.tpl i just added:

Code: Select all

<script src="view/javascript/jquery/datetimepicker/moment.js" type="text/javascript"></script>
<script src="view/javascript/jquery/datetimepicker/pl.js" type="text/javascript"></script>
<script>moment.locale('pl');</script>
and in admin it works! - I have polish calendars with monday as first day

Unfortunatelly in front it doesnt work - and i have no idea why...
I added in catalog/view/theme/default/template/common/header.tpl

Code: Select all

<script>moment.locale('pl');</script>
Line with moment.js is added there earlier bye script in header.tpl.

Looks very similar to admin part - in source links are correct. But it still doesnt work.

Newbie

Posts

Joined
Sat Mar 19, 2016 12:00 am
Who is online

Users browsing this forum: No registered users and 10 guests