logicbroker - Version 1.0.0

Version Notes

Stable

Download this release

Release Info

Developer Logicbroker
Extension logicbroker
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (38) hide show
  1. app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/Logicbroker.php +19 -0
  2. app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/Logicbroker/Edit.php +100 -0
  3. app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/Logicbroker/Edit/Form.php +26 -0
  4. app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/Logicbroker/Edit/Tab/Form.php +176 -0
  5. app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/Logicbroker/Edit/Tabs.php +32 -0
  6. app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/Logicbroker/Grid.php +129 -0
  7. app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/System/Config/Fieldset/Hint.php +134 -0
  8. app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/System/Config/Submitbutton.php +100 -0
  9. app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/Widget/Grid/Column/Renderer/Textaction.php +37 -0
  10. app/code/community/Logicbroker/Fulfillment/Helper/Data.php +17 -0
  11. app/code/community/Logicbroker/Fulfillment/Model/Abstract.php +21 -0
  12. app/code/community/Logicbroker/Fulfillment/Model/Apicreate.php +14 -0
  13. app/code/community/Logicbroker/Fulfillment/Model/Email.php +71 -0
  14. app/code/community/Logicbroker/Fulfillment/Model/Excelxml.php +202 -0
  15. app/code/community/Logicbroker/Fulfillment/Model/Infromlogicbroker.php +15 -0
  16. app/code/community/Logicbroker/Fulfillment/Model/Logicbroker.php +367 -0
  17. app/code/community/Logicbroker/Fulfillment/Model/Observer.php +47 -0
  18. app/code/community/Logicbroker/Fulfillment/Model/Resource/Supplier.php +16 -0
  19. app/code/community/Logicbroker/Fulfillment/Model/Resource/Supplier/Collection.php +20 -0
  20. app/code/community/Logicbroker/Fulfillment/Model/Supplier.php +126 -0
  21. app/code/community/Logicbroker/Fulfillment/Model/Synchronize.php +45 -0
  22. app/code/community/Logicbroker/Fulfillment/Model/System/Config/Source/Attributecodes.php +31 -0
  23. app/code/community/Logicbroker/Fulfillment/Model/System/Config/Source/Ediqualifier.php +70 -0
  24. app/code/community/Logicbroker/Fulfillment/Model/System/Config/Source/Optionvalues.php +66 -0
  25. app/code/community/Logicbroker/Fulfillment/controllers/Adminhtml/LogicbrokerController.php +193 -0
  26. app/code/community/Logicbroker/Fulfillment/data/logicbroker_setup/data-install-1.0.0.php +51 -0
  27. app/code/community/Logicbroker/Fulfillment/etc/adminhtml.xml +42 -0
  28. app/code/community/Logicbroker/Fulfillment/etc/config.xml +139 -0
  29. app/code/community/Logicbroker/Fulfillment/etc/jstranslator.xml +35 -0
  30. app/code/community/Logicbroker/Fulfillment/etc/system.xml +413 -0
  31. app/code/community/Logicbroker/Fulfillment/sql/logicbroker_setup/mysql4-install-1.0.0.php +54 -0
  32. app/design/adminhtml/default/default/layout/logicbroker.xml +8 -0
  33. app/design/adminhtml/default/default/template/logicbroker/system/config/fieldset/hint.phtml +48 -0
  34. app/design/adminhtml/default/default/template/logicbroker/system/config/submitbutton.phtml +125 -0
  35. app/etc/modules/Logicbroker_Fulfillment.xml +10 -0
  36. app/locale/en_US/Logicbroker_Fulfillment.csv +2 -0
  37. app/locale/en_US/template/email/logicbroker.html +17 -0
  38. package.xml +18 -0
