Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/version 0.0.2 #2

Merged
merged 25 commits into from
Feb 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b0ecd97
start working on v0.0.2
blopa Feb 12, 2017
5fd7a3c
add message ID to database
blopa Feb 15, 2017
ef6ac36
fix dual message glitch, include code into proper condition and fix g…
blopa Feb 15, 2017
9faff9d
add proper response code 200 to telegram
blopa Feb 15, 2017
029da50
update telegram api wrapper
blopa Feb 15, 2017
f41fb43
using facebook api bot
blopa Feb 19, 2017
9da3427
add a quickfix
blopa Feb 19, 2017
4a81824
begin codding facebook requests + some minor fixs on telegram
blopa Feb 19, 2017
574dbc4
fix typo on apitype
blopa Feb 19, 2017
a8e42bf
facebook configured and responding
blopa Feb 19, 2017
228746b
Add about command to facebook
blopa Feb 19, 2017
8009f96
add condition to start processing data, add witAI api and command lists
blopa Feb 21, 2017
4ef350f
using root layout to output facebook challenge hub
blopa Feb 22, 2017
3a77226
Add list categories and products option to facebook
blopa Feb 23, 2017
9ec0f9b
better way to configure commands
blopa Feb 25, 2017
09f90c8
overriting adminhtml/system_config_backend_serialized_array
blopa Feb 25, 2017
1b5b95a
better way to configure commands now working with telegram and facebook
blopa Feb 25, 2017
4ded98a
Cleaning code structure
blopa Feb 25, 2017
65e14de
command alias working on facebook
blopa Feb 25, 2017
c9a3d26
add to cart and checking working on facebook and add log option
blopa Feb 25, 2017
246c1fd
copy all cases from telegram class
blopa Feb 25, 2017
909183b
handling cross plataform messages
blopa Feb 25, 2017
94c0db4
cross platform messages working
blopa Feb 26, 2017
d32a9a2
enable only one support for client
blopa Feb 26, 2017
7534469
fixes on settings page
blopa Feb 26, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions app/code/community/Werules/Chatbot/Block/Commands.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
class Werules_Chatbot_Block_Commands extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
{
protected $_itemRenderer;

public function _prepareToRender()
{
$this->addColumn('command_id', array(
'label' => Mage::helper('core')->__('Command'),
'renderer' => $this->_getRenderer()
));
$this->addColumn('command_code', array(
'label' => Mage::helper('core')->__('Command Code'),
'style' => 'width: 150px'
));
$this->addColumn('command_alias_list', array(
'label' => Mage::helper('core')->__('Alias'),
'style' => 'width: 250px'
));

$this->_addAfter = false;
$this->_addButtonLabel = Mage::helper('core')->__('Add');
}

protected function _getRenderer()
{
if (!$this->_itemRenderer)
{
$this->_itemRenderer = $this->getLayout()->createBlock(
'werules_chatbot/commandsSelect',
'',
array('is_render_to_js_template' => true)
)->setExtraParams("style='width: auto;'");
}
return $this->_itemRenderer;
}

protected function _prepareArrayRow(Varien_Object $row)
{
$row->setData(
'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('command_id')),
'selected="selected"'
);
}
}
19 changes: 19 additions & 0 deletions app/code/community/Werules/Chatbot/Block/CommandsSelect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
class Werules_Chatbot_Block_CommandsSelect extends Mage_Core_Block_Html_Select
{
public function _toHtml()
{
$options = Mage::getSingleton('chatbot/options')->toOptionArray();
foreach ($options as $option)
{
$this->addOption($option['value'], $option['label']);
}

return parent::_toHtml();
}

public function setInputName($value)
{
return $this->setName($value);
}
}
35 changes: 35 additions & 0 deletions app/code/community/Werules/Chatbot/Model/Adminhtml/Serialized.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

class Werules_Chatbot_Model_Adminhtml_Serialized extends Mage_Adminhtml_Model_System_Config_Backend_Serialized
{
protected function _afterLoad()
{
if (!is_array($this->getValue())) {
$serializedValue = $this->getValue();
$unserializedValue = false;
if (!empty($serializedValue)) {
try {
$unserializedValue = Mage::helper('core/unserializeArray')
->unserialize((string)$serializedValue); // fix magento unserializing bug
} catch (Exception $e) {
Mage::logException($e);
}
}
$this->setValue($unserializedValue);
}
}

protected function _beforeSave()
{
$value = $this->getValue();
if (is_array($value)) {
unset($value['__empty']);
}
$this->setValue($value);

if (is_array($this->getValue()))
{
$this->setValue(serialize($this->getValue()));
}
}
}
Loading