This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 15 replies, has 3 voices.

Last updated by Itamar 5 months ago.

Assigned support staff: Itamar.

Author Posts
February 2, 2018 at 1:39 pm #1505394

Aksel Caba

Hi,
Bizzthemes Appointments plugin provides an internal calendar to view our monthly booked slots.

In the images we have attached you can see how the Spanish and English appointments are displayed perfectly according to the language used will administrating our WP.

The problem is that when we choose "All Languages" to join Spanish & English appointments to see a whole picture of our booked slots non of them are displayed.

We really need to see all appointments at once, how can we solve it?

Thanks in advace,
Aksel.

February 4, 2018 at 9:15 pm #1506556

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Aksel.

The WooCommerce Appointments plugin by BizzThemes (hidden link) is in our compatibility list here https://wpml.org/documentation/woocommerce-extensions-compatibility/.

Is it possible for you to share a copy of the plugin, so I can try it locally and investigate further?
I'll set next reply as private so that you can share a download link safely.
You can upload it to a service like Google Drive or Dropbox and share the link with me.
For this, I'll enable private message for the next reply.

Thanks,
Itamar.

February 5, 2018 at 10:38 pm #1507858

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Aksel.

I get this message at the download link that you have shared with me.

sorry, this download link no longer exists 🙁

Could you please check this issue and share with me the correct download link?
I'm enabling private message again.

Thanks,
Itamar.

February 7, 2018 at 10:08 am #1509643

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi and thank you for sharing the plugin with me.

I'm testing this issue, and I can see that when 'All Languages' is selected no appointment are showing. I have one question, please.
Are the appointment products on your site translated from Spanish into English and also the other way around?
I'm asking this because when I look at the screenshot Calendar-Spanish.png, it looks like all the appointments are showing. The appointments that I can see on the Calendar-English.png screenshot plus the appointments from the Spanish language.So I think. Am I correct?
When I try it on my local server and translate the appointment into the second language, I can see the appointment on the default language calendar as well as on the second language calendar.
I ask this to be able to replicate the exact scenario that you have.

Thanks,
Itamar.

February 7, 2018 at 10:20 am #1509678

Aksel Caba

Hi Itamar,
I'm not completely sure I understand your question, but I try to answer it.

The main language site i Spanish.
The English products are translations from the Spanish ones.
If you place an order into Spanish only an Spanish Appointment will be created.
If you place an order into English only an English Appointment will be created.
You see few English appointments because we have few English spoken customers.

The fact that the Enligsh appointments are not replicated into Spanish and vice versa is due to the fact that we are using an option from Bizzthemes Appointments that alow us to choose the appropriate staff for each order.
Ass we only have one staff available you can not have two appointments (English&Spanish) at the same slot.

Basically I know that WPML by default tries to replicate all appointments into all available languages on the site. If you can do this you will have in any language all appointments existing. Therefore there is no need to join and display all appointments from several languages into the calendar when you choose the "All languages" option.
In our case we have de activated that replication because was crashing Bizzthemes plugin.

Hope this explanation helps.
Thanks for your help,
Aksel.

February 7, 2018 at 10:08 pm #1510676

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

When I was testing this issue I was adding an appointment on the back-end in Appointments -> Add Appointment.
Reading what you are writing now, I have the feeling that I'm not replicating the issue correctly.
You are talking about placing an order. How do I place an order?
You are also mentioning an option that did not work for you and crashed the Bizzthemes plugin.
Which option is it?
Can you, please tell me a step by step what I should to replicate this issue?
Explain to me like this do 1 then 2 then 3 and so on.
And also sometimes screen-shots illustrating what you mean may go a long way to clarify what words fail to transmit, so if you like, make use of “upload an image” below the comment area.

Thanks,
Itamar.

February 8, 2018 at 8:41 am #1511020

Aksel Caba

Hi Itamar,
Do not take care about the placing order process.
Right now it works fine and the issue regarding that is been solved from Bizzthemes.

Our main problem now is the one about the calendar.
We want to have all languages appointments displayed when you choose "All Languages" in the language selection.

If you want to try it with new order you can do it, but is no need to do so as there are appointments in both languages already.

