Magebuzz_Simple_Faq - Version 0.1.2

Version Notes

Reuploaded

Download this release

Release Info

Developer Magebuzz
Extension Magebuzz_Simple_Faq
Version 0.1.2
Comparing to
See all releases


Version 0.1.2

Files changed (54) hide show
  1. app/code/community/Magebuzz/Faq/Block/Adminhtml/Category.php +12 -0
  2. app/code/community/Magebuzz/Faq/Block/Adminhtml/Category/Edit.php +45 -0
  3. app/code/community/Magebuzz/Faq/Block/Adminhtml/Category/Edit/Form.php +21 -0
  4. app/code/community/Magebuzz/Faq/Block/Adminhtml/Category/Edit/Tab/Form.php +73 -0
  5. app/code/community/Magebuzz/Faq/Block/Adminhtml/Category/Edit/Tabs.php +24 -0
  6. app/code/community/Magebuzz/Faq/Block/Adminhtml/Category/Grid.php +131 -0
  7. app/code/community/Magebuzz/Faq/Block/Adminhtml/Faq.php +12 -0
  8. app/code/community/Magebuzz/Faq/Block/Adminhtml/Faq/Edit.php +52 -0
  9. app/code/community/Magebuzz/Faq/Block/Adminhtml/Faq/Edit/Form.php +19 -0
  10. app/code/community/Magebuzz/Faq/Block/Adminhtml/Faq/Edit/Tab/Form.php +85 -0
  11. app/code/community/Magebuzz/Faq/Block/Adminhtml/Faq/Edit/Tabs.php +24 -0
  12. app/code/community/Magebuzz/Faq/Block/Adminhtml/Faq/Grid.php +140 -0
  13. app/code/community/Magebuzz/Faq/Block/Adminhtml/Faq/Renderer/Category.php +11 -0
  14. app/code/community/Magebuzz/Faq/Block/Category.php +62 -0
  15. app/code/community/Magebuzz/Faq/Block/Detail.php +62 -0
  16. app/code/community/Magebuzz/Faq/Block/Faq.php +99 -0
  17. app/code/community/Magebuzz/Faq/Block/Left.php +28 -0
  18. app/code/community/Magebuzz/Faq/Block/Result.php +181 -0
  19. app/code/community/Magebuzz/Faq/Helper/Data.php +44 -0
  20. app/code/community/Magebuzz/Faq/Model/Category.php +21 -0
  21. app/code/community/Magebuzz/Faq/Model/Faq.php +25 -0
  22. app/code/community/Magebuzz/Faq/Model/Item.php +23 -0
  23. app/code/community/Magebuzz/Faq/Model/Mysql4/Category.php +73 -0
  24. app/code/community/Magebuzz/Faq/Model/Mysql4/Category/Collection.php +30 -0
  25. app/code/community/Magebuzz/Faq/Model/Mysql4/Faq.php +270 -0
  26. app/code/community/Magebuzz/Faq/Model/Mysql4/Faq/Collection.php +25 -0
  27. app/code/community/Magebuzz/Faq/Model/Mysql4/Item.php +9 -0
  28. app/code/community/Magebuzz/Faq/Model/Mysql4/Item/Collection.php +10 -0
  29. app/code/community/Magebuzz/Faq/Model/Status.php +16 -0
  30. app/code/community/Magebuzz/Faq/Model/System/Config/Source/Sortorder.php +12 -0
  31. app/code/community/Magebuzz/Faq/controllers/Adminhtml/CategoryController.php +197 -0
  32. app/code/community/Magebuzz/Faq/controllers/Adminhtml/FaqController.php +203 -0
  33. app/code/community/Magebuzz/Faq/controllers/CategoryController.php +27 -0
  34. app/code/community/Magebuzz/Faq/controllers/IndexController.php +15 -0
  35. app/code/community/Magebuzz/Faq/etc/adminhtml.xml +77 -0
  36. app/code/community/Magebuzz/Faq/etc/config.xml +134 -0
  37. app/code/community/Magebuzz/Faq/etc/system.xml +58 -0
  38. app/code/community/Magebuzz/Faq/sql/faq_setup/mysql4-install-0.1.0.php +41 -0
  39. app/code/community/Magebuzz/Faq/sql/faq_setup/mysql4-upgrade-0.1.0-0.1.1.php +29 -0
  40. app/code/community/Magebuzz/Faq/sql/faq_setup/mysql4-upgrade-0.1.1-0.1.2.php +8 -0
  41. app/design/frontend/base/default/layout/faq.xml +82 -0
  42. app/design/frontend/base/default/template/faq/category.phtml +41 -0
  43. app/design/frontend/base/default/template/faq/detail.phtml +22 -0
  44. app/design/frontend/base/default/template/faq/faq.phtml +90 -0
  45. app/design/frontend/base/default/template/faq/left.phtml +15 -0
  46. app/design/frontend/base/default/template/faq/result.phtml +58 -0
  47. app/etc/modules/Magebuzz_Faq.xml +9 -0
  48. app/locale/en_US/Magebuzz_Faq.csv +12 -0
  49. package.xml +18 -0
  50. skin/frontend/base/default/magebuzz/faq/faq.css +100 -0
  51. skin/frontend/base/default/magebuzz/faq/images/Thumbs.db +0 -0
  52. skin/frontend/base/default/magebuzz/faq/images/bkg_block-layered-dt.gif +0 -0
  53. skin/frontend/base/default/magebuzz/faq/images/bkg_block-layered-label.gif +0 -0
  54. skin/frontend/base/default/magebuzz/faq/images/bullet.png +0 -0
