diff --git a/Magento1_deprecated/README.md b/Magento1_deprecated/README.md index 159f247..7112fea 100644 --- a/Magento1_deprecated/README.md +++ b/Magento1_deprecated/README.md @@ -140,98 +140,101 @@ Conversation ![ScreenShot](https://raw.githubusercontent.com/blopa/Magento-Chatbot/master/screenshots/conversation.jpg) ## Release Notes +- **v0.0.18:** + - Add missing cron file + - Fix module version - **v0.0.17:** - - Add Abandoned Cart messages - - Enable all types of products to be listed - - Update module license for MIT license + - Add Abandoned Cart messages + - Enable all types of products to be listed + - Update module license for MIT license - **v0.0.16:** - - Code improvements - - Fix flood of messages when disabling bot for human respond - - [Backend] Add module version to configuration - - Update wit.ai API version - - [Backend] Add options/commands to Welcome Message + - Code improvements + - Fix flood of messages when disabling bot for human respond + - [Backend] Add module version to configuration + - Update wit.ai API version + - [Backend] Add options/commands to Welcome Message - **v0.0.15:** - - First stable version - - Add option to ignore certain messages using Default Replies - - Add Customer Chat ID to message for support - - Add module tables update from previous versions + - First stable version + - Add option to ignore certain messages using Default Replies + - Add Customer Chat ID to message for support + - Add module tables update from previous versions - **v0.0.14:** - - Fix problem when setting Telegram Webhook - - Fix problem when sending message between different chat plataforms - - Fix small translation problems - - Code improvements + - Fix problem when setting Telegram Webhook + - Fix problem when sending message between different chat plataforms + - Fix small translation problems + - Code improvements - **v0.0.13:** - - Code improvements - - Add admin commands listing on Telegram - - Fix problem when receiving 503 from wit.ai - - [Backend] Add option to disable Bot replies on Facebook (good for when a you need to reply on Page Messages) - - [Backend] Add option to open Messenger Box with referral - - [Backend] Add option to write the customer name in a message using "{customername}" - - Default Replies are now able to send big texts - - Order listing now uses Facebook Receipt layout + - Code improvements + - Add admin commands listing on Telegram + - Fix problem when receiving 503 from wit.ai + - [Backend] Add option to disable Bot replies on Facebook (good for when a you need to reply on Page Messages) + - [Backend] Add option to open Messenger Box with referral + - [Backend] Add option to write the customer name in a message using "{customername}" + - Default Replies are now able to send big texts + - Order listing now uses Facebook Receipt layout - **v0.0.12:** - - Fix command alias - - Fix list categories command glitch - - Fix some other small glitches - - Code improvements - - Add Facebook Live Chat on store frontend - - [Customer] Speech recognition for Telegram - - [Backend] Option to enable/disable speech recognition - - [Backend] Layout improvements + - Fix command alias + - Fix list categories command glitch + - Fix some other small glitches + - Code improvements + - Add Facebook Live Chat on store frontend + - [Customer] Speech recognition for Telegram + - [Backend] Option to enable/disable speech recognition + - [Backend] Layout improvements - **v0.0.11:** - - Fix logout command glitch - - Fix some other small glitches - - Code improvements - - Fix problem when replying a customer on support mode - - [Backend] Integration with wit.ai - - [Backend] Use wit.ai as match for a default reply - - [Customer] Add option do enable/disable receiving promotional messages + - Fix logout command glitch + - Fix some other small glitches + - Code improvements + - Fix problem when replying a customer on support mode + - [Backend] Integration with wit.ai + - [Backend] Use wit.ai as match for a default reply + - [Customer] Add option do enable/disable receiving promotional messages - **v0.0.10:** - - [Backend] Add option to match a 'default reply' as a command - - [Backend] Add default fallback message - - [Backend] Add option to disable Telegram inline search + - [Backend] Add option to match a 'default reply' as a command + - [Backend] Add default fallback message + - [Backend] Add option to disable Telegram inline search - **v0.0.9:** - - [Customer] Add inline search for Telegram - - Add price to product listing on Telegram - - Fix category buttons listing glitch on Telegram - - Fix regex validation - - Fix webhook security issue - - New webhook URL + - [Customer] Add inline search for Telegram + - Add price to product listing on Telegram + - Fix category buttons listing glitch on Telegram + - Fix regex validation + - Fix webhook security issue + - New webhook URL - **v0.0.8:** - - [Backend] Add "starts with", "ends with", "contains", "equals to" and "regex" options to Default Replies - - [Backend] Better backend layout - - [Backend] Better way to enable/disable commands + - [Backend] Add "starts with", "ends with", "contains", "equals to" and "regex" options to Default Replies + - [Backend] Better backend layout + - [Backend] Better way to enable/disable commands - **v0.0.7:** - - [Backend] Fix problems with URL - - [Customer] Add register command - - Add Chinese translation (big thanks to [leedssheung](https://github.com/leedssheung/)) - - Show command list on "help" instead of "about" - - Fix buttons size on Telegram when listing categories - - [Backend] Add option to stop processing when sending a default reply + - [Backend] Fix problems with URL + - [Customer] Add register command + - Add Chinese translation (big thanks to [leedssheung](https://github.com/leedssheung/)) + - Show command list on "help" instead of "about" + - Fix buttons size on Telegram when listing categories + - [Backend] Add option to stop processing when sending a default reply - **v0.0.6:** - - [Backend] Better admin descriptions and typos + - [Backend] Better admin descriptions and typos - **v0.0.5:** - - [Backend] Add Default Replies - - [Backend] Add option to unavailability message - - Better feedback messages + - [Backend] Add Default Replies + - [Backend] Add option to unavailability message + - Better feedback messages - **v0.0.4:** - - Fix glitch on order listing - - Fix glitchs with product search and category listing - - Better feedback messages - - [Customer] Add logout command - - [Admin] Add feature to send message to all customers - - [Admin] Add option to enable/disable support for a customer + - Fix glitch on order listing + - Fix glitchs with product search and category listing + - Better feedback messages + - [Customer] Add logout command + - [Admin] Add feature to send message to all customers + - [Admin] Add option to enable/disable support for a customer - **v0.0.3:** - - Limit products/orders listing - - Add stock validation for listing - - [Backend] Add option to enable/disable empty categories listing - - [Customer] Add search by SKU + - Limit products/orders listing + - Add stock validation for listing + - [Backend] Add option to enable/disable empty categories listing + - [Customer] Add search by SKU - **v0.0.2:** - - Facebook integration - - [Admin] Cross platform messages with support mode + - Facebook integration + - [Admin] Cross platform messages with support mode - **v0.0.1:** - - Telegram integration - - First working version + - Telegram integration + - First working version ## F.A.Q. @@ -249,23 +252,23 @@ A: Thank you! You can help by codding more features, creating pull requests, or ## TODO - **Integrations:** - - Whatsapp - - WeChat - - Microsoft Bot Framework / Skype - - ??? + - Whatsapp + - WeChat + - Microsoft Bot Framework / Skype + - ??? - **Features:** - - Add message queueing - - Documentation / Tutorials / Videos - - Add a custom in-store message chat app - - Save support history - - Support for audio commands - - Better uses for wit.ai - - Force a command for a customer - - Integrate checkout to Facebook Payment API - - Save messages on database before sending to make sure it will be sent eventually - - Add "Add to cart" feature for configurable products and products with custom options - - Better approach for Abandoned Carts - - Add `CDATA` and `` to configuration descriptions + - Add message queueing + - Documentation / Tutorials / Videos + - Add a custom in-store message chat app + - Save support history + - Support for audio commands + - Better uses for wit.ai + - Force a command for a customer + - Integrate checkout to Facebook Payment API + - Save messages on database before sending to make sure it will be sent eventually + - Add "Add to cart" feature for configurable products and products with custom options + - Better approach for Abandoned Carts + - Add `CDATA` and `` to configuration descriptions ## License Free. Don't forget to star :D and send pull requests. :D diff --git a/Magento1_deprecated/app/code/community/Werules/Chatbot/Model/Cron.php b/Magento1_deprecated/app/code/community/Werules/Chatbot/Model/Cron.php new file mode 100644 index 0000000..51407e0 --- /dev/null +++ b/Magento1_deprecated/app/code/community/Werules/Chatbot/Model/Cron.php @@ -0,0 +1,69 @@ +getCollection(); + foreach($chatbotCollection as $chatbot) + { + //$hasQuote = $chatbot->getSessionId() && $chatbot->getQuoteId(); // has class quote and session ids + $enabled = // if backend promotional messages are disabled or if the customer wants to receive promotional messages + (Mage::getStoreConfig('chatbot_enable/general_config/disable_promotional_messages') != "1") || + ($chatbot->getEnablePromotionalMessages() == "1"); + $customer = Mage::getModel('customer/customer')->load((int)$chatbot->getCustomerId()); + if (($customer->getId()) && ($enabled)) // if is a valid customer id + { + $fbChatId = $chatbot->getFacebookChatId(); + $tgChatId = $chatbot->getTelegramChatId(); + $customerId = $customer->getId(); + $lifetime = (int)Mage::getStoreConfig('chatbot_enable/general_config/abandoned_cart_days'); + //$lifetime = 7; + $quotes = Mage::getModel( 'sales/quote' )->getCollection(); + $quotes->addFieldToFilter('customer_id', $customerId) + //->addFieldToFilter('is_active', 1) + ->addFieldToFilter('updated_at', array('to' => date("Y-m-d", time() - ($lifetime * 86400)))) + ; + if (count($quotes) > 0) // TODO + { + $enableFb = Mage::getStoreConfig('chatbot_enable/facebook_config/enable_abandoned_cart'); + $enableTg = Mage::getStoreConfig('chatbot_enable/telegram_config/enable_abandoned_cart'); + + if ($enableFb == "1") // messenger + { + $message = Mage::getStoreConfig('chatbot_enable/facebook_config/abandoned_cart_msg'); + if ($message != "") + { + $apikey = Mage::getStoreConfig('chatbot_enable/facebook_config/facebook_api_key'); + $facebook = new MessengerBot($apikey); + $facebook->postMessage($fbChatId, $message); + } + } + if ($enableTg == "1") // telegram + { + $message = Mage::getStoreConfig('chatbot_enable/telegram_config/abandoned_cart_msg'); + if ($message != "") + { + $apikey = Mage::getStoreConfig('chatbot_enable/telegram_config/telegram_api_key'); + $facebook = new TelegramBot($apikey); + $facebook->postMessage($tgChatId, $message); + } + } + } +// foreach($quotes as $quote) +// { +// $orders = Mage::getModel('sales/order')->getCollection(); +// $orders->addFieldToFilter('quote_id', $quote->getId()); +// $items = Mage::getModel('sales/quote_item') +// ->getCollection() +// ->setQuote($quote); +// } + } + } + } +} diff --git a/Magento1_deprecated/app/code/community/Werules/Chatbot/etc/config.xml b/Magento1_deprecated/app/code/community/Werules/Chatbot/etc/config.xml index 4b7a1b8..355784e 100644 --- a/Magento1_deprecated/app/code/community/Werules/Chatbot/etc/config.xml +++ b/Magento1_deprecated/app/code/community/Werules/Chatbot/etc/config.xml @@ -2,7 +2,7 @@ - 0.0.16 + 0.0.18 diff --git a/Magento1_deprecated/app/code/community/Werules/Chatbot/etc/system.xml b/Magento1_deprecated/app/code/community/Werules/Chatbot/etc/system.xml index 9b671ad..3b8f468 100644 --- a/Magento1_deprecated/app/code/community/Werules/Chatbot/etc/system.xml +++ b/Magento1_deprecated/app/code/community/Werules/Chatbot/etc/system.xml @@ -23,7 +23,7 @@ 1 1 1 - Magento Chatbot v0.0.16

To Use This Module You'll Need to Have SSL Enabled in Your Store.

]]>
+ Magento Chatbot v0.0.18

To Use This Module You'll Need to Have SSL Enabled in Your Store.

]]>
diff --git a/README.md b/README.md index f396a40..8ba5e9a 100644 --- a/README.md +++ b/README.md @@ -112,10 +112,13 @@ Go to **System > General Settings > Chatbot Settings** - Much more ### Magento1 #### Deprecated versions +- **v0.0.18:** + - Add missing cron file + - Fix module version - **v0.0.17:** - - Add Abandoned Cart messages - - Enable all types of products to be listed - - Update module license for MIT license + - Add Abandoned Cart messages + - Enable all types of products to be listed + - Update module license for MIT license - **v0.0.16:** - Code improvements - Fix flood of messages when disabling bot for human respond