app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/Logicbroker.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+ class Logicbroker_Fulfillment_Block_Adminhtml_Logicbroker extends Mage_Adminhtml_Block_Widget_Grid_Container
10
+ {
11
+ public function __construct()
12
+ {
13
+ $this->_controller = 'adminhtml_logicbroker';
14
+ $this->_blockGroup = 'logicbroker';
15
+ $this->_headerText = Mage::helper('logicbroker')->__('Vendor Manager');
16
+ $this->_addButtonLabel = Mage::helper('logicbroker')->__('Add Vendor');
17
+ parent::__construct();
18
+ }
19
+ }
app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/Logicbroker/Edit.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Block_Adminhtml_Logicbroker_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
11
+ {
12
+ public function __construct()
13
+ {
14
+
15
+
16
+ $this->_objectId = 'vendor_id';
17
+ $this->_blockGroup = 'logicbroker';
18
+ $this->_controller = 'adminhtml_logicbroker';
19
+ parent::__construct();
20
+
21
+ $this->_updateButton('save', 'label', Mage::helper('logicbroker')->__('Save Vendor'));
22
+ $this->_updateButton('delete', 'label', Mage::helper('logicbroker')->__('Delete Vendor'));
23
+
24
+ $this->_addButton('saveandcontinue', array(
25
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
26
+ 'onclick' => 'saveAndContinueEdit()',
27
+ 'class' => 'save',
28
+ ), -100);
29
+ $this->_removeButton('delete');
30
+ $this->_removeButton('reset');
31
+ $script = $isUpdate='';
32
+ if( Mage::registry('logicbroker_data') && Mage::registry('logicbroker_data')->getVendorId() )
33
+ {
34
+ $isUpdate = "if($('is_update')) $('is_update').value = '1';";
35
+ }
36
+
37
+ if(Mage::getModel('logicbroker/supplier')->isVendorSubmitted())
38
+ {
39
+ $message = '<p><ul class="messages"><li class="error-msg"><ul><li><span>'.$this->__('You have unsubmitted changes.').'</span></li></ul></li></ul></p>';
40
+ $script = "$$('.main-col-inner .content-header')[0].insert({after:'{$message}'});";
41
+ }
42
+ $vendorAttributeId = Mage::getModel('logicbroker/supplier')->getVendorAttributeId();
43
+ $link = Mage::helper('logicbroker')->getConfigObject('apiconfig/helpurl/link');
44
+
45
+ $string = 'Enter new code here';
46
+ //$blank = '';
47
+ $this->_formScripts[] = "
48
+ {$isUpdate}
49
+ {$script}
50
+ $('need_help').href = '{$link}';
51
+ $('need_help').target = '_blank';
52
+ $('need_help').insert('Contact Us');
53
+ function saveAndContinueEdit(){
54
+ editForm.submit($('edit_form').action+'back/edit/');
55
+ }
56
+
57
+ $('magento_vendor_attribute_id').value = '{$vendorAttributeId}';
58
+ function checkisnew(value){
59
+ if(value == 'addnew' && $('add_new_option') == null)
60
+ {
61
+ $('magento_vendor_code').insert({
62
+ after: new Element('input', {type: 'text',
63
+ name:'addnewoption',class:'input-text',id:'add_new_option',value:'{$string}',
64
+ onfocus:'if(this.value==\"{$string}\"){this.value=\"\"; this.addClassName(\"required-entry\")}; '
65
+ })
66
+ });
67
+ Form.Element.focus('add_new_option');
68
+ }else
69
+ {
70
+ if($('add_new_option'))
71
+ {
72
+ $('add_new_option').remove();
73
+
74
+ }
75
+ if($('advice-required-entry-add_new_option'))
76
+ {
77
+ $('advice-required-entry-add_new_option').remove();
78
+ }
79
+ }
80
+ }
81
+ Validation.addAllThese([
82
+
83
+ ['validate-ftp-url-logicbroker', 'Please enter a valid URL. Protocol is required (ftp://, ftps:// )', function (v) {
84
+ v = (v || '').replace(/^\s+/, '').replace(/\s+$/, '');
85
+ return Validation.get('IsEmpty').test(v) || /^(ftp|ftps):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(v)
86
+ }]
87
+ ]);
88
+ ";
89
+ }
90
+
91
+ public function getHeaderText()
92
+ {
93
+ if( Mage::registry('logicbroker_data') && Mage::registry('logicbroker_data')->getVendorId() ) {
94
+ return Mage::helper('logicbroker')->__("Edit Vendor", $this->htmlEscape(Mage::registry('logicbroker_data')->getTitle()));
95
+ } else {
96
+ return Mage::helper('logicbroker')->__('Add Vendor');
97
+ }
98
+ }
99
+
100
+ }
app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/Logicbroker/Edit/Form.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Block_Adminhtml_Logicbroker_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ protected function _prepareForm()
13
+ {
14
+ $form = new Varien_Data_Form(array(
15
+ 'id' => 'edit_form',
16
+ 'action' => $this->getUrl('*/*/save', array('vendor_id' => $this->getRequest()->getParam('vendor_id'))),
17
+ 'method' => 'post',
18
+ 'enctype' => 'multipart/form-data'
19
+ )
20
+ );
21
+
22
+ $form->setUseContainer(true);
23
+ $this->setForm($form);
24
+ return parent::_prepareForm();
25
+ }
26
+ }
app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/Logicbroker/Edit/Tab/Form.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Block_Adminhtml_Logicbroker_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+
13
+ protected function _prepareForm()
14
+ {
15
+ $form = new Varien_Data_Form();
16
+ $this->setForm($form);
17
+ $fieldset = $form->addFieldset('logicbroker_form', array('legend'=>Mage::helper('logicbroker')->__('Vendor Information')));
18
+ //$data = $form->setValues(Mage::registry('logicbroker_data')->getData());
19
+
20
+ $fieldset->addField('is_update', 'hidden', array(
21
+ 'name' => 'is_update',
22
+ ));
23
+ $fieldset->addField('company_id', 'text', array(
24
+ 'label' => Mage::helper('logicbroker')->__('logicbroker Company ID'),
25
+ 'name' => 'company_id',
26
+ 'note'=>'From the logicbroker portal - optional if you do not have an account'
27
+
28
+ ));
29
+ $fieldset->addField('address1', 'text', array(
30
+ 'label' => Mage::helper('logicbroker')->__('Address 1'),
31
+ 'class' => 'required-entry',
32
+ 'required' => true,
33
+ 'name' => 'address1',
34
+ ));
35
+ $fieldset->addField('address2', 'text', array(
36
+ 'label' => Mage::helper('logicbroker')->__('Address 2'),
37
+ 'name' => 'address2',
38
+ ));
39
+ $fieldset->addField('city', 'text', array(
40
+ 'label' => Mage::helper('logicbroker')->__('City'),
41
+ 'class' => 'required-entry',
42
+ 'required' => true,
43
+ 'name' => 'city',
44
+ ));
45
+ $fieldset->addField('state', 'text', array(
46
+ 'label' => Mage::helper('logicbroker')->__('State'),
47
+ 'class' => 'required-entry',
48
+ 'required' => true,
49
+ 'name' => 'state',
50
+ ));
51
+ $fieldset->addField('zip', 'text', array(
52
+ 'label' => Mage::helper('logicbroker')->__('Zip'),
53
+ 'class' => 'required-entry validate-digits',
54
+ 'required' => true,
55
+ 'name' => 'zip',
56
+ ));
57
+ $fieldset->addField('country', 'select', array(
58
+ 'label' => Mage::helper('logicbroker')->__('Country'),
59
+ 'class' => 'required-entry validate-select',
60
+ 'required' => true,
61
+ 'name' => 'country',
62
+ 'values' => Mage::getModel('adminhtml/system_config_source_country')->toOptionArray(),
63
+ 'default' => ''
64
+ ));
65
+ $fieldset->addField('edi_qualifier', 'select', array(
66
+ 'label' => Mage::helper('logicbroker')->__('EDI Qualifier'),
67
+ 'class' => 'required-entry validate-select',
68
+ 'required' => true,
69
+ 'name' => 'edi_qualifier',
70
+ 'values' => Mage::getModel('logicbroker/system_config_source_ediqualifier')->toOptionArray(),
71
+ 'default' => ''
72
+ ));
73
+ $fieldset->addField('edi_identifier', 'text', array(
74
+ 'label' => Mage::helper('logicbroker')->__('EDI Identifier'),
75
+ 'class' => 'required-entry',
76
+ 'required' => true,
77
+ 'name' => 'edi_identifier',
78
+ ));
79
+
80
+ $fieldset->addField('magento_vendor_attribute_id', 'hidden', array(
81
+ 'name' => 'magento_vendor_attribute_id',
82
+
83
+
84
+ ));
85
+ $fieldset->addField('magento_vendor_code', 'select', array(
86
+ 'label' => Mage::helper('logicbroker')->__('Vendor Code'),
87
+ 'class' => 'required-entry validate-select',
88
+ 'required' => true,
89
+ 'onchange' => 'checkisnew(value)',
90
+ 'name' => 'magento_vendor_code',
91
+ 'values' => Mage::getModel('logicbroker/system_config_source_Optionvalues')->toOptionArray(),
92
+ 'default' => ''
93
+ ));
94
+ $fieldset->addField('file_directory_inbound', 'text', array(
95
+ 'label' => Mage::helper('logicbroker')->__('File Directory Inbound'),
96
+ 'class' => 'required-entry',
97
+ 'required' => true,
98
+ 'name' => 'file_directory_inbound',
99
+ ));
100
+ $fieldset->addField('file_directory_outbound', 'text', array(
101
+ 'label' => Mage::helper('logicbroker')->__('File Directory Outbound'),
102
+ 'class' => 'required-entry',
103
+ 'required' => true,
104
+ 'name' => 'file_directory_outbound',
105
+ ));
106
+ $fieldset->addField('ftp_address', 'text', array(
107
+ 'label' => Mage::helper('logicbroker')->__('FTP Address'),
108
+ 'class' => 'required-entry validate-ftp-url-logicbroker',
109
+ 'required' => true,
110
+ 'name' => 'ftp_address',
111
+ ));
112
+ $fieldset->addField('ftp_username', 'text', array(
113
+ 'label' => Mage::helper('logicbroker')->__('FTP Username'),
114
+ 'class' => 'required-entry',
115
+ 'required' => true,
116
+ 'name' => 'ftp_username',
117
+ ));
118
+ $fieldset->addField('ftp_password', 'password', array(
119
+ 'label' => Mage::helper('logicbroker')->__('FTP Password'),
120
+ 'class' => 'required-entry',
121
+ 'required' => true,
122
+ 'name' => 'ftp_password',
123
+ ));
124
+ $fieldset->addField('ftp_protocol', 'select', array(
125
+ 'label' => Mage::helper('logicbroker')->__('FTP Protocol'),
126
+ 'class' => 'required-entry validate-select',
127
+ 'required' => true,
128
+ 'name' => 'ftp_protocol',
129
+ 'values' =>array(
130
+ array('value' => '', 'label'=>Mage::helper('adminhtml')->__('')),
131
+ array('value' => 'ftp', 'label'=>Mage::helper('adminhtml')->__('FTP')),
132
+ array('value' => 'ftpes', 'label'=>Mage::helper('adminhtml')->__('FTPES')),
133
+ ),
134
+
135
+ ));
136
+ $fieldset->addField('firstname', 'text', array(
137
+ 'label' => Mage::helper('logicbroker')->__('Contact First Name'),
138
+ 'class' => 'required-entry',
139
+ 'required' => true,
140
+ 'name' => 'firstname',
141
+ ));
142
+ $fieldset->addField('lastname', 'text', array(
143
+ 'label' => Mage::helper('logicbroker')->__('Contact Last Name'),
144
+ 'class' => 'required-entry',
145
+ 'required' => true,
146
+ 'name' => 'lastname',
147
+ ));
148
+ $fieldset->addField('email', 'text', array(
149
+ 'label' => Mage::helper('logicbroker')->__('Contact Email'),
150
+ 'class' => 'required-entry validate-email',
151
+ 'required' => true,
152
+ 'name' => 'email',
153
+ ));
154
+ $fieldset->addField('phone', 'text', array(
155
+ 'label' => Mage::helper('logicbroker')->__('Contact Phone'),
156
+ 'class' => 'required-entry validate-phoneStrict',
157
+ 'required' => true,
158
+ 'name' => 'phone',
159
+ ));
160
+
161
+ $fieldset->addField('need_help', 'link', array(
162
+ 'label' => $this->__('Need Help?'),
163
+ 'value' => ''
164
+
165
+ ));
166
+
167
+ if ( Mage::getSingleton('adminhtml/session')->getLogicbrokerData() )
168
+ {
169
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getLogicbrokerData());
170
+ Mage::getSingleton('adminhtml/session')->setLogicbrokerData(null);
171
+ } elseif ( Mage::registry('logicbroker_data') ) {
172
+ $form->setValues(Mage::registry('logicbroker_data')->getData());
173
+ }
174
+ return parent::_prepareForm();
175
+ }
176
+ }
app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/Logicbroker/Edit/Tabs.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Block_Adminhtml_Logicbroker_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
11
+ {
12
+
13
+
14
+ public function __construct()
15
+ {
16
+ parent::__construct();
17
+ $this->setId('logicbroker_tabs');
18
+ $this->setDestElementId('edit_form');
19
+ $this->setTitle(Mage::helper('logicbroker')->__('Vendor Information'));
20
+ }
21
+
22
+ protected function _beforeToHtml()
23
+ {
24
+ $this->addTab('form_section', array(
25
+ 'label' => Mage::helper('logicbroker')->__('Vendor Information'),
26
+ 'title' => Mage::helper('logicbroker')->__('Vendor Information'),
27
+ 'content' => $this->getLayout()->createBlock('logicbroker/adminhtml_logicbroker_edit_tab_form')->toHtml(),
28
+ ));
29
+
30
+ return parent::_beforeToHtml();
31
+ }
32
+ }
app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/Logicbroker/Grid.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Block_Adminhtml_Logicbroker_Grid extends Mage_Adminhtml_Block_Widget_Grid
11
+ {
12
+ public function __construct()
13
+ {
14
+ parent::__construct();
15
+ $this->setId('logicbrokergrid');
16
+ $this->setDefaultSort('vendor_id');
17
+ $this->setDefaultDir('ASC');
18
+ $this->setUseAjax(true);
19
+ $this->setSaveParametersInSession(true);
20
+ }
21
+
22
+ protected function _prepareCollection()
23
+ {
24
+ $collection = Mage::getModel('logicbroker/supplier')->getCollection()->addFieldToFilter('status',array('neq'=>'deleted'));
25
+ $this->setCollection($collection);
26
+ return parent::_prepareCollection();
27
+ }
28
+
29
+ protected function _prepareColumns()
30
+ {
31
+ $this->addColumn('vendor_id', array(
32
+ 'header' => Mage::helper('logicbroker')->__('Magento Id'),
33
+ 'align' =>'right',
34
+ 'width' => '50px',
35
+ 'index' => 'vendor_id',
36
+ ));
37
+ $this->addColumn('company_id', array(
38
+ 'header' => Mage::helper('logicbroker')->__('logicbroker Id'),
39
+ 'align' =>'right',
40
+ 'width' => '50px',
41
+ //'type' => 'text',
42
+ 'index' => 'company_id',
43
+ //'options' => Mage::getModel('logicbroker/supplier')->getCompanyids(),
44
+ ));
45
+ $this->addColumn('address1', array(
46
+ 'header' => Mage::helper('logicbroker')->__('Address'),
47
+ 'align' =>'right',
48
+ 'width' => '50px',
49
+ 'index' => 'address1',
50
+ ));
51
+
52
+ $this->addColumn('magento_vendor_code', array(
53
+ 'header' => Mage::helper('logicbroker')->__('Vendor Attribute Value'),
54
+ 'align' =>'left',
55
+ 'width' => '80px',
56
+ 'index' => 'magento_vendor_code',
57
+ ));
58
+
59
+ $this->addColumn('firstname', array(
60
+ 'header' => Mage::helper('logicbroker')->__('Firstname'),
61
+ 'align' =>'left',
62
+ 'width' => '80px',
63
+ 'index' => 'firstname',
64
+ ));
65
+
66
+ $this->addColumn('lastname', array(
67
+ 'header' => Mage::helper('logicbroker')->__('Lastname'),
68
+ 'align' =>'left',
69
+ 'width' => '80px',
70
+ 'index' => 'lastname',
71
+ ));
72
+
73
+ $this->addColumn('email', array(
74
+ 'header' => Mage::helper('logicbroker')->__('Email'),
75
+ 'align' =>'left',
76
+ 'width' => '80px',
77
+ 'index' => 'email',
78
+ ));
79
+ $this->addColumn('phone', array(
80
+ 'header' => Mage::helper('logicbroker')->__('Phone'),
81
+ 'align' =>'left',
82
+ 'width' => '80px',
83
+ 'index' => 'phone',
84
+ ));
85
+
86
+ $this->addColumn('action',
87
+ array(
88
+ 'header' => Mage::helper('logicbroker')->__('Action'),
89
+ 'width' => '100',
90
+ 'type' => 'textaction',
91
+ 'getter' => 'getVendorId',
92
+ 'actions' => array(
93
+ array(
94
+ 'caption' => Mage::helper('logicbroker')->__('edit'),
95
+ 'url' => array('base'=> '*/*/edit'),
96
+ 'field' => 'vendor_id'
97
+ ),
98
+ array(
99
+ 'caption' => Mage::helper('logicbroker')->__('delete'),
100
+ 'url' => array('base'=> '*/*/delete'),
101
+ 'field' => 'vendor_id',
102
+ 'confirm' =>'Are you sure to delete vendor?'
103
+
104
+ )
105
+ ),
106
+ 'filter' => false,
107
+ 'sortable' => false,
108
+ 'index' => 'stores',
109
+ 'is_system' => true,
110
+ 'renderer' => 'Logicbroker_Fulfillment_Block_Adminhtml_Widget_Grid_Column_Renderer_Textaction'
111
+ ));
112
+
113
+
114
+ $this->addExportType('*/*/exportCsv', Mage::helper('logicbroker')->__('CSV'));
115
+ $this->addExportType('*/*/exportXml', Mage::helper('logicbroker')->__('XML'));
116
+
117
+ return parent::_prepareColumns();
118
+ }
119
+
120
+ public function getRowUrl($row)
121
+ {
122
+ return $this->getUrl('*/*/edit', array('vendor_id' => $row->getVendorId()));
123
+ }
124
+ public function getGridUrl()
125
+ {
126
+ return $this->getUrl('*/*/grid', array('_current'=>true));
127
+ }
128
+
129
+ }
app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/System/Config/Fieldset/Hint.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Logicbroker
4
+ *
5
+ * @category Community
6
+ * @package Logicbroker_Fulfillment
7
+ */
8
+ class Logicbroker_Fulfillment_Block_Adminhtml_System_Config_Fieldset_Hint
9
+ extends Mage_Adminhtml_Block_Abstract
10
+ implements Varien_Data_Form_Element_Renderer_Interface
11
+ {
12
+ protected $_template = 'logicbroker/system/config/fieldset/hint.phtml';
13
+
14
+ /**
15
+ * Render fieldset html
16
+ *
17
+ * @param Varien_Data_Form_Element_Abstract $element
18
+ * @return string
19
+ */
20
+
21
+
22
+
23
+
24
+
25
+ public function getGroup($element = null)
26
+ {
27
+ if (is_null($element)) {
28
+ $element = $this->getElement();
29
+ }
30
+ if ($element && $element->getGroup() instanceof Mage_Core_Model_Config_Element) {
31
+ return $element->getGroup();
32
+ }
33
+
34
+ return new Mage_Core_Model_Config_Element('<config/>');
35
+ }
36
+
37
+ public function render(Varien_Data_Form_Element_Abstract $element)
38
+ {
39
+ //print_r($element->getElement('zip'));
40
+ $groupConfig = $this->getGroup($element)->asArray();
41
+ $html .= $this->genrateHtml($groupConfig['fields'],$element);
42
+ //print_r($element->getForm()->getElements());
43
+ $elementHtmlObject = $element->getElementHtml();
44
+ $elementOriginalData = $element->getOriginalData();
45
+ if (isset($elementOriginalData['page_heading'])) {
46
+ $this->setPageHeading($elementOriginalData['page_heading']);
47
+ }
48
+ if ($elementHtmlObject) {
49
+ $this->setHtmlSupplier($elementHtmlObject);
50
+ }
51
+
52
+ $html .= $this->toHtml();
53
+ return $html;
54
+ }
55
+
56
+ public function genrateHtml($fields,$element)
57
+ {
58
+ $html .= $this->_getHeaderHtml($element);
59
+ $html .= $this->_getContentHtml($fields);
60
+ $html .= $this->_getFooterHtml($element);
61
+
62
+ return $html;
63
+ }
64
+
65
+ public function _getContentHtml($fields)
66
+ {
67
+ foreach($fields as $key=>$val)
68
+ {
69
+ if($val['frontend_type'] == 'text')
70
+ {
71
+ $html .= $this->_getTextBoxHtml($key,$val);
72
+
73
+ }
74
+
75
+ if($val['frontend_type'] == 'select')
76
+ {
77
+ $html .= $this->_getSelectBoxHtml($key,$val);
78
+ }
79
+ }
80
+ return $html;
81
+ }
82
+
83
+ protected function _getHeaderHtml($element)
84
+ {
85
+ $html = '<h4 class="icon-head head-edit-form">'.$element->getLegend().'</h4>';
86
+ $html.= '<fieldset class="config" id="'.$element->getHtmlId().'">';
87
+ $html.= '<legend>'.$element->getLegend().'</legend>';
88
+
89
+ // field label column
90
+ $html.= '<table cellspacing="0"><colgroup class="label" /><colgroup class="value" />';
91
+ $html.= '<tbody>';
92
+
93
+ return $html;
94
+
95
+ }
96
+
97
+ protected function _getFooterHtml($element)
98
+ {
99
+ $html = '</tbody></table></fieldset>';
100
+ return $html;
101
+
102
+ }
103
+
104
+ protected function _getConfigurationValue($val)
105
+ {
106
+ return isset($val) ? $val:'';
107
+ }
108
+
109
+ protected function _getTextBoxHtml($key,$val)
110
+ {
111
+ return '<tr id="row_'.$key.'"><td class="label"><label for="'.$key.'">'.$this->_getConfigurationValue($val['label']).'</label></td><td class="value"><input id="'.$key.'" name="'.$key.'" value="" class="input-text '.$this->_getConfigurationValue($val['validate']).'" type="text"></td><td class=""></td></tr>';
112
+
113
+ /* return '<div id="row_'.$key.'"><div style="200px;float:left;" class="label"><label style="display: block;width: 185px;padding-right: 15px;padding-top: 1px;"for="'.$key.'">'.$this->_getConfigurationValue($val['label']).'</label></div><div style="300px"class="value"><input style="274px" id="'.$key.'" name="'.$key.'" value="" class="input-text '.$this->_getConfigurationValue($val['validate']).'" type="text">
114
+ </div></div><div clear="both"></div>';*/
115
+
116
+ }
117
+
118
+ protected function _getSelectBoxHtml($key,$val)
119
+ {
120
+ $optionArray = Mage::getSingleton("adminhtml/system_config_source_country")->toOptionArray();
121
+
122
+ foreach($optionArray as $code=>$label){
123
+ $optionHtml .= '<option value = "'.$label['value'].'">'.$label['label'].'</option>';
124
+
125
+ }
126
+
127
+ return '<tr id="row_'.$key.'"><td class="label"><label for="'.$key.'">'.$this->_getConfigurationValue($val['label']).'</label></td><td class="value"><select id="'.$key.'" name="'.$key.'" class=" select '.$this->_getConfigurationValue($val['validate']).'">'.$optionHtml.'</select></td><td class=""></td></tr>';
128
+ /*return '<div id="row_'.$key.'"><div class="label"><label for="'.$key.'">'.$this->_getConfigurationValue($val['label']).'</label></div><div class="value"><select id="'.$key.'" name="'.$key.'" class="select '.$this->_getConfigurationValue($val['validate']).'">'.$optionHtml.'
129
+ </select>
130
+ </div></div>';*/
131
+
132
+ }
133
+
134
+ }
app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/System/Config/Submitbutton.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Logicbroker
4
+ *
5
+ * @category Community
6
+ * @package Logicbroker_Fulfillment
7
+ */
8
+ class Logicbroker_Fulfillment_Block_Adminhtml_System_Config_Submitbutton
9
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
10
+ {
11
+ /*
12
+ * Set template
13
+ */
14
+ protected function _construct()
15
+ {
16
+ parent::_construct();
17
+ $this->setTemplate('logicbroker/system/config/submitbutton.phtml');
18
+ }
19
+
20
+ /**
21
+ * Remove scope label
22
+ *
23
+ * @param Varien_Data_Form_Element_Abstract $element
24
+ * @return string
25
+ */
26
+ public function render(Varien_Data_Form_Element_Abstract $element)
27
+ {
28
+ $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
29
+ return parent::render($element);
30
+ }
31
+
32
+ /**
33
+ * Return element html
34
+ *
35
+ * @param Varien_Data_Form_Element_Abstract $element
36
+ * @return string
37
+ */
38
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
39
+ {
40
+ return $this->_toHtml();
41
+ }
42
+
43
+ /**
44
+ * Return ajax url for synchronize button
45
+ *
46
+ * @return string
47
+ */
48
+ public function getAjaxSyncUrl()
49
+ {
50
+ return Mage::getUrl('logicbroker/adminhtml_logicbroker/validateajaxrequest');
51
+ }
52
+
53
+
54
+ /**
55
+ * Generate synchronize button html
56
+ *
57
+ * @return string
58
+ */
59
+ public function getSubmitButtonHtml()
60
+ {
61
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
62
+ ->setData(array(
63
+ 'id' => 'submit_button',
64
+ 'label' => $this->helper('adminhtml')->__('Submit to logicbroker '),
65
+ 'onclick' => 'javascript:synchronize(this.id); return false;',
66
+ 'style' => 'float:right'
67
+ ));
68
+
69
+ return $button->toHtml();
70
+ }
71
+
72
+ /**
73
+ * Generate Save button html
74
+ *
75
+ * @return string
76
+ */
77
+ public function getSaveButtonHtml()
78
+ {
79
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
80
+ ->setData(array(
81
+ 'id' => 'save_button',
82
+ 'label' => $this->helper('adminhtml')->__('Save for Later'),
83
+ 'onclick' => 'javascript:synchronize(this.id); return false;',
84
+
85
+ ));
86
+
87
+ return $button->toHtml();
88
+ }
89
+
90
+ public function getTermsAndConditionsUrl()
91
+ {
92
+ return Mage::helper('logicbroker')->getConfigObject('apiconfig/termsandconditions/link');
93
+ }
94
+
95
+ public function getHelpUrl()
96
+ {
97
+ return Mage::helper('logicbroker')->getConfigObject('apiconfig/helpurl/link');
98
+ }
99
+
100
+ }
app/code/community/Logicbroker/Fulfillment/Block/Adminhtml/Widget/Grid/Column/Renderer/Textaction.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml grid item renderer
5
+ *
6
+ * @category Orange
7
+ * @package Orange_Prepaidcards
8
+ * @author Anil Pawar <anilpa@cybage.com>
9
+ */
10
+
11
+ class Logicbroker_Fulfillment_Block_Adminhtml_Widget_Grid_Column_Renderer_Textaction extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
12
+ {
13
+
14
+ /**
15
+ * Renders column
16
+ *
17
+ * @param Varien_Object $row
18
+ * @return string
19
+ */
20
+ public function render(Varien_Object $row)
21
+ {
22
+ $actions = $this->getColumn()->getActions();
23
+ if ( empty($actions) || !is_array($actions) ) {
24
+ return '&nbsp;';
25
+ }
26
+ $out="";
27
+ if(!$this->getColumn()->getNoLink()) {
28
+ foreach ($actions as $action) {
29
+ if ( is_array($action) ) {
30
+ $out .= "&nbsp;&nbsp;&nbsp;".$this->_toLinkHtml($action, $row);
31
+ }
32
+ }
33
+ }
34
+ return $out;
35
+
36
+ }
37
+ }
app/code/community/Logicbroker/Fulfillment/Helper/Data.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ *
7
+ *
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Helper_Data extends Mage_Core_Helper_Abstract
11
+ {
12
+ public function getConfigObject($nodeName = null)
13
+ {
14
+ return trim(Mage::getConfig()->getNode($nodeName)->__toString());
15
+ }
16
+ }
17
+
app/code/community/Logicbroker/Fulfillment/Model/Abstract.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ abstract class Logicbroker_Fulfillment_Model_Abstract
11
+ {
12
+
13
+ public function send($attachment,$fieldSetData) {
14
+
15
+ }
16
+
17
+ public function prepareData($fieldsetData)
18
+ {
19
+
20
+ }
21
+ }
app/code/community/Logicbroker/Fulfillment/Model/Apicreate.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Model_Apicreate {
11
+ //put your code here
12
+ }
13
+
14
+ ?>
app/code/community/Logicbroker/Fulfillment/Model/Email.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Model_Email extends Logicbroker_Fulfillment_Model_Abstract{
11
+
12
+ public function prepareData($fieldsetData)
13
+ {
14
+ $excelxmlModel = Mage::getModel('logicbroker/excelxml');
15
+ $response = $excelxmlModel->getExcelFile($fieldsetData);
16
+ if(!is_array($response) && !$response)
17
+ {
18
+ Mage::throwException('Not able to genrate excel XML');
19
+ }
20
+
21
+ return $response['value'];
22
+
23
+ }
24
+
25
+
26
+
27
+ public function send($attachment = null,$fieldsetData) {
28
+ try {
29
+
30
+ $fieldsetData['isnewreg'] = ($attachment)?0:1;
31
+
32
+ $postObject = new Varien_Object();
33
+ $postObject->setData($fieldsetData);
34
+ $mailTemplate = Mage::getModel('core/email_template');
35
+ if($attachment)
36
+ {
37
+ $content = file_get_contents($attachment);
38
+ $content = str_replace('></',">\n</",$content);
39
+ // this is for to set the file format
40
+ $at = new Zend_Mime_Part($content);
41
+
42
+ $at->type = 'application/xml'; // if u have PDF then it would like -> 'application/pdf'
43
+ $at->disposition = Zend_Mime::DISPOSITION_INLINE;
44
+ $at->encoding = Zend_Mime::ENCODING_8BIT;
45
+ $at->filename = 'logicbroker'.date('ymdHis').'.xml';
46
+ $mailTemplate->getMail()->addAttachment($at);
47
+ //$emailTemplate->_mail->addAttachment($at);
48
+ }
49
+ /* @var $mailTemplate Mage_Core_Model_Email_Template */
50
+ $mailTemplate->setDesignConfig(array('area' => 'frontend'))
51
+ ->sendTransactional(
52
+ 'logicbroker_email_email_template',
53
+ 'general',
54
+ Mage::helper('logicbroker')->getConfigObject('apiconfig/email/toaddress'),
55
+ Mage::helper('logicbroker')->getConfigObject('apiconfig/email/toname'),
56
+ array('templatevar' => $postObject)
57
+ );
58
+
59
+ if (!$mailTemplate->getSentSuccess()) {
60
+ return false;
61
+ //throw new Exception();
62
+ }
63
+
64
+ return true;//echo 'Mail send successfully with attachment file name -: ' . $attachment . "\n";
65
+ } catch (Exception $e) {
66
+ return false;//$e->getMassage();
67
+ }
68
+ }
69
+
70
+ }
71
+ ?>
app/code/community/Logicbroker/Fulfillment/Model/Excelxml.php ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Model_Excelxml{
11
+
12
+
13
+ protected function prepareExportCollection()
14
+ {
15
+ $fieldSelect = Mage::helper('logicbroker')->getConfigObject('apiconfig/fieldstoexport/data');
16
+ $selectFields = array();
17
+ foreach(explode(',',$fieldSelect) as $values)
18
+ {
19
+ $selectFields[] = $values;
20
+
21
+ }
22
+ $supplierCollection = Mage::getModel('logicbroker/supplier')->getCollection()->addFieldToFilter('status','')->addFieldToSelect($selectFields);
23
+ $supplierData = $supplierCollection->getData();
24
+
25
+ if(count($supplierData) > 0)
26
+ {
27
+
28
+ return $supplierData;
29
+ }
30
+ return 0;
31
+ }
32
+
33
+ public function getConfigObject($nodeName = null)
34
+ {
35
+ return Mage::getConfig()->getNode($nodeName);
36
+ }
37
+
38
+ protected function _getExportHeadersConfiguration($fieldsetData)
39
+ {
40
+ $headers = array();
41
+ $mode = '';
42
+
43
+ $baseUrl = Mage::getBaseUrl('web');
44
+
45
+ if($baseUrl == $fieldsetData['your_production_store_url'])
46
+ {
47
+ $mode = Mage::getModel('logicbroker/logicbroker')->checkProductionMode($fieldsetData);
48
+ }elseif($baseUrl == $fieldsetData['your_staging_store_url'])
49
+ {
50
+ $mode = 'staging';
51
+ }else
52
+ {
53
+ $mode = 'staging';
54
+ }
55
+
56
+
57
+ $headers = array('companyid','key',$mode);
58
+
59
+ return $headers;
60
+ }
61
+
62
+ protected function _getExportRowsConfiguration($adapter,$parser,$fieldsetData)
63
+ {
64
+ $mode = '';
65
+
66
+ $baseUrl = Mage::getBaseUrl('web');
67
+
68
+ if($baseUrl == $fieldsetData['your_production_store_url'])
69
+ {
70
+ Mage::getModel('logicbroker/logicbroker')->checkProductionMode($fieldsetData);
71
+ $mode = 'your_production_store_url';
72
+ }elseif($baseUrl == $fieldsetData['your_staging_store_url'])
73
+ {
74
+ $mode = 'your_staging_store_url';
75
+ }else
76
+ {
77
+ $mode = 'your_staging_store_url';
78
+ }
79
+ $apiPassword = Mage::registry('api_password');
80
+ $columns = array('MagentoAPIVersion' => Mage::getVersion(), 'MagentoStoreList' => 'stores', 'MagentoURL' => $mode, 'MagentoUserName' => 'api_user_name', 'MagentoUserPwd' => $apiPassword, 'MageStatus1' =>'processing_status', 'MageStatus2' => 'error_status', 'MageStatus3' => 'sentto_warehouse_status', 'MageVendorCode' => 'supplier_attribute');
81
+ $temproray = array();
82
+
83
+
84
+ foreach ($columns as $key => $val) {
85
+ if($key == 'MagentoAPIVersion' || $key == 'MagentoUserPwd')
86
+ {
87
+ $temproray[] = array($fieldsetData['logicbroker_company_id'], $key, $val);
88
+ }elseif($key == 'MagentoURL'){
89
+ $url = $fieldsetData[$val];
90
+ //$append = (preg_match("/\/\z/i",$fieldsetData[$val]))?'index.php/v2_soap/index':'/index.php/v2_soap/index';
91
+ $slash = (preg_match("/\/\z/i",$fieldsetData[$val]))?'':'/';
92
+ $append = (preg_match("/v2_soap/i",$fieldsetData[$val]))?'':$slash.'index.php/v2_soap/index';
93
+ $temproray[] = array($fieldsetData['logicbroker_company_id'], $key,$url.$append);
94
+ }elseif($key == 'MagentoStoreList'){
95
+ $temproray[] = array($fieldsetData['logicbroker_company_id'], $key, implode(',',$fieldsetData[$val]));
96
+ }
97
+ else{
98
+ $temproray[] = array($fieldsetData['logicbroker_company_id'], $key, $fieldsetData[$val]);
99
+ }
100
+ }
101
+ //print_r($temproray);
102
+ //die();
103
+ foreach ($temproray as $values) {
104
+ $row = array();
105
+ foreach ($values as $val) {
106
+ $row[] = $val;
107
+ }
108
+ $data = $parser->getRowXml($row);
109
+ $adapter->streamWrite($data);
110
+ array_merge($row, $data);
111
+ }
112
+ }
113
+
114
+
115
+ protected function _getExportHeadersSupplier()
116
+ {
117
+ $headers = array();
118
+
119
+
120
+ foreach ($this->prepareExportCollection() as $keys => $values) {
121
+
122
+ foreach($values as $key=>$val)
123
+ if(!in_array($key,$headers))
124
+ $headers[] = $key;
125
+
126
+ }
127
+
128
+ return $headers;
129
+ }
130
+
131
+ protected function _getExportRowsSupplier($adapter,$parser)
132
+ {
133
+ foreach ($this->prepareExportCollection() as $keys => $values) {
134
+ $row = array();
135
+ foreach ($values as $val) {
136
+ $row[] = $val;
137
+ }
138
+ $data = $parser->getRowXml($row);
139
+ $adapter->streamWrite($data);
140
+ array_merge($row,$data);
141
+ }
142
+
143
+ }
144
+
145
+
146
+
147
+
148
+ /**
149
+ * Retrieve a file container array by grid data as MS Excel 2003 XML Document
150
+ *
151
+ * Return array with keys type and value
152
+ *
153
+ * @return string
154
+ */
155
+ public function getExcelFile($fieldsetData)
156
+ {
157
+ $sheetName =array('configurationproperties','systemvendor');
158
+ if(!is_array($fieldsetData))
159
+ {
160
+ return false;
161
+ }
162
+ if($this->prepareExportCollection() > 0)
163
+ {
164
+
165
+ $parser = new Varien_Convert_Parser_Xml_Excel();
166
+ $io = new Varien_Io_File();
167
+
168
+ $path = Mage::getBaseDir('var') . DS . 'export' . DS;
169
+ $name = 'logicbroker_integration_'.date('YmdHis');
170
+ $file = $path . DS . $name . '.xml';
171
+
172
+ $io->setAllowCreateFolders(true);
173
+ $io->open(array('path' => $path));
174
+ $io->streamOpen($file, 'w+');
175
+ $io->streamLock(true);
176
+ $io->streamWrite($parser->getHeaderXml($sheetName[0]));
177
+ $io->streamWrite($parser->getRowXml($this->_getExportHeadersConfiguration($fieldsetData)));
178
+ $this->_getExportRowsConfiguration($io,$parser,$fieldsetData);
179
+ $io->streamWrite('</Table></Worksheet>');
180
+ $io->streamWrite('<Worksheet ss:Name="'.$sheetName[1].'"><Table>');
181
+ $io->streamWrite($parser->getRowXml($this->_getExportHeadersSupplier()));
182
+ $this->_getExportRowsSupplier($io,$parser);
183
+ $io->streamWrite($parser->getFooterXml());
184
+ $io->streamUnlock();
185
+ $io->streamClose();
186
+
187
+ return array(
188
+ 'type' => 'filename',
189
+ 'value' => $file,
190
+ 'rm' => true // can delete file after use
191
+ );
192
+ }else{
193
+ return false;
194
+ }
195
+
196
+
197
+ }
198
+
199
+
200
+
201
+ }
202
+
app/code/community/Logicbroker/Fulfillment/Model/Infromlogicbroker.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * To change this template, choose Tools | Templates
4
+ * and open the template in the editor.
5
+ */
6
+
7
+ /**
8
+ * Description of Infromlogicbroker
9
+ *
10
+ * @author shubhs
11
+ */
12
+ class Infromlogicbroker {
13
+ //put your code here
14
+ }
15
+ ?>
app/code/community/Logicbroker/Fulfillment/Model/Logicbroker.php ADDED
@@ -0,0 +1,367 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Model_Logicbroker {
11
+ /* Validate the user inputs */
12
+
13
+ public function validation($request) {
14
+ $result = array();
15
+ if (!is_array($request)) {
16
+ return $result[] = array('error' => 'Something wrong with request');
17
+ }
18
+
19
+ if (!$this->_checkRequestParams($request)) {
20
+ return $result[] = array('error' => 'Please fill all field mark with astrik sign');
21
+ }
22
+
23
+ if (!$this->_checkAttribute($request)) {
24
+ $value = $request['supplier_attribute'];
25
+ return $result[] = array('error' => 'Vendor attribute code "' . $value['value'] . '" is not defined');
26
+ }
27
+ if (!$this->checkAtLeastOneSupplier()) {
28
+ return $result[] = array('error' => 'At least one vendor information available to share with logicbroker');
29
+ }
30
+ if(Mage::app()->getRequest()->getParam('savelater'))
31
+ {
32
+ //no further processing only fields are saving in magento database
33
+ return $result[] = array('success' => 'Data has been validate successfully.... ');
34
+ }
35
+ return $result[] = array('success' => 'Please wait while transmitting your configuration to logicbroker');
36
+
37
+
38
+ }
39
+
40
+ public function checkAtLeastOneSupplier() {
41
+ $logicbrokerCollection = Mage::getModel('logicbroker/supplier')->getCollection();
42
+ //->addFieldToFilter(array('is_update', 'verified'), array('1', '0'))
43
+ //->addFieldToSelect(array('company_id', 'magento_vendor_code'));
44
+
45
+ //return $logicbrokerCollection->getSelect()->__toString();
46
+ $comapnyIdArray = $logicbrokerCollection->getData();
47
+ if (count($comapnyIdArray) > 0) {
48
+ return true;
49
+ } else {
50
+ return false;
51
+ }
52
+ }
53
+
54
+ /* check that all listed field will not be empty in integration form
55
+ * username
56
+ * password
57
+ * production Url >> regx check
58
+ * staging Url >> regx check
59
+ * Api username >> regx check only alpha
60
+ * supplier Attribute
61
+ *
62
+ */
63
+
64
+ protected function _checkRequestParams($request) {
65
+ $values = array('logic_broker_username', 'logic_broker_password', 'your_production_store_url', 'your_staging_store_url', 'api_user_name', 'supplier_attribute');
66
+
67
+ foreach ($request as $key => $val) {
68
+ if (in_array($key, $values) && $val['value'] == '') {
69
+
70
+ return false;
71
+ }
72
+ }
73
+ return true;
74
+ }
75
+
76
+ protected function _checkAttribute($request) {
77
+ $supplierAttributeCode = $request['supplier_attribute'];
78
+ $attributeDetails = Mage::getSingleton("eav/config")->getAttribute("catalog_product", $supplierAttributeCode['value']);
79
+
80
+ if ($attributeDetails->getId() && $attributeDetails->getFrontendInput() == 'select') {
81
+ return true;
82
+ } else {
83
+ return false;
84
+ }
85
+ }
86
+
87
+ public function checkProductionMode($request) {
88
+ if (!is_array($request)) {
89
+ return false;
90
+ }
91
+ $salseOderItemTable = Mage::getSingleton('core/resource')->getTableName('sales/order_item');
92
+ $orders = Mage::getResourceModel('sales/order_collection')->addAttributeTofilter('status', 'complete');
93
+ $orders->getSelect()->join(array('item' => $salseOderItemTable), 'item.order_id = main_table.entity_id and item.product_type = "simple"', array('item.sku'));
94
+ $productCollection = Mage::getResourceModel('catalog/product_collection');
95
+ $skus = array();
96
+ foreach ($orders as $order) {
97
+ $skus[] = $order->getSku();
98
+ }
99
+
100
+
101
+ $productCollection->addAttributeToFilter('sku', array('in' => $skus))->addAttributeToFilter(trim($request['supplier_attribute']), array('notnull' => true));
102
+ if (count($productCollection) > 0) {
103
+ return 'production';
104
+ } else {
105
+ return 'qa';
106
+ }
107
+ }
108
+
109
+ public function installConfig($fieldsetData) {
110
+ if (!$this->createApiRoleAndUser($fieldsetData)) {
111
+ Mage::throwException('Problem in creating API role and user');
112
+ }
113
+
114
+ if (!$this->attributeOptionValidation($fieldsetData)) {
115
+ Mage::throwException('Problem in validating attribute options');
116
+ }
117
+
118
+ if (!$this->checkAndCreateOrderStatus($fieldsetData)) {
119
+ Mage::throwException('Problem in validating order status');
120
+ }
121
+ return true;
122
+ }
123
+
124
+ /* Creae API role */
125
+
126
+ public function createApiRoleAndUser($fieldsetData) {
127
+
128
+ $role = Mage::getModel('api/roles');
129
+ $roleName = 'logicbroker';
130
+ $parentId = '';
131
+ $roleType = 'G';
132
+ $ruleAsString = Mage::helper('logicbroker')->getConfigObject('apiconfig/rolepermission/data');
133
+ $ruleNodes = array();
134
+
135
+ if (!is_array($fieldsetData)) {
136
+ return false;
137
+ }
138
+ foreach (explode(',', $ruleAsString) as $rules) {
139
+ $ruleNodes[] = trim($rules);
140
+ }
141
+ $role->load($roleName, 'role_name');
142
+
143
+ try {
144
+ $role = $role->setName($roleName)
145
+ ->setPid($parentId)
146
+ ->setRoleType($roleType)
147
+ ->save();
148
+
149
+ Mage::getModel("api/rules")->setRoleId($role->getId())
150
+ ->setResources($ruleNodes)
151
+ ->saveRel();
152
+ } catch (Exception $e) {
153
+ return false; //$e->getMessage();
154
+ }
155
+ //$password = Mage::helper('core')->decrypt(Mage::getStoreConfig('logicbroker_integration/integration/api_password'));
156
+ $password = $fieldsetData['api_password'];
157
+ $userExist = $this->_userExists($fieldsetData['api_user_name'],$fieldsetData['email']);
158
+ $userId = '';
159
+ if (is_array($userExist)) {
160
+ $modelData = Mage::getModel('api/user')->load($userExist[1]);
161
+ $userId = $modelData->getUserId();
162
+ }else
163
+ {
164
+ $modelData = Mage::getModel('api/user');
165
+ }
166
+
167
+ $modelData->setData(array(
168
+ 'user_id'=> $userId,
169
+ 'username' => $fieldsetData['api_user_name'],
170
+ 'firstname' => $fieldsetData['firstname'],
171
+ 'lastname' => $fieldsetData['lastname'],
172
+ 'email' => $fieldsetData['email'],
173
+ 'api_key' => $password,
174
+ 'api_key_confirmation' => $password,
175
+ 'is_active' => 1,
176
+ 'user_roles' => '',
177
+ 'assigned_user_role' => '',
178
+ 'role_name' => '',
179
+ 'roles' => array($role->getId()) // your created custom role
180
+ ));
181
+
182
+ try {
183
+
184
+ Mage::register('api_password', $modelData->getApiKey());
185
+ $modelData->save();
186
+ $modelData->setRoleIds(array($role->getId())) // your created custom role
187
+ ->setRoleUserId($modelData->getUserId())
188
+ ->saveRelations();
189
+ }
190
+
191
+ catch (Exception $e) {
192
+ return false;//$e->getMessage();
193
+ }
194
+ return true;
195
+ }
196
+
197
+ protected function _userExists($username,$email)
198
+ {
199
+ $resource = Mage::getSingleton('core/resource');
200
+ $usersTable = $resource->getTableName('api/user');
201
+ $adapter = $resource->getConnection('core_read');
202
+ $condition = array(
203
+ $adapter->quoteInto("{$usersTable}.username = ?", $username),
204
+ $adapter->quoteInto("{$usersTable}.email = ?", $email),
205
+ );
206
+ $select = $adapter->select()
207
+ ->from($usersTable)
208
+ ->where(implode(' OR ', $condition))
209
+ ->where($usersTable.'.user_id != ?', '');
210
+ $result = $adapter->fetchRow($select);
211
+ if(is_array($result) && count($result) > 0 )
212
+ {
213
+ return array(true,(int)$result['user_id']);
214
+ }else
215
+ {
216
+ return false;
217
+ }
218
+
219
+ }
220
+
221
+ protected function _generatePassword($length = 8) {
222
+ $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
223
+ $count = mb_strlen($chars);
224
+
225
+ for ($i = 0, $result = ''; $i < $length; $i++) {
226
+ $index = rand(0, $count - 1);
227
+ $result .= mb_substr($chars, $index, 1);
228
+ }
229
+
230
+ return $result;
231
+ }
232
+
233
+ /* Creae Atrribute option if not available */
234
+
235
+ public function attributeOptionValidation($fieldsetData) {
236
+ if (!is_array($fieldsetData)) {
237
+ return false;
238
+ }
239
+
240
+ $logicbrokerCollection = Mage::getModel('logicbroker/supplier')->getCollection()
241
+ ->addFieldToFilter(array('is_update', 'verified'), array('1', '0',''))->addFieldToFilter('status','')
242
+ ->addFieldToSelect(array('company_id', 'magento_vendor_code'));
243
+
244
+ //return $logicbrokerCollection->getSelect()->__toString();
245
+ $comapnyIds = $logicbrokerCollection->getData();
246
+ if (count($comapnyIds) > 0) {
247
+ foreach ($comapnyIds as $key => $value) {
248
+ if (!$this->_checkAndCreateOptions($value['magento_vendor_code'],$fieldsetData['supplier_attribute'])) {
249
+ return false;
250
+ }
251
+ }
252
+ }
253
+ return true;
254
+ }
255
+
256
+ protected function _checkAndCreateOptions($value, $fieldsetData) {
257
+
258
+ $attributeLables = array();
259
+ $optionToBeSearch = strtolower($value);
260
+ $attributeCode = strtolower($fieldsetData);
261
+
262
+ $attributeDetails = Mage::getSingleton("eav/config")->getAttribute("catalog_product", $attributeCode);
263
+ $options = $attributeDetails->getSource()->getAllOptions(false);
264
+ Foreach ($options as $option) {
265
+
266
+ $attributeLables[] = strtolower($option["label"]);
267
+ }
268
+
269
+ if (!in_array($optionToBeSearch, $attributeLables)) {
270
+ $installer = new Mage_Eav_Model_Entity_Setup('core_setup');
271
+ $installer->startSetup();
272
+ try {
273
+ $searchAttributeOptions = array($optionToBeSearch);
274
+ $productEntityTypeId = Mage::getModel('catalog/product')->getResource()->getTypeId();
275
+ $createOptions = array();
276
+ $createOptions['attribute_id'] = $installer->getAttributeId($productEntityTypeId, $attributeCode);
277
+
278
+ for ($iCount = 0; $iCount < sizeof($searchAttributeOptions); $iCount++) {
279
+ $createOptions['value']['option' . $iCount][0] = $searchAttributeOptions[$iCount];
280
+ }
281
+ $installer->addAttributeOption($createOptions);
282
+ } catch (Exception $e) {
283
+ return false; //$e->getMessage();
284
+ }
285
+
286
+ $installer->endSetup();
287
+ }
288
+ return true;
289
+ }
290
+
291
+ public function checkAndCreateOrderStatus($fieldsetData) {
292
+ if (!is_array($fieldsetData) && empty($fieldsetData)) {
293
+ return false;
294
+ }
295
+ $statuses = $this->_getStatusCode($fieldsetData);
296
+ $state = 'processing';
297
+ $isDefault = '0';
298
+ foreach ($statuses as $status => $label) {
299
+ $statusModel = Mage::getModel('sales/order_status')->load($status);
300
+ if (!$statusModel->getStatus()) {
301
+ $statusModel->setData(array('status' => $status, 'label' => $label))->setStatus($status);
302
+ try {
303
+ $statusModel->save();
304
+ $statusModel->assignState($state, $isDefault);
305
+
306
+ }catch (Mage_Core_Exception $e) {
307
+ return false; //$e->getMessage();
308
+ }
309
+ }
310
+ }
311
+ return true;
312
+ }
313
+
314
+ protected function _getStatusCode($fieldsetData)
315
+ {
316
+ $status = array($fieldsetData['processing_status'],$fieldsetData['error_status'],$fieldsetData['sentto_warehouse_status']);
317
+ $labels = array();
318
+ foreach($status as $label)
319
+ {
320
+ $labels[$label] = ucwords(str_replace('_',' ', $label));
321
+ }
322
+ return $labels;
323
+ }
324
+
325
+
326
+ public function updateSupplier()
327
+ {
328
+
329
+ $logicbrokerCollection = Mage::getModel('logicbroker/supplier')->getCollection()
330
+ ->addFieldToFilter(array('is_update', 'verified'), array('1', '0'))
331
+ ->addFieldToSelect(array('company_id', 'vendor_id'));
332
+
333
+ foreach($logicbrokerCollection->getData() as $key=>$value)
334
+ {
335
+ $modelSupplier = Mage::getModel('logicbroker/supplier')->load($value['vendor_id']);
336
+ $modelSupplier->setIsUpdate('0');
337
+ $modelSupplier->setVerified('1');
338
+ try
339
+ {
340
+ $modelSupplier->save();
341
+ }catch(Exception $e)
342
+ {
343
+ return false;
344
+ }
345
+ }
346
+
347
+
348
+ }
349
+
350
+
351
+ public function createOptionValueOnSave($value)
352
+ {
353
+
354
+ $integration = Mage::getStoreConfig('logicbroker_integration/integration/supplier_attribute');
355
+ if($integration != null && $integration && $value)
356
+ {
357
+
358
+ $this->_checkAndCreateOptions($value,$integration);
359
+
360
+ }
361
+ return;
362
+ }
363
+
364
+
365
+ }
366
+
367
+ ?>
app/code/community/Logicbroker/Fulfillment/Model/Observer.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Model_Observer
11
+ {
12
+ public function connectToLogicbroker($object)
13
+ {
14
+
15
+ $modelSupplier = Mage::getModel('logicbroker/supplier');
16
+ $modelLogicbroker = Mage::getModel('logicbroker/logicbroker');
17
+ $modelSync = Mage::getModel('logicbroker/synchronize');
18
+ $modelEmail = Mage::getModel('logicbroker/email');
19
+ $groupData = $object->getobject()->getGroups();
20
+
21
+
22
+
23
+
24
+
25
+ foreach($groupData as $group=>$groupDataArray )
26
+ $fieldsetData = array();
27
+ foreach ($groupDataArray['fields'] as $field => $fieldData) {
28
+ $fieldsetData[$field] = (is_array($fieldData) && isset($fieldData['value'])) ? $fieldData['value'] : null;
29
+ }
30
+ $modelLogicbroker->installConfig($fieldsetData);
31
+ if(Mage::app()->getRequest()->getParam('savelater'))
32
+ {
33
+ //no further processing only fields are saving in magento database
34
+ return;
35
+ }
36
+ $modelSync->process($fieldsetData);
37
+ $modelLogicbroker->updateSupplier();
38
+ if(!Mage::getStoreConfig('logicbroker_integration/integration/notificationstatus'))
39
+ $modelEmail->send(null,$fieldsetData);
40
+
41
+
42
+ }
43
+
44
+
45
+ }
46
+
47
+ ?>
app/code/community/Logicbroker/Fulfillment/Model/Resource/Supplier.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Model_Resource_Supplier extends Mage_Core_Model_Mysql4_Abstract
11
+ {
12
+ protected function _construct()
13
+ {
14
+ $this->_init("logicbroker/supplier", "vendor_id");
15
+ }
16
+ }
app/code/community/Logicbroker/Fulfillment/Model/Resource/Supplier/Collection.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Model_Resource_Supplier_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
11
+ {
12
+
13
+ public function _construct(){
14
+ $this->_init("logicbroker/supplier");
15
+ }
16
+
17
+
18
+
19
+ }
20
+
app/code/community/Logicbroker/Fulfillment/Model/Supplier.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Model_Supplier extends Mage_Core_Model_Abstract
11
+ {
12
+ protected function _construct(){
13
+
14
+ $this->_init("logicbroker/supplier");
15
+ }
16
+
17
+ public function getCompanyids() {
18
+ $collection = Mage::getModel('logicbroker/supplier')->getCollection();
19
+ $collection = Mage::getModel('logicbroker/supplier')
20
+ ->getCollection()
21
+ ->addFieldToSelect('company_id');
22
+ $data = $collection->getData();
23
+ $options = array();
24
+ foreach($data as $newdata) {
25
+ if(!empty($newdata['company_id'])) {
26
+ $options[] = $newdata['company_id'];
27
+ }
28
+ }
29
+ return $options;
30
+ }
31
+
32
+ public function getCountry() {
33
+ $countries = Mage::getModel('adminhtml/system_config_source_country')->toOptionArray();
34
+ $options = array();
35
+ foreach ($countries as $country) {
36
+ if(!empty($country['value'])) {
37
+ $options[$country['value']] = $country['label'];
38
+ }
39
+ }
40
+ return $options;
41
+ }
42
+
43
+ public function validateCompany($companyid,$supplierId) {
44
+ $flag = 0;
45
+ if(empty($companyid) || empty($supplierId))
46
+ {
47
+ return $flag;
48
+ }
49
+ $collection = Mage::getModel('logicbroker/supplier')
50
+ ->getCollection()
51
+ ->addFieldToFilter('company_id', $companyid)
52
+ ->addFieldToFilter('status',array('neq'=>'deleted'))
53
+ ->addFieldToSelect('company_id')
54
+ ->addFieldToSelect('vendor_id');
55
+ $data = $collection->getData();
56
+ if(array_key_exists(0,$data) and $data[0]['company_id'] != null) {
57
+ if($data[0]['vendor_id'] != $supplierId) {
58
+ return $flag = 1;
59
+ }else
60
+ {
61
+ return $flag;
62
+ }
63
+ }
64
+
65
+ }
66
+
67
+ public function getVendorAttributeId()
68
+ {
69
+ $attributeCode = Mage::getStoreConfig('logicbroker_integration/integration/supplier_attribute');
70
+ //$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product',$attributeCode);
71
+ if($attributeCode != null)
72
+ {
73
+ return $attributeCode;
74
+ }else
75
+ {
76
+ return '';
77
+ }
78
+
79
+
80
+ }
81
+
82
+ public function deleteOption($attributeCode,$optionvalue) {
83
+ //$attributeCode = Mage::getStoreConfig('logicbroker_integration/integration/supplier_attribute');
84
+ if ($attributeCode) {
85
+
86
+ $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', $attributeCode);
87
+ $collection = Mage::getResourceModel('eav/entity_attribute_option_collection')
88
+ ->setAttributeFilter($attribute->getId())
89
+ ->setStoreFilter($attribute->getStoreId())
90
+ ->load();
91
+ //echo '<pre>';
92
+ //die(print_r($collection->getData()));
93
+ foreach ($collection as $option) {
94
+ if($option['option_id'] == $optionvalue)
95
+ $option->delete();
96
+ }
97
+ } else {
98
+ return ;
99
+ }
100
+ }
101
+ //check if information is submitted to logicbroker
102
+ public function isVendorSubmitted()
103
+ {
104
+ $objId = Mage::app()->getRequest()->getParam('vendor_id');
105
+ if(!empty($objId)){
106
+ $logicbrokerCollection = $this->getCollection()
107
+ ->addFieldToFilter(array('is_update', 'verified'), array('1', '0'))
108
+ ->addFieldToFilter('status','')
109
+ // ->addFieldToFilter('vendor_id',$objId)
110
+ ->addFieldToSelect(array('company_id', 'magento_vendor_code'));
111
+
112
+ //return $logicbrokerCollection->getSelect()->__toString();
113
+ $comapnyIdArray = $logicbrokerCollection->getData();
114
+ if (count($comapnyIdArray) > 0) {
115
+ return true;
116
+ } else {
117
+ return false;
118
+ }
119
+ }else
120
+ {
121
+ return false;
122
+ }
123
+
124
+ }
125
+ }
126
+
app/code/community/Logicbroker/Fulfillment/Model/Synchronize.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /**
5
+ * Description of Createexcelxml
6
+ *
7
+ * @author shubhs
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Model_Synchronize {
11
+
12
+ protected $_modelResource = 'logicbroker';
13
+ protected $_configNode = 'apiconfig/connectiontype/type';
14
+
15
+
16
+ public function process($fieldsetData)
17
+ {
18
+ $model = $this->_getModelObject();
19
+ try
20
+ {
21
+ $fileAttachment = $model->prepareData($fieldsetData);
22
+ if(!$model->send($fileAttachment,$fieldsetData))
23
+ {
24
+ Mage::throwException('Problem in sending attachment mail');
25
+ }
26
+
27
+ }catch(Exception $e)
28
+ {
29
+ return false;
30
+ }
31
+ }
32
+
33
+ protected function _getModelObject()
34
+ {
35
+ $modelClass = $this->_modelResource;
36
+ $type = Mage::helper('logicbroker')->getConfigObject($this->_configNode);
37
+
38
+ //die($modelClass.'/'.$type);
39
+ return Mage::getModel($modelClass.'/'.$type);
40
+ }
41
+
42
+
43
+ }
44
+
45
+ ?>
app/code/community/Logicbroker/Fulfillment/Model/System/Config/Source/Attributecodes.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of Attributecode
10
+ *
11
+ * @author shubhs
12
+ */
13
+
14
+ class Logicbroker_Fulfillment_Model_System_Config_Source_Attributecodes {
15
+
16
+ public function toOptionArray() {
17
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
18
+ ->getItems();
19
+ $attributeCode = array();
20
+ foreach ($attributes as $attribute) {
21
+
22
+ if ($attribute->getFrontendInput() == 'select' && $attribute->getIsUserDefined()) {
23
+ $attributeCode[] = array('value' => $attribute->getAttributecode(), 'label' => Mage::helper('logicbroker')->__($attribute->getFrontendLabel()));
24
+ }
25
+ }
26
+ array_unshift($attributeCode,array('value' => '', 'label' => Mage::helper('logicbroker')->__('--Please Select--')));
27
+ return $attributeCode;
28
+ }
29
+ }
30
+
31
+
app/code/community/Logicbroker/Fulfillment/Model/System/Config/Source/Ediqualifier.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of Ediidentifier
10
+ *
11
+ * @author shubhs
12
+ */
13
+ class Logicbroker_Fulfillment_Model_System_Config_Source_Ediqualifier {
14
+
15
+
16
+ public function toOptionArray()
17
+ {
18
+ return array(
19
+ array('value' => '', 'label' => Mage::helper('logicbroker')->__('--Please Select--')),
20
+ array('value' => Mage::helper('logicbroker')->__('01 Duns (Dun & Bradstreet)'), 'label' => Mage::helper('logicbroker')->__('01 Duns (Dun & Bradstreet)')),
21
+ array('value' => Mage::helper('logicbroker')->__('02 SCAC (Standard Carrier Alpha Code)'), 'label' => Mage::helper('logicbroker')->__('02 SCAC (Standard Carrier Alpha Code)')),
22
+ array('value' => Mage::helper('logicbroker')->__('03 FMC (Federal Maritime Commission)'), 'label' => Mage::helper('logicbroker')->__('03 FMC (Federal Maritime Commission)')),
23
+ array('value' => Mage::helper('logicbroker')->__('04 IATA (International Air Transport Association)'), 'label' => Mage::helper('logicbroker')->__('04 IATA (International Air Transport Association)')),
24
+ array('value' => Mage::helper('logicbroker')->__('08 UCC EDI Communications ID (Comm ID)'), 'label' => Mage::helper('logicbroker')->__('08 UCC EDI Communications ID (Comm ID)')),
25
+ array('value' => Mage::helper('logicbroker')->__('09 X.121 (CCITT)'), 'label' => Mage::helper('logicbroker')->__('09 X.121 (CCITT)')),
26
+ array('value' => Mage::helper('logicbroker')->__('10 Department of Defence (DoD) Activity Address Code'), 'label' => Mage::helper('logicbroker')->__('10 Department of Defence (DoD) Activity Address Code')),
27
+ array('value' => Mage::helper('logicbroker')->__('11 DEA (Drug Enforcement Administration)'), 'label' => Mage::helper('logicbroker')->__('11 DEA (Drug Enforcement Administration)')),
28
+ array('value' => Mage::helper('logicbroker')->__('12 Phone (Telephone Companies)'), 'label' => Mage::helper('logicbroker')->__('12 Phone (Telephone Companies)')),
29
+ array('value' => Mage::helper('logicbroker')->__('13 UCS Code (UCS Code is a Code is Used for UCS Transmissions, it includes the Area Code and Telephone Number of Modem, it Does Not Include Punctuation, Blanks or Access Code )'), 'label' => Mage::helper('logicbroker')->__('13 UCS Code (UCS Code is a Code is Used for UCS Transmissions, it includes the Area Code and Telephone Number of Modem, it Does Not Include Punctuation, Blanks or Access Code )')),
30
+ array('value' => Mage::helper('logicbroker')->__('14 Duns Plus Suffix'), 'label' => Mage::helper('logicbroker')->__('14 Duns Plus Suffix')),
31
+ array('value' => Mage::helper('logicbroker')->__('15 Petroleum Accountants Society Of Canada Company Code'), 'label' => Mage::helper('logicbroker')->__('15 Petroleum Accountants Society Of Canada Company Code')),
32
+ array('value' => Mage::helper('logicbroker')->__('16 Duns Number With 4-Character Suffix'), 'label' => Mage::helper('logicbroker')->__('16 Duns Number With 4-Character Suffix')),
33
+ array('value' => Mage::helper('logicbroker')->__('17 American Bankers Association (ABA) Transit Routing Number (Including check digit, 9-digit )'), 'label' => Mage::helper('logicbroker')->__('17 American Bankers Association (ABA) Transit Routing Number (Including check digit, 9-digit )')),
34
+ array('value' => Mage::helper('logicbroker')->__('18 Association of American Railroads (AAR) Standard Distribution Code'), 'label' => Mage::helper('logicbroker')->__('18 Association of American Railroads (AAR) Standard Distribution Code')),
35
+ array('value' => Mage::helper('logicbroker')->__('19 EDI Council of Australia (EDICA) Communications ID Number (COMM ID)'), 'label' => Mage::helper('logicbroker')->__('19 EDI Council of Australia (EDICA) Communications ID Number (COMM ID)')),
36
+ array('value' => Mage::helper('logicbroker')->__('20 Health Industry Number (HIN)'), 'label' => Mage::helper('logicbroker')->__('20 Health Industry Number (HIN)')),
37
+ array('value' => Mage::helper('logicbroker')->__('21 Integrated Postsecondary Education Data system, or (IPEDS)'), 'label' => Mage::helper('logicbroker')->__('21 Integrated Postsecondary Education Data system, or (IPEDS)')),
38
+ array('value' => Mage::helper('logicbroker')->__('22 Federal Interagency Commision on Education, or FICE'), 'label' => Mage::helper('logicbroker')->__('22 Federal Interagency Commision on Education, or FICE')),
39
+ array('value' => Mage::helper('logicbroker')->__('23 National Center for Education Statistics Common Core Of Data 12-Digit Number For Pre-K-Grade 12 Institutes, or NCES'), 'label' => Mage::helper('logicbroker')->__('23 National Center for Education Statistics Common Core Of Data 12-Digit Number For Pre-K-Grade 12 Institutes, or NCES')),
40
+ array('value' => Mage::helper('logicbroker')->__('24 The College Board`s Admission Testing Program 4-Digit Code Of Postsecondary Institutes, or ATP'), 'label' => Mage::helper('logicbroker')->__('24 The College Board`s Admission Testing Program 4-Digit Code Of Postsecondary Institutes, or ATP')),
41
+ array('value' => Mage::helper('logicbroker')->__('25 American College Testing Program 4-Digit code Of Postsecondary Institutions, or ACT'), 'label' => Mage::helper('logicbroker')->__('25 American College Testing Program 4-Digit code Of Postsecondary Institutions, or ACT')),
42
+ array('value' => Mage::helper('logicbroker')->__('26 Statistics of Canada List Of Postsecondary Institutions'), 'label' => Mage::helper('logicbroker')->__('26 Statistics of Canada List Of Postsecondary Institutions')),
43
+ array('value' => Mage::helper('logicbroker')->__('27 Carrier Identification Number as assigned by Health Care Financing Administration (HCFA)'), 'label' => Mage::helper('logicbroker')->__('27 Carrier Identification Number as assigned by Health Care Financing Administration (HCFA)')),
44
+ array('value' => Mage::helper('logicbroker')->__('28 Fiscal Intermediary Identification Number as assigned by Health Care Financing Administration (HCFA)'), 'label' => Mage::helper('logicbroker')->__('28 Fiscal Intermediary Identification Number as assigned by Health Care Financing Administration (HCFA)')),
45
+ array('value' => Mage::helper('logicbroker')->__('29 Medicare Provider and Supplier Identification Number as assigned by Health Care Financing Administration (HCFA)'), 'label' => Mage::helper('logicbroker')->__('29 Medicare Provider and Supplier Identification Number as assigned by Health Care Financing Administration (HCFA)')),
46
+ array('value' => Mage::helper('logicbroker')->__('30 U.S. Federal Tax Identification Number'), 'label' => Mage::helper('logicbroker')->__('30 U.S. Federal Tax Identification Number')),
47
+ array('value' => Mage::helper('logicbroker')->__('31 Jurisdiction Identification Number Plus 4 as assigned by the International Association Of Industrial Accident Boards and Commissions (IAIABC)'), 'label' => Mage::helper('logicbroker')->__('31 Jurisdiction Identification Number Plus 4 as assigned by the International Association Of Industrial Accident Boards and Commissions (IAIABC)')),
48
+ array('value' => Mage::helper('logicbroker')->__('32 U.S. Federal Employer Identification Number (FEIN)'), 'label' => Mage::helper('logicbroker')->__('32 U.S. Federal Employer Identification Number (FEIN)')),
49
+ array('value' => Mage::helper('logicbroker')->__('33 National Association Of Insurance Commissioners Company Code (NAIC)'), 'label' => Mage::helper('logicbroker')->__('33 National Association Of Insurance Commissioners Company Code (NAIC)')),
50
+ array('value' => Mage::helper('logicbroker')->__('34 Medicaid Provider and Supplier Identification Number as assigned by individual State Medicaid Agencies in conjunction with Health Care Financing Administration (HCFA)'), 'label' => Mage::helper('logicbroker')->__('34 Medicaid Provider and Supplier Identification Number as assigned by individual State Medicaid Agencies in Conjunction with Health Care Financing Administration (HCFA)')),
51
+ array('value' => Mage::helper('logicbroker')->__('35 Statistics Canada Canadian College Student Information System Institution Codes'), 'label' => Mage::helper('logicbroker')->__('35 Statistics Canada Canadian College Student Information System Institution Codes')),
52
+ array('value' => Mage::helper('logicbroker')->__('36 Statistics Canada University Student Information System Institution codes'), 'label' => Mage::helper('logicbroker')->__('36 Statistics Canada University Student Information System Institution codes')),
53
+ array('value' => Mage::helper('logicbroker')->__('37 Society of Property Information Compilers and Analysts'), 'label' => Mage::helper('logicbroker')->__('37 Society of Property Information Compilers and Analysts')),
54
+ array('value' => Mage::helper('logicbroker')->__('AM Association Mexicana del Codigo de Producto (AMECOP) Communication ID'), 'label' => Mage::helper('logicbroker')->__('AM Association Mexicana del Codigo de Producto (AMECOP) Communication ID')),
55
+ array('value' => Mage::helper('logicbroker')->__('NR National Retail Merchants Association (NRMA) - Assigned'), 'label' => Mage::helper('logicbroker')->__('NR National Retail Merchants Association (NRMA) - Assigned')),
56
+ array('value' => Mage::helper('logicbroker')->__('SN Standard Address Number'), 'label' => Mage::helper('logicbroker')->__('SN Standard Address Number')),
57
+ array('value' => Mage::helper('logicbroker')->__('ZZ Mutually Defined'), 'label' => Mage::helper('logicbroker')->__('ZZ Mutually Defined')),
58
+ );
59
+ }
60
+
61
+ public function toArray()
62
+ {
63
+ return array(
64
+ 0 => Mage::helper('adminhtml')->__('No'),
65
+ 1 => Mage::helper('adminhtml')->__('Yes'),
66
+ );
67
+ }
68
+ }
69
+
70
+ ?>
app/code/community/Logicbroker/Fulfillment/Model/System/Config/Source/Optionvalues.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of Ediidentifier
10
+ *
11
+ * @author shubhs
12
+ */
13
+ class Logicbroker_Fulfillment_Model_System_Config_Source_Optionvalues {
14
+
15
+
16
+ public function toOptionArray()
17
+ {
18
+
19
+ $optionsArray = $this->getOptionValue();
20
+ if(is_array($optionsArray)){
21
+ array_unshift($optionsArray,array('value' => '', 'label' => Mage::helper('logicbroker')->__('--Please Select--')));
22
+ array_push($optionsArray,array('value' => 'addnew', 'label' => Mage::helper('logicbroker')->__('Add new code')));
23
+ }
24
+ else
25
+ {
26
+ $optionsArray = array(array('value' => '', 'label' => Mage::helper('logicbroker')->__('--Please Select--')),
27
+ array('value' => 'addnew', 'label' => Mage::helper('logicbroker')->__('Add new code')));
28
+ }
29
+ // echo '<pre>';
30
+ // print_r($optionsArray);
31
+ // die('save ememm');
32
+ return $optionsArray;
33
+
34
+ }
35
+
36
+ public function getOptionValue()
37
+ {
38
+ $integration = Mage::getStoreConfig('logicbroker_integration/integration/supplier_attribute');
39
+ $logicbrokerCollection = Mage::getModel('logicbroker/supplier')->getCollection();
40
+ $attributeArray = array();
41
+ if($integration != null && $integration)
42
+ {
43
+ $attributeDetails = Mage::getSingleton("eav/config")->getAttribute("catalog_product", $integration);
44
+ $options = $attributeDetails->getSource()->getAllOptions(false);
45
+ foreach ($options as $option) {
46
+
47
+ $attributeArray[] = array('value'=>$option["label"],'label' => Mage::helper('logicbroker')->__(strtolower($option["label"])));
48
+ }
49
+ }else
50
+ {
51
+ $logicbrokerCollection ->addFieldToFilter(array('is_update', 'verified'), array('1', '0'))->addFieldToFilter('status','')
52
+ ->addFieldToSelect(array('company_id', 'magento_vendor_code'));
53
+ $comapnyIds = $logicbrokerCollection->getData();
54
+ if (count($comapnyIds) > 0) {
55
+ foreach ($comapnyIds as $key=>$value) {
56
+ $attributeArray[] = array('value'=>$value['magento_vendor_code'],'label' => Mage::helper('logicbroker')->__(strtolower($value['magento_vendor_code'])));
57
+ }
58
+ }
59
+ }
60
+
61
+ return $attributeArray;
62
+
63
+ }
64
+ }
65
+
66
+ ?>
app/code/community/Logicbroker/Fulfillment/controllers/Adminhtml/LogicbrokerController.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ class Logicbroker_Fulfillment_Adminhtml_LogicbrokerController extends Mage_Adminhtml_Controller_Action
11
+ {
12
+
13
+ protected function _initAction() {
14
+ $this->loadLayout()
15
+ ->_setActiveMenu('logicbroker/suppliers')
16
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Vendor Manager'), Mage::helper('adminhtml')->__('Vendor Manager'));
17
+
18
+ return $this;
19
+ }
20
+
21
+ public function indexAction() {
22
+ $this->_initAction()
23
+ ->renderLayout();
24
+ }
25
+
26
+ /**
27
+ * suppplier grid for AJAX request
28
+ */
29
+ public function gridAction() {
30
+ $this->getResponse()->setBody(
31
+ $this->getLayout()->createBlock('logicbroker/adminhtml_logicbroker_grid')->toHtml()
32
+ );
33
+ }
34
+ public function editAction() {
35
+ $id = $this->getRequest()->getParam('vendor_id');
36
+ $model = Mage::getModel('logicbroker/supplier')->load($id);
37
+
38
+ if ($model->getVendorId() || $id == 0) {
39
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
40
+ if (!empty($data)) {
41
+ $model->setData($data);
42
+
43
+ }
44
+ Mage::register('logicbroker_data', $model);
45
+
46
+ $this->loadLayout();
47
+ $this->_setActiveMenu('logicbroker/suppliers');
48
+
49
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Vendor Manager'), Mage::helper('adminhtml')->__('Vendor Manager'));
50
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
51
+
52
+ $this->_addContent($this->getLayout()->createBlock('logicbroker/adminhtml_logicbroker_edit'))
53
+ ->_addLeft($this->getLayout()->createBlock('logicbroker/adminhtml_logicbroker_edit_tabs'));
54
+
55
+ $this->renderLayout();
56
+ } else {
57
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('logicbroker')->__('Vendor does not exist'));
58
+ $this->_redirect('*/*/');
59
+ }
60
+ }
61
+
62
+ public function newAction()
63
+ {
64
+ $this->loadLayout();
65
+ $this->_setActiveMenu('logicbroker/suppliers');
66
+ $this->_addContent($this->getLayout()->createBlock('logicbroker/adminhtml_logicbroker_edit'))
67
+ ->_addLeft($this->getLayout()->createBlock('logicbroker/adminhtml_logicbroker_edit_tabs'));
68
+ $this->renderLayout();
69
+
70
+ }
71
+
72
+ public function saveAction() {
73
+ if ($data = $this->getRequest()->getPost()) {
74
+
75
+
76
+ $model = Mage::getModel('logicbroker/supplier');
77
+ if ($id = $this->getRequest()->getParam('vendor_id')) {//the parameter name may be different
78
+ $model->load($id);
79
+ }
80
+
81
+
82
+ $model->addData($data);
83
+ $companyid = $this->getRequest()->getParam('company_id');
84
+
85
+ try {
86
+ if(!empty($data['addnewoption'])){
87
+ $model->setData('magento_vendor_code',strtolower($data['addnewoption']));
88
+ }
89
+ //validate compny id as unique
90
+ $validate = $model->validateCompany($companyid,$this->getRequest()
91
+ ->getParam('vendor_id'));
92
+ if($validate == 1){
93
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('logicbroker')->__('Duplicate Company ID'));
94
+ $this->_redirect('*/*/edit', array('vendor_id' => $model->getVendorId()));
95
+ return;
96
+ }
97
+ //$model->getFtpPassword = md5($model->getFtpPassword());
98
+ //$model->setData('ftp_password',$model->getFtpPassword);
99
+ $model->save();
100
+ if(!empty($data['addnewoption'])){
101
+ Mage::getModel('logicbroker/logicbroker')->createOptionValueOnSave($model->getMagentoVendorCode());
102
+ }
103
+
104
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
105
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('logicbroker')->__('vendor was successfully saved'));
106
+
107
+ if ($this->getRequest()->getParam('back')) {
108
+ $this->_redirect('*/*/edit', array('vendor_id' => $model->getVendorId()));
109
+ return;
110
+ }
111
+ $this->_redirect('*/*/');
112
+ return;
113
+ } catch (Exception $e) {
114
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
115
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
116
+ $this->_redirect('*/*/edit', array('vendor_id'=>$model->getVendorId(), '_current'=>true));
117
+ return;
118
+ }
119
+ }
120
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('logicbroker')->__('Unable to find vendor to save'));
121
+ $this->_redirect('*/*/');
122
+ }
123
+
124
+ public function deleteAction()
125
+ {
126
+ // check if we know what should be deleted
127
+ if ($id = $this->getRequest()->getParam('vendor_id')) {
128
+ try {
129
+ // init model and delete
130
+ $model = Mage::getModel('logicbroker/supplier');
131
+ $model->load($id);
132
+ //$model->deleteOption($model->getMagentoVendorAttributeId(),$model->getMagentoSupplierAttribute());
133
+ $model->setData('status','deleted');
134
+ $model->save();
135
+ //$model->delete();
136
+ // display success message
137
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('logicbroker')->__('The vendor has been deleted.'));
138
+ // go to grid
139
+ $this->_redirect('*/*/');
140
+ return;
141
+
142
+ } catch (Exception $e) {
143
+ // display error message
144
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
145
+ // go back to edit form
146
+ $this->_redirect('*/*/edit', array('vendor_id' => $id));
147
+ return;
148
+ }
149
+ }
150
+ // display error message
151
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('logicbroker')->__('Unable to find a vendor to delete.'));
152
+ // go to grid
153
+ $this->_redirect('*/*/');
154
+ }
155
+
156
+
157
+ /**
158
+ * Export vendor in csv format
159
+ */
160
+ public function exportCsvAction()
161
+ {
162
+ $fileName = 'vendor.csv';
163
+ $content = $this->getLayout()->createBlock('logicbroker/adminhtml_logicbroker_grid')
164
+ ->getCsvFile();
165
+
166
+ $this->_prepareDownloadResponse($fileName, $content);
167
+ }
168
+
169
+ /**
170
+ * Export vendor in Excel format
171
+ */
172
+ public function exportXmlAction()
173
+ {
174
+ $fileName = 'vendor.xml';
175
+ $content = $this->getLayout()->createBlock('logicbroker/adminhtml_logicbroker_grid')
176
+ ->getExcelFile($fileName);
177
+
178
+ $this->_prepareDownloadResponse($fileName, $content);
179
+ }
180
+
181
+ public function validateajaxrequestAction()
182
+ {
183
+
184
+ $paramsArray = $this->getRequest()->getParams();
185
+ $validation = Mage::getModel('logicbroker/logicbroker');
186
+ $result = $validation->validation($paramsArray['groups']['integration']['fields']);
187
+ //$result['message'] = 'JAI hohohoh';
188
+ $result = Mage::helper('core')->jsonEncode($result);
189
+ Mage::app()->getResponse()->setBody($result);
190
+
191
+ }
192
+
193
+ }
app/code/community/Logicbroker/Fulfillment/data/logicbroker_setup/data-install-1.0.0.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Cms
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ $coreConfigData = array(
28
+ array(
29
+ 'scope' => 'default',
30
+ 'scope_id' => '0',
31
+ 'path' => 'logicbroker_integration/integration/notificationstatus',
32
+ 'value' => '0',
33
+
34
+ ),
35
+ array(
36
+ 'scope' => 'default',
37
+ 'scope_id' => '0',
38
+ 'path' => 'logicbroker_integration/integration/dateofinstalltion',
39
+ 'value' => date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())),
40
+
41
+ )
42
+ );
43
+
44
+ /**
45
+ * Insert default blocks
46
+ */
47
+ foreach ($coreConfigData as $data) {
48
+
49
+ Mage::getModel('core/config_data')->setData($data)->save();
50
+ }
51
+
app/code/community/Logicbroker/Fulfillment/etc/adminhtml.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <logicbroker_integration translate="title" module="logicbroker">
12
+ <title>integration Section</title>
13
+ <sort_order>1</sort_order>
14
+ </logicbroker_integration>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+
24
+ <menu>
25
+ <logicbroker translate="title" module="logicbroker">
26
+ <title>logicbroker</title>
27
+ <sort_order>91</sort_order>
28
+ <children>
29
+ <suppliers translate="title">
30
+ <title>Vendors</title>
31
+ <action>logicbroker/adminhtml_logicbroker</action>
32
+ <sort_order>10</sort_order>
33
+ </suppliers>
34
+ <integration translate="title">
35
+ <title>Integration</title>
36
+ <action>adminhtml/system_config/edit/section/logicbroker_integration</action>
37
+ <sort_order>11</sort_order>
38
+ </integration>
39
+ </children>
40
+ </logicbroker>
41
+ </menu>
42
+ </config>
app/code/community/Logicbroker/Fulfillment/etc/config.xml ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Logicbroker_Fulfillment>
5
+ <version>1.0.0</version>
6
+ </Logicbroker_Fulfillment>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <logicbroker>
11
+ <class>Logicbroker_Fulfillment_Block</class>
12
+ </logicbroker>
13
+ </blocks>
14
+
15
+ <helpers>
16
+ <logicbroker>
17
+ <class>Logicbroker_Fulfillment_Helper</class>
18
+ </logicbroker>
19
+ </helpers>
20
+ <models>
21
+ <logicbroker>
22
+ <class>Logicbroker_Fulfillment_Model</class>
23
+ <resourceModel>logicbroker_resource</resourceModel>
24
+ </logicbroker>
25
+ <logicbroker_resource>
26
+ <class>Logicbroker_Fulfillment_Model_Resource</class>
27
+ <entities>
28
+ <supplier>
29
+ <table>logicbroker_vendor</table>
30
+ </supplier>
31
+ </entities>
32
+ </logicbroker_resource>
33
+ </models>
34
+ <resources>
35
+ <logicbroker_setup>
36
+ <setup>
37
+ <module>Logicbroker_Fulfillment</module>
38
+ </setup>
39
+ <connection>
40
+ <use>core_setup</use>
41
+ </connection>
42
+ </logicbroker_setup>
43
+ <logicbroker_write>
44
+ <connection>
45
+ <use>core_write</use>
46
+ </connection>
47
+ </logicbroker_write>
48
+ <logicbroker_read>
49
+ <connection>
50
+ <use>core_read</use>
51
+ </connection>
52
+ </logicbroker_read>
53
+ </resources>
54
+ <events>
55
+ <model_config_data_save_before>
56
+ <observers>
57
+ <logicbroker>
58
+ <class>logicbroker/observer</class>
59
+ <method>connectToLogicbroker</method>
60
+ </logicbroker>
61
+ </observers>
62
+ </model_config_data_save_before>
63
+ </events>
64
+ <template>
65
+ <email>
66
+ <logicbroker_email_email_template translate="label" module="logicbroker">
67
+ <label>logicbroker</label>
68
+ <file>logicbroker.html</file>
69
+ <type>html</type>
70
+ </logicbroker_email_email_template>
71
+ </email>
72
+ </template>
73
+
74
+ </global>
75
+
76
+ <admin>
77
+ <routers>
78
+ <logicbroker>
79
+ <use>admin</use>
80
+ <args>
81
+ <module>Logicbroker_Fulfillment</module>
82
+ <frontName>logicbroker</frontName>
83
+ </args>
84
+ </logicbroker>
85
+ </routers>
86
+ </admin>
87
+ <adminhtml>
88
+ <layout>
89
+ <updates>
90
+ <logicbroker>
91
+ <file>logicbroker.xml</file>
92
+ </logicbroker>
93
+ </updates>
94
+ </layout>
95
+ <translate>
96
+ <modules>
97
+ <Logicbroker_Fulfillment>
98
+ <files>
99
+ <default>Logicbroker_Fulfillment.csv</default>
100
+ </files>
101
+ </Logicbroker_Fulfillment>
102
+ </modules>
103
+ </translate>
104
+ </adminhtml>
105
+ <default>
106
+ <logicbroker_integration>
107
+ <integration>
108
+ <api_user_name>LogicBrokerIntegration</api_user_name>
109
+ <processing_status>proceesing</processing_status>
110
+ <error_status>error</error_status>
111
+ <sentto_warehouse_status>sent_to_warehouse</sentto_warehouse_status>
112
+ </integration>
113
+ </logicbroker_integration>
114
+ </default>
115
+
116
+
117
+ <apiconfig>
118
+ <termsandconditions>
119
+ <link>http://www.logicbroker.com/magento-edi-connector-agreement/</link>
120
+ </termsandconditions>
121
+ <helpurl>
122
+ <link>http://logicbroker.com/contact-us/</link>
123
+ </helpurl>
124
+ <email>
125
+ <toaddress>magentoext@logicbroker.com</toaddress>
126
+ <toname>logicbroker</toname>
127
+ <subject>logicbroker new extesnion Installation</subject>
128
+ </email>
129
+ <connectiontype>
130
+ <type>email</type>
131
+ </connectiontype>
132
+ <fieldstoexport>
133
+ <data>company_id,address1,address2,city,state,zip,country,edi_qualifier,edi_identifier,magento_vendor_code,file_directory_inbound,file_directory_outbound,ftp_address,ftp_username,ftp_password,ftp_protocol,firstname,lastname,email,phone</data>
134
+ </fieldstoexport>
135
+ <rolepermission>
136
+ <data>__root__, catalog,catalog/product, catalog/product/attribute, catalog/product/attribute/info, catalog/product/attribute/option, catalog/product/attribute/option/remove, catalog/product/attribute/option/add, catalog/product/attribute/set, catalog/product/attribute/set/group_add,catalog/product/attribute/set/group_rename, catalog/product/attribute/set/group_remove, catalog/product/attribute/set/attribute_remove, catalog/product/attribute/set/attribute_add, catalog/product/attribute/set/create, catalog/product/attribute/set/remove, catalog/product/attribute/set/list, catalog/product/attribute/remove, catalog/product/attribute/update, catalog/product/attribute/create, catalog/product/attribute/read, catalog/product/link, catalog/product/link/remove, catalog/product/link/update, catalog/product/link/assign, catalog/product/media, catalog/product/media/remove, catalog/product/media/update, catalog/product/media/create, catalog/product/tag, catalog/product/tag/remove, catalog/product/tag/update, catalog/product/tag/add, catalog/product/tag/info, catalog/product/tag/list, catalog/product/option, catalog/product/option/list, catalog/product/option/remove, catalog/product/option/add, catalog/product/option/info, catalog/product/option/types, catalog/product/option/update, catalog/category, catalog/category/info, catalog/category/tree, catalog/category/delete, catalog/category/update, catalog/category/move, catalog/category/create, catalog/category/product, catalog/category/product/remove, catalog/category/product/update, catalog/category/product/assign, sales, sales/order, sales/order/creditmemo, sales/order/creditmemo/list, sales/order/creditmemo/info, sales/order/creditmemo/cancel, sales/order/creditmemo/comment, sales/order/creditmemo/create, sales/order/invoice, sales/order/invoice/cancel, sales/order/invoice/info, sales/order/invoice/void, sales/order/invoice/capture, sales/order/invoice/comment, sales/order/invoice/create, sales/order/shipment, sales/order/shipment/send, sales/order/shipment/info, sales/order/shipment/track, sales/order/shipment/comment, sales/order/shipment/create, sales/order/info, sales/order/change, cataloginventory, cataloginventory/info, cataloginventory/update</data>
137
+ </rolepermission>
138
+ </apiconfig>
139
+ </config>
app/code/community/Logicbroker/Fulfillment/etc/jstranslator.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Mage
23
+ * @package Mage_Core
24
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <jstranslator>
29
+ <validate-url-logicbroker translate="message" module="logicbroker">
30
+ <message>Please enter a valid URL. Protocol is required (http://, https:// or ftp://)</message>
31
+ </validate-url-logicbroker>
32
+ <validate-one-required-by-name-logicbroker translate="message" module="logicbroker">
33
+ <message>Please select one of the options.</message>
34
+ </validate-one-required-by-name-logicbroker>
35
+ </jstranslator>
app/code/community/Logicbroker/Fulfillment/etc/system.xml ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <logicbroker translate="label" module="logicbroker">
5
+ <label>logicbroker</label>
6
+ <sort_order>500</sort_order>
7
+ </logicbroker>
8
+ </tabs>
9
+ <sections>
10
+ <logicbroker_integration translate="label" module="logicbroker">
11
+ <label>Integration</label>
12
+ <tab>logicbroker</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>40</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>0</show_in_website>
17
+ <show_in_store>0</show_in_store>
18
+ <groups>
19
+ <integration translate="label">
20
+ <label>logicbroker - Integration</label>
21
+ <page_heading>Vendors</page_heading>
22
+ <expanded>1</expanded>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>10</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>0</show_in_website>
27
+ <show_in_store>0</show_in_store>
28
+ <fields>
29
+
30
+ <issubmitted translate="label">
31
+ <frontend_type>hidden</frontend_type>
32
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
33
+ <sort_order>0</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>0</show_in_website>
36
+ <show_in_store>0</show_in_store>
37
+ </issubmitted>
38
+
39
+ <notificationstatus translate="label">
40
+ <frontend_type>hidden</frontend_type>
41
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
42
+ <sort_order>0</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>0</show_in_website>
45
+ <show_in_store>0</show_in_store>
46
+ </notificationstatus>
47
+
48
+ <dateofinstalltion translate="label">
49
+ <frontend_type>hidden</frontend_type>
50
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
51
+ <sort_order>0</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>0</show_in_website>
54
+ <show_in_store>0</show_in_store>
55
+ </dateofinstalltion>
56
+
57
+ <firstname translate="label">
58
+ <label>First Name</label>
59
+ <frontend_type>text</frontend_type>
60
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
61
+ <sort_order>0</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>0</show_in_website>
64
+ <show_in_store>0</show_in_store>
65
+ <validate>required-entry</validate>
66
+ </firstname>
67
+
68
+ <lastname translate="label">
69
+ <label>Last Name</label>
70
+ <frontend_type>text</frontend_type>
71
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
72
+ <sort_order>1</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>0</show_in_website>
75
+ <show_in_store>0</show_in_store>
76
+ <validate>required-entry</validate>
77
+ </lastname>
78
+
79
+ <title translate="label">
80
+ <label>Title</label>
81
+ <frontend_type>text</frontend_type>
82
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
83
+ <sort_order>2</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>0</show_in_website>
86
+ <show_in_store>0</show_in_store>
87
+ <validate>required-entry</validate>
88
+ </title>
89
+
90
+ <email translate="label">
91
+ <label>Email</label>
92
+ <frontend_type>text</frontend_type>
93
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
94
+ <sort_order>3</sort_order>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>0</show_in_website>
97
+ <show_in_store>0</show_in_store>
98
+ <validate>required-entry validate-email</validate>
99
+ </email>
100
+
101
+ <direct_phone translate="label">
102
+ <label>Direct Phone</label>
103
+ <frontend_type>text</frontend_type>
104
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
105
+ <sort_order>4</sort_order>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>0</show_in_website>
108
+ <show_in_store>0</show_in_store>
109
+ <validate>required-entry</validate>
110
+ </direct_phone>
111
+
112
+ <logicbroker_company_id translate="label">
113
+ <label>logicbroker Company ID</label>
114
+ <frontend_type>text</frontend_type>
115
+ <comment>From the logicbroker portal - optional if you do not have an account</comment>
116
+ <sort_order>5</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>0</show_in_website>
119
+ <show_in_store>0</show_in_store>
120
+ </logicbroker_company_id>
121
+
122
+ <company_name translate="label">
123
+ <label>Company Name</label>
124
+ <frontend_type>text</frontend_type>
125
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
126
+ <sort_order>6</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>0</show_in_website>
129
+ <show_in_store>0</show_in_store>
130
+ <validate>required-entry</validate>
131
+ </company_name>
132
+
133
+ <company_address_1 translate="label">
134
+ <label>Address 1</label>
135
+ <frontend_type>text</frontend_type>
136
+ <validate>required-entry</validate>
137
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
138
+ <sort_order>7</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>0</show_in_website>
141
+ <show_in_store>0</show_in_store>
142
+ </company_address_1>
143
+
144
+ <company_address_2 translate="label">
145
+ <label>Address 2</label>
146
+ <frontend_type>text</frontend_type>
147
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
148
+ <sort_order>8</sort_order>
149
+ <show_in_default>1</show_in_default>
150
+ <show_in_website>0</show_in_website>
151
+ <show_in_store>0</show_in_store>
152
+ </company_address_2>
153
+
154
+ <company_city translate="label">
155
+ <label>City</label>
156
+ <frontend_type>text</frontend_type>
157
+ <validate>required-entry</validate>
158
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
159
+ <sort_order>9</sort_order>
160
+ <show_in_default>1</show_in_default>
161
+ <show_in_website>0</show_in_website>
162
+ <show_in_store>0</show_in_store>
163
+ </company_city>
164
+
165
+ <company_state translate="label">
166
+ <label>State</label>
167
+ <frontend_type>text</frontend_type>
168
+ <validate>required-entry</validate>
169
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
170
+ <sort_order>10</sort_order>
171
+ <show_in_default>1</show_in_default>
172
+ <show_in_website>0</show_in_website>
173
+ <show_in_store>0</show_in_store>
174
+ </company_state>
175
+
176
+ <company_zip translate="label">
177
+ <label>Zip</label>
178
+ <frontend_type>text</frontend_type>
179
+ <validate>required-entry validate-digits</validate>
180
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
181
+ <sort_order>11</sort_order>
182
+ <show_in_default>1</show_in_default>
183
+ <show_in_website>0</show_in_website>
184
+ <show_in_store>0</show_in_store>
185
+ </company_zip>
186
+
187
+ <company_country translate="label">
188
+ <label>Country</label>
189
+ <frontend_type>select</frontend_type>
190
+ <validate>required-entry</validate>
191
+ <source_model>adminhtml/system_config_source_Country</source_model>
192
+ <sort_order>12</sort_order>
193
+ <show_in_default>1</show_in_default>
194
+ <show_in_website>0</show_in_website>
195
+ <show_in_store>0</show_in_store>
196
+ </company_country>
197
+
198
+ <company_website translate="label">
199
+ <label>Company Website</label>
200
+ <frontend_type>text</frontend_type>
201
+ <validate>validate-url-logicbroker</validate>
202
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
203
+ <sort_order>13</sort_order>
204
+ <show_in_default>1</show_in_default>
205
+ <show_in_website>0</show_in_website>
206
+ <show_in_store>0</show_in_store>
207
+ </company_website>
208
+
209
+ <order_per_day translate="label">
210
+ <label>Orders Per Day</label>
211
+ <frontend_type>text</frontend_type>
212
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
213
+ <sort_order>14</sort_order>
214
+ <show_in_default>1</show_in_default>
215
+ <show_in_website>0</show_in_website>
216
+ <show_in_store>0</show_in_store>
217
+ </order_per_day>
218
+
219
+ <erp_system translate="label">
220
+ <label>ERP System</label>
221
+ <frontend_type>text</frontend_type>
222
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
223
+ <sort_order>15</sort_order>
224
+ <show_in_default>1</show_in_default>
225
+ <show_in_website>0</show_in_website>
226
+ <show_in_store>0</show_in_store>
227
+ </erp_system>
228
+
229
+ <notes translate="label">
230
+ <label>Notes</label>
231
+ <frontend_type>text</frontend_type>
232
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
233
+ <sort_order>16</sort_order>
234
+ <show_in_default>1</show_in_default>
235
+ <show_in_website>0</show_in_website>
236
+ <show_in_store>0</show_in_store>
237
+ </notes>
238
+
239
+ <edi_qualifier translate="label">
240
+ <label>EDI Qualifier</label>
241
+ <frontend_type>select</frontend_type>
242
+ <source_model>logicbroker/system_config_source_ediqualifier</source_model>
243
+ <sort_order>17</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>0</show_in_website>
246
+ <show_in_store>0</show_in_store>
247
+ </edi_qualifier>
248
+
249
+ <edi_purchase_identifier translate="label">
250
+ <label>EDI Identifier</label>
251
+ <frontend_type>text</frontend_type>
252
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
253
+ <sort_order>18</sort_order>
254
+ <show_in_default>1</show_in_default>
255
+ <show_in_website>0</show_in_website>
256
+ <show_in_store>0</show_in_store>
257
+ </edi_purchase_identifier>
258
+
259
+ <supplier_attribute translate="label">
260
+ <label>Vendor Attribute</label>
261
+ <frontend_type>select</frontend_type>
262
+ <comment>Attribute code for attribute that will store the product vendor information for fulfillment. This attribute must be present on every product to be fulfilled by logicbroker.You can update/add/delete attribute by navigating to "Catalog->Attributes->Manage Attributes"</comment>
263
+ <source_model>logicbroker/system_config_source_attributecodes</source_model>
264
+ <sort_order>19</sort_order>
265
+ <show_in_default>1</show_in_default>
266
+ <show_in_website>0</show_in_website>
267
+ <show_in_store>0</show_in_store>
268
+ <validate>required-entry</validate>
269
+ </supplier_attribute>
270
+
271
+ <stores translate="label">
272
+ <label>Stores</label>
273
+ <frontend_type>multiselect</frontend_type>
274
+ <source_model>adminhtml/system_config_source_store</source_model>
275
+ <sort_order>20</sort_order>
276
+ <show_in_default>1</show_in_default>
277
+ <show_in_website>0</show_in_website>
278
+ <show_in_store>0</show_in_store>
279
+ <validate>required-entry</validate>
280
+ </stores>
281
+
282
+ <logic_broker_username translate="label">
283
+ <label>Magento Admin Username For logicbroker</label>
284
+ <frontend_type>text</frontend_type>
285
+ <!--source_model>adminhtml/system_config_source_text</source_model-->
286
+ <sort_order>21</sort_order>
287
+ <show_in_default>1</show_in_default>
288
+ <show_in_website>0</show_in_website>
289
+ <show_in_store>0</show_in_store>
290
+ <validate>required-entry</validate>
291
+ </logic_broker_username>
292
+
293
+ <logic_broker_password translate="label">
294
+ <label>Magento Admin Password For logicbroker</label>
295
+ <frontend_type>Password</frontend_type>
296
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
297
+ <sort_order>22</sort_order>
298
+ <show_in_default>1</show_in_default>
299
+ <show_in_website>0</show_in_website>
300
+ <show_in_store>0</show_in_store>
301
+ <validate>required-entry</validate>
302
+ </logic_broker_password>
303
+
304
+ <your_production_store_url translate="label">
305
+ <label>Production Webservice URL</label>
306
+ <frontend_type>text</frontend_type>
307
+ <sort_order>23</sort_order>
308
+ <show_in_default>1</show_in_default>
309
+ <show_in_website>0</show_in_website>
310
+ <show_in_store>0</show_in_store>
311
+ <!--comment>Please append "/" at end of the URL</comment-->
312
+ <validate>required-entry validate-url-logicbroker</validate>
313
+ </your_production_store_url>
314
+
315
+ <your_staging_store_url translate="label">
316
+ <label>Staging Webservice URL</label>
317
+ <frontend_type>text</frontend_type>
318
+ <sort_order>24</sort_order>
319
+ <show_in_default>1</show_in_default>
320
+ <show_in_website>0</show_in_website>
321
+ <show_in_store>0</show_in_store>
322
+ <!--comment>Please append "/" at end of the URL</comment-->
323
+ <validate>required-entry validate-url-logicbroker</validate>
324
+ </your_staging_store_url>
325
+
326
+ <api_user_name translate="label">
327
+ <label>Webservice Username</label>
328
+ <frontend_type>text</frontend_type>
329
+ <sort_order>25</sort_order>
330
+ <show_in_default>1</show_in_default>
331
+ <show_in_website>0</show_in_website>
332
+ <show_in_store>0</show_in_store>
333
+ <validate>required-entry</validate>
334
+ </api_user_name>
335
+
336
+ <api_password translate="label">
337
+ <label>Webservice Password</label>
338
+ <frontend_type>Password</frontend_type>
339
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
340
+ <sort_order>26</sort_order>
341
+ <show_in_default>1</show_in_default>
342
+ <show_in_website>0</show_in_website>
343
+ <show_in_store>0</show_in_store>
344
+ <validate>required-entry</validate>
345
+ </api_password>
346
+
347
+ <processing_status translate="label">
348
+ <label>Processing Status</label>
349
+ <comment>Status can be check by navigating to "System->Order Statuses</comment>
350
+ <frontend_type>text</frontend_type>
351
+ <sort_order>27</sort_order>
352
+ <show_in_default>1</show_in_default>
353
+ <show_in_website>0</show_in_website>
354
+ <show_in_store>0</show_in_store>
355
+ <validate>required-entry validate-data</validate>
356
+ </processing_status>
357
+
358
+ <error_status translate="label">
359
+ <comment>Status can be check by navigating to "System->Order Statuses</comment>
360
+ <label>Error Status</label>
361
+ <frontend_type>text</frontend_type>
362
+ <sort_order>28</sort_order>
363
+ <show_in_default>1</show_in_default>
364
+ <show_in_website>0</show_in_website>
365
+ <show_in_store>0</show_in_store>
366
+ <validate>required-entry validate-data</validate>
367
+ </error_status>
368
+
369
+ <sentto_warehouse_status translate="label">
370
+ <comment>Status can be check by navigating to "System->Order Statuses</comment>
371
+ <label>Sent To Vendor Status</label>
372
+ <frontend_type>text</frontend_type>
373
+ <sort_order>29</sort_order>
374
+ <show_in_default>1</show_in_default>
375
+ <show_in_website>0</show_in_website>
376
+ <show_in_store>0</show_in_store>
377
+ <validate>required-entry validate-data</validate>
378
+ </sentto_warehouse_status>
379
+
380
+ <termsandcondition translate="label">
381
+ <label>Accept Terms And Conditions</label>
382
+ <frontend_type>checkbox</frontend_type>
383
+ <sort_order>30</sort_order>
384
+ <show_in_default>1</show_in_default>
385
+ <show_in_website>0</show_in_website>
386
+ <show_in_store>0</show_in_store>
387
+ <validate>validate-one-required-by-name</validate>
388
+ </termsandcondition>
389
+ <need_help translate="label comment">
390
+ <label>Need Help?</label>
391
+ <text>Contact Us</text>
392
+ <frontend_type>link</frontend_type>
393
+ <sort_order>31</sort_order>
394
+ <show_in_default>1</show_in_default>
395
+ <show_in_website>0</show_in_website>
396
+ <show_in_store>0</show_in_store>
397
+ </need_help>
398
+ <submit_button translate="label comment">
399
+ <frontend_type>button</frontend_type>
400
+ <frontend_model>logicbroker/adminhtml_system_config_submitbutton</frontend_model>
401
+ <sort_order>32</sort_order>
402
+ <show_in_default>1</show_in_default>
403
+ <show_in_website>0</show_in_website>
404
+ <show_in_store>0</show_in_store>
405
+ </submit_button>
406
+
407
+
408
+ </fields>
409
+ </integration>
410
+ </groups>
411
+ </logicbroker_integration>
412
+ </sections>
413
+ </config>
app/code/community/Logicbroker/Fulfillment/sql/logicbroker_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Logicbroker
5
+ *
6
+ * @category Community
7
+ * @package Logicbroker_Fulfillment
8
+ */
9
+
10
+ $installer = $this;
11
+ $installer->startSetup();
12
+ $sql=<<<SQLTEXT
13
+ DROP TABLE IF EXISTS {$this->getTable('logicbroker_vendor')};
14
+ CREATE TABLE {$this->getTable('logicbroker_vendor')}(vendor_id int not null auto_increment,
15
+ company_id varchar(50) not null,
16
+ companyname varchar(100) not null,
17
+ address1 varchar(255) not null,
18
+ address2 varchar(255) not null,
19
+ city varchar(100) not null,
20
+ state varchar(100) not null,
21
+ zip int not null ,
22
+ country varchar(50) not null,
23
+ edi_qualifier text NOT NULL,
24
+ edi_identifier varchar(100) not null,
25
+ magento_vendor_code varchar(100) not null,
26
+ file_directory_inbound varchar(100) not null,
27
+ file_directory_outbound varchar(100) not null,
28
+ ftp_address varchar(100) not null,
29
+ ftp_username varchar(100) not null,
30
+ ftp_password varchar(100) not null,
31
+ firstname varchar(100) not null,
32
+ lastname varchar(100) not null,
33
+ email varchar(100) not null,
34
+ phone varchar(50) not null,
35
+ primary key(vendor_id),
36
+ is_update int(1) NOT NULL DEFAULT '0',
37
+ verified int(1) NOT NULL DEFAULT '0',
38
+ ftp_protocol ENUM('ftp','ftpes' ) NOT NULL,
39
+ magento_vendor_attribute_id varchar(255) not null,
40
+ status varchar(11) NOT NULL,
41
+ KEY `company_id` (`company_id`),
42
+ KEY `status` (`status`),
43
+ KEY `magento_vendor_code` (`magento_vendor_code`),
44
+ KEY `email` (`email`))
45
+ ENGINE=InnoDB DEFAULT CHARSET=utf8;
46
+
47
+ SQLTEXT;
48
+
49
+ $installer->run($sql);
50
+ //demo
51
+ //Mage::getModel('core/url_rewrite')->setId(null);
52
+ //demo
53
+ $installer->endSetup();
54
+
app/design/adminhtml/default/default/layout/logicbroker.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <logicbroker_adminhtml_logicbroker_index>
4
+ <reference name="content">
5
+ <block type="logicbroker/adminhtml_logicbroker" name="logicbroker" />
6
+ </reference>
7
+ </logicbroker_adminhtml_logicbroker_index>
8
+ </layout>
app/design/adminhtml/default/default/template/logicbroker/system/config/fieldset/hint.phtml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * @see Mage_Paypal_Block_System_Config_Fieldset_Hint
30
+ */
31
+ ?>
32
+
33
+ <div class="logicbroker">
34
+ <div class="logicbroker-notice">
35
+
36
+ </div>
37
+ <div class="title">
38
+
39
+ <h1 style=""></h1>
40
+
41
+ </div>
42
+ <div class="logicbroker-form">
43
+ <div class="logicbroker-addnew">
44
+ <?php //echo $this->getChildHtml('form') ?>
45
+
46
+ </div>
47
+ </div>
48
+ </div>
app/design/adminhtml/default/default/template/logicbroker/system/config/submitbutton.phtml ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <?php /* var $this Mage_Adminhtml_Block_System_Config_System_Storage_Media_Synchronize */ ?>
29
+
30
+ <script type="text/javascript">
31
+ //<![CDATA[
32
+ Validation.addAllThese([
33
+ ['validate-url-logicbroker', 'Please enter a valid URL. Protocol is required (http://, https:// )', function (v) {
34
+ v = (v || '').replace(/^\s+/, '').replace(/\s+$/, '');
35
+ return Validation.get('IsEmpty').test(v) || /^(http|https):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(v)
36
+ }],
37
+ ['validate-ftp-url-logicbroker', 'Please enter a valid URL. Protocol is required (ftp://, ftps:// )', function (v) {
38
+ return Validation.get('IsEmpty').test(v) || /^(ftps|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v) || /^(www)((\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v)
39
+ }]
40
+ ]);
41
+ <?php if(!Mage::getStoreConfig('logicbroker_integration/integration/notificationstatus')) ?>
42
+ $('logicbroker_integration_integration_notificationstatus').value = '1';
43
+
44
+ $$('.form-buttons')[0].hide()
45
+ $('row_logicbroker_integration_integration_issubmitted').hide()
46
+ $('row_logicbroker_integration_integration_notificationstatus').hide()
47
+ $('row_logicbroker_integration_integration_dateofinstalltion').hide()
48
+ $$('.required-entry').each(function(items){
49
+ $('row_'+items.id).down(1).insert('<span class="required"> *</span>');
50
+
51
+ })
52
+ $('logicbroker_integration_integration_termsandcondition').up().insert({bottom:'&nbsp&nbspPlease see the <a href="<?php echo $this->getTermsAndConditionsUrl() ?>" target="_blank">Terms & Conditions</a>'});
53
+
54
+ $('logicbroker_integration_integration_need_help').href = '<?php echo $this->getHelpUrl() ?>';
55
+ $('logicbroker_integration_integration_need_help').target = '_blank';
56
+ $('logicbroker_integration_integration_need_help').insert('Contact Us');
57
+ //var testValidation = new varienForm('config_edit_form',true);
58
+
59
+ function synchronize(id) {
60
+
61
+ if(!configForm.validate())
62
+ {
63
+ return ;
64
+ }
65
+
66
+ if(id == 'save_button')
67
+ {
68
+ $('savelater').value = '1';
69
+ $$('.form-buttons')[0].show()
70
+ $('logicbroker_integration_integration_issubmitted').value = '0';
71
+ configForm.submit()
72
+
73
+ }
74
+
75
+
76
+ new Ajax.Request('<?php echo $this->getAjaxSyncUrl() ?>', {
77
+ parameters: $('config_edit_form').serialize(),
78
+ method: 'post',
79
+ onSuccess: successFunc,
80
+ onFailure: failFunc
81
+ });
82
+
83
+ // window.setTimeout('checkStatus()', 2011);
84
+
85
+ // disableStorageSelection();
86
+ // disableSyncButton();
87
+ }
88
+
89
+ function successFunc(response){
90
+
91
+ //var content = response.responseText;
92
+ //return alert(content);
93
+ var container = $('messages');
94
+ var content = response.responseText.evalJSON();
95
+ //container.update(content);
96
+ if(content.success)
97
+ {
98
+ container.update('<ul class="messages"><li class="success-msg"><ul><li><span>'+content.success+'</span></li></ul></li></ul>')
99
+ container.scrollTo()
100
+ $$('.form-buttons')[0].show()
101
+ $('logicbroker_integration_integration_issubmitted').value = '1';
102
+ configForm.submit()
103
+ }
104
+ if(content.error)
105
+ {
106
+ container.update('<ul class="messages"><li class="error-msg"><ul><li><span>'+content.error+'</span></li></ul></li></ul>')
107
+ container.scrollTo()
108
+ return;
109
+ }
110
+
111
+ }
112
+
113
+ function failFunc(){
114
+ alert('Not able to connect to server please try again later');
115
+ }
116
+ //]]>
117
+ </script>
118
+ <?php echo $this->getSaveButtonHtml() ?><?php echo $this->getSubmitButtonHtml() ?><!--span class="sync-indicator no-display" id="sync_span"><img alt="Synchronize" style="margin:0 5px" src="<?php echo $this->getSkinUrl('images/process_spinner.gif') ?>"/><span id="sync_message_span"></span></span-->
119
+ <!--p></p>
120
+ <p><a href="<?php echo $this->getHelpUrl() ?>" target="_blank">Having Trouble?</a></p-->
121
+
122
+ <?php if(Mage::getStoreConfig('logicbroker_integration/integration/issubmitted') == '0'): ?>
123
+ <p><ul class="messages"><li class="error-msg"><ul><li><span><?php echo $this->__('You have unsubmitted changes.') ?></span></li></ul></li></ul></p>
124
+ <?php endif; ?>
125
+ <input type="hidden" id="savelater" name="savelater" value="0"/>
app/etc/modules/Logicbroker_Fulfillment.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Logicbroker_Fulfillment>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>0.1.0</version>
8
+ </Logicbroker_Fulfillment>
9
+ </modules>
10
+ </config>
app/locale/en_US/Logicbroker_Fulfillment.csv ADDED
@@ -0,0 +1,2 @@
 
 
1
+ "Please enter a valid URL. Protocol is required (http://, https:// or ftp://)","Please enter a valid URL. Protocol is required (http://, https://)"
2
+ "Please select one of the options.","Please select the checkbox."
app/locale/en_US/template/email/logicbroker.html ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Contact Form@-->
2
+ <!--@vars
3
+ {"var data.name":"Sender Name",
4
+ "var data.email":"Sender Email",
5
+ "var data.telephone":"Sender Telephone",
6
+ "var data.comment":"Comment"}
7
+ @-->
8
+
9
+ {{if templatevar.isnewreg}}
10
+ A new user has installed Extension on following URL -: {{store url=""}}
11
+ {{else}}
12
+ Please find the excel sheet in attachment customer details are given below -:<br> Name : {{var templatevar.firstname}} <span>{{var templatevar.lastname}}
13
+ </span> <br> Email : {{var templatevar.email}}
14
+ {{/if}}
15
+
16
+
17
+
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>logicbroker</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://logicbroker.com/portfolio/magento/license">Customer License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>logicbroker enables Magento merchants to seamlessly connect with vendors via EDI for drop ship automation.</summary>
10
+ <description>logicbroker is the most complete eCommerce integration platform available and offers a true end-to-end EDI solution for Magento. Beyond its EDI capabilities, logicbroker&#x2019;s flexible connectivity automates and simplifies tasks like drop ship deployment and omni-channel retailing. logicbroker connects Magento to backend systems like ERPs (Dynamics, Netsuite, Exact), accounting software (QuickBooks), and order management systems (M.O.M) to seamlessly exchange information</description>
11
+ <notes>Stable</notes>
12
+ <authors><author><name>Logicbroker</name><user>Logicbroker</user><email>magentoext@logicbroker.com</email></author></authors>
13
+ <date>2014-04-28</date>
14
+ <time>12:42:54</time>
15
+ <contents><target name="magecommunity"><dir name="Logicbroker"><dir name="Fulfillment"><dir name="Block"><dir name="Adminhtml"><dir name="Logicbroker"><dir name="Edit"><file name="Form.php" hash="f6cda7c2b3c2abde7ead267cd5225bdd"/><dir name="Tab"><file name="Form.php" hash="d8fa50be85d9803260293ca302d29845"/></dir><file name="Tabs.php" hash="aa50ffbd40244b75544eaa0beee7424b"/></dir><file name="Edit.php" hash="f65072acf0dfbffd87bbc8f130289d44"/><file name="Grid.php" hash="4647fad316e3b59678e6a7d6edb9f278"/></dir><file name="Logicbroker.php" hash="263acd2c2bcc377c61c12b28e28f496c"/><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="fb5c84fc3a92224fe96bcf772ce4e3e2"/></dir><file name="Submitbutton.php" hash="ae26fe2eddd677ac0bc172604c295f93"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Textaction.php" hash="91e820b46d5fd27ea46db4ca5305a516"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="ead0d884761acefd39073dfef7ce7cd0"/></dir><dir name="Model"><file name="Abstract.php" hash="6a4f54539e45483251c738cac17485f1"/><file name="Apicreate.php" hash="f525ac3eb7677d00486ed5ac8b9dffce"/><file name="Email.php" hash="9db5cb8066f1ae5695689fbb424d4a2a"/><file name="Excelxml.php" hash="e38e32160200c8597f4681440765659c"/><file name="Infromlogicbroker.php" hash="dcf042dfa253809f1f6e2886d40e6414"/><file name="Logicbroker.php" hash="1b3342e6eb17ce1e0b387af837b286f1"/><file name="Observer.php" hash="6eb1b76791aa5147d8d3e4429cc3c89e"/><dir name="Resource"><dir name="Supplier"><file name="Collection.php" hash="8d34cf5db7ea454507f6e482c1980487"/></dir><file name="Supplier.php" hash="70a06dfb0429b2e92052a6dc61eb822a"/></dir><file name="Supplier.php" hash="1b9f082644c8af7320c6758af51e96b2"/><file name="Synchronize.php" hash="19a6bb2daa3231fbb469bb12cbfc41ee"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Attributecodes.php" hash="4b9d097406e0c4b5030fc739a798fd1a"/><file name="Ediqualifier.php" hash="d25512bfd273a84b7628fab7103c5be3"/><file name="Optionvalues.php" hash="70cc5a5c7c72f6a75b6d5266467ff8c9"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="LogicbrokerController.php" hash="7f723e921e1ed38492a8c95c265fd8bd"/></dir></dir><dir name="data"><dir name="logicbroker_setup"><file name="data-install-1.0.0.php" hash="dc8db696c806e0ef43dd7fe151e781e5"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="aa3bcde0b8f36840f82b7079dda4abc4"/><file name="config.xml" hash="5c128d32c6953e50c5f7c61d33ff3676"/><file name="jstranslator.xml" hash="c4401a0c80dd792208ee3bbdbe6c27ff"/><file name="system.xml" hash="319d06d78cf529d81dc63ace510ce2d8"/></dir><dir name="sql"><dir name="logicbroker_setup"><file name="mysql4-install-1.0.0.php" hash="e39fe4850f06551e745a646274d53410"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="logicbroker"><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="7b409b95a71e7315fe672ffe075a6323"/></dir><file name="submitbutton.phtml" hash="c524672897bab938256b7dd3e101606b"/></dir></dir></dir></dir><dir name="layout"><file name="logicbroker.xml" hash="7a8d87801975b329f79a94f1a3b73302"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Logicbroker_Fulfillment.xml" hash="423c11fbb087bcb8c82e4a39138ae492"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Logicbroker_Fulfillment.csv" hash="34e85a999b73c4a216eed04dfffa756d"/><dir name="template"><dir name="email"><file name="logicbroker.html" hash="20ec1acaa64500708bdc6b1c86a33668"/></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>