app/code/community/Magebuzz/Faq/Block/Adminhtml/Category.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Faq_Block_Adminhtml_Category extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_category';
7
+ $this->_blockGroup = 'faq';
8
+ $this->_headerText = Mage::helper('faq')->__('Manage FAQ Categories');
9
+ $this->_addButtonLabel = Mage::helper('faq')->__('Add New FAQ Category');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/community/Magebuzz/Faq/Block/Adminhtml/Category/Edit.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Faq_Block_Adminhtml_Category_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'faq';
11
+ $this->_controller = 'adminhtml_category';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('faq')->__('Save Category'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('faq')->__('Delete Category'));
15
+
16
+ $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);
21
+
22
+ $this->_formScripts[] = "
23
+ function toggleEditor() {
24
+ if (tinyMCE.getInstanceById('faq_content') == null) {
25
+ tinyMCE.execCommand('mceAddControl', false, 'faq_content');
26
+ } else {
27
+ tinyMCE.execCommand('mceRemoveControl', false, 'faq_content');
28
+ }
29
+ }
30
+
31
+ function saveAndContinueEdit(){
32
+ editForm.submit($('edit_form').action+'back/edit/');
33
+ }
34
+ ";
35
+ }
36
+
37
+ public function getHeaderText()
38
+ {
39
+ if( Mage::registry('faq_data') && Mage::registry('faq_data')->getId() ) {
40
+ return Mage::helper('faq')->__("Edit Category '%s'", $this->htmlEscape(Mage::registry('faq_data')->getCategoryName()));
41
+ } else {
42
+ return Mage::helper('faq')->__('New Category');
43
+ }
44
+ }
45
+ }
app/code/community/Magebuzz/Faq/Block/Adminhtml/Category/Edit/Form.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Faq_Block_Adminhtml_Category_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+
16
+
17
+ $form->setUseContainer(true);
18
+ $this->setForm($form);
19
+ return parent::_prepareForm();
20
+ }
21
+ }
app/code/community/Magebuzz/Faq/Block/Adminhtml/Category/Edit/Tab/Form.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Faq_Block_Adminhtml_Category_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('faq_form', array('legend'=>Mage::helper('faq')->__('General Information')));
10
+
11
+ $fieldset->addField('category_name', 'text', array(
12
+ 'name' => 'category_name',
13
+ 'label' => Mage::helper('faq')->__('Category Name'),
14
+ 'title' => Mage::helper('faq')->__('Category Name'),
15
+ 'required' => true,
16
+ ));
17
+ $fieldset->addField('sort_order', 'text', array(
18
+ 'name' => 'sort_order',
19
+ 'label' => Mage::helper('faq')->__('Sort Order'),
20
+ 'title' => Mage::helper('faq')->__('Sort Order'),
21
+ 'required' => false,
22
+ ));
23
+
24
+ if (!Mage::app()->isSingleStoreMode()) {
25
+ $fieldset->addField('store_id', 'multiselect', array(
26
+ 'name' => 'stores[]',
27
+ 'label' => Mage::helper('cms')->__('Store View'),
28
+ 'title' => Mage::helper('cms')->__('Store View'),
29
+ 'required' => true,
30
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
31
+ ));
32
+ }
33
+ else {
34
+ $fieldset->addField('store_id', 'hidden', array(
35
+ 'name' => 'stores[]',
36
+ 'value' => Mage::app()->getStore(true)->getId()
37
+ ));
38
+ $model->setStoreId(Mage::app()->getStore(true)->getId());
39
+ }
40
+
41
+ $category_id = $this->getRequest()->getParam('id');
42
+ $fieldset->addField('category_id', 'hidden', array(
43
+ 'name' => 'category_id',
44
+ 'value' => $category_id,
45
+ ));
46
+
47
+ $fieldset->addField('is_active', 'select', array(
48
+ 'label' => Mage::helper('faq')->__('Active'),
49
+ 'name' => 'is_active',
50
+ 'values' => array(
51
+ array(
52
+ 'value' => 1,
53
+ 'label' => Mage::helper('faq')->__('Enabled'),
54
+ ),
55
+
56
+ array(
57
+ 'value' => 0,
58
+ 'label' => Mage::helper('faq')->__('Disabled'),
59
+ ),
60
+ ),
61
+ ));
62
+
63
+
64
+ if ( Mage::getSingleton('adminhtml/session')->getFaqData() )
65
+ {
66
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getFaqData());
67
+ Mage::getSingleton('adminhtml/session')->setFaqData(null);
68
+ } elseif ( Mage::registry('faq_data') ) {
69
+ $form->setValues(Mage::registry('faq_data')->getData());
70
+ }
71
+ return parent::_prepareForm();
72
+ }
73
+ }
app/code/community/Magebuzz/Faq/Block/Adminhtml/Category/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Faq_Block_Adminhtml_Category_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('faq_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('faq')->__('Category Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('faq')->__('General Information'),
18
+ 'title' => Mage::helper('faq')->__('General Information'),
19
+ 'content' => $this->getLayout()->createBlock('faq/adminhtml_category_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/community/Magebuzz/Faq/Block/Adminhtml/Category/Grid.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Faq_Block_Adminhtml_Category_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('faqGrid');
9
+ $this->setDefaultSort('category_id');
10
+ $this->setDefaultDir('DESC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('faq/category')->getCollection();
17
+ $this->setCollection($collection);
18
+ return parent::_prepareCollection();
19
+ }
20
+
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn('category_id', array(
24
+ 'header' => Mage::helper('faq')->__('Category#'),
25
+ 'align' =>'right',
26
+ 'width' => '50px',
27
+ 'index' => 'category_id',
28
+ ));
29
+
30
+
31
+ $this->addColumn('category_name', array(
32
+ 'header' => Mage::helper('faq')->__('Category Name'),
33
+ 'align' => 'left',
34
+ 'index' => 'category_name',
35
+ ));
36
+ $this->addColumn('sort_order', array(
37
+ 'header' => Mage::helper('faq')->__('Sort Order'),
38
+ 'align' => 'center',
39
+ 'width' => '20px',
40
+ 'index' => 'sort_order'
41
+ ));
42
+
43
+ if (!Mage::app()->isSingleStoreMode()) {
44
+ $this->addColumn('store_id', array(
45
+ 'header' => Mage::helper('cms')->__('Store View'),
46
+ 'index' => 'store_id',
47
+ 'type' => 'store',
48
+ 'store_all' => true,
49
+ 'store_view' => true,
50
+ 'sortable' => false,
51
+ 'filter_condition_callback'
52
+ => array($this, '_filterStoreCondition'),
53
+ ));
54
+ }
55
+
56
+
57
+ $this->addColumn('is_active', array(
58
+ 'header' => Mage::helper('faq')->__('Active'),
59
+ 'align' => 'left',
60
+ 'width' => '80px',
61
+ 'index' => 'is_active',
62
+ 'type' => 'options',
63
+ 'options' => array(
64
+ 1 => 'Enabled',
65
+ 0 => 'Disabled',
66
+ ),
67
+ ));
68
+
69
+ $this->addColumn('action',
70
+ array(
71
+ 'header' => Mage::helper('faq')->__('Action'),
72
+ 'width' => '100',
73
+ 'type' => 'action',
74
+ 'getter' => 'getId',
75
+ 'actions' => array(
76
+ array(
77
+ 'caption' => Mage::helper('faq')->__('Edit'),
78
+ 'url' => array('base'=> '*/*/edit'),
79
+ 'field' => 'id'
80
+ )
81
+ ),
82
+ 'filter' => false,
83
+ 'sortable' => false,
84
+ 'index' => 'stores',
85
+ 'is_system' => true,
86
+ ));
87
+
88
+ return parent::_prepareColumns();
89
+ }
90
+
91
+ protected function _prepareMassaction()
92
+ {
93
+ $this->setMassactionIdField('category_id');
94
+ $this->getMassactionBlock()->setFormFieldName('faq');
95
+
96
+ $this->getMassactionBlock()->addItem('delete', array(
97
+ 'label' => Mage::helper('faq')->__('Delete'),
98
+ 'url' => $this->getUrl('*/*/massDelete'),
99
+ 'confirm' => Mage::helper('faq')->__('Are you sure?')
100
+ ));
101
+
102
+ $statuses = Mage::getSingleton('faq/status')->getOptionArray();
103
+
104
+ // array_unshift($statuses, array('label'=>'', 'value'=>''));
105
+ $this->getMassactionBlock()->addItem('status', array(
106
+ 'label'=> Mage::helper('faq')->__('Change status'),
107
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
108
+ 'additional' => array(
109
+ 'visibility' => array(
110
+ 'name' => 'status',
111
+ 'type' => 'select',
112
+ 'class' => 'required-entry',
113
+ 'label' => Mage::helper('faq')->__('Status'),
114
+ 'values' => $statuses
115
+ )
116
+ )
117
+ ));
118
+ return $this;
119
+ }
120
+
121
+ public function getRowUrl($row)
122
+ {
123
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
124
+ }
125
+
126
+ protected function _afterLoadCollection() {
127
+ $this->getCollection()->walk('afterLoad');
128
+ parent::_afterLoadCollection();
129
+ }
130
+
131
+ }
app/code/community/Magebuzz/Faq/Block/Adminhtml/Faq.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Faq_Block_Adminhtml_Faq extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_faq';
7
+ $this->_blockGroup = 'faq';
8
+ $this->_headerText = Mage::helper('faq')->__('Manage FAQ');
9
+ $this->_addButtonLabel = Mage::helper('faq')->__('Add New FAQ');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/community/Magebuzz/Faq/Block/Adminhtml/Faq/Edit.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Faq_Block_Adminhtml_Faq_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'faq';
11
+ $this->_controller = 'adminhtml_faq';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('faq')->__('Save FAQ'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('faq')->__('Delete FAQ'));
15
+
16
+ $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);
21
+
22
+ $this->_formScripts[] = "
23
+ function toggleEditor() {
24
+ if (tinyMCE.getInstanceById('faq_content') == null) {
25
+ tinyMCE.execCommand('mceAddControl', false, 'faq_content');
26
+ } else {
27
+ tinyMCE.execCommand('mceRemoveControl', false, 'faq_content');
28
+ }
29
+ }
30
+
31
+ function saveAndContinueEdit(){
32
+ editForm.submit($('edit_form').action+'back/edit/');
33
+ }
34
+ ";
35
+ }
36
+
37
+ protected function _prepareLayout() {
38
+ parent::_prepareLayout();
39
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
40
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
41
+ }
42
+ }
43
+
44
+ public function getHeaderText()
45
+ {
46
+ if( Mage::registry('faq_data') && Mage::registry('faq_data')->getId() ) {
47
+ return Mage::helper('faq')->__("Edit FAQ '%s'", $this->htmlEscape(Mage::registry('faq_data')->getQuestion()));
48
+ } else {
49
+ return Mage::helper('faq')->__('New FAQ');
50
+ }
51
+ }
52
+ }
app/code/community/Magebuzz/Faq/Block/Adminhtml/Faq/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Faq_Block_Adminhtml_Faq_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/community/Magebuzz/Faq/Block/Adminhtml/Faq/Edit/Tab/Form.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Faq_Block_Adminhtml_Faq_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('faq_form', array('legend'=>Mage::helper('faq')->__('General Information')));
10
+
11
+ $model = Mage::registry('faq_data');
12
+ $fieldset->addField('question', 'text', array(
13
+ 'name' => 'question',
14
+ 'label' => Mage::helper('faq')->__('Question'),
15
+ 'title' => Mage::helper('faq')->__('Question'),
16
+ 'required' => true,
17
+ ));
18
+
19
+ $fieldset->addField('is_active', 'select', array(
20
+ 'label' => Mage::helper('faq')->__('Active'),
21
+ 'name' => 'is_active',
22
+ 'values' => array(
23
+ array(
24
+ 'value' => 1,
25
+ 'label' => Mage::helper('faq')->__('Enabled'),
26
+ ),
27
+
28
+ array(
29
+ 'value' => 0,
30
+ 'label' => Mage::helper('faq')->__('Disabled'),
31
+ ),
32
+ ),
33
+ ));
34
+
35
+ $fieldset->addField('category_id', 'select', array(
36
+ 'name' => 'categories[]',
37
+ 'label' => Mage::helper('faq')->__('Category'),
38
+ 'title' => Mage::helper('faq')->__('Category'),
39
+ 'required' => true,
40
+ 'values' => Mage::getResourceSingleton('faq/category_collection')->toOptionArray(),
41
+ ));
42
+ $fieldset->addField('sort_order', 'text', array(
43
+ 'name' => 'sort_order',
44
+ 'label' => Mage::helper('faq')->__('Sort Order'),
45
+ 'title' => Mage::helper('faq')->__('Sort Order'),
46
+ 'required' => false,
47
+ ));
48
+
49
+ if (!Mage::app()->isSingleStoreMode()) {
50
+ $fieldset->addField('store_id', 'multiselect', array(
51
+ 'name' => 'stores[]',
52
+ 'label' => Mage::helper('cms')->__('Store View'),
53
+ 'title' => Mage::helper('cms')->__('Store View'),
54
+ 'required' => true,
55
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
56
+ ));
57
+ }
58
+ else {
59
+ $fieldset->addField('store_id', 'hidden', array(
60
+ 'name' => 'stores[]',
61
+ 'value' => Mage::app()->getStore(true)->getId()
62
+ ));
63
+ $model->setStoreId(Mage::app()->getStore(true)->getId());
64
+ }
65
+
66
+ $fieldset->addField('answer', 'editor', array(
67
+ 'name' => 'answer',
68
+ 'label' => Mage::helper('faq')->__('Answer'),
69
+ 'title' => Mage::helper('faq')->__('Answer'),
70
+ 'style' => 'height:12em;width:500px;',
71
+ 'wysiwyg' => true,
72
+ 'required' => true,
73
+ 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
74
+ ));
75
+
76
+ if ( Mage::getSingleton('adminhtml/session')->getFaqData() )
77
+ {
78
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getFaqData());
79
+ Mage::getSingleton('adminhtml/session')->setFaqData(null);
80
+ } elseif ( Mage::registry('faq_data') ) {
81
+ $form->setValues(Mage::registry('faq_data')->getData());
82
+ }
83
+ return parent::_prepareForm();
84
+ }
85
+ }
app/code/community/Magebuzz/Faq/Block/Adminhtml/Faq/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Faq_Block_Adminhtml_Faq_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('faq_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('faq')->__('FAQ Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('faq')->__('General Information'),
18
+ 'title' => Mage::helper('faq')->__('General Information'),
19
+ 'content' => $this->getLayout()->createBlock('faq/adminhtml_faq_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/community/Magebuzz/Faq/Block/Adminhtml/Faq/Grid.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Faq_Block_Adminhtml_Faq_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('faqGrid');
9
+ $this->setDefaultSort('faq_id');
10
+ $this->setDefaultDir('DESC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('faq/faq')->getCollection();
17
+ $collection->getSelect()
18
+ ->join(array('faqcat' => Mage::getSingleton('core/resource')->getTableName('faq_category_item')), 'main_table.faq_id=faqcat.faq_id', '')
19
+ ->join(array('cat' => Mage::getSingleton('core/resource')->getTableName('faq_category')), 'faqcat.category_id=cat.category_id', 'cat.category_name')
20
+ ->order('main_table.faq_id', 'ASC');
21
+
22
+ $this->setCollection($collection);
23
+ return parent::_prepareCollection();
24
+ }
25
+
26
+ protected function _prepareColumns()
27
+ {
28
+ $this->addColumn('faq_id', array(
29
+ 'header' => Mage::helper('faq')->__('FAQ#'),
30
+ 'align' =>'right',
31
+ 'width' => '50px',
32
+ 'index' => 'faq_id',
33
+ ));
34
+
35
+ $this->addColumn('question', array(
36
+ 'header' => Mage::helper('faq')->__('Question'),
37
+ 'align' => 'left',
38
+ 'index' => 'question',
39
+ ));
40
+
41
+ $this->addColumn('category_name', array(
42
+ 'header' => Mage::helper('faq')->__('Category'),
43
+ 'align' => 'left',
44
+ 'index' => 'category_name'
45
+ ));
46
+ $this->addColumn('sort_order', array(
47
+ 'header' => Mage::helper('faq')->__('Sort Order'),
48
+ 'align' => 'center',
49
+ 'width' => '20px',
50
+ 'index' => 'sort_order'
51
+ ));
52
+
53
+ if (!Mage::app()->isSingleStoreMode()) {
54
+ $this->addColumn('store_id', array(
55
+ 'header' => Mage::helper('cms')->__('Store View'),
56
+ 'index' => 'store_id',
57
+ 'type' => 'store',
58
+ 'store_all' => true,
59
+ 'store_view' => true,
60
+ 'sortable' => false,
61
+ 'filter_condition_callback' => array($this, '_filterStoreCondition'),
62
+ ));
63
+ }
64
+
65
+ $this->addColumn('is_active', array(
66
+ 'header' => Mage::helper('faq')->__('Active'),
67
+ 'align' => 'left',
68
+ 'width' => '80px',
69
+ 'index' => 'is_active',
70
+ 'type' => 'options',
71
+ 'options' => array(
72
+ 1 => 'Enabled',
73
+ 0 => 'Disabled',
74
+ ),
75
+ ));
76
+
77
+ $this->addColumn('action',
78
+ array(
79
+ 'header' => Mage::helper('faq')->__('Action'),
80
+ 'width' => '100',
81
+ 'type' => 'action',
82
+ 'getter' => 'getId',
83
+ 'actions' => array(
84
+ array(
85
+ 'caption' => Mage::helper('faq')->__('Edit'),
86
+ 'url' => array('base'=> '*/*/edit'),
87
+ 'field' => 'id'
88
+ )
89
+ ),
90
+ 'filter' => false,
91
+ 'sortable' => false,
92
+ 'index' => 'stores',
93
+ 'is_system' => true,
94
+ ));
95
+
96
+ return parent::_prepareColumns();
97
+ }
98
+
99
+ protected function _prepareMassaction()
100
+ {
101
+ $this->setMassactionIdField('faq_id');
102
+ $this->getMassactionBlock()->setFormFieldName('faq');
103
+
104
+ $this->getMassactionBlock()->addItem('delete', array(
105
+ 'label' => Mage::helper('faq')->__('Delete'),
106
+ 'url' => $this->getUrl('*/*/massDelete'),
107
+ 'confirm' => Mage::helper('faq')->__('Are you sure?')
108
+ ));
109
+
110
+ $statuses = Mage::getSingleton('faq/status')->getOptionArray();
111
+
112
+
113
+ // array_unshift($statuses, array('label'=>'', 'value'=>''));
114
+ $this->getMassactionBlock()->addItem('status', array(
115
+ 'label'=> Mage::helper('faq')->__('Change status'),
116
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
117
+ 'additional' => array(
118
+ 'visibility' => array(
119
+ 'name' => 'status',
120
+ 'type' => 'select',
121
+ 'class' => 'required-entry',
122
+ 'label' => Mage::helper('faq')->__('Status'),
123
+ 'values' => $statuses
124
+ )
125
+ )
126
+ ));
127
+ return $this;
128
+ }
129
+
130
+ public function getRowUrl($row)
131
+ {
132
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
133
+ }
134
+
135
+ protected function _afterLoadCollection() {
136
+ $this->getCollection()->walk('afterLoad');
137
+ parent::_afterLoadCollection();
138
+ }
139
+
140
+ }
app/code/community/Magebuzz/Faq/Block/Adminhtml/Faq/Renderer/Category.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Faq_Block_Adminhtml_Faq_Renderer_Category extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
3
+ public function render(Varien_Object $row){
4
+ $category = Mage::getModel('faq/category_item')->getCollection()
5
+ ->addFieldToFilter('faq', $row->getId);
6
+ $category->getSelect()
7
+ ->join(array('fcat' => Mage::getSingleton('core/resource')->getTableName('faq_category')), 'main_table.category_id=fcat.category_id', 'fcat.category_name');
8
+ print_r($category);
9
+ die('ss');
10
+ }
11
+ }
app/code/community/Magebuzz/Faq/Block/Category.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+
6
+ class Magebuzz_Faq_Block_Category extends Mage_Core_Block_Template {
7
+ protected $_faqCollection = null;
8
+
9
+ public function __construct() {
10
+ parent::__construct();
11
+ $cat_id = $this->getRequest()->getParam('cid');
12
+ $sortOrder = Mage::getStoreConfig('faq/general/sort_order');
13
+ if ($cat_id) {
14
+ $cat = Mage::getModel('faq/category')->load($cat_id);
15
+ Mage::register('current_faqcategory', $cat);
16
+ if ($this->_faqCollection == null) {
17
+ $storeIds = array(Mage::app()->getStore()->getId(), Mage_Core_Model_App::ADMIN_STORE_ID);
18
+ $collection = Mage::getModel('faq/faq')->getCollection();
19
+ $collection->getSelect()
20
+ ->join(array('faq_category' => Mage::getModel('core/resource')->getTableName('faq_category_item')), 'main_table.faq_id=faq_category.faq_id')
21
+ ->join(array('fstore' => Mage::getModel('core/resource')->getTableName('faq_store')), 'main_table.faq_id=fstore.faq_id')
22
+ ->where('faq_category.category_id=?', $cat_id)
23
+ ->where('fstore.store_id IN (?)', $storeIds);
24
+ $collection->setOrder('sort_order',$sortOrder);
25
+ $this->_faqCollection = $collection;
26
+ }
27
+ }
28
+ $this->setCollection($this->_faqCollection);
29
+ }
30
+
31
+ public function _prepareLayout() {
32
+ if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
33
+ $breadcrumbsBlock->addCrumb('home', array(
34
+ 'label'=>Mage::helper('catalog')->__('Home'),
35
+ 'title'=>Mage::helper('catalog')->__('Go to Home Page'),
36
+ 'link'=>Mage::getBaseUrl()
37
+ ));
38
+
39
+ $breadcrumbsBlock->addCrumb('faq', array(
40
+ 'label' => Mage::helper('faq')->__('FAQ'),
41
+ 'title' => Mage::helper('faq')->__('FAQ'),
42
+ 'link' => $this->getUrl('faq')
43
+ ));
44
+
45
+ $breadcrumbsBlock->addCrumb('faqcat', array(
46
+ 'label'=> Mage::helper('faq')->__('FAQ Category'),
47
+ 'title'=> Mage::helper('faq')->__('FAQ Category')
48
+ ));
49
+ }
50
+ $this->getLayout()->getBlock('head')->setTitle(Mage::helper('faq')->__('FAQ Category'));
51
+ return parent::_prepareLayout();
52
+ }
53
+
54
+ public function getFaqUrl($faq) {
55
+ $url_key = $faq->getUrlKey();
56
+ return $this->getUrl('faq/question/'. $url_key, array());
57
+ }
58
+
59
+ public function getFaqCategory() {
60
+ return Mage::registry('current_faqcategory');
61
+ }
62
+ }
app/code/community/Magebuzz/Faq/Block/Detail.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_Block_Detail extends Mage_Core_Block_Template {
6
+ protected $_faq = null;
7
+ public function __construct() {
8
+ parent::__construct();
9
+ $faq_id = $this->getRequest()->getParam('id', false);
10
+ if ($faq_id && $this->_faq == null) {
11
+ $faq = Mage::getModel('faq/faq')->load($faq_id);
12
+ Mage::register('current_faq', $faq);
13
+ }
14
+ }
15
+
16
+ public function _prepareLayout() {
17
+ if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
18
+ $breadcrumbsBlock->addCrumb('home', array(
19
+ 'label'=>Mage::helper('catalog')->__('Home'),
20
+ 'title'=>Mage::helper('catalog')->__('Go to Home Page'),
21
+ 'link'=>Mage::getBaseUrl()
22
+ ));
23
+
24
+ $breadcrumbsBlock->addCrumb('faq', array(
25
+ 'label'=>Mage::helper('faq')->__('FAQ'),
26
+ 'title'=>Mage::helper('faq')->__('FAQ'),
27
+ 'link'=> $this->getUrl('faq')
28
+ ));
29
+
30
+ $breadcrumbsBlock->addCrumb('faqdetail', array(
31
+ 'label'=>Mage::helper('faq')->__('FAQ Question'),
32
+ 'title'=>Mage::helper('faq')->__('FAQ Question')
33
+ ));
34
+ }
35
+
36
+ $this->getLayout()->getBlock('head')->setTitle(Mage::helper('faq')->__('FAQ'));
37
+ return parent::_prepareLayout();
38
+ }
39
+
40
+ public function getFaq() {
41
+ return Mage::registry('current_faq');
42
+ }
43
+
44
+ public function getOtherQuestions() {
45
+ $cat_id = Mage::helper('faq')->getCategoryIdByFaqId($this->getFaq()->getId());
46
+ $sortOrder = Mage::getStoreConfig('faq/general/sort_order');
47
+ $storeIds = array(Mage::app()->getStore()->getId(), Mage_Core_Model_App::ADMIN_STORE_ID);
48
+ $collection = Mage::getModel('faq/faq')->getCollection();
49
+ $collection->getSelect()
50
+ ->join(array('faq_category' => Mage::getModel('core/resource')->getTableName('faq_category_item')), 'main_table.faq_id=faq_category.faq_id')
51
+ ->join(array('fstore' => Mage::getModel('core/resource')->getTableName('faq_store')), 'main_table.faq_id=fstore.faq_id')
52
+ ->where('faq_category.category_id=?', $cat_id)
53
+ ->where('fstore.store_id IN (?)', $storeIds);
54
+ $collection->setOrder('sort_order',$sortOrder);
55
+ return $collection;
56
+ }
57
+
58
+ public function getFaqUrl($faq) {
59
+ $url_key = $faq->getUrlKey();
60
+ return $this->getUrl('faq/question/'. $url_key, array());
61
+ }
62
+ }
app/code/community/Magebuzz/Faq/Block/Faq.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Faq_Block_Faq extends Mage_Core_Block_Template {
3
+ public function __construct() {
4
+ parent::__construct();
5
+ }
6
+
7
+ public function _prepareLayout() {
8
+ if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
9
+ $breadcrumbsBlock->addCrumb('home', array(
10
+ 'label'=>Mage::helper('catalog')->__('Home'),
11
+ 'title'=>Mage::helper('catalog')->__('Go to Home Page'),
12
+ 'link'=>Mage::getBaseUrl()
13
+ ));
14
+
15
+ $breadcrumbsBlock->addCrumb('faq', array(
16
+ 'label'=>Mage::helper('faq')->__('FAQ'),
17
+ 'title'=>Mage::helper('faq')->__('FAQ')
18
+ ));
19
+ }
20
+ $this->getLayout()->getBlock('head')->setTitle(Mage::helper('faq')->__('FAQ'));
21
+ return parent::_prepareLayout();
22
+ }
23
+
24
+
25
+ public function getQuestion($category) {
26
+ $questions=Mage::getModel('faq/faq')->getResource()->getQuestion($category);
27
+ return $questions;
28
+ }
29
+
30
+ public function getAllQuestion() {
31
+ $allQuestion=Mage::getModel('faq/faq')->getResource()->getAllQuestion();
32
+ return $allQuestion;
33
+ }
34
+
35
+ public function getCategories(){
36
+ $sortOrder = Mage::getStoreConfig('faq/general/sort_order');
37
+ $storeIds = array(Mage::app()->getStore()->getId(), Mage_Core_Model_App::ADMIN_STORE_ID);
38
+ $collection = Mage::getModel('faq/category')->getCollection();
39
+ $collection->getSelect()
40
+ ->join(array('fstore' => Mage::getModel('core/resource')->getTableName('faq_category_store')), 'main_table.category_id=fstore.category_id')
41
+ ->where('fstore.store_id IN (?)', $storeIds);
42
+ $collection->setOrder('sort_order',$sortOrder);
43
+ return $collection;
44
+ }
45
+
46
+ public function getAllAvaliableCategories(){
47
+ $collection = $this->getCategories();
48
+ $categoriesIds = array();
49
+ foreach($collection as $item){
50
+ $categoriesIds[] = $item->getCategoryId();
51
+ }
52
+ return $categoriesIds;
53
+ }
54
+
55
+ public function getFaqsData($cat_id) {
56
+ $sortOrder = Mage::getStoreConfig('faq/general/sort_order');
57
+ $storeIds = array(Mage::app()->getStore()->getId(), Mage_Core_Model_App::ADMIN_STORE_ID);
58
+ $collection = Mage::getModel('faq/faq')->getCollection();
59
+ $collection->getSelect()
60
+ ->join(array('faq_category' => Mage::getModel('core/resource')->getTableName('faq_category_item')), 'main_table.faq_id=faq_category.faq_id')
61
+ ->join(array('fstore' => Mage::getModel('core/resource')->getTableName('faq_store')), 'main_table.faq_id=fstore.faq_id')
62
+ ->where('faq_category.category_id=?', $cat_id)
63
+ ->where('fstore.store_id IN (?)', $storeIds);
64
+ $collection->setOrder('sort_order',$sortOrder);
65
+ return $collection;
66
+ }
67
+
68
+ public function getSearchResult(){
69
+ $categoriesIds = $this->getAllAvaliableCategories();
70
+ $result = array();
71
+ foreach ($categoriesIds as $catId){
72
+ $catData = $this->getFaqsData($catId);
73
+ foreach ($catData as $data){
74
+ $result[] = $data;
75
+ }
76
+ }
77
+ return $result;
78
+ }
79
+
80
+ public function getCategoryTitle(){
81
+ $cat_id = $this->getRequest()->getParam('cid');
82
+ $title = Mage::getModel('faq/category')->getTitle($cat_id);
83
+ if($title == null || $cat_id == null)
84
+ return null;
85
+ return $title;
86
+ }
87
+
88
+ public function getCategoryUrl($id) {
89
+ $category = Mage::getModel('faq/category')->load($id);
90
+ $url_key = $category->getUrlKey();
91
+ return $this->getUrl('faq/category/'. $url_key, array());
92
+ }
93
+
94
+ public function getQuestionUrl($id) {
95
+ $question = Mage::getModel('faq/faq')->load($id);
96
+ $url_key = $question->getUrlKey();
97
+ return $this->getUrl('faq/question/'. $url_key, array());
98
+ }
99
+ }
app/code/community/Magebuzz/Faq/Block/Left.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+
6
+ class Magebuzz_Faq_Block_Left extends Mage_Core_Block_Template {
7
+ public function _prepareLayout() {
8
+ return parent::_prepareLayout();
9
+ }
10
+
11
+ public function getFaqCategories() {
12
+ $storeIds = array(Mage::app()->getStore()->getId(), Mage_Core_Model_App::ADMIN_STORE_ID);
13
+ $sortOrder = Mage::getStoreConfig('faq/general/sort_order');
14
+ $collection = Mage::getModel('faq/category')->getCollection();
15
+ $collection->getSelect()
16
+ ->join(array('fstore' => Mage::getModel('core/resource')->getTableName('faq_category_store')), 'main_table.category_id=fstore.category_id')
17
+ ->where('fstore.store_id IN (?)', $storeIds);
18
+ $collection->setOrder('sort_order',$sortOrder);
19
+ return $collection;
20
+ }
21
+
22
+ public function getCategoryUrl($cat) {
23
+ $url_key = $cat->getUrlKey();
24
+ return $this->getUrl('faq/category/'. $url_key, array());
25
+ }
26
+
27
+
28
+ }
app/code/community/Magebuzz/Faq/Block/Result.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Faq_Block_Result extends Mage_Core_Block_Template {
3
+ public function _prepareLayout() {
4
+ if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
5
+ $breadcrumbsBlock->addCrumb('home', array(
6
+ 'label'=>Mage::helper('catalog')->__('Home'),
7
+ 'title'=>Mage::helper('catalog')->__('Go to Home Page'),
8
+ 'link'=>Mage::getBaseUrl()
9
+ ));
10
+
11
+ $breadcrumbsBlock->addCrumb('faq', array(
12
+ 'label'=>Mage::helper('faq')->__('FAQ'),
13
+ 'title'=>Mage::helper('faq')->__('FAQ'),
14
+ 'link'=> $this->getUrl('faq')
15
+ ));
16
+
17
+ $breadcrumbsBlock->addCrumb('faqsearch', array(
18
+ 'label'=>Mage::helper('faq')->__('FAQ Search Result'),
19
+ 'title'=>Mage::helper('faq')->__('FAQ Search Result')
20
+ ));
21
+ }
22
+ $this->getLayout()->getBlock('head')->setTitle(Mage::helper('faq')->__('FAQ Search Result'));
23
+ return parent::_prepareLayout();
24
+ }
25
+
26
+ public function getCategoryResult() {
27
+ $is_loop = array();
28
+ $category_collection_array = array();
29
+ $post = $this->getRequest()->getPost();
30
+ $keywords = preg_split ('/[^a-z0-9]+/i',$post['keyword']);
31
+ $j=0;
32
+ foreach($keywords as $keyword) {
33
+ $keyword=preg_replace('/[^a-z0-9]+/i','',$keyword);
34
+ $category_collection = $this->getCategories();
35
+ $catIds = $this->getAllAvaliableCategories();
36
+ $category_collection = Mage::getSingleton('faq/category')->getCollection();
37
+ $category_collection->addFieldToFilter('is_active', 1);
38
+ $category_collection->addFieldToFilter('category_id',array('in', $catIds));
39
+ $loop = false;
40
+
41
+ foreach ($category_collection as $category) {
42
+ $j=$j+1;
43
+ $category_id = $category->getData('category_id');
44
+ $is_loop[$j] = $category_id;
45
+ }
46
+
47
+ $n = count($is_loop);
48
+
49
+ for ($i=0;$i<$n-1;$i++) {
50
+ if($is_loop[$i+1]==$is_loop[$j]) {
51
+ $loop=true;
52
+ }
53
+ }
54
+
55
+ $category_check = $category_collection->getData();
56
+
57
+ if(!$loop and !empty($category_check))
58
+ $category_collection_array[$keyword] = $category_collection;
59
+ }
60
+ return $category_collection_array;
61
+ }
62
+
63
+
64
+ public function getFaqs($cat_id) {
65
+ $sortOrder = Mage::getStoreConfig('faq/general/sort_order');
66
+ $storeIds = array(Mage::app()->getStore()->getId(), Mage_Core_Model_App::ADMIN_STORE_ID);
67
+ $collection = Mage::getModel('faq/faq')->getCollection();
68
+ $collection->getSelect()
69
+ ->join(array('faq_category' => Mage::getModel('core/resource')->getTableName('faq_category_item')), 'main_table.faq_id=faq_category.faq_id')
70
+ ->join(array('fstore' => Mage::getModel('core/resource')->getTableName('faq_store')), 'main_table.faq_id=fstore.faq_id')
71
+ ->where('faq_category.category_id=?', $cat_id)
72
+ ->where('fstore.store_id IN (?)', $storeIds);
73
+ $collection->setOrder('sort_order',$sortOrder);
74
+ return $collection;
75
+ }
76
+
77
+ public function getQuestionResult() {
78
+ $is_loop = array();
79
+ $question_collection_array = array();
80
+ $post = $this->getRequest()->getPost();
81
+ $keywords = preg_split ('/[^a-z0-9]+/i',$post['keyword']);
82
+ $j = 0;
83
+
84
+
85
+ foreach ($keywords as $keyword) {
86
+ $keyword = preg_replace('/[^a-z0-9]+/i','',$keyword);
87
+ $question_collection = $this->getSearchResult();
88
+ $question_collection->addFieldToFilter('is_active',1);
89
+ $question_collection->addFieldToFilter('question',array('like'=>'%'.$keyword.'%'));
90
+
91
+ $loop = false;
92
+
93
+ foreach ($question_collection as $question) {
94
+ $j = $j+1;
95
+ $faq_id = $question->getData('faq_id');
96
+ $is_loop[$j] = $faq_id;
97
+
98
+ }
99
+
100
+ $n = count($is_loop);
101
+
102
+ for ($i = 0; $i < $n-1; $i++){
103
+ if($is_loop[$i+1]== $is_loop[$j]) {
104
+ $loop=true;
105
+ }
106
+ }
107
+
108
+ $question_check = $question_collection->getData();
109
+ if(!$loop and !empty($question_check))
110
+ $question_collection_array[$keyword] = $question_collection;
111
+ }
112
+
113
+ return $question_collection_array;
114
+ }
115
+
116
+ public function getCategories(){
117
+ $sortOrder = Mage::getStoreConfig('faq/general/sort_order');
118
+ $storeIds = array(Mage::app()->getStore()->getId(), Mage_Core_Model_App::ADMIN_STORE_ID);
119
+ $collection = Mage::getModel('faq/category')->getCollection();
120
+ $collection->getSelect()
121
+ ->join(array('fstore' => Mage::getModel('core/resource')->getTableName('faq_category_store')), 'main_table.category_id=fstore.category_id')
122
+ ->where('fstore.store_id IN (?)', $storeIds);
123
+ $collection->setOrder('sort_order',$sortOrder);
124
+ return $collection;
125
+ }
126
+
127
+ public function getAllAvaliableCategories(){
128
+ $collection = $this->getCategories();
129
+ $categoriesIds = array();
130
+ foreach($collection as $item){
131
+ $categoriesIds[] = $item->getCategoryId();
132
+ }
133
+ return $categoriesIds;
134
+ }
135
+
136
+ public function getFaqsData($cat_id) {
137
+ $sortOrder = Mage::getStoreConfig('faq/general/sort_order');
138
+ $storeIds = array(Mage::app()->getStore()->getId(), Mage_Core_Model_App::ADMIN_STORE_ID);
139
+ $collection = Mage::getModel('faq/faq')->getCollection();
140
+ $collection->getSelect()
141
+ ->join(array('faq_category' => Mage::getModel('core/resource')->getTableName('faq_category_item')), 'main_table.faq_id=faq_category.faq_id')
142
+ ->join(array('fstore' => Mage::getModel('core/resource')->getTableName('faq_store')), 'main_table.faq_id=fstore.faq_id')
143
+ ->where('faq_category.category_id=?', $cat_id)
144
+ ->where('fstore.store_id IN (?)', $storeIds);
145
+ $collection->setOrder('sort_order',$sortOrder);
146
+ return $collection;
147
+ }
148
+
149
+ public function getSearchResult(){
150
+ $categoriesIds = $this->getAllAvaliableCategories();
151
+ $result = array();
152
+
153
+ foreach ($categoriesIds as $catId){
154
+ $catData = $this->getFaqsData($catId);
155
+ foreach ($catData as $data){
156
+ $result[] = $data->getFaqId();
157
+ }
158
+ }
159
+ $collection = Mage::getModel('faq/faq')->getCollection()
160
+ ->addFieldToFilter('faq_id', array('in', $result));
161
+ return $collection;
162
+ }
163
+
164
+ public function getQuestion($category) {
165
+ $questions=Mage::getModel('faq/faq')->getResource()->getQuestion($category);
166
+ return $questions;
167
+ }
168
+
169
+ public function getCategory($question) {
170
+ $category=Mage::getModel('faq/faq')->getResource()->getCategory($question);
171
+ return $category;
172
+ }
173
+
174
+ public function getQuestionUrl($id) {
175
+ $question = Mage::getModel('faq/faq')->load($id);
176
+ $url_key = $question->getUrlKey();
177
+
178
+ return $this->getUrl('faq/question/'. $url_key, array());
179
+ }
180
+
181
+ }
app/code/community/Magebuzz/Faq/Helper/Data.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_Helper_Data extends Mage_Core_Helper_Abstract {
6
+ const XML_PATH_GET_CONFIG_USING_JAVASCRIPT = 'faq/general/using_javascript';
7
+
8
+ public function getUseJavascript(){
9
+ return (int)Mage::getStoreConfig(self::XML_PATH_GET_CONFIG_USING_JAVASCRIPT);
10
+ }
11
+
12
+ public function generateUrl($string) {
13
+ $identifier = preg_replace('#[^0-9a-z]+#i', '-', Mage::helper('catalog/product_url')->format($string));
14
+ $identifier = strtolower($identifier);
15
+ $identifier = trim($identifier, '-');
16
+ return $identifier;
17
+ }
18
+
19
+ public function checkUrlRewriteHasExist($tagert_path){
20
+ $oUrlRewriteCollection = Mage::getModel('core/url_rewrite')
21
+ ->getCollection()
22
+ ->addFieldToFilter('target_path', $tagert_path)
23
+ ->getFirstItem();
24
+ $id = $oUrlRewriteCollection->getId();
25
+ $model = Mage::getModel('core/url_rewrite');
26
+ if (count($oUrlRewriteCollection) > 0) {
27
+ $data = $model->load($id)->delete();
28
+ }
29
+ }
30
+
31
+ public function convertArrayToString(){
32
+ $array = array("firstname"=>"John","lastname"=>"doe");
33
+ $json = json_encode($array);
34
+ $phpStringArray = str_replace(array("{","}",":"), array("array(","}","=>"), $json);
35
+ echo $phpStringArray;
36
+ }
37
+
38
+ public function getCategoryIdByFaqId($faq_id) {
39
+ $object = Mage::getModel('faq/item')->getCollection()
40
+ ->addFieldToFilter('faq_id', $faq_id)
41
+ ->getFirstItem();
42
+ return $object->getCategoryId();
43
+ }
44
+ }
app/code/community/Magebuzz/Faq/Model/Category.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_Model_Category extends Mage_Core_Model_Abstract
6
+ {
7
+ protected function _construct() {
8
+ $this->_init('faq/category');
9
+ }
10
+
11
+ public function getTitle($cat_id){
12
+ $categoryInfo = $this->getCollection()
13
+ ->addFieldToFilter('category_id', $cat_id)
14
+ ->getFirstItem()
15
+ ->getData();
16
+ if($categoryInfo == null)
17
+ return null;
18
+ return $categoryInfo['category_name'];
19
+ }
20
+
21
+ }
app/code/community/Magebuzz/Faq/Model/Faq.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_Model_Faq extends Mage_Core_Model_Abstract
6
+ {
7
+ public function _construct() {
8
+ parent::_construct();
9
+ $this->_init('faq/faq');
10
+ }
11
+
12
+ public function getQuestionId($object) {
13
+ $condition = $this->getResource()->_getWriteAdapter()->quoteInto('faq_id = ?', $object->getData('category_id'));
14
+ $this->_getWriteAdapter()->load($this->getTable('faq/category_item'), $condition);
15
+ return $this;
16
+ }
17
+
18
+ public function getFaqsByIds($faqIds){
19
+ $faqCollection = $this->getCollection()
20
+ ->addFieldToFilter('is_active', 1)
21
+ ->addFieldToFilter('faq_id', array('in' => $faqIds));
22
+ return $faqCollection;
23
+ }
24
+
25
+ }
app/code/community/Magebuzz/Faq/Model/Item.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_Model_Item extends Mage_Core_Model_Abstract {
6
+ public function _construct() {
7
+ parent::_construct();
8
+ $this->_init('faq/item');
9
+ }
10
+
11
+ public function getAllFaqIds($id){
12
+ $collection = $this->getCollection()
13
+ ->addFieldToFilter('category_id',$id)
14
+ ->getData();
15
+ $faqIds = array();
16
+ foreach ($collection as $item){
17
+ $faqIds[] = $item['faq_id'];
18
+ }
19
+
20
+ return $faqIds;
21
+ }
22
+
23
+ }
app/code/community/Magebuzz/Faq/Model/Mysql4/Category.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_Model_Mysql4_Category extends Mage_Core_Model_Mysql4_Abstract {
6
+ protected function _construct() {
7
+ $this->_init('faq/category', 'category_id');
8
+ }
9
+
10
+ protected function _beforeSave(Mage_Core_Model_Abstract $object) {
11
+ if (! $object->getId()) {
12
+ $object->setCreationTime(Mage::getSingleton('core/date')->gmtDate());
13
+ }
14
+ $object->setUpdateTime(Mage::getSingleton('core/date')->gmtDate());
15
+ return $this;
16
+ }
17
+
18
+ protected function _afterSave(Mage_Core_Model_Abstract $object) {
19
+ $condition = $this->_getWriteAdapter()->quoteInto('category_id = ?', $object->getId());
20
+ $this->_getWriteAdapter()->delete($this->getTable('faq/faq_category_store'), $condition);
21
+
22
+ foreach ((array)$object->getData('stores') as $store) {
23
+ $storeArray = array();
24
+ $storeArray['category_id'] = $object->getId();
25
+ $storeArray['store_id'] = $store;
26
+ $this->_getWriteAdapter()->insert($this->getTable('faq/faq_category_store'), $storeArray);
27
+ }
28
+ return parent::_afterSave($object);
29
+ }
30
+
31
+ public function load(Mage_Core_Model_Abstract $object, $value, $field=null) {
32
+ if (!intval($value) && is_string($value)) {
33
+ $field = 'identifier'; // You probably don't have an identifier...
34
+ }
35
+ return parent::load($object, $value, $field);
36
+ }
37
+
38
+
39
+ protected function _afterLoad(Mage_Core_Model_Abstract $object) {
40
+ $select = $this->_getReadAdapter()->select()
41
+ ->from($this->getTable('faq/faq_category_store'))
42
+ ->where('category_id = ?', $object->getId());
43
+
44
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
45
+ $storesArray = array();
46
+ foreach ($data as $row) {
47
+ $storesArray[] = $row['store_id'];
48
+ }
49
+ $object->setData('store_id', $storesArray);
50
+ }
51
+
52
+ return parent::_afterLoad($object);
53
+ }
54
+
55
+ protected function _getLoadSelect($field, $value, $object) {
56
+ $select = parent::_getLoadSelect($field, $value, $object);
57
+ if ($object->getStoreId()) {
58
+ $select->join(array('cbs' => $this->getTable('faq/faq_category_store')), $this->getMainTable().'.category_id = cbs.category_id')
59
+ ->where('is_active=1 AND cbs.store_id in (0, ?) ', $object->getStoreId())
60
+ ->order('store_id DESC')
61
+ ->limit(1);
62
+ }
63
+ return $select;
64
+ }
65
+
66
+ public function lookupStoreIds($id) {
67
+ return $this->_getReadAdapter()->fetchCol($this->_getReadAdapter()->select()
68
+ ->from($this->getTable('faq/faq_category_store'), 'store_id')
69
+ ->where("{$this->getIdFieldName()} = ?", $id)
70
+ );
71
+ }
72
+
73
+ }
app/code/community/Magebuzz/Faq/Model/Mysql4/Category/Collection.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_Model_Mysql4_Category_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
6
+ public function _construct() {
7
+ parent::_construct();
8
+ $this->_init('faq/category');
9
+ }
10
+
11
+ protected function _toOptionArray($valueField = 'category_id', $labelField = 'category_name', $additional = array()) {
12
+ return parent:: _toOptionArray($valueField, $labelField, $additional);
13
+ }
14
+
15
+ public function addStoreFilter($store, $withAdmin = true){
16
+ if ($store instanceof Mage_Core_Model_Store) {
17
+ $store = array($store->getId());
18
+ }
19
+
20
+ $this->getSelect()->join(
21
+ array('store_table' => $this->getTable('faq/faq_category_store')),
22
+ 'main_table.category_id = store_table.category_id',
23
+ array()
24
+ )
25
+ ->where('store_table.store_id in (?)', ($withAdmin ? array(0, $store) : $store))
26
+ ->group('main_table.category_id');
27
+
28
+ return $this;
29
+ }
30
+ }
app/code/community/Magebuzz/Faq/Model/Mysql4/Faq.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_Model_Mysql4_Faq extends Mage_Core_Model_Mysql4_Abstract {
6
+ public function _construct() {
7
+ $this->_init('faq/faq', 'faq_id');
8
+ }
9
+ /**
10
+ *
11
+ *
12
+ * @param Mage_Core_Model_Abstract $object
13
+ */
14
+ protected function _beforeSave(Mage_Core_Model_Abstract $object)
15
+ {
16
+ if (! $object->getId()) {
17
+ $object->setCreationTime(Mage::getSingleton('core/date')->gmtDate());
18
+ }
19
+ $object->setUpdateTime(Mage::getSingleton('core/date')->gmtDate());
20
+ return $this;
21
+ }
22
+
23
+ public function lookupCategoryIds($faq_id) {
24
+ $adapter = $this->_getReadAdapter();
25
+
26
+ $select = $adapter->select()
27
+ ->from($this->getTable('faq/category_item'), 'category_id')
28
+ ->where('faq_id = ?',(int)$faq_id);
29
+
30
+ return $adapter->fetchCol($select);
31
+ }
32
+
33
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
34
+ {
35
+ // update faq category
36
+ $newCategoryIds = $object->getData('categories');
37
+ $oldCategoryIds = $this->lookupCategoryIds($object->getId());
38
+
39
+ $table = $this->getTable('faq/category_item');
40
+ $insert = array_diff($newCategoryIds, $oldCategoryIds);
41
+ $delete = array_diff($oldCategoryIds, $newCategoryIds);
42
+ if ($delete) {
43
+ $where = array(
44
+ 'faq_id = ?' => (int) $object->getId(),
45
+ 'category_id IN (?)' => $delete
46
+ );
47
+ $this->_getWriteAdapter()->delete($table, $where);
48
+ }
49
+ if ($insert) {
50
+ $data = array();
51
+ foreach ($insert as $catId) {
52
+ $data[] = array(
53
+ 'faq_id' => (int) $object->getId(),
54
+ 'category_id' => (int) $catId
55
+ );
56
+ }
57
+ $this->_getWriteAdapter()->insertMultiple($table, $data);
58
+ }
59
+
60
+ //update store
61
+ $condition = $this->_getWriteAdapter()->quoteInto('faq_id = ?', $object->getId());
62
+ $this->_getWriteAdapter()->delete($this->getTable('faq/faq_store'), $condition);
63
+
64
+ foreach ((array)$object->getData('stores') as $store) {
65
+ $storeArray = array();
66
+ $storeArray['faq_id'] = $object->getId();
67
+ $storeArray['store_id'] = $store;
68
+ $this->_getWriteAdapter()->insert($this->getTable('faq/faq_store'), $storeArray);
69
+ }
70
+
71
+ return parent::_afterSave($object);
72
+ }
73
+
74
+ public function changeCategory($data){
75
+ $mainTable = $this->getTable('faq/category_item');
76
+ $where = $this->_getWriteAdapter()->quoteInto('faq_id = ?', $data['faq_id']);
77
+ try{
78
+ $query = $this->_getWriteAdapter()->update($mainTable, array('category_id'=>$data['category_id']),$where);
79
+ }catch(Exception $e) {
80
+ echo $e->getMessage();
81
+ }
82
+ }
83
+
84
+ public function lookForFaq($data){
85
+ $mainTable = $this->getTable('faq/category_item');
86
+ $where = $this->_getWriteAdapter()->quoteInto('faq_id = ?', $data['faq_id']);
87
+ try{
88
+ $select = $this->_getReadAdapter()->select()->from($mainTable, array('category_id'=>$data['category_id']),$where);
89
+ $result = $this->_getReadAdapter()->fetchRow();
90
+ }catch(Exception $e) {
91
+ echo $e->getMessage();
92
+ }
93
+ return $result;
94
+ }
95
+
96
+ public function load(Mage_Core_Model_Abstract $object, $value, $field=null)
97
+ {
98
+ if (!intval($value) && is_string($value)) {
99
+ $field = 'identifier'; // You probably don't have an identifier...
100
+ }
101
+ return parent::load($object, $value, $field);
102
+ }
103
+
104
+ /**
105
+ *
106
+ * @param Mage_Core_Model_Abstract $object
107
+ */
108
+ protected function _afterLoad(Mage_Core_Model_Abstract $object) {
109
+ $select = $this->_getReadAdapter()->select()->from(
110
+ $this->getTable('faq/category_item')
111
+ )->where('faq_id = ?', $object->getId());
112
+
113
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
114
+ $categoryArray = array ();
115
+ foreach ($data as $row) {
116
+ $categoryArray[] = $row['category_id'];
117
+ }
118
+ $object->setData('category_id', $categoryArray);
119
+
120
+ }
121
+
122
+ $select = $this->_getReadAdapter()->select()
123
+ ->from($this->getTable('faq/faq_store'))
124
+ ->where('faq_id = ?', $object->getId());
125
+
126
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
127
+ $storesArray = array();
128
+ foreach ($data as $row) {
129
+ $storesArray[] = $row['store_id'];
130
+ }
131
+ $object->setData('store_id', $storesArray);
132
+ }
133
+
134
+ return parent::_afterLoad($object);
135
+ }
136
+
137
+ /**
138
+ * Retrieve select object for load object data
139
+ *
140
+ * @param string $field
141
+ * @param mixed $value
142
+ * @return Zend_Db_Select
143
+ */
144
+ protected function _getLoadSelect($field, $value, $object)
145
+ {
146
+ $select = parent::_getLoadSelect($field, $value, $object);
147
+
148
+ if ($object->getStoreId()) {
149
+ $select->join(array('cbs' => $this->getTable('faq/faq_store')), $this->getMainTable().'.faq_id = cbs.faq_id')
150
+ ->where('is_active=1 AND cbs.store_id in (0, ?) ', $object->getStoreId())
151
+ ->order('store_id DESC')
152
+ ->limit(1);
153
+ }
154
+ return $select;
155
+ }
156
+
157
+ /**
158
+ * Get store ids to which specified item is assigned
159
+ *
160
+ * @param int $id
161
+ * @return array
162
+ */
163
+ public function lookupStoreIds($id)
164
+ {
165
+ return $this->_getReadAdapter()->fetchCol($this->_getReadAdapter()->select()
166
+ ->from($this->getTable('faq/faq_store'), 'store_id')
167
+ ->where("{$this->getIdFieldName()} = ?", $id)
168
+ );
169
+ }
170
+
171
+
172
+ public function getQuestion ($category) {
173
+ $store_id = Mage::app()->getStore()->getId();
174
+ $faq_table = $this->getTable('faq/faq');
175
+ $faq_category_table = $this->getTable('faq/category_item');
176
+ $store_table = $this->getTable('faq/faq_store');
177
+ $where = $this->_getReadAdapter()->quoteInto('category_id = ? AND ', $category->getData('category_id')).$this->_getReadAdapter()->quoteInto('is_active =?',1);
178
+ $where2 = $this->_getReadAdapter()->quoteInto('category_id = ? ', $store_id);
179
+ $condition = $this->_getReadAdapter()->quoteInto('faq_category.faq_id = faq.faq_id', $category);
180
+ $condition2 = $this->_getReadAdapter()->quoteInto('faq_category.faq_id = store_table.faq_id', $store_id);
181
+ $select = $this->_getReadAdapter()->select()->from(array('faq_category' => $faq_category_table))->join(array('faq'=>$faq_table),$condition)->where($where);
182
+ $select = $this->_getReadAdapter()->select()->from(array('faq_category' => $faq_category_table))->join(array('store_table'=>$store_table),$condition2)->where($where2);
183
+ $question_collection = $this->_getReadAdapter()->fetchAll($select);
184
+ return $question_collection;
185
+ }
186
+
187
+ public function getAllQuestion () {
188
+ $faq_table=$this->getTable('faq/faq');
189
+ $faq_category_table=$this->getTable('faq/category_item');
190
+ $faq_category_store_table=$this->getTable('faq/faq_category_store');
191
+ $where = $this->_getReadAdapter()->quoteInto('is_active =?',1);
192
+ $condition=$this->_getReadAdapter()->quoteInto('faq_category.faq_id =faq.faq_id', '');
193
+ $condition2 = $this->_getReadAdapter()->quoteInto('category_store.category_id =faq.category_id', '');
194
+ $select=$this->_getReadAdapter()->select()->from(array('faq_category'=>$faq_category_table))->join(array('faq'=>$faq_table),$condition)->where($where);
195
+ $allQuestion=$this->_getReadAdapter()->fetchAll($select);
196
+ return $allQuestion;
197
+ }
198
+
199
+ public function getAllFaqs($categories) {
200
+ $storeIds = array(Mage::app()->getStore()->getId(), Mage_Core_Model_App::ADMIN_STORE_ID);
201
+ $collection = Mage::getModel('faq/faq')->getCollection();
202
+ $collection->getSelect()
203
+ ->join(array('faq_category' => Mage::getModel('core/resource')->getTableName('faq_category_item')), 'main_table.faq_id=faq_category.faq_id')
204
+ ->join(array('fstore' => Mage::getModel('core/resource')->getTableName('faq_store')), 'main_table.faq_id=fstore.faq_id')
205
+ ->where('faq_category.category_id IN (?)', $categories)
206
+ ->where('fstore.store_id IN (?)', $storeIds);
207
+
208
+ return $collection;
209
+ }
210
+
211
+ public function getCategory ($faq) {
212
+ $category_table=$this->getTable('faq/category');
213
+ $faq_category_table=$this->getTable('faq/category_item');
214
+ $where = $this->_getReadAdapter()->quoteInto('faq_id = ? AND ', $faq->getData('faq_id')).$this->_getReadAdapter()->quoteInto('is_active =?',1);
215
+ $condition=$this->_getReadAdapter()->quoteInto('faq_category.category_id =category.category_id', '');
216
+ $select=$this->_getReadAdapter()->select()->from(array('faq_category'=>$faq_category_table))->join(array('category'=>$category_table),$condition)->where($where)->order('category.category_id DESC');
217
+ $category_collection=$this->_getReadAdapter()->fetchAll($select);
218
+ return $category_collection;
219
+ }
220
+
221
+ public function getCategories(){
222
+ $storeIds = Mage::app()->getStore()->getId();
223
+ $collection = Mage::getModel('faq/category')->getCollection();
224
+ $collection->getSelect()
225
+ ->join(array('fstore' => Mage::getModel('core/resource')->getTableName('faq_category_store')), 'main_table.category_id=fstore.category_id')
226
+ ->where('fstore.store_id = ?', $storeIds);
227
+ return $collection;
228
+ }
229
+
230
+ public function getAllAvaliableCategories(){
231
+ $collection = $this->getCategories();
232
+ $categoriesIds = array();
233
+ foreach($collection as $item){
234
+ $categoriesIds[] = $item->getCategoryId();
235
+ }
236
+ return $categoriesIds;
237
+ }
238
+
239
+ public function getFAQIds(){
240
+ $storeIds = array(Mage::app()->getStore()->getId(), Mage_Core_Model_App::ADMIN_STORE_ID);
241
+ $collection = Mage::getModel('faq/faq')->getCollection();
242
+ $collection->getSelect()
243
+ ->join(array('fstore' => Mage::getModel('core/resource')->getTableName('faq_store')), 'main_table.faq_id=fstore.faq_id')
244
+ ->where('fstore.store_id IN (?)', $storeIds);
245
+
246
+ $questionIds = array();
247
+ foreach($collection as $item){
248
+ $questionIds[] = $item->getFaqId();
249
+ }
250
+
251
+ return $questionIds;
252
+ }
253
+
254
+ public function getAllQuestionFaq() {
255
+ $faqIds = $this->getFAQIds();
256
+ $categoryIds = $this->getAllAvaliableCategories();
257
+ $table = $this->getTable('faq/category_item');
258
+ $where = $this->_getReadAdapter()->quoteInto('category_id IN(?) ', $categoryIds);
259
+ $select = $this->_getReadAdapter()->select()->from($table, array('faq_id'))->where($where);
260
+ $faq = $this->_getReadAdapter()->fetchAll($select);
261
+
262
+ $collection = Mage::getModel('faq/faq')->getCollection();
263
+
264
+ if($faqIds){
265
+ $collection->addFieldToFilter('faq_id', array('in', $faqIds));
266
+ }
267
+
268
+ return $collection;
269
+ }
270
+ }
app/code/community/Magebuzz/Faq/Model/Mysql4/Faq/Collection.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_Model_Mysql4_Faq_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
6
+ public function _construct(){
7
+ parent::_construct();
8
+ $this->_init('faq/faq');
9
+ }
10
+
11
+ public function addStoreFilter($store){
12
+ if ($store instanceof Mage_Core_Model_Store) {
13
+ $store = array($store->getId());
14
+ }
15
+
16
+ $this->getSelect()->join(
17
+ array('store_table' => $this->getTable('faq/faq_store')),
18
+ 'main_table.faq_id = store_table.faq_id',
19
+ array()
20
+ )
21
+ ->where('store_table.store_id in (?)', array(0, $store));
22
+
23
+ return $this;
24
+ }
25
+ }
app/code/community/Magebuzz/Faq/Model/Mysql4/Item.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_Model_Mysql4_Item extends Mage_Core_Model_Mysql4_Abstract {
6
+ protected function _construct() {
7
+ $this->_init('faq/item', 'category_id');
8
+ }
9
+ }
app/code/community/Magebuzz/Faq/Model/Mysql4/Item/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_Model_Mysql4_Item_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
6
+ public function _construct() {
7
+ parent::_construct();
8
+ $this->_init('faq/item');
9
+ }
10
+ }
app/code/community/Magebuzz/Faq/Model/Status.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_Model_Status extends Varien_Object {
6
+ const STATUS_ENABLED = 1;
7
+ const STATUS_DISABLED = 0;
8
+
9
+ static public function getOptionArray()
10
+ {
11
+ return array(
12
+ self::STATUS_ENABLED => Mage::helper('faq')->__('Enabled'),
13
+ self::STATUS_DISABLED => Mage::helper('faq')->__('Disabled')
14
+ );
15
+ }
16
+ }
app/code/community/Magebuzz/Faq/Model/System/Config/Source/Sortorder.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Faq_Model_System_Config_Source_Sortorder
3
+ {
4
+
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ 'ASC' => Mage::helper('adminhtml')->__('Asc'),
9
+ "DESC" => Mage::helper('adminhtml')->__('Desc')
10
+ );
11
+ }
12
+ }
app/code/community/Magebuzz/Faq/controllers/Adminhtml/CategoryController.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_Adminhtml_CategoryController extends Mage_Adminhtml_Controller_action {
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('magebuzz/faq')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+ public function editAction() {
20
+ $id = $this->getRequest()->getParam('id');
21
+ $model = Mage::getModel('faq/category')->load($id);
22
+
23
+ if ($model->getId() || $id == 0) {
24
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
25
+ if (!empty($data)) {
26
+ $model->setData($data);
27
+ }
28
+
29
+ Mage::register('faq_data', $model);
30
+
31
+ $this->loadLayout();
32
+ $this->_setActiveMenu('magebuzz/faq');
33
+
34
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
35
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
36
+
37
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
38
+
39
+ $this->_addContent($this->getLayout()->createBlock('faq/adminhtml_category_edit'))
40
+ ->_addLeft($this->getLayout()->createBlock('faq/adminhtml_category_edit_tabs'));
41
+
42
+ $this->renderLayout();
43
+ } else {
44
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('faq')->__('Item does not exist'));
45
+ $this->_redirect('*/*/');
46
+ }
47
+ }
48
+
49
+ public function newAction() {
50
+ $this->_forward('edit');
51
+ }
52
+
53
+ public function saveAction() {
54
+ if ($data = $this->getRequest()->getPost()) {
55
+ $model = Mage::getModel('faq/category');
56
+
57
+ try {
58
+ if(!isset($data['url_key']) || $data['url_key'] == '') {
59
+ $data['url_key'] = $data['category_name'];
60
+ }
61
+ $data['url_key'] = Mage::helper('faq')->generateUrl($data['url_key']);
62
+
63
+ $model->setData($data)
64
+ ->setId($this->getRequest()->getParam('id'));
65
+
66
+ if ($model->getCreatedTime() == NULL || $model->getUpdateTime() == NULL) {
67
+ $model->setCreatedTime(now())
68
+ ->setUpdateTime(now());
69
+ } else {
70
+ $model->setUpdateTime(now());
71
+ }
72
+
73
+
74
+ $model->save();
75
+
76
+ // Rewrite Url
77
+ $rewriteModel = Mage::getModel('core/url_rewrite');
78
+
79
+ //$categoryUrlName = Mage::helper('faq')->generateUrl($model->getCategoryName());
80
+ $request_path = 'faq/category/' . $data['url_key'];
81
+ $id_path = 'faq/category/' . $model->getId();
82
+ $rewriteModel->loadByIdPath($id_path);
83
+
84
+ $rewriteModel->setData('id_path', $id_path);
85
+ $rewriteModel->setData('request_path', $request_path);
86
+ $rewriteModel->setData('target_path', 'faq/category/view/cid/'.$model->getId());
87
+ $rewriteModel->save();
88
+
89
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('faq')->__('Category was successfully saved'));
90
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
91
+
92
+ if ($this->getRequest()->getParam('back')) {
93
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
94
+ return;
95
+ }
96
+ $this->_redirect('*/*/');
97
+ return;
98
+ } catch (Exception $e) {
99
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
100
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
101
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
102
+ return;
103
+ }
104
+ }
105
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('faq')->__('Unable to find item to save'));
106
+ $this->_redirect('*/*/');
107
+ }
108
+
109
+ public function deleteAction() {
110
+ if( $this->getRequest()->getParam('id') > 0 ) {
111
+ try {
112
+ //delete rewrite url
113
+ $model = Mage::getModel('faq/category');
114
+ $categoryId = $this->getRequest()->getParam('id');
115
+ $model->load($categoryId);
116
+
117
+ $categoryUrlName = Mage::helper('faq')->generateUrl($model->getCategoryName());
118
+ $rewriteModel = Mage::getModel('core/url_rewrite');
119
+ $request_path = 'faq/category/' . $categoryUrlName;
120
+ $rewriteModel->loadByRequestPath($request_path);
121
+
122
+ if($rewriteModel->getId()){
123
+ $rewriteModel->delete();
124
+ }
125
+
126
+ $model = Mage::getModel('faq/category');
127
+ $model->setId($this->getRequest()->getParam('id'))
128
+ ->delete();
129
+
130
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Category was successfully deleted'));
131
+ $this->_redirect('*/*/');
132
+ } catch (Exception $e) {
133
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
134
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
135
+ }
136
+ }
137
+ $this->_redirect('*/*/');
138
+ }
139
+
140
+ public function massDeleteAction() {
141
+ $faqIds = $this->getRequest()->getParam('faq');
142
+ if(!is_array($faqIds)) {
143
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
144
+ } else {
145
+ try {
146
+ foreach ($faqIds as $faqId) {
147
+ $faq = Mage::getModel('faq/category')->load($faqId);
148
+ //delete rewrite url
149
+ $model = Mage::getModel('faq/category')->load($faqId);
150
+ $categoryUrlName = Mage::helper('faq')->generateUrl($model->getCategoryName());
151
+
152
+ $rewriteModel = Mage::getModel('core/url_rewrite');
153
+ $request_path = 'faq/category/' . $categoryUrlName;
154
+ $rewriteModel->loadByRequestPath($request_path);
155
+
156
+ if($rewriteModel->getId()){
157
+ $rewriteModel->delete();
158
+ }
159
+ //delete category url
160
+ $faq->delete();
161
+ }
162
+ Mage::getSingleton('adminhtml/session')->addSuccess(
163
+ Mage::helper('adminhtml')->__(
164
+ 'Total of %d record(s) were successfully deleted', count($faqIds)
165
+ )
166
+ );
167
+ } catch (Exception $e) {
168
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
169
+ }
170
+ }
171
+ $this->_redirect('*/*/index');
172
+ }
173
+
174
+ public function massStatusAction()
175
+ {
176
+ $faqIds = $this->getRequest()->getParam('faq');
177
+ if(!is_array($faqIds)) {
178
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
179
+ } else {
180
+ try {
181
+ foreach ($faqIds as $faqId) {
182
+ $faq = Mage::getSingleton('faq/category')
183
+ ->load($faqId)
184
+ ->setIsActive($this->getRequest()->getParam('status'))
185
+ ->setIsMassupdate(true)
186
+ ->save();
187
+ }
188
+ $this->_getSession()->addSuccess(
189
+ $this->__('Total of %d record(s) were successfully updated', count($faqIds))
190
+ );
191
+ } catch (Exception $e) {
192
+ $this->_getSession()->addError($e->getMessage());
193
+ }
194
+ }
195
+ $this->_redirect('*/*/index');
196
+ }
197
+ }
app/code/community/Magebuzz/Faq/controllers/Adminhtml/FaqController.php ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_Adminhtml_FaqController extends Mage_Adminhtml_Controller_action {
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('magebuzz/faq')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
11
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
12
+ }
13
+ return $this;
14
+ }
15
+
16
+ public function indexAction() {
17
+ $this->_initAction()
18
+ ->renderLayout();
19
+ }
20
+
21
+ public function editAction() {
22
+ $id = $this->getRequest()->getParam('id');
23
+ $model = Mage::getModel('faq/faq')->load($id);
24
+
25
+ if ($model->getId() || $id == 0) {
26
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
27
+ if (!empty($data)) {
28
+ $model->setData($data);
29
+ }
30
+
31
+ Mage::register('faq_data', $model);
32
+
33
+ $this->loadLayout();
34
+ $this->_setActiveMenu('magebuzz/faq');
35
+
36
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
37
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
38
+
39
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
40
+
41
+ $this->_addContent($this->getLayout()->createBlock('faq/adminhtml_faq_edit'))
42
+ ->_addLeft($this->getLayout()->createBlock('faq/adminhtml_faq_edit_tabs'));
43
+
44
+ $this->renderLayout();
45
+ } else {
46
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('faq')->__('Item does not exist'));
47
+ $this->_redirect('*/*/');
48
+ }
49
+ }
50
+
51
+ public function newAction() {
52
+ $this->_forward('edit');
53
+ }
54
+
55
+ public function saveAction() {
56
+ $data = $this->getRequest()->getPost();
57
+ $model = Mage::getModel('faq/faq');
58
+ $model->setData($data)
59
+ ->setId($this->getRequest()->getParam('id'));
60
+
61
+ // $faq_id = $this->getRequest()->getParam('id');
62
+
63
+ // if($faq_id){
64
+ // $faqData = array();
65
+ // $faqData['category_id'] = $data['categories'][0];
66
+ // $faqData['faq_id'] = $faq_id;
67
+ // Mage::getModel('faq/faq')->getResource()->changeCategory($faqData);
68
+ // }
69
+
70
+ try {
71
+ if(!isset($data['url_key']) || $data['url_key'] == '') {
72
+ $data['url_key'] = $data['question'];
73
+ }
74
+ $data['url_key'] = Mage::helper('faq')->generateUrl($data['url_key']);
75
+
76
+ $model->setData($data)
77
+ ->setId($this->getRequest()->getParam('id'));
78
+
79
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
80
+ $model->setCreatedTime(now())
81
+ ->setUpdateTime(now());
82
+ } else {
83
+ $model->setUpdateTime(now());
84
+ }
85
+ $model->save();
86
+ /* rewrite url*/
87
+ $rewriteModel = Mage::getModel('core/url_rewrite');
88
+
89
+ //$url_key = Mage::helper('faq')->generateUrl($model->getQuestion());
90
+ $id_path = 'faq/question/' . $model->getId();
91
+ $rewriteModel->loadByIdPath($id_path);
92
+
93
+ $rewriteModel->setData('id_path', 'faq/question/' . $model->getId());
94
+ $rewriteModel->setData('request_path', 'faq/question/' . $data['url_key']);
95
+ $rewriteModel->setData('target_path', 'faq/category/detail/id/'.$model->getId());
96
+ $rewriteModel->save();
97
+
98
+ //end rewrite url
99
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('faq')->__('FAQ was successfully saved'));
100
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
101
+
102
+ if ($this->getRequest()->getParam('back')) {
103
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
104
+ return;
105
+ }
106
+
107
+ $this->_redirect('*/*/');
108
+ return;
109
+
110
+ } catch (Exception $e) {
111
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
112
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
113
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
114
+ return;
115
+ }
116
+
117
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('faq')->__('Unable to find FAQ to save'));
118
+ $this->_redirect('*/*/');
119
+ }
120
+
121
+ public function deleteAction() {
122
+ if( $this->getRequest()->getParam('id') > 0 ) {
123
+ try {
124
+ $model = Mage::getModel('faq/faq');
125
+ //delete rewrite url
126
+ $faqId = $this->getRequest()->getParam('id');
127
+ $model->load($faqId);
128
+
129
+ $question = Mage::helper('faq')->generateUrl($model->getQuestion());
130
+ $rewriteModel = Mage::getModel('core/url_rewrite');
131
+ $request_path = 'faq/question/' . $question;
132
+ $rewriteModel->loadByRequestPath($request_path);
133
+ if($rewriteModel->getId()){
134
+ $rewriteModel->delete();
135
+ }
136
+ //delete faq
137
+ $model->setId($this->getRequest()->getParam('id'))
138
+ ->delete();
139
+
140
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('FAQ was successfully deleted'));
141
+ $this->_redirect('*/*/');
142
+ } catch (Exception $e) {
143
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
144
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
145
+ }
146
+ }
147
+ $this->_redirect('*/*/');
148
+ }
149
+
150
+ public function massDeleteAction() {
151
+ $faqIds = $this->getRequest()->getParam('faq');
152
+ if(!is_array($faqIds)) {
153
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
154
+ } else {
155
+ try {
156
+ foreach ($faqIds as $faqId) {
157
+ $model = Mage::getModel('faq/faq')->load($faqId);
158
+ $question = Mage::helper('faq')->generateUrl($model->getQuestion());
159
+ $rewriteModel = Mage::getModel('core/url_rewrite');
160
+ $request_path = 'faq/question/' . $question;
161
+ $rewriteModel->loadByRequestPath($request_path);
162
+ if($rewriteModel->getId()){
163
+ $rewriteModel->delete();
164
+ }
165
+ $faq = Mage::getModel('faq/faq')->load($faqId);
166
+ $faq->delete();
167
+ }
168
+ Mage::getSingleton('adminhtml/session')->addSuccess(
169
+ Mage::helper('adminhtml')->__(
170
+ 'Total of %d record(s) were successfully deleted', count($faqIds)
171
+ )
172
+ );
173
+ } catch (Exception $e) {
174
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
175
+ }
176
+ }
177
+ $this->_redirect('*/*/index');
178
+ }
179
+
180
+ public function massStatusAction()
181
+ {
182
+ $faqIds = $this->getRequest()->getParam('faq');
183
+ if(!is_array($faqIds)) {
184
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
185
+ } else {
186
+ try {
187
+ foreach ($faqIds as $faqId) {
188
+ $faq = Mage::getSingleton('faq/faq')
189
+ ->load($faqId)
190
+ ->setIsActive($this->getRequest()->getParam('status'))
191
+ ->setIsMassupdate(true)
192
+ ->save();
193
+ }
194
+ $this->_getSession()->addSuccess(
195
+ $this->__('Total of %d record(s) were successfully updated', count($faqIds))
196
+ );
197
+ } catch (Exception $e) {
198
+ $this->_getSession()->addError($e->getMessage());
199
+ }
200
+ }
201
+ $this->_redirect('*/*/index');
202
+ }
203
+ }
app/code/community/Magebuzz/Faq/controllers/CategoryController.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_CategoryController extends Mage_Core_Controller_Front_Action
6
+ {
7
+ public function indexAction() {
8
+ $this->loadLayout();
9
+ $this->renderLayout();
10
+ }
11
+
12
+ public function searchAction() {
13
+ $this->indexAction();
14
+ }
15
+
16
+ public function viewAction(){
17
+ $this->loadLayout();
18
+ $this->getLayout()->getBlock('head')->setTitle(Mage::helper('faq')->__('FAQ Category'));
19
+ $this->renderLayout();
20
+ }
21
+
22
+ public function detailAction(){
23
+ $this->loadLayout();
24
+ $this->getLayout()->getBlock('head')->setTitle(Mage::helper('faq')->__('FAQ Detail'));
25
+ $this->renderLayout();
26
+ }
27
+ }
app/code/community/Magebuzz/Faq/controllers/IndexController.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2013 AZeBiz Co. LTD
4
+ */
5
+ class Magebuzz_Faq_IndexController extends Mage_Core_Controller_Front_Action
6
+ {
7
+ public function indexAction() {
8
+ $this->loadLayout();
9
+ $this->renderLayout();
10
+ }
11
+
12
+ public function searchAction() {
13
+ $this->indexAction();
14
+ }
15
+ }
app/code/community/Magebuzz/Faq/etc/adminhtml.xml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <magebuzz>
5
+ <title>Magebuzz</title>
6
+ <sort_order>89</sort_order>
7
+ <children>
8
+ <faq module="faq">
9
+ <title>FAQ</title>
10
+ <sort_order>101</sort_order>
11
+ <children>
12
+ <manage_category module="faq">
13
+ <title>Manage FAQ Categories</title>
14
+ <sort_order>1</sort_order>
15
+ <action>faq/adminhtml_category</action>
16
+ </manage_category>
17
+ <manage_question module="faq">
18
+ <title>Manage FAQs</title>
19
+ <sort_order>2</sort_order>
20
+ <action>faq/adminhtml_faq</action>
21
+ </manage_question>
22
+ </children>
23
+ </faq>
24
+ </children>
25
+ </magebuzz>
26
+ </menu>
27
+ <acl>
28
+ <resources>
29
+ <all>
30
+ <title>Allow Everything</title>
31
+ </all>
32
+ <admin>
33
+ <children>
34
+ <system>
35
+ <children>
36
+ <config>
37
+ <children>
38
+ <faq module="faq" translate="title">
39
+ <title>FAQ</title>
40
+ <sort_order>786</sort_order>
41
+ </faq>
42
+ </children>
43
+ </config>
44
+ </children>
45
+ </system>
46
+ <magebuzz>
47
+ <title>Magebuzz</title>
48
+ <sort_order>89</sort_order>
49
+ <children>
50
+ <faq module="faq">
51
+ <title>FAQ</title>
52
+ <sort_order>101</sort_order>
53
+ <children>
54
+ <manage_category module="faq">
55
+ <title>Manage FAQ Categories</title>
56
+ <sort_order>1</sort_order>
57
+ <action>faq/adminhtml_category</action>
58
+ </manage_category>
59
+ <manage_question module="faq">
60
+ <title>Manage Questions</title>
61
+ <sort_order>2</sort_order>
62
+ <action>faq/adminhtml_faq</action>
63
+ </manage_question>
64
+ <settings module="faq" translate="title">
65
+ <title>Settings</title>
66
+ <sort_order>967</sort_order>
67
+ <action>faq/adminhtml_system_config_edit_section_faq</action>
68
+ </settings>
69
+ </children>
70
+ </faq>
71
+ </children>
72
+ </magebuzz>
73
+ </children>
74
+ </admin>
75
+ </resources>
76
+ </acl>
77
+ </config>
app/code/community/Magebuzz/Faq/etc/config.xml ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magebuzz_Faq>
5
+ <version>0.1.2</version>
6
+ </Magebuzz_Faq>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <faq>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Magebuzz_Faq</module>
14
+ <frontName>faq</frontName>
15
+ </args>
16
+ </faq>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <faq>
21
+ <file>faq.xml</file>
22
+ </faq>
23
+ </updates>
24
+ </layout>
25
+ <translate>
26
+ <modules>
27
+ <Magebuzz_Faq>
28
+ <files>
29
+ <default>Magebuzz_Faq.csv</default>
30
+ </files>
31
+ </Magebuzz_Faq>
32
+ </modules>
33
+ </translate>
34
+ </frontend>
35
+ <admin>
36
+ <routers>
37
+ <faq>
38
+ <use>admin</use>
39
+ <args>
40
+ <module>Magebuzz_Faq</module>
41
+ <frontName>faq</frontName>
42
+ </args>
43
+ </faq>
44
+ </routers>
45
+ </admin>
46
+ <adminhtml>
47
+ <layout>
48
+ <updates>
49
+ <faq>
50
+ <file>faq.xml</file>
51
+ </faq>
52
+ </updates>
53
+ </layout>
54
+ <translate>
55
+ <modules>
56
+ <Magebuzz_Faq>
57
+ <files>
58
+ <default>Magebuzz_Faq.csv</default>
59
+ </files>
60
+ </Magebuzz_Faq>
61
+ </modules>
62
+ </translate>
63
+ </adminhtml>
64
+ <global>
65
+ <models>
66
+ <faq>
67
+ <class>Magebuzz_Faq_Model</class>
68
+ <resourceModel>faq_mysql4</resourceModel>
69
+ </faq>
70
+ <faq_mysql4>
71
+ <class>Magebuzz_Faq_Model_Mysql4</class>
72
+ <entities>
73
+ <faq>
74
+ <table>faq</table>
75
+ </faq>
76
+ <category>
77
+ <table>faq_category</table>
78
+ </category>
79
+ <category_item>
80
+ <table>faq_category_item</table>
81
+ </category_item>
82
+ <item>
83
+ <table>faq_category_item</table>
84
+ </item>
85
+ <faq_category_store>
86
+ <table>faq_category_store</table>
87
+ </faq_category_store>
88
+ <faq_store>
89
+ <table>faq_store</table>
90
+ </faq_store>
91
+ </entities>
92
+ </faq_mysql4>
93
+ </models>
94
+ <resources>
95
+ <faq_setup>
96
+ <setup>
97
+ <module>Magebuzz_Faq</module>
98
+ </setup>
99
+ <connection>
100
+ <use>core_setup</use>
101
+ </connection>
102
+ </faq_setup>
103
+ <faq_write>
104
+ <connection>
105
+ <use>core_write</use>
106
+ </connection>
107
+ </faq_write>
108
+ <faq_read>
109
+ <connection>
110
+ <use>core_read</use>
111
+ </connection>
112
+ </faq_read>
113
+ </resources>
114
+ <blocks>
115
+ <faq>
116
+ <class>Magebuzz_Faq_Block</class>
117
+ </faq>
118
+ </blocks>
119
+ <helpers>
120
+ <faq>
121
+ <class>Magebuzz_Faq_Helper</class>
122
+ </faq>
123
+ </helpers>
124
+ </global>
125
+ <default>
126
+ <faq>
127
+ <general>
128
+ <using_javascript>0</using_javascript>
129
+ <show_top_link>1</show_top_link>
130
+ <sort_order>ASC</sort_order>
131
+ </general>
132
+ </faq>
133
+ </default>
134
+ </config>
app/code/community/Magebuzz/Faq/etc/system.xml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <magebuzz translate="label" module="faq">
5
+ <label>Magebuzz Add-ons</label>
6
+ <sort_order>400</sort_order>
7
+ </magebuzz>
8
+ </tabs>
9
+ <sections>
10
+ <faq translate="label" module="faq">
11
+ <class>separator-top</class>
12
+ <label>FAQ</label>
13
+ <tab>magebuzz</tab>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <general translate="label" module="faq">
19
+ <label>FAQ Options</label>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>1</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <show_top_link translate="label">
27
+ <label>Display FAQ in the top link</label>
28
+ <frontend_type>select</frontend_type>
29
+ <source_model>adminhtml/system_config_source_yesno</source_model>
30
+ <sort_order>10</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>0</show_in_store>
34
+ </show_top_link>
35
+ <using_javascript translate="label">
36
+ <label><![CDATA[Display FAQ question & answer in the same page]]></label>
37
+ <frontend_type>select</frontend_type>
38
+ <source_model>adminhtml/system_config_source_yesno</source_model>
39
+ <sort_order>20</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>0</show_in_store>
43
+ </using_javascript>
44
+ <sort_order translate="label">
45
+ <label>Sort Order</label>
46
+ <frontend_type>select</frontend_type>
47
+ <source_model>faq/system_config_source_sortorder</source_model>
48
+ <sort_order>30</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>0</show_in_store>
52
+ </sort_order>
53
+ </fields>
54
+ </general>
55
+ </groups>
56
+ </faq>
57
+ </sections>
58
+ </config>
app/code/community/Magebuzz/Faq/sql/faq_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+ -- DROP TABLE IF EXISTS {$this->getTable('faq')};
9
+ CREATE TABLE {$this->getTable('faq')} (
10
+ `faq_id` int(11) unsigned NOT NULL auto_increment,
11
+ `question` text NOT NULL default '',
12
+ `answer` text NOT NULL default '',
13
+ `is_active` smallint(6) NOT NULL default '1',
14
+ `created_time` datetime NULL,
15
+ `update_time` datetime NULL,
16
+ PRIMARY KEY (`faq_id`)
17
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
18
+
19
+
20
+ -- DROP TABLE IF EXISTS {$this->getTable('faq_category')};
21
+ CREATE TABLE {$this->getTable('faq_category')} (
22
+ `category_id` int(11) unsigned NOT NULL auto_increment,
23
+ `category_name` VARCHAR(255) NOT NULL,
24
+ `is_active` smallint(6) NOT NULL default '1',
25
+ `created_time` datetime NULL,
26
+ `update_time` datetime NULL,
27
+ PRIMARY KEY (`category_id`)
28
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
29
+
30
+ -- DROP TABLE IF EXISTS {$this->getTable('faq_category_item')};
31
+ CREATE TABLE {$this->getTable('faq_category_item')} (
32
+ `category_id` INT(11) UNSIGNED NOT NULL,
33
+ `faq_id` INT(11) UNSIGNED NOT NULL,
34
+ PRIMARY KEY (`category_id`,`faq_id`),
35
+ CONSTRAINT `FK_FAQ_CATEGORY_ITEM_FAQ_CATEGORY` FOREIGN KEY (`category_id`) REFERENCES `{$this->getTable('faq_category')}` (`category_id`) ON DELETE CASCADE,
36
+ CONSTRAINT `FK_FAQ_CATEGORY_ITEM_FAQ` FOREIGN KEY (`faq_id`) REFERENCES `{$this->getTable('faq')}` (`faq_id`) ON DELETE CASCADE
37
+ ) ENGINE=InnoDB COMMENT='FAQ Items to Cateories';
38
+ ");
39
+
40
+
41
+ $installer->endSetup();
app/code/community/Magebuzz/Faq/sql/faq_setup/mysql4-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $installer->run("
5
+ -- DROP TABLE IF EXISTS {$this->getTable('faq_store')};
6
+ CREATE TABLE {$this->getTable('faq_store')} (
7
+ `auto_id` int(11) unsigned NOT NULL auto_increment,
8
+ `faq_id` int(11) unsigned NOT NULL,
9
+ `store_id` int(11) unsigned NOT NULL,
10
+ PRIMARY KEY (`auto_id`),
11
+ FOREIGN KEY (`faq_id`) REFERENCES {$this->getTable('faq')} (`faq_id`) ON DELETE CASCADE ON UPDATE CASCADE
12
+
13
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
14
+
15
+ -- DROP TABLE IF EXISTS {$this->getTable('faq_category_store')};
16
+ CREATE TABLE {$this->getTable('faq_category_store')} (
17
+ `auto_id` int(11) unsigned NOT NULL auto_increment,
18
+ `category_id` int(11) unsigned NOT NULL,
19
+ `store_id` int(11) unsigned NOT NULL,
20
+ PRIMARY KEY (`auto_id`),
21
+ FOREIGN KEY (`category_id`) REFERENCES {$this->getTable('faq_category')} (`category_id`) ON DELETE CASCADE ON UPDATE CASCADE
22
+
23
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
24
+
25
+ ALTER TABLE {$this->getTable('faq')} ADD `url_key` varchar(255) NOT NULL default '';
26
+ ALTER TABLE {$this->getTable('faq_category')} ADD `url_key` varchar(255) NOT NULL default '';
27
+
28
+ ");
29
+ $installer->endSetup();
app/code/community/Magebuzz/Faq/sql/faq_setup/mysql4-upgrade-0.1.1-0.1.2.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $installer->run("
5
+ ALTER TABLE {$this->getTable('faq')} ADD `sort_order` int(11) unsigned NOT NULL;
6
+ ALTER TABLE {$this->getTable('faq_category')} ADD `sort_order` int(11) unsigned NOT NULL;
7
+ ");
8
+ $installer->endSetup();
app/design/frontend/base/default/layout/faq.xml ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="top.links">
5
+ <action method="addLink" translate="label title" module="faq" ifconfig="faq/general/show_top_link">
6
+ <label>FAQ</label>
7
+ <url>faq</url>
8
+ <title>FAQ</title>
9
+ <prepare>true</prepare>
10
+ <urlParams/>
11
+ <position>0</position>
12
+ </action>
13
+ </reference>
14
+ </default>
15
+ <faq_index_index>
16
+ <reference name="root">
17
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
18
+ </reference>
19
+ <reference name="head">
20
+ <action method="addCss"><stylesheet>magebuzz/faq/faq.css</stylesheet> </action>
21
+ </reference>
22
+ <reference name="content">
23
+ <block type="faq/faq" name="faq" template="faq/faq.phtml" />
24
+ </reference>
25
+ </faq_index_index>
26
+ <faq_category_view>
27
+ <reference name="root">
28
+ <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
29
+ </reference>
30
+ <reference name="left">
31
+ <block type="faq/left" name="faq.left" template="faq/left.phtml" before="-"/>
32
+ </reference>
33
+ <reference name="head">
34
+ <action method="addCss"><stylesheet>magebuzz/faq/faq.css</stylesheet> </action>
35
+ </reference>
36
+ <reference name="content">
37
+ <block type="faq/category" name="faq" template="faq/category.phtml" />
38
+ </reference>
39
+ </faq_category_view>
40
+ <faq_category_detail>
41
+ <reference name="root">
42
+ <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
43
+ </reference>
44
+ <reference name="left">
45
+ <block type="faq/left" name="faq.left" template="faq/left.phtml" before="-"/>
46
+ </reference>
47
+ <reference name="head">
48
+ <action method="addCss"><stylesheet>magebuzz/faq/faq.css</stylesheet> </action>
49
+ </reference>
50
+ <reference name="content">
51
+ <block type="faq/detail" name="faq" template="faq/detail.phtml" />
52
+ </reference>
53
+ </faq_category_detail>
54
+ <faq_category_search>
55
+ <reference name="head">
56
+ <action method="addCss"><stylesheet>magebuzz/faq/faq.css</stylesheet> </action>
57
+ </reference>
58
+ <reference name="root">
59
+ <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
60
+ </reference>
61
+ <reference name="left">
62
+ <block type="faq/left" name="faq.left" template="faq/left.phtml" before="-"/>
63
+ </reference>
64
+ <reference name="content">
65
+ <block type="faq/result" name="result" template="faq/result.phtml" />
66
+ </reference>
67
+ </faq_category_search>
68
+ <faq_index_search>
69
+ <reference name="head">
70
+ <action method="addCss"><stylesheet>magebuzz/faq/faq.css</stylesheet> </action>
71
+ </reference>
72
+ <reference name="left">
73
+ <block type="faq/left" name="faq.left" template="faq/left.phtml" before="-"/>
74
+ </reference>
75
+ <reference name="root">
76
+ <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
77
+ </reference>
78
+ <reference name="content">
79
+ <block type="faq/result" name="result" template="faq/result.phtml" />
80
+ </reference>
81
+ </faq_index_search>
82
+ </layout>
app/design/frontend/base/default/template/faq/category.phtml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $collection = $this->getCollection();
3
+ $isUseJavascript = Mage::helper('faq')->getUseJavascript();
4
+ $faqCategory = $this->getFaqCategory();
5
+ ?>
6
+ <div class="page-title">
7
+ <h1><?php echo $faqCategory->getCategoryName();?></h1>
8
+ </div>
9
+ <div class="faq-category">
10
+ <div class="box-head">
11
+ <div class="search-title">
12
+ <h2><?php echo $this->__('Search FAQ');?></h2>
13
+ </div>
14
+ <div class="faq-search">
15
+ <form name="faqsearch" action="<?php echo $this->getUrl('*/*/search') ?>" method="post" id="search-form">
16
+ <ul>
17
+ <li>
18
+ <input name="keyword" id="keyword" class="input-text required-entry" type="text" maxlength="100" size="80" />
19
+ <button type="submit" title="<?php echo $this->__('SEARCH') ?>" class="button"><span><span><?php echo $this->__('SEARCH') ?></span></span></button>
20
+ </li>
21
+ </ul>
22
+ </form>
23
+ </div>
24
+ </div>
25
+ <?php if(count($collection)) :?>
26
+ <div class="faq-questions">
27
+ <?php foreach ($collection as $faq):?>
28
+ <div class="faq-detail">
29
+ <h2 class="faq-title">
30
+ <a href="<?php echo $this->getFaqUrl($faq)?>" title="<?php echo $faq->getQuestion()?>"><?php echo $faq->getQuestion()?></a>
31
+ </h2>
32
+ <div class="faq_answer">
33
+ <?php echo $faq->getAnswer();?>
34
+ </div>
35
+ </div>
36
+ <?php endforeach;?>
37
+ </div>
38
+ <?php else: ?>
39
+ <p class="note-msg"><?php echo $this->__('There are no FAQs matching the selection.') ?></p>
40
+ <?php endif?>
41
+ </div>
app/design/frontend/base/default/template/faq/detail.phtml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $faq = $this->getFaq(); ?>
2
+ <?php if ($faq):?>
3
+ <div class="page-title"><h1><?php echo $faq->getQuestion()?></h1></div>
4
+ <div class="faq-detail-answer">
5
+ <?php echo $faq->getAnswer();?>
6
+ </div>
7
+ <?php endif ?>
8
+ <div class="other-questions">
9
+ <h2><?php echo $this->__('Other questions in the same category');?></h2>
10
+ <?php $questions = $this->getOtherQuestions();?>
11
+ <?php if (count($questions)):?>
12
+ <ul>
13
+ <?php foreach ($questions as $_question):?>
14
+ <?php if ($_question->getId() != $faq->getId()):?>
15
+ <li>
16
+ <a href="<?php echo $this->getFaqUrl($_question)?>" title="<?php echo $_question->getQuestion()?>"><?php echo $_question->getQuestion()?></a>
17
+ </li>
18
+ <?php endif;?>
19
+ <?php endforeach;?>
20
+ </ul>
21
+ <?php endif;?>
22
+ </div>
app/design/frontend/base/default/template/faq/faq.phtml ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="page-title">
2
+ <h1><?php echo $this->__('Frequently Asked Question')?></h1>
3
+ </div>
4
+ <div class="faq-content">
5
+ <div class="box-head">
6
+ <div class="search-title">
7
+ <h2><?php echo $this->__('Search FAQ');?></h2>
8
+ </div>
9
+ <div class="faq-search">
10
+ <form name="faqsearch" action="<?php echo $this->getUrl('*/*/search') ?>" method="post" id="faq-search-form">
11
+ <ul>
12
+ <li>
13
+ <input name="keyword" id="keyword" class="input-text required-entry" type="text" maxlength="100" size="80" />
14
+ <button type="submit" title="<?php echo $this->__('SEARCH') ?>" class="button"><span><span><?php echo $this->__('SEARCH') ?></span></span></button>
15
+ </li>
16
+ </ul>
17
+ </form>
18
+ </div>
19
+ </div>
20
+ <div class="description">
21
+ <?php $isUseJavascript = Mage::helper('faq')->getUseJavascript();?>
22
+ <?php $allQuestion=$this->getAllQuestion()?>
23
+ <?php if(!empty($allQuestion)):?>
24
+ <?php $category = $this->getCategories()->getData(); ?>
25
+ <?php if(count($category) > 0): ?>
26
+ <ul>
27
+ <?php $i=0;foreach ($category as $obj): ?>
28
+ <?php $questions=$this->getFaqsData($obj['category_id']) ?>
29
+ <?php $questions = $questions->getData();?>
30
+ <?php if(count($questions)): ?>
31
+ <?php $i=$i+1?>
32
+ <li class="<?php if(($i%2)!= 0):?>left<?php else:?>right<?php endif;?>">
33
+ <h3><?php echo $obj['category_name']?></h3>
34
+ <ul>
35
+ <?php foreach ($questions as $question): ?>
36
+ <li>
37
+ <?php if ($isUseJavascript): ?>
38
+ <a id="faq_question_<?php echo $question['faq_id']?>" onclick="showanswer('<?php echo $question['faq_id']?>')" href="javascript://"><?php echo $question['question'] ?></a>
39
+ <div class="faq_answer" id="faq_answer_<?php echo $question['faq_id']?>" style="display:none;">
40
+ <?php echo $question['answer'] ?>
41
+ </div>
42
+ <?php else : ?>
43
+ <a href="<?php echo $this->getQuestionUrl(array('id' => $question['faq_id']))?>"><?php echo $question['question']; ?></a>
44
+ <div class="answer">
45
+ </div>
46
+ <?php endif ?>
47
+ </li>
48
+ <?php endforeach ?>
49
+ </ul>
50
+ <?php $_categroyId = $obj['category_id'];?>
51
+ <?php if (!$isUseJavascript): ?>
52
+ <div class="faq-view-more">
53
+ <a href="<?php echo $this->getCategoryUrl(array('cid' => $_categroyId))?>"><?php echo $this->__('View more...')?></a>
54
+ </div>
55
+ <?php endif ?>
56
+ <?php endif ?>
57
+ </li>
58
+ <?php endforeach ?>
59
+ </ul>
60
+ <?php else: ?>
61
+ <?php echo $this->__('There are no FAQs matching the selection.') ?>
62
+ <?php endif?>
63
+ <?php else: ?>
64
+ <p class="note-msg"><?php echo $this->__('There are no FAQs matching the selection.') ?></p>
65
+ <?php endif ?>
66
+ </div>
67
+ </div>
68
+ <?php if ($isUseJavascript): ?>
69
+ <script type="text/javascript">
70
+ function showanswer(faq_id) {
71
+ $$('div.faq_answer').each(
72
+ function (e) {
73
+ if (e.id != 'faq_answer_'+faq_id) {
74
+ e.hide();
75
+ }
76
+ }
77
+ );
78
+
79
+ if ($('faq_answer_'+faq_id).getStyle('display') == 'none') {
80
+ $('faq_answer_'+faq_id).show();
81
+ }
82
+ else {
83
+ $('faq_answer_'+faq_id).hide();
84
+ }
85
+ }
86
+ //<![CDATA[
87
+ var dataForm = new VarienForm('faq-search-form', true);
88
+ //]]>
89
+ </script>
90
+ <?php endif;?>
app/design/frontend/base/default/template/faq/left.phtml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $categories = $this->getFaqCategories();?>
2
+ <?php if (count($categories)):?>
3
+ <div class="block block-faq">
4
+ <div class="block-title">
5
+ <strong><span><?php echo $this->__('FAQ Categories') ?></span></strong>
6
+ </div>
7
+ <div class="block-content">
8
+ <ul class="faq-categories">
9
+ <?php foreach ($categories as $category):?>
10
+ <li><a href="<?php echo $this->getCategoryUrl($category)?>" title="<?php echo $category->getCategoryName();?>"><?php echo $category->getCategoryName();?></a></li>
11
+ <?php endforeach;?>
12
+ </ul>
13
+ </div>
14
+ </div>
15
+ <?php endif;?>
app/design/frontend/base/default/template/faq/result.phtml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $post= $this->getRequest()->getPost();
3
+ $isUseJavascript = Mage::helper('faq')->getUseJavascript();
4
+ ?>
5
+ <div class="page-title">
6
+ <h1><?php echo $this->__("Search result for '%s'", $post['keyword']);?></h1>
7
+ </div>
8
+ <div class="faq-search-result">
9
+ <div class="faq-search">
10
+ <form name="faqsearch" action="<?php echo $this->getUrl('*/*/search') ?>" method="post" id="search-form">
11
+ <ul>
12
+ <li>
13
+ <input name="keyword" id="keyword" class="input-text required-entry" type="text" maxlength="100" size="80" />
14
+ <button type="submit" title="<?php echo $this->__('SEARCH') ?>" class="button"><span><span><?php echo $this->__('SEARCH') ?></span></span></button>
15
+ </li>
16
+ </ul>
17
+ </form>
18
+ </div>
19
+ <div class="description">
20
+ <?php $question_result_array = $this->getQuestionResult()?>
21
+ <?php if(!empty($question_result_array)): ?>
22
+ <?php foreach ($question_result_array as $question_result ): ?>
23
+ <?php foreach ($question_result as $question):?>
24
+ <?php $category = $this->getCategory($question) ?>
25
+ <?php if(!empty($category)): ?>
26
+ <ul>
27
+
28
+ <h3><?php echo $category[0]['category_name']?></h3>
29
+ <li>
30
+ <div class="faq-question"><a href="<?php echo $this->getQuestionUrl(array('id' => $question->getData('faq_id')))?>" title="<?php echo $question['question']; ?>"><?php echo $question['question']; ?></a></div>
31
+ <div class="answer">
32
+ </div>
33
+ </li>
34
+
35
+ </ul>
36
+ <?php endif ?>
37
+ <?php endforeach ?>
38
+ <?php endforeach ?>
39
+ <?php else:?>
40
+ <p class="note-msg"><?php echo $this->__('There are no FAQs matching the selection.'); ?></p>
41
+ <?php endif ?>
42
+ </div>
43
+ </div>
44
+ <div class="buttons-set">
45
+ <p class="back-link">
46
+ <button class="button" title="Goback" onclick="goBack()"><span><span>Go Back</span></span></button>
47
+ </p>
48
+ </div>
49
+
50
+ <script type="text/javascript">
51
+ function goBack(){
52
+ window.history.back();
53
+ }
54
+ //<![CDATA[
55
+ var dataForm = new VarienForm('search-form', true);
56
+ //]]>
57
+
58
+ </script>
app/etc/modules/Magebuzz_Faq.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magebuzz_Faq>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Magebuzz_Faq>
8
+ </modules>
9
+ </config>
app/locale/en_US/Magebuzz_Faq.csv ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "FAQ","FAQ"
2
+ "Frequently Asked Question", "Frequently Asked Question"
3
+ "Search FAQ", "Search FAQ"
4
+ "SEARCH","SEARCH"
5
+ "There are no FAQs matching the selection.", "There are no FAQs matching the selection."
6
+ "FAQ Category", "FAQ Category"
7
+ "FAQ Question", "FAQ Question"
8
+ "Other questions in the same category","Other questions in the same category"
9
+ "FAQ Categories", "FAQ Categories"
10
+ "FAQ Search Result", "FAQ Search Result"
11
+ "Search result for '%s'", "Search result for '%s'"
12
+ "FAQ Detail", "FAQ Detail"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Magebuzz_Simple_Faq</name>
4
+ <version>0.1.2</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Simple FAQ extension for Magento Community</summary>
10
+ <description>Add Frequently Asked Questions to your Magento store.</description>
11
+ <notes>Reuploaded</notes>
12
+ <authors><author><name>Magebuzz</name><user>magebuzz</user><email>magebuzz@gmail.com</email></author></authors>
13
+ <date>2014-07-23</date>
14
+ <time>03:08:28</time>
15
+ <contents><target name="magecommunity"><dir name="Magebuzz"><dir name="Faq"><dir name="Block"><dir name="Adminhtml"><dir name="Category"><dir name="Edit"><file name="Form.php" hash="e41c8fbe72b165b2b5b6bc67fab9cd2c"/><dir name="Tab"><file name="Form.php" hash="29efbd42fccb363ad68667986996cf59"/></dir><file name="Tabs.php" hash="ecce7c49cf6dea84824f6a69b6904cde"/></dir><file name="Edit.php" hash="61448facab887ce6799e5a358f47e207"/><file name="Grid.php" hash="25622dd4c2f83498488248cfe945e532"/></dir><file name="Category.php" hash="5ee70bdb257f1441dc86c90d840a0cdb"/><dir name="Faq"><dir name="Edit"><file name="Form.php" hash="f55078ae920cb16834577e1ea6806668"/><dir name="Tab"><file name="Form.php" hash="e2dccefd2d4302e2c16413d20e179c01"/></dir><file name="Tabs.php" hash="8c76df49c3326cd5f3b21c2a8763370d"/></dir><file name="Edit.php" hash="3c111d5cf857825f94dd9d6aed963913"/><file name="Grid.php" hash="68c84036e3a6b35d5070594d06c091a4"/><dir name="Renderer"><file name="Category.php" hash="d71ed4e91b5f58a476221b762410bff0"/></dir></dir><file name="Faq.php" hash="fdc78efc28b0c59e21d208d2aa0201db"/></dir><file name="Category.php" hash="696a02b9b5ba50b0c1024ae835aec000"/><file name="Detail.php" hash="a810c97868fe6a22df564f12e428601a"/><file name="Faq.php" hash="fe3d24dd329d1ff93ca338b492562ff7"/><file name="Left.php" hash="adc6a0262f0f3e77c322c2a89d993f4b"/><file name="Result.php" hash="f14a4028696a5503dedc56f5fc35a26a"/></dir><dir name="Helper"><file name="Data.php" hash="b7c13f61e7fe7e8a5070619806dc1931"/></dir><dir name="Model"><file name="Category.php" hash="07f3ceddec3557597f6a956f0a1f2ab7"/><file name="Faq.php" hash="e20174e690d8fea591bdf66a028c44fb"/><file name="Item.php" hash="0f4fbb8eab5d52abaec62554da0a7d9b"/><dir name="Mysql4"><dir name="Category"><file name="Collection.php" hash="c2406ba9ed238882d7983531596f2a23"/></dir><file name="Category.php" hash="0eceb86bb3b9d1037e3dcb687037fd9c"/><dir name="Faq"><file name="Collection.php" hash="c53bf2ab8996986dd7036dd67e61ef81"/></dir><file name="Faq.php" hash="6c8658bf5425dc43779c4f3b519cd53a"/><dir name="Item"><file name="Collection.php" hash="035fe88fe1cd4d3bb7b5188b8ff8aa4d"/></dir><file name="Item.php" hash="283ed8e0d18c00b06f11986ec897e3ab"/></dir><file name="Status.php" hash="60a51107afa9cad8454111475b5b639e"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Sortorder.php" hash="78bdab18773e2b1615f478576417378b"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CategoryController.php" hash="7d4c11c4cac14cb98c29025133e33d75"/><file name="FaqController.php" hash="96b18f32f44f07433e1f99b140e324d2"/></dir><file name="CategoryController.php" hash="838672f28c7f2826449a55afdc470688"/><file name="IndexController.php" hash="eaef2033c1d46daa9461390199b247a1"/></dir><dir name="etc"><file name="adminhtml.xml" hash="0483de86bc0ededacff5a4b171edc6c1"/><file name="config.xml" hash="39c54d05bf50ce8cf507af07ac018e5b"/><file name="system.xml" hash="15e7cb0500e9fbb63f3089d6cc88982d"/></dir><dir name="sql"><dir name="faq_setup"><file name="mysql4-install-0.1.0.php" hash="0ab560c261a80a813d2797a19624f537"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="d6e9a489cdd75760a9c206befd0f4071"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="87ab77e2aeec6ec71515acc6e78bc73e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="faq.xml" hash="90de9438a9e924a93d17da7727e03bc7"/></dir><dir name="template"><dir name="faq"><file name="category.phtml" hash="255273964374915abd038edacb543f93"/><file name="detail.phtml" hash="b930f938b784f6d08acb09b3c0413d66"/><file name="faq.phtml" hash="fec08b6cc71ee45c969aadb338208c81"/><file name="left.phtml" hash="b9a2a848a7c6df763c8366ccfe33cdef"/><file name="result.phtml" hash="77df1cec00e6f04949e395bc5d8fc8ba"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Magebuzz_Faq.csv" hash="cdbd98416787102fd8e84eea1fe241c8"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="magebuzz"><dir name="faq"><file name="faq.css" hash="c41d83f68b41d9ba4b186d3111a24cbc"/><dir name="images"><file name="Thumbs.db" hash="a17c192dd469e2250d2904bbc25a3dc5"/><file name="bkg_block-layered-dt.gif" hash="ba8229068657b80f2c42111c5a1a307e"/><file name="bkg_block-layered-label.gif" hash="14687dfa3921cfd12d2149c1497d9765"/><file name="bullet.png" hash="b84409666190ec9e5d7016a0dca3aa35"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magebuzz_Faq.xml" hash="47a2422faaa647304d3e568906edac3c"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/frontend/base/default/magebuzz/faq/faq.css ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .search-result h2 {
2
+ color:#1E7EC8;
3
+ float:left;
4
+ font-family:Arial;
5
+ font-size:18px;
6
+ padding-bottom:5px;
7
+ text-transform:uppercase;
8
+ width:100%;
9
+ font-weight:bold;
10
+ }
11
+ .faq-content .description .note-msg {clear:both;}
12
+ .faq-content .box-head{float:left; width:100%; margin-bottom:20px;border-bottom:1px solid #e2e2e2}
13
+ .faq-content .box-title{float:left; width:100%;padding-bottom:5px;}
14
+ .faq-content .box-title h3{
15
+ color: #FF7F50;
16
+ text-transform: uppercase;
17
+ font-size: 20px;
18
+ }
19
+ .faq-search{float:left;margin-bottom: 20px;}
20
+ .faq-search input.input-text{width:300px;}
21
+ .formsearch label {
22
+ color:#FF7F50;
23
+ float:left;
24
+ font-family:Arial;
25
+ font-size:16px;
26
+ padding-bottom:5px;
27
+ text-transform:uppercase;
28
+ width:100%;
29
+ font-weight:bold;
30
+
31
+ }
32
+
33
+ .formsearch h4 {
34
+ color:#1E7EC8;
35
+ float:left;
36
+ font-family:Arial;
37
+ font-size:12px;
38
+ padding-bottom:5px;
39
+ text-transform:uppercase;
40
+ width:100%;
41
+ padding-bottom:2px;
42
+ padding-top:20px;
43
+ font-weight:normal;
44
+ }
45
+
46
+ .description ul {
47
+ color:#FF7F50;
48
+ font-size:14px;
49
+ font-weight:bold;
50
+ margin-bottom:0;
51
+ padding-bottom:10px;
52
+ padding-top:20px;
53
+ text-transform:uppercase;
54
+ overflow: hidden;
55
+ clear: both;
56
+ }
57
+ .description ul li {
58
+ color:#737373;
59
+ font-size:12px;
60
+ text-decoration:none;
61
+ text-transform:capitalize;
62
+ font-weight:normal;
63
+ line-height:20px;
64
+ margin-bottom:5px;
65
+ width:45%;
66
+ }
67
+ .faq-search-result .description ul li{width:100%;}
68
+ .faq-search-result .description ul li a{ text-decoration:none; font-size:13px; font-weight:normal;background:url(../../magebuzz/faq/images/bullet.png) center left no-repeat;padding-left:20px; color:#363636;}
69
+ .faq-search-result .search-no-result{float:left; width:100%; font-size:13px; font-weight:normal; padding:5px 0;}
70
+ .description ul h3{text-transform:uppercase; color:#1E7EC8;border-bottom:1px dotted #e2e2e2; }
71
+ .description ul li h3{text-transform:uppercase; color:#1E7EC8;border-bottom:1px dotted #e2e2e2; }
72
+ .description ul li.left{clear:both;}
73
+ .description ul li ul{width:100%}
74
+ .description ul li ul li {
75
+ color:#737373;
76
+ font-size:12px;
77
+ text-decoration:none;
78
+ text-transform:capitalize;
79
+ font-weight:normal;
80
+ line-height:20px;
81
+ padding-bottom:5px;
82
+ margin-bottom:0;
83
+ width:90%;
84
+
85
+ }
86
+ .description ul li a{ text-decoration:none; font-size:13px; font-weight:normal;}
87
+ .description ul li ul li a{ text-decoration:none; font-size:13px; font-weight:normal;background:url(../../magebuzz/faq/images/bullet.png) center left no-repeat;padding-left:20px; color:#363636;}
88
+
89
+ .faq_answer {padding:5px 0 5px 25px;color:#1E7EC8;}
90
+ .faq-view-more {float:right; margin-right:40px;}
91
+
92
+ .faq-category .faq-questions {clear:both;}
93
+ .faq-category .faq-questions .faq-detail .faq-title a{text-decoration:none;}
94
+ .faq-category .faq-questions .faq-detail .faq_answer {color:#2F2F2F;}
95
+ .faq-detail-answer {clear:both;}
96
+ .other-questions {margin-top:20px; border-top:1px dotted #CCCCCC; padding-top:5px;}
97
+ .block-faq .faq-categories {padding-left:10px;}
98
+ .block-faq .block-content ul li {margin-bottom:5px;}
99
+
100
+ .faq-search-result .description .note-msg{clear:both;}
skin/frontend/base/default/magebuzz/faq/images/Thumbs.db ADDED
Binary file
skin/frontend/base/default/magebuzz/faq/images/bkg_block-layered-dt.gif ADDED
Binary file
skin/frontend/base/default/magebuzz/faq/images/bkg_block-layered-label.gif ADDED
Binary file
skin/frontend/base/default/magebuzz/faq/images/bullet.png ADDED
Binary file