Thanks for your help,
Aksel.

February 8, 2018 at 10:28 am #1511200

Aksel Caba

Hi Itamar,
Just to help you understanding better I add an screenshot of the "All Appointments " list when "All Languages" is Selected.
Take a look at the underlined appointments. You can see as Spanish and English appointments are listed together .
But if instead of the list we try to display the Calendar with the "All languages" options no appointments are displayed, nor Spanish neither English.

It should be like the list, all mixed toghether in just one calendar to properly see which slots are booked.

Hope it helps,
Dani.

February 10, 2018 at 6:09 pm #1513845

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hello.

I can see in our internal documentation that we are in contact with the author of the plugin and this plugin is in a testing phase of making him compatible with WPML.
I'm now escalating this ticket to our compatibility team to let them know about this issue and see if there is a fix for it.
I'll keep you updated here for any news about this issue.

Thanks,
Itamar.

February 15, 2018 at 11:19 pm #1519735

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

I have a response from our compatibility team.

Changing the code in the following file resolved the issue:
woocommerce-appointments/includes/integrations/class-wc-appointments-integratio-wcml.php
function: appointments_in_date_range_query
starting at line 792

Cahnge from this:

function appointments_in_date_range_query( $appointment_ids ){
     
   foreach ( $appointment_ids as $key => $appointment_id ) {
       $language_code = $this->sitepress->get_language_for_element( get_post_meta( $appointment_id, '_appointment_product_id', true ) , 'post_product' );
       $current_language = $this->sitepress->get_current_language();

         if ( $language_code != $current_language ) {
             unset( $appointment_ids[$key] );
          }
       }
     return $appointment_ids;
 }

to this:

function appointments_in_date_range_query( $appointment_ids ){

        $current_language = $this->sitepress->get_current_language();       
        foreach ( $appointment_ids as $key => $appointment_id ) {
            $language_code = $this->sitepress->get_language_for_element( get_post_meta( $appointment_id, '_appointment_product_id', true ) , 'post_product' );
            
             if ( ( $language_code != $current_language ) && ($current_language !== "all") ){
                unset( $appointment_ids[$key] );
            }
        }
    
        return $appointment_ids;

 }

Please let me know if it is working for you.

February 16, 2018 at 1:23 pm #1520293

Aksel Caba

Hi Itamar,
I think there was a little mistake in your code, one line from the updated version was missing and without it no Appointments were displayed.

This is the actual code we are using:

function appointments_in_date_range_query( $appointment_ids ) {
foreach ( $appointment_ids as $key => $appointment_id ) {
$language_code = $this->sitepress->get_language_for_element( get_post_meta( $appointment_id, '_appointment_product_id', true ) , 'post_product' );
$current_language = $this->sitepress->get_current_language();

if (( $language_code != $current_language ) && ($current_language !== "all")){
unset( $appointment_ids[ $key ] );
}
}

return $appointment_ids;
}

With this version looks like solved and the website seems to work fine.
Can you check that we are right?

Thanks for all,
Aksel.

February 18, 2018 at 11:22 am #1521238

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Aksel.

I'm waiting for a reply from our second tier about this.
I'll get back to once I have an answer from here.

Regards,
Itamar.

February 19, 2018 at 9:32 pm #1522868

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

Our second tier says that the following line was there before the foreach loop.

$current_language = $this->sitepress->get_current_language();

And it makes it a bit more efficient as you only consult the active language once and not each time for each post. But it can work either way. So if it is working for you the way that you are showing us, then your code is fine.
Please note that the "official" fix will be delivered by the plugin author eventually.

Best Regards,
Itamar.

February 26, 2018 at 3:26 pm #1529392

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Aksel.

Can you please confirm that the fix is working for you?

Regards,
Itamar.

May 10, 2018 at 3:23 pm #2075823

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hello

This is Yvette from the 2nd tier support group. Could you please let us know if the code we provided resolved your issue?

In this way, we can then forward the fix to the plugin author so it can be integrated into the next release of their code. Otherwise, when you upgrade the plugin, the code will be overwritten and you will be required to re-do the code changes.

Thanks for your feedback on this.