Re: How do I execute this script?
Posted: Wed Nov 30, 2022 6:25 am
Have you checked this?
https://forum.livehelperchat.com/viewtopic.php?id=1739
https://forum.livehelperchat.com/viewtopic.php?id=1739
Phoenix Cart, E-Commerce made Easy!
https://phoenixcart.org/forum/
Omar_one wrote: ↑Tue Nov 29, 2022 6:43 pm @Rich-Os
you can add pages to hookand called ScriptCode: Select all
var $good_pages = ['index.php', 'xxxx.php', 'xxxx.php']; // what pages do you want to load the livehelperchat script
Code: Select all
$livehelperchatScript = <<<eod <script>(HERE THE SCRIPT) </script> eod;
Code: Select all
class hook_shop_siteWide_livehelperchat {
var $version = '3.4.1';
var $sitestart = null;
var $good_pages = ['index.php', 'conditions.php', 'shipping.php']; // what pages do you want to load the livehelperchat script
function listen_injectSiteStart() {
$this->sitestart .= '<!-- livehelperchat hooked -->' . PHP_EOL;
$livehelperchatScript .= '<script>var LHC_API = LHC_API||{};
LHC_API.args = {mode:"widget",lhc_base_url:"//mysite.com/livehelperchat/lhc_web/index.php/",wheight:450,wwidth:350,pheight:520,pwidth:500,leaveamessage:true,check_messages:false};
(function() {
var po = document.createElement("script"); po.type = "text/javascript"; po.setAttribute("crossorigin","anonymous"); po.async = true;
var date = new Date();po.src = "//mysite.com/livehelperchat/lhc_web/design/defaulttheme/js/widgetv2/index.js?"+(""+date.getFullYear() + date.getMonth() + date.getDate());
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);
})();
</script>' . PHP_EOL;
if (in_array(basename($_SERVER['PHP_SELF']), $this->good_pages)) {
$this->sitestart .= $livehelperchatScript . PHP_EOL;
return $this->sitestart;
}
}
}
Yes, I have. Thank you.mecinta wrote: ↑Wed Nov 30, 2022 6:25 am Have you checked this?
https://forum.livehelperchat.com/viewtopic.php?id=1739