Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

PureChat Integration on all Website pages


Go to End


9 Posts   2685 Views

Avatar
ChrisVeale

Community Member, 5 Posts

14 August 2014 at 2:12pm

Hi.

I am looking at integrating PureChat with our website and would like to know the best way of getting a snippet of code to be added to all pages on our site with a single (or as little as possible) changes

Is this something that can be done through a change to the themes or something like that?

I am not usually a web developer, but our web dev has just left and I am in the lurch a bit.

If someone could advise a direction I may be able to work it out :)

Cheers

Chris

Avatar
Kirk

Community Member, 67 Posts

14 August 2014 at 3:02pm

Edited: 14/08/2014 3:04pm

This can be done with Includes, the steps are below


  • * Create a file with the extension .ss (for example PureChat.ss) in your themes/[your website theme name]/templetes/Includes directory
    * Inside the new file add the PureChat code
    * In your Page.ss file include the following to insert the PureChat code <% include PureChat %>

Your theme folder will be in the root directory of your website and you can find out the theme you are using for your website by going to settings in the admin section.

More documentation on templates can be found here (under Includes)

http://doc.silverstripe.org/framework/en/reference/templates

Avatar
ChrisVeale

Community Member, 5 Posts

15 August 2014 at 4:45pm

Thanks Kirk.

I will have a look at this next week and Post how well it works :)

Cheers

Chris

Avatar
ChrisVeale

Community Member, 5 Posts

19 August 2014 at 9:24am

Hi Kirk.

Targeting this at you as you have helped already :)

I have done as you suggested, but with just the code for purechat nothing happens.

If I add some text into the code as well, then that text does get displayed so I believe the include and integration is working, is there some way to debug and see why the chat widget is not displayed? or is this more a question (given the text is displaying) for Axosoft (purechat developers)

Cheers

Chris

Avatar
Kirk

Community Member, 67 Posts

19 August 2014 at 10:10am

Hi Chris,

The best way to debug this would be to use some of the popular browser inspectors like Firebug for Firefox or the Chrome inspector as I suspect a JavaScript error may be thrown and this will be displayed in the console window of something like Inspector in Chrome.

A common cause of something like this would the PureChat script trying to use jQuery before it has been included.
In silverStripe JavaScript is included before the closing body tag so if your PureChat include is above this then it could possibly be throwing undefined errors.

To use inspector in Chrome right-click on the window and select 'Inspect Element' you will see a frame open at the bottom of the screen and can then select the Console tab you will then need to reload the page and see if any errors are thrown.

Avatar
Kirk

Community Member, 67 Posts

19 August 2014 at 10:12am

Looking at the PureChat FAQ it could be something as simple as no operators being available.

https://www.purechat.com/faq

I've copied and pasted the javascript, but I don't see the chat widget on my website. Why not?
In most cases this is due to no operator being logged in with a status of “available”. Make sure you are logged in and available, and then check your website again. If you still don't see it, refresh the page to ensure you aren't looking at a cached version of your site. Still don't see it? Please send an email to help@purechat.com, so we can help you.

Why doesn't the widget show up when operators are unavailable?
This was a design decision on our part. It ensures that your visitors will only request a chat when there is someone there to chat with them. If you would like, there are options to set an away message that asks your visitors to leave a contact request.

Avatar
ChrisVeale

Community Member, 5 Posts

19 August 2014 at 11:20am

Hmmm ok so I messed up.

I have the text which gets displayed is at the same point at my <% include PureChat.ss %> code which is why it is displaying.

I have another set of text inside the purechat.ss file which is not being displayed.

I cannot attached my page.ss (from /themes/env/templates/layout directory) and purechat.ss (from /themes/env/templates/includes directory) as this will not accept the file type

the page.ss from above only has A <DIV> entry in it so I am assuming it is included somehow into the main page.ss?

I did notice that there is another page.ss file in /themes/env/templates so I put the <% include purechat.ss %> in there as well

There is nothing appearing in the console window of chrome inspector so I think it is just not picking up the include file somehow.

If I alter the Purechat.ss file to just display some text, this is not displaying so the more in investigate, there is some interaction with the page.ss file and the purechat.ss file that is missing...

Looks like this might be something for the silverstripe gurus to set up for me :(

Chris

Avatar
Kirk

Community Member, 67 Posts

19 August 2014 at 11:33am

You can use http://www.sspaste.com/ to share any code if you can not include it in the forum post

Go to Top