Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #149 from blopa/hotfix/unserialization_glitch
Browse files Browse the repository at this point in the history
Hotfix/unserialization glitch
  • Loading branch information
blopa authored Mar 25, 2018
2 parents ddc7b57 + 5fe321b commit 63684fa
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Magento2/app/code/Werules/Chatbot/Setup/UpgradeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function upgrade(
ModuleContextInterface $context
) {
$setup->startSetup();
if (version_compare($context->getVersion(), "1.0.6", "<")) {
//Your upgrade script
if (version_compare($context->getVersion(), "1.0.7", "<")) {
//Your upgrade script
}
$setup->endSetup();
}
Expand Down
6 changes: 3 additions & 3 deletions Magento2/app/code/Werules/Chatbot/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<group id="general" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="10" translate="label comment tooltip">
<label>General Settings</label>
<comment><![CDATA[
<h3>Magento Chatbot v1.0.6</h3>
<h3>Magento Chatbot v1.0.7</h3>
<p>To use this module you'll have to use SSL in your store.</p>
]]></comment>
<field id="enable" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="1" translate="label comment tooltip" type="select">
Expand Down Expand Up @@ -67,7 +67,7 @@
<group id="general" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="10" translate="label comment tooltip">
<label>Messenger Settings</label>
<comment><![CDATA[
<h3>Magento Chatbot v1.0.6</h3>
<h3>Magento Chatbot v1.0.7</h3>
<p>To use this module you'll have to use SSL in your store.</p>
]]></comment>
<field id="enable" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="1" translate="label comment tooltip" type="select">
Expand Down Expand Up @@ -240,7 +240,7 @@
<group id="general" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="10" translate="label comment tooltip">
<label>Danger Zone</label>
<comment><![CDATA[
<h3>Magento Chatbot v1.0.6</h3>
<h3>Magento Chatbot v1.0.7</h3>
<p>To use this module you'll have to use SSL in your store.</p>
<p style='color: red;'><b>You should only change settings here if you know what you're doing.</b></p>
<div class='message-system-inner' id='werules_scheduled_clearing' style='display: none; border-width: 0.1rem; padding: 0 1.5rem 0 3rem;'>
Expand Down
6 changes: 3 additions & 3 deletions Magento2/app/code/Werules/Chatbot/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
<message_options/>
<help_message>SOS!</help_message>
<enable_help_command_list>0</enable_help_command_list>
<commands_list> <!-- thanks to https://duzun.me/playground/serialize and https://stackoverflow.com/questions/14297926/structure-of-a-serialized-php-string -->
a:16:{s:18:"_1510428167773_773";a:4:{s:10:"command_id";s:1:"2";s:14:"enable_command";s:1:"1";s:12:"command_code";s:6:"Search";s:18:"command_alias_list";s:0:"";}s:18:"_1510428168781_781";a:4:{s:10:"command_id";s:1:"3";s:14:"enable_command";s:1:"1";s:12:"command_code";s:5:"Login";s:18:"command_alias_list";s:0:"";}s:17:"_1510428170069_69";a:4:{s:10:"command_id";s:1:"4";s:14:"enable_command";s:1:"1";s:12:"command_code";s:11:"List Orders";s:18:"command_alias_list";s:0:"";}s:18:"_1510428170781_781";a:4:{s:10:"command_id";s:1:"5";s:14:"enable_command";s:1:"1";s:12:"command_code";s:7:"Reorder";s:18:"command_alias_list";s:0:"";}s:18:"_1510428171332_332";a:4:{s:10:"command_id";s:1:"6";s:14:"enable_command";s:1:"1";s:12:"command_code";s:11:"Add to Cart";s:18:"command_alias_list";s:0:"";}s:18:"_1510428171828_828";a:4:{s:10:"command_id";s:1:"7";s:14:"enable_command";s:1:"1";s:12:"command_code";s:8:"Checkout";s:18:"command_alias_list";s:0:"";}s:18:"_1510428172317_317";a:4:{s:10:"command_id";s:1:"8";s:14:"enable_command";s:1:"1";s:12:"command_code";s:10:"Clear Cart";s:18:"command_alias_list";s:0:"";}s:18:"_1510428172909_909";a:4:{s:10:"command_id";s:1:"9";s:14:"enable_command";s:1:"1";s:12:"command_code";s:11:"Track Order";s:18:"command_alias_list";s:0:"";}s:18:"_1510428173452_452";a:4:{s:10:"command_id";s:2:"10";s:14:"enable_command";s:1:"1";s:12:"command_code";s:7:"Support";s:18:"command_alias_list";s:0:"";}s:17:"_1510428174012_12";a:4:{s:10:"command_id";s:2:"11";s:14:"enable_command";s:1:"1";s:12:"command_code";s:10:"Send Email";s:18:"command_alias_list";s:0:"";}s:18:"_1510428174525_525";a:4:{s:10:"command_id";s:2:"12";s:14:"enable_command";s:1:"1";s:12:"command_code";s:6:"Cancel";s:18:"command_alias_list";s:5:"Abort";}s:18:"_1510428175116_116";a:4:{s:10:"command_id";s:2:"13";s:14:"enable_command";s:1:"1";s:12:"command_code";s:4:"Help";s:18:"command_alias_list";s:0:"";}s:18:"_1510428176398_398";a:4:{s:10:"command_id";s:2:"14";s:14:"enable_command";s:1:"1";s:12:"command_code";s:5:"About";s:18:"command_alias_list";s:0:"";}s:18:"_1510428176911_911";a:4:{s:10:"command_id";s:2:"15";s:14:"enable_command";s:1:"1";s:12:"command_code";s:6:"Logout";s:18:"command_alias_list";s:0:"";}s:18:"_1510428177356_356";a:4:{s:10:"command_id";s:2:"16";s:14:"enable_command";s:1:"1";s:12:"command_code";s:8:"Register";s:18:"command_alias_list";s:0:"";}s:18:"_1510428242102_102";a:4:{s:10:"command_id";s:1:"1";s:14:"enable_command";s:1:"1";s:12:"command_code";s:15:"List Categories";s:18:"command_alias_list";s:0:"";}}
</commands_list>
<!--<commands_list> &lt;!&ndash; thanks to https://duzun.me/playground/serialize and https://stackoverflow.com/questions/14297926/structure-of-a-serialized-php-string &ndash;&gt;-->
<!--a:16:{s:18:"_1510428167773_773";a:4:{s:10:"command_id";s:1:"2";s:14:"enable_command";s:1:"1";s:12:"command_code";s:6:"Search";s:18:"command_alias_list";s:0:"";}s:18:"_1510428168781_781";a:4:{s:10:"command_id";s:1:"3";s:14:"enable_command";s:1:"1";s:12:"command_code";s:5:"Login";s:18:"command_alias_list";s:0:"";}s:17:"_1510428170069_69";a:4:{s:10:"command_id";s:1:"4";s:14:"enable_command";s:1:"1";s:12:"command_code";s:11:"List Orders";s:18:"command_alias_list";s:0:"";}s:18:"_1510428170781_781";a:4:{s:10:"command_id";s:1:"5";s:14:"enable_command";s:1:"1";s:12:"command_code";s:7:"Reorder";s:18:"command_alias_list";s:0:"";}s:18:"_1510428171332_332";a:4:{s:10:"command_id";s:1:"6";s:14:"enable_command";s:1:"1";s:12:"command_code";s:11:"Add to Cart";s:18:"command_alias_list";s:0:"";}s:18:"_1510428171828_828";a:4:{s:10:"command_id";s:1:"7";s:14:"enable_command";s:1:"1";s:12:"command_code";s:8:"Checkout";s:18:"command_alias_list";s:0:"";}s:18:"_1510428172317_317";a:4:{s:10:"command_id";s:1:"8";s:14:"enable_command";s:1:"1";s:12:"command_code";s:10:"Clear Cart";s:18:"command_alias_list";s:0:"";}s:18:"_1510428172909_909";a:4:{s:10:"command_id";s:1:"9";s:14:"enable_command";s:1:"1";s:12:"command_code";s:11:"Track Order";s:18:"command_alias_list";s:0:"";}s:18:"_1510428173452_452";a:4:{s:10:"command_id";s:2:"10";s:14:"enable_command";s:1:"1";s:12:"command_code";s:7:"Support";s:18:"command_alias_list";s:0:"";}s:17:"_1510428174012_12";a:4:{s:10:"command_id";s:2:"11";s:14:"enable_command";s:1:"1";s:12:"command_code";s:10:"Send Email";s:18:"command_alias_list";s:0:"";}s:18:"_1510428174525_525";a:4:{s:10:"command_id";s:2:"12";s:14:"enable_command";s:1:"1";s:12:"command_code";s:6:"Cancel";s:18:"command_alias_list";s:5:"Abort";}s:18:"_1510428175116_116";a:4:{s:10:"command_id";s:2:"13";s:14:"enable_command";s:1:"1";s:12:"command_code";s:4:"Help";s:18:"command_alias_list";s:0:"";}s:18:"_1510428176398_398";a:4:{s:10:"command_id";s:2:"14";s:14:"enable_command";s:1:"1";s:12:"command_code";s:5:"About";s:18:"command_alias_list";s:0:"";}s:18:"_1510428176911_911";a:4:{s:10:"command_id";s:2:"15";s:14:"enable_command";s:1:"1";s:12:"command_code";s:6:"Logout";s:18:"command_alias_list";s:0:"";}s:18:"_1510428177356_356";a:4:{s:10:"command_id";s:2:"16";s:14:"enable_command";s:1:"1";s:12:"command_code";s:8:"Register";s:18:"command_alias_list";s:0:"";}s:18:"_1510428242102_102";a:4:{s:10:"command_id";s:1:"1";s:14:"enable_command";s:1:"1";s:12:"command_code";s:15:"List Categories";s:18:"command_alias_list";s:0:"";}}-->
<!--</commands_list>-->
<enable_default_replies>0</enable_default_replies>
<default_replies/>
<enable_nlp_replies/>
Expand Down
2 changes: 1 addition & 1 deletion Magento2/app/code/Werules/Chatbot/etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Werules_Chatbot" setup_version="1.0.6" schema_version="1.0.6"/>
<module name="Werules_Chatbot" setup_version="1.0.7" schema_version="1.0.7"/>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,31 @@
updateCustomKeyUrl(custom_key.value);

var scheduled_clear = document.getElementById('werules_chatbot_danger_general_clear_message_pending');
if (scheduled_clear)
{
if (scheduled_clear.value === '1')
{
if (scheduled_clear) {
if (scheduled_clear.value === '1') {
var schedule_message = document.getElementById('werules_scheduled_clearing');
if (schedule_message)
document.getElementById('werules_scheduled_clearing').style.display = 'block';
}
}

function updateCustomKeyUrl(custom_key)
{
function updateCustomKeyUrl(custom_key) {
var messenger_url = document.getElementById('werules_messenger_url');
var telegram_url = document.getElementById('werules_telegram_url');
var store_url = '<?php echo $baseUrl; ?>';
// messenger_url.href = store_url + 'chatbot/webhook/endpoint/api/messenger/key/' + custom_key;
messenger_url.href = 'https://werules.github.io/chatbot/?key=' + custom_key;
telegram_url.href = store_url + 'chatbot/webhook/endpoint/api/messenger/key/' + custom_key;
messenger_url.href = 'https://werules.github.io/chatbot/?key=' + custom_key + '&base_url=' + store_url;
// telegram_url.href = store_url + 'chatbot/webhook/endpoint/api/messenger/key/' + custom_key; // TODO
}

function generateCustomKey()
{
function generateCustomKey() {
var key_input = document.getElementById('werules_chatbot_general_general_custom_key');
var custom_key = getRandomCustomKey(Math.floor(Math.random() * 4));
key_input.value = custom_key;
// updateCustomKeyUrl(custom_key);
}

function getRandomCustomKey(qty)
{
function getRandomCustomKey(qty) {
var key = '';
for (var i = 0; i <= qty; i++)
key += Math.random().toString(36).substring(2, 15);
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ Go to **System > General Settings > Chatbot Settings**

## Release Notes
### Magento2
- **v1.0.7:**
- Fix unserialization problem [#146](https://github.com/blopa/Magento-Chatbot/issues/146) (thanks [xmav](https://github.com/xmav))
- **v1.0.6:**
- Update license
- Fix issue [#142](https://github.com/blopa/Magento-Chatbot/issues/142)
Expand Down
Binary file modified screenshots/m2/messenger_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 63684fa

Please sign in to comment.