ouun / zammad-wp

Zammad WordPress integration
GNU General Public License v2.0
27 stars 5 forks source link

The embed chat and the embed form do not work on my site #26

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hi @ouun,

I hope you are well!

I would like to use Zammad on my website https://www.jaimemesdents.fr/ and for that, I am testing on my test site, namely https://staging.jaimemesdents.fr/.

It's a WordPress and while digging on the internet I discovered that you had developed a plugin that facilitates the integration of Zammad on WordPress and in particular the chat, forms and API. I read the documentation, but unfortunately I can't seem to implement my form and my chat on my Staging site.

I have well defined what I need in my wp-config.php, namely : define('ZAMMAD_URL', 'https://my-zammad.com'); define('ZAMMAD_USERNAME', 'username'); define('ZAMMAD_PASSWORD', 'password');

I added the code from the doc to embed the chat in the functions.php of my child theme, but it doesn't display anything. Same for the form.

Can you help me to solve the problem?

Thanks for your help, I wish you a nice day!

Brendan

ouun commented 2 years ago

Hi @Brendyyyp,

I see from your source code that something goes wrong with the definition of "ZAMMAD_URL". The URLs to the required JS of Zammad is currently https://staging.jaimemesdents.fr/wpZAMMAD_URL/assets/chat/chat.min.js?ver=0.8.3, please note the extra "ZAMMAD_URL" within the URL.

Please first go sure that define('ZAMMAD_URL', 'https://my-zammad.com/'); is set correctly, where https://my-zammad.com/ is the URL to your Zammad instance.

Also please share your code with which you want to embed the chat.

Kind regards,

Philipp

ghost commented 2 years ago

Thanks @ouun for your quick response!

You will see on this screenshot my configuration set up. I have the link from my Zammad, namely 'https://zammad.jaimemesdents.cloud-ed.fr/.

And here is the screenshot of the code I wrote in my functions.php file of my child theme: image

Kind regards,

Brendan

ouun commented 2 years ago

OK, this looks good so far. Could you please try to remove Config:: from your definitions. So only:

define('ZAMMAD_URL', 'https://zammad.jaimemesdents.cloud-ed.fr/');
define('ZAMMAD_USERNAME', 'username');
define('ZAMMAD_PASSWORD', 'password');

Could be an issue with Bedrock, that the definitions are set too late. Also please remember to change your password... ;)

ouun commented 2 years ago

@Brendyyyp also noticed in you second screenshot that you copied the example snippets from the Wiki. These are really only examples and you need to configure them. So best you remove the first one and as I assume that you want the chat to appear on the frontend, you need to use another hook init for your second block:

add_action('init', function () {
        if (function_exists('zammad_register_chat')) {
            zammad_register_chat( 1, [
                'buttonClass' => 'button action',
                'target' => '$("#wpbody")'
            ] );
        }
    });

Also better you remove the form snippets until you got the chat running.

ghost commented 2 years ago

@ouun, I just removed Config:: from the definitions, and it works I do have the embed chat.

Oh thank you, I didn't pay any attention that my password was visible, thank you very much, it's modified and I removed the screenshot from my previous answer.

I'll see tomorrow to set up the form, I'll come back to you if I need help. But already thank you very much for your help ! :)

See you soon !

ouun commented 2 years ago

@Brendyyyp I am glad that this is solved.

As you are working on a WooCommerce site with sustainable products, I think another project I am woking on will be of interest for you, too: WeRePack.org Would be great to get you onboard. ;)