Skip to content

Commit

Permalink
Moved widget to footer
Browse files Browse the repository at this point in the history
- on some pages or templates footer does not exist and chat is not visible
marekgach committed Nov 22, 2019
1 parent 93b0e3c commit 7a1f30b
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions smartsupp/smartsupp.php
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ public function install()
$tab->id_parent = -1;
$tab->module = $this->name;

if (!$tab->add() || !parent::install() || !$this->registerHook('footer') || !$this->registerHook('backOfficeHeader') || !Configuration::updateValue('SMARTSUPP_KEY', '') || !Configuration::updateValue('SMARTSUPP_EMAIL', '') || !Configuration::updateValue('SMARTSUPP_CUSTOMER_ID', '1') || !Configuration::updateValue('SMARTSUPP_CUSTOMER_NAME', '1') || !Configuration::updateValue('SMARTSUPP_CUSTOMER_EMAIL', '1') || !Configuration::updateValue('SMARTSUPP_CUSTOMER_PHONE', '1') || !Configuration::updateValue('SMARTSUPP_CUSTOMER_ROLE', '1') || !Configuration::updateValue('SMARTSUPP_CUSTOMER_SPENDINGS', '1') || !Configuration::updateValue('SMARTSUPP_CUSTOMER_ORDERS', '1') || !Configuration::updateValue('SMARTSUPP_OPTIONAL_API', '')
if (!$tab->add() || !parent::install() || !$this->registerHook('header') || !$this->registerHook('backOfficeHeader') || !Configuration::updateValue('SMARTSUPP_KEY', '') || !Configuration::updateValue('SMARTSUPP_EMAIL', '') || !Configuration::updateValue('SMARTSUPP_CUSTOMER_ID', '1') || !Configuration::updateValue('SMARTSUPP_CUSTOMER_NAME', '1') || !Configuration::updateValue('SMARTSUPP_CUSTOMER_EMAIL', '1') || !Configuration::updateValue('SMARTSUPP_CUSTOMER_PHONE', '1') || !Configuration::updateValue('SMARTSUPP_CUSTOMER_ROLE', '1') || !Configuration::updateValue('SMARTSUPP_CUSTOMER_SPENDINGS', '1') || !Configuration::updateValue('SMARTSUPP_CUSTOMER_ORDERS', '1') || !Configuration::updateValue('SMARTSUPP_OPTIONAL_API', '')
) {
return false;
}
@@ -89,7 +89,7 @@ public function uninstall()
$tab->delete();
}

if (!parent::uninstall() || !$this->unregisterHook('footer') || !$this->unregisterHook('backOfficeHeader') || !Configuration::deleteByName('SMARTSUPP_KEY') || !Configuration::deleteByName('SMARTSUPP_EMAIL') || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_ID', '') || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_NAME', '') || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_EMAIL', '') || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_PHONE', '') || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_ROLE', '') || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_SPENDINGS', '') || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_ORDERS', '') || !Configuration::deleteByName('SMARTSUPP_OPTIONAL_API', '')
if (!parent::uninstall() || !$this->unregisterHook('header') || !$this->unregisterHook('backOfficeHeader') || !Configuration::deleteByName('SMARTSUPP_KEY') || !Configuration::deleteByName('SMARTSUPP_EMAIL') || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_ID', '') || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_NAME', '') || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_EMAIL', '') || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_PHONE', '') || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_ROLE', '') || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_SPENDINGS', '') || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_ORDERS', '') || !Configuration::deleteByName('SMARTSUPP_OPTIONAL_API', '')
) {
return false;
}
@@ -256,11 +256,12 @@ protected function getSmartsuppJs($smartsupp_key)
return $chat->render() . $custom_code;
}

public function hookFooter()
public function hookHeader()
{
$smartsupp_key = Configuration::get('SMARTSUPP_KEY');
$this->smarty->assign(array('smartsupp_js' => $this->getSmartsuppJs($smartsupp_key)));

return $this->getSmartsuppJs($smartsupp_key);
return $this->display(__FILE__, './views/templates/front/chat_widget.tpl');
}

public function hookBackOfficeHeader()
1 change: 1 addition & 0 deletions smartsupp/views/templates/front/chat_widget.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{$smartsupp_js nofilter}

0 comments on commit 7a1f30b

Please sign in to comment.