livehelperchat icon indicating copy to clipboard operation
livehelperchat copied to clipboard

Way to create two embed chats in the same page

Open futbolsalas15 opened this issue 6 years ago • 0 comments

Currently, LHC doesn't support add two embed chat widgets in the same page, when in Widget embed code option we create a new code with Native Placement enabled.

The reason for this is that the id of the div generated always shows lhc_status_container, regarding of the changes that we made to the file design/defaulttheme/tpl/lhchat/getstatus/options_variable.tpl.php. According to the code, changing $chatCSSPrefix in this file allow to create new JS code with a new id generated. e.g.:

<?php
    $chatOptionsVariable = 'LHCChatOptions';
    $chatCSSPrefix = 'crucero';
    $chatCSSLayoutOptions = array(
        'container_id' => 'crucero_container'
    )
?>

The previous change allows to create the following JS file:

Captura de pantalla 2019-03-30 a la(s) 9 28 28 a  m

Although it works initially, there is some parts of the code that have references to a non-parametrized id. e.g.: design/defaulttheme/tpl/lhabstract/custom/widget_theme.tpl.php:

<div id="lhc_status_container"><a id="online-icon" class="status-icon" href="#">{{ngModelAbstractInput_online_text || <?php echo json_encode(htmlspecialchars_decode(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/getstatus','Live help is online...'),ENT_QUOTES))?>}}</a></div>

(I ran this search in github to find the coincidences: https://github.com/LiveHelperChat/livehelperchat/search?q=lhc_status_container&unscoped_q=lhc_status_container)

The idea is maintain the consistency of the prefix through all the code.

Thanks.

futbolsalas15 avatar Mar 30 '19 14:03 futbolsalas15