- Posts: 145
- Thank you received: 6
discount not work in Persian language
Calendar does not work at a discount in Persian language. And because of this, discounts do not apply over time.
Must be English for proper operation.
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Please Log in or Create an account to join the conversation.
As we don't read persian and don't now how a date in persian can be read and what we should expect, could you please provide details with screenshots to explains the steps, what to expect, what you get and why it's false ?
Please Log in or Create an account to join the conversation.
attach file
perfumesmart.ir/vid/cal.mp4
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Please Log in or Create an account to join the conversation.
Ok, so watching your video and checking online, I understand that
09:30 1400 Mordad 02 displayed on the discounts listing corresponds to 2021-07-24 09:30
en.wikipedia.org/wiki/Solar_Hijri_calendar
www.languagesandnumbers.com/how-to-count-in-persian/en/fas/
Also, it seems that when you select a date in the calendar while the language is in Persian, the date displays fine with 09:30 1400 Mordad 02 and 09:30 1400 Mordad 18.
However, the moment you press on the save button, it seems that some javascript of the calendar system transforms the date to 06:00 2021 Ordibehesht 30 and 06:00 2021 Tir 10 before the discount settings are actually sent to the server and saved, which then discard the dates as they are incorrect for the Hijri calendar.
Do you confirm all of this or did I do some mistake somewhere ?
I did some research on the issue for now and here is what I can say:
- In HikaShop, we use the Joomla calendar system to display calendars everywhere in the backend. We use the same code everywhere else. You're reporting the issue for the calendar selector for discounts, but I'm surprised you don't say that you have the same issue for other date selectors everywhere else in HikaShop (like on the orders listing's filter options area, or the product sale dates option, etc). Do you have similar issues there, or it's really only in the discount calendar selector ?
- Since the calendar system comes from Joomla, and we don't have any javascript that would convert the date like that when the saving occurs, I suspect that the issue is inside the calendar system of Joomla. But maybe it could also be because of the way we initialize it. For example, maybe the issue is that you need to change the translation keys of HikaShop:
HIKASHOP_DATE_FORMAT="%Y-%m-%d"
HIKASHOP_EXTENDED_DATE_FORMAT="%Y-%m-%d %H:%M"
In order to match with the format you have in Joomla's persian language ? I can see that in the fa-IR language file we use the default date format of English %Y-%m-%d %H:%M, so maybe that's why it's causing the problem, and the format there should be fixed ?
- Also, do you have a similar issue with Joomla pages ? (like on the Joomla article edit form for published date)
- I found several pages online mentionning that with Joomla 3.7, the calendar system was heavily modified to support the Hijri calendar in Persian:
issues.joomla.org/tracker/joomla-cms/16590
issues.joomla.org/tracker/joomla-cms/14411
Which version of Joomla are you using exactly ?
Please Log in or Create an account to join the conversation.
when save discount in Persian language, the date not store in database.Do you confirm all of this or did I do some mistake somewhere ?
On the other hand, in Joomla, the date is stored in the database in Georgian calendar, regardless of the language of the administration, and Joomla returns it to the language of that country according to the language of the site and by a JHtml::_('date', $date, $format) . In Hikashop, date is stored as numbers.
I don't test other date selectors in Hikashop. I see this issues in discount and coupon. I think in other parts there is a problem of saving date in the database when the admin language is Persian.Do you have similar issues there, or it's really only in the discount calendar selector ?
Joomla calendar work well. For example, in the Content component and other built-in joomla extention, it correctly converts the date to solar calendar. I use latest joomla version.Since the calendar system comes from Joomla, and we don't have any javascript that would convert the date like that when the saving occurs, I suspect that the issue is inside the calendar system of Joomla. But maybe it could also be because of the way we initialize it. For example, maybe the issue is that you need to change the translation keys of HikaShop:
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Please Log in or Create an account to join the conversation.
Yes, that's what I meant when I saidwhen save discount in Persian language, the date not store in database.
which then discard the dates as they are incorrect for the Hijri calendar
So I did some tests on my end and when I use the Persian language and create a new discount with a start and end date and save it once, the date is properly stored in the database. And the value stored correspond to the correct date. The numbers you see there correspond to the unix timestamp: www.unixtimestamp.com/
The problem appears on my end when I open again the discount. Then, the calendar date is wrong.
The date 1400-05-03 01:03 becomes ۷۸۱-۰۱-۰-۶۸۶ ۰۱:۰۳
And In think that it's because the date 1400-05-03 01:03 is already converted to the Persian calendar before it is sent to the Joomla calendar system, which then converts it again and thus you get a double conversion. But I'm not sure how to read the date ۷۸۱-۰۱-۰-۶۸۶ ۰۱:۰۳ so I'm not sure if my theory is correct.
If so, it means that we need to handle the date differently when sending it to Joomla calendar's system as we don't want to convert it in the current language calendar.
I've tried replacing the code:
This basically does the same thing, but avoids that the language file overrides the date conversion and thus the date is not converted anymore to the Hijri calendar before being sent to the calendar system of Joomla.
This seems to fix the problem on my end. Cna you confirm on your end ?
However, since we use the same function everywhere we display the dates, like on the discounts listing, they now appear with the Gregorian calendar, even when the current language is in Persian.
Now, this could be solved by adding a switch in the hikashop_getDate function to use one mode or the other based on whether we're displaying the date, or sending it to the calendar system. But it would require a bit more development work.
Please Log in or Create an account to join the conversation.
i'm not developer, but i think the solution is to save the discount date in Gregorian, regardless of language, like Joomla Content component. JHtml::_('date', $date, $format) itself returns it to the language used.
Long ago, I saw the problem of converting history in other components like K2, and that is the only solution.
With this change, only the discount date is displayed in Gregorian in persian language. But the problem of storing date remainsin the file administrator/components/com_hikashop/helpers/helper.php
This basically does the same thing, but avoids that the language file overrides the date conversion and thus the date is not converted anymore to the Hijri calendar before being sent to the calendar system of Joomla.
This seems to fix the problem on my end. Cna you confirm on your end ?
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Please Log in or Create an account to join the conversation.
Then I'm not sure what to say. With the modification I made, I can select and store dates with the Persian language on my end, also with the latest version of HikaShop and Joomla.
I suppose we would have to directly look at the situation on your website with a backend and FTP access since I'm not able to reproduce the problem on my end anymore with that patch.
Please Log in or Create an account to join the conversation.
I send download link for you in privet.
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Please Log in or Create an account to join the conversation.
You gave me a zip of all the files of the website, but I can't do anything with that.
First, I don't have the same server, configured the same way as you, nor do I have your database with the data of the website.
So I can't check anything with that unfortunately.
The best would be that you provide a backend access and a FTP access to the website where you have the issue, or a copy of it.
Please Log in or Create an account to join the conversation.
You can easily install it on xampp without problem. like Joomla
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Please Log in or Create an account to join the conversation.
As Nicolas told you, there are many different parameters and lots of different settings to emulate the context and be able to reproduce your current issue, let's say it it's almost impossible.
The only way is to allow us to deeper analyze the situation and your website, and for this ftp references is required.
For this you can use our Contact us form in order to provide these secret references, just don't forget to add an Url link to this subject.
Regards
Please Log in or Create an account to join the conversation.
I send FTP account in Contact us.
subject is: discount not work in Persian language in perfumesmart.ir
Thank you for your help
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Please Log in or Create an account to join the conversation.