-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from alvinjohnsonso/apply-coding-standards
- fixed spacing format - transferred backend functions to a separate file - renamed main tawk to admin file name to `tawk_to_widget_admin.php` - added build script
- Loading branch information
Showing
14 changed files
with
966 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.zip | ||
./build/tawk-zencart-*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,44 @@ | ||
tawk/tawk-zencart | ||
================ | ||
# tawk.to Live Chat | ||
|
||
# About tawk.to | ||
tawk.to is a free live chat app that lets you monitor and chat with visitors on your website | ||
or from a free customizable page. No catch. No spam. No wares. It's truly free and always will be. | ||
Free live chat widget for your site | ||
|
||
# Installation | ||
Copy files to your Zen Cart directory. Zen Cart uses customized directories for admin | ||
so you have to copy files from YOUR_ADMIN_FOLDER to folder where you have moved Zen Cart | ||
admin files. Same thing applies to templates, copy includes/templates/YOUR_TEMPLATE content | ||
to folder with template you are using | ||
## Description | ||
|
||
HINT: If you don't know what the template directory name you are using, then you can find it out by following these steps: | ||
1) Login to your Zen Cart admin dashboard. | ||
2) From the menu, Go to "Tools > Template Selection". | ||
3) From the screen that shows Template Selection, look under the column that is titled "Template Directory". The name you find under that column is the template directory name that your Zen Cart site is currently using. That EXACT name is the one that you will use to replace each instance of "includes/templates/YOUR_TEMPLATE_FOLDER_NAME". | ||
The tawk.to Live Chat app makes it easy to monitor and chat with visitors on your website. Be there when they need you with unlimited messaging, ticketing and your own Knowledge Base — all 100% FREE. | ||
|
||
# Usage | ||
Go to administration page -> tools -> Tawk.to widget and select widget you want to use in your | ||
Zen Cart store, selected widget will appear in all the pages of your store. | ||
Compatible with all modern browsers, tawk.to was created in response to the growing need for businesses to respond in real time, with real people. | ||
|
||
If you don't have [tawk.to](https://tawk.to/?utm_source=zencart&utm_medium=link&utm_campaign=signup) account, you can always [create one for free](https://tawk.to/?utm_source=wpdirectory&utm_medium=link&utm_campaign=signup) | ||
Never lose another lead or sale again — tawk.to offers iOS, Android, Windows and Mac OSX apps to keep you connected wherever you go. | ||
|
||
Don’t have a tawk.to account yet? [Create one here.](https://tawk.to/?utm_source=zencart&utm_medium=link&utm_campaign=signup) | ||
|
||
## Installation | ||
1. Extract the zip file. | ||
2. Copy the contents of the `YOUR_ADMIN_FOLDER` to `<ZENCART_INSTALLATION>`/`<YOUR_ADMIN_FOLDER>` | ||
3. Copy the contents of the `includes`/`templates`/`YOUR_TEMPLATE` to `<ZENCART_INSTALLATION>`/`includes`/`templates`/`<YOUR_CURRENT_TEMPLATE>`. | ||
4. Copy the other contents of the `includes` folder to `<ZENCART_INSTALLATION>`/`includes`. | ||
|
||
NOTE: If you don't know what the template directory name you are using, then you can find it out by following these steps: | ||
1. Go to `Dashboard` -> `Tools` -> `Template Selection`. | ||
2. From the screen that shows `Template Selection`, look under the column that is titled `Template Directory`. You can find the name of your template directory that your Zen Cart site is currently using. That `EXACT` name is the one that you will use to replace each instance of `<YOUR_CURRENT_TEMPLATE>`. | ||
|
||
## Widget Configuration | ||
1. Go to `Dashboard` -> `Tools` -> `tawk.to widget`. | ||
2. Log in to your tawk.to account. | ||
3. Select the property and the widget you want to place on your store and click `Use selected widget`. | ||
4. The widget will now appear on your store. | ||
|
||
## How To Remove | ||
Delete all the files included in this module. These are the files with `tawk_to` in the filename and can be found under these folders: | ||
- `includes`/`extra_datafiles` | ||
- `includes`/`templates`/`YOUR_TEMPLATE`/`jscript` | ||
- `YOUR_ADMIN_FOLDER` | ||
- `YOUR_ADMIN_FOLDER`/`includes`/`auto_loaders` | ||
- `YOUR_ADMIN_FOLDER`/`includes`/`extra_datafiles` | ||
- `YOUR_ADMIN_FOLDER`/`includes`/`functions` | ||
- `YOUR_ADMIN_FOLDER`/`includes`/`functions`/`extra_functions` | ||
- `YOUR_ADMIN_FOLDER`/`includes`/`init_includes` | ||
- `YOUR_ADMIN_FOLDER`/`includes`/`languages`/`english`/`extra_definitions` | ||
|
||
## Frequently Asked Questions | ||
Visit our [Help Center](https://help.tawk.to/) for answers to FAQs |
8 changes: 4 additions & 4 deletions
8
YOUR_ADMIN_FOLDER/includes/auto_loaders/config.tawk_to_widget.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<?php | ||
if (!defined('IS_ADMIN_FLAG')) { | ||
die('Illegal Access'); | ||
die('Illegal Access'); | ||
} | ||
|
||
$autoLoadConfig[999][] = array( | ||
'autoType' => 'init_script', | ||
'loadFile' => 'init_tawk_to_widget.php' | ||
); | ||
'autoType' => 'init_script', | ||
'loadFile' => 'init_tawk_to_widget.php' | ||
); |
8 changes: 4 additions & 4 deletions
8
YOUR_ADMIN_FOLDER/includes/extra_datafiles/tawk_to_config_fields.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
define('TAWK_TO_PAGE_ID_FIELD', 'tawk_to_page_id'); | ||
define('TAWK_TO_WIDGET_ID_FIELD', 'tawk_to_widget_id'); | ||
define('FILENAME_TAWK_TO_WIDGET', 'tawk_to_widget'); | ||
define('TAWK_TO_WIDGET_BASE_URL', 'https://plugins.tawk.to'); | ||
define('TAWK_TO_PAGE_ID_FIELD', 'tawk_to_page_id'); | ||
define('TAWK_TO_WIDGET_ID_FIELD', 'tawk_to_widget_id'); | ||
define('FILENAME_TAWK_TO_WIDGET', 'tawk_to_widget_admin'); | ||
define('TAWK_TO_WIDGET_BASE_URL', 'https://plugins.tawk.to'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
YOUR_ADMIN_FOLDER/includes/languages/english/extra_definitions/tawk_to_widget_name.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<?php | ||
define('BOX_TOOLS_TAWK_TO_WIDGET', 'Tawk.to widget'); | ||
define('BOX_TOOLS_TAWK_TO_WIDGET', 'tawk.to widget'); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?php | ||
/** | ||
* @package tawk.to | ||
* @copyright Copyright 2021 tawk.to | ||
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 | ||
* @version 1.1.0 | ||
*/ | ||
|
||
require('includes/application_top.php'); | ||
|
||
$tawk_widget_current_values = array( | ||
'page_id' => zen_get_configuration_key_value(TAWK_TO_PAGE_ID_FIELD), | ||
'widget_id' => zen_get_configuration_key_value(TAWK_TO_WIDGET_ID_FIELD) | ||
); | ||
|
||
//zen cart returns span with error message if configuration key can't be found | ||
if (strpos($tawk_widget_current_values['page_id'], '<') === 0) { | ||
$tawk_widget_current_values['page_id'] = ''; | ||
$tawk_widget_current_values['widget_id'] = ''; | ||
} | ||
?> | ||
|
||
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> | ||
<html <?php echo HTML_PARAMS; ?>> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> | ||
<title><?php echo TITLE; ?></title> | ||
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> | ||
<link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> | ||
<script language="javascript" src="includes/menu.js"></script> | ||
<script language="javascript" src="includes/general.js"></script> | ||
<script type="text/javascript" src="<?php echo TAWK_TO_WIDGET_BASE_URL ?>/public/js/jquery-1.11.0.min.js"></script> | ||
<script type="text/javascript"> | ||
function init() | ||
{ | ||
cssjsmenu('navbar'); | ||
if (document.getElementById) { | ||
var kill = document.getElementById('hoverJS'); | ||
kill.disabled = true; | ||
} | ||
} | ||
</script> | ||
|
||
</head> | ||
<body onload="init()"> | ||
<!-- header //--> | ||
<?php require(DIR_WS_INCLUDES . 'header.php'); ?> | ||
<!-- header_eof //--> | ||
|
||
<!-- body //--> | ||
<div style="width:100%; height: 100%; margin: 10px auto"> | ||
<iframe id="tawkIframe" src="" style="width:100%; height: 100%; border: none"></iframe> | ||
</div> | ||
<script type="text/javascript"> | ||
var currentHost = window.location.protocol + "//" + window.location.host; | ||
var url = "<?php echo TAWK_TO_WIDGET_BASE_URL ?>/generic/widgets?currentWidgetId=<?php echo $tawk_widget_current_values['widget_id'] ?>¤tPageId=<?php echo $tawk_widget_current_values['page_id']?>&parentDomain=" + currentHost; | ||
|
||
jQuery('#tawkIframe').attr('src', url); | ||
|
||
var iframe = jQuery('#tawk_widget_customization')[0]; | ||
|
||
window.addEventListener('message', function(e) { | ||
if (e.origin === '<?php echo TAWK_TO_WIDGET_BASE_URL ?>') { | ||
|
||
if(e.data.action === 'setWidget') { | ||
setWidget(e); | ||
} | ||
|
||
if(e.data.action === 'removeWidget') { | ||
removeWidget(e); | ||
} | ||
} | ||
}); | ||
|
||
function setWidget(e) { | ||
jQuery.post('tawk_to_widget_manager.php?actionType=set', { | ||
page_id : e.data.pageId, | ||
widget_id : e.data.widgetId | ||
}, function(r) { | ||
if (r.success) { | ||
e.source.postMessage({action: 'setDone'}, '<?php echo TAWK_TO_WIDGET_BASE_URL ?>'); | ||
} else { | ||
e.source.postMessage({action: 'setFail'}, '<?php echo TAWK_TO_WIDGET_BASE_URL ?>'); | ||
} | ||
|
||
}); | ||
} | ||
|
||
function removeWidget(e) { | ||
jQuery.post('tawk_to_widget_manager.php?actionType=remove', {}, function(r) { | ||
if (r.success) { | ||
e.source.postMessage({action: 'removeDone'}, '<?php echo TAWK_TO_WIDGET_BASE_URL ?>'); | ||
} else { | ||
e.source.postMessage({action: 'removeFail'}, '<?php echo TAWK_TO_WIDGET_BASE_URL ?>'); | ||
} | ||
}); | ||
} | ||
</script> | ||
<!-- body_eof //--> | ||
|
||
<!-- footer //--> | ||
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?> | ||
<!-- footer_eof //--> | ||
</body> | ||
</html> | ||
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> |
Oops, something went wrong.