tv_faq_new - Version 0.1.2

Version Notes

Third Version

Download this release

Release Info

Developer Tarun Vishnoi
Extension tv_faq_new
Version 0.1.2
Comparing to
See all releases


Code changes from version 0.1.1 to 0.1.2

app/code/local/TV/Faq/Block/Adminhtml/Item/Edit/Tab/Form.php CHANGED
@@ -101,12 +101,12 @@ class TV_Faq_Block_Adminhtml_Item_Edit_Tab_Form extends Mage_Adminhtml_Block_Wid
101
  '1' => Mage::helper('cms')->__('Enabled'),
102
  '0' => Mage::helper('cms')->__('Disabled') ) ));
103
 
104
- $fieldset->addField('category_id', 'multiselect',
105
  array (
106
  'label' => Mage::helper('tv_faq')->__('Category'),
107
  'title' => Mage::helper('tv_faq')->__('Category'),
108
  'name' => 'categories[]',
109
- 'required' => false,
110
  'values' => Mage::getResourceSingleton('tv_faq/category_collection')->toOptionArray(),
111
  )
112
  );
101
  '1' => Mage::helper('cms')->__('Enabled'),
102
  '0' => Mage::helper('cms')->__('Disabled') ) ));
103
 
104
+ $fieldset->addField('category_id', 'select',
105
  array (
106
  'label' => Mage::helper('tv_faq')->__('Category'),
107
  'title' => Mage::helper('tv_faq')->__('Category'),
108
  'name' => 'categories[]',
109
+ 'required' => true,
110
  'values' => Mage::getResourceSingleton('tv_faq/category_collection')->toOptionArray(),
111
  )
112
  );
app/design/frontend/base/default/template/faq/list.phtml CHANGED
@@ -1,64 +1,73 @@
1
  <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * FAQ accordion for Magento
22
- *
23
- * Website: www.abc.com
24
- * Email: honeyvishnoi@gmail.com
25
- *
26
- /* @var $this TV_Faq_Block_Frontend_List */
27
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  <div class="page-title">
29
  <h1><?php echo $this->__('FAQ List'); ?></h1>
30
  </div>
31
 
32
- <?php if ($this->hasFaq()): ?>
33
- <?php if ($this->getCategoryCollection()) : ?>
34
- <!--<dl class="faq-list">
35
- <?php foreach ($this->getCategoryCollection() as $category) : ?>
36
- <dt><?php echo $this->htmlEscape($category->getName()); ?></dt><dd><ul class="faq-list">
37
- <?php foreach ($this->getItemCollectionByCategory($category) as $item) : ?>
38
- <li>
39
- <a href="#faq-item-<?php echo $item->getId() ?>">
40
- <?php echo $this->htmlEscape($item->getQuestion()); ?>
41
- </a>
42
- </li>
43
- <?php endforeach; ?>
44
- </ul></dd>
45
- <?php endforeach; ?>
46
- </dl>-->
47
- <?php else : ?>
48
- <ul class="faq-list">
49
- <?php foreach ($this->getFaqCollection() as $faqItem): ?>
50
- <li>
51
- <a href="#faq-item-<?php echo $faqItem->getId() ?>">
52
- <?php echo $this->htmlEscape($faqItem->getQuestion()) ?>
53
- </a>
54
- </li>
55
- <?php endforeach; ?>
56
- </ul>
57
- <?php endif; ?>
58
 
59
- <dl class="faq-items">
 
 
 
 
 
 
 
60
  <?php foreach ($this->getFaqCollection() as $faqItem): ?>
61
- <dt id="faq-que-<?php echo $faqItem->getId() ?>" onclick="slide('faq-que-<?php echo $faqItem->getId() ?>','faq-ans-<?php echo $faqItem->getId() ?>')">
 
62
  <?php echo $this->htmlEscape($faqItem->getQuestion()) ?>
63
  </dt>
64
  <dd id="faq-ans-<?php echo $faqItem->getId() ?>" style="display:none;">
@@ -66,18 +75,85 @@
66
  <?php echo $_process->filter($faqItem->getAnswer()); ?>
67
  </dd>
68
  <?php endforeach; ?>
69
- </dl>
70
- <?php else: ?>
71
- <p class="faq-items"><?php echo $this->__('There are no FAQ items at the moment.') ?></p>
72
- <?php endif; ?>
73
  <script type="text/javascript">
74
- function slide(element1, element2){
75
  new Effect.toggle(element2,'Slide', {duration:1});
76
- if( $(element1).hasClassName("active") ){
77
- $(element1).removeClassName("active");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  }
79
  else{
80
- $(element1).addClassName("active");
81
  }
82
  }
83
  </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ?>
4
+ <style>
5
+ .tabs{
6
+ margin: 0px;
7
+ padding: 0px;
8
+ list-style: none;
9
+ background:#2c3e50;
10
+ border-bottom: 5px #e67e22 solid;
11
+ }
12
+
13
+ .tabs li{
14
+ display: inline-block;
15
+ margin:0;
16
+ padding: 10px 20px 5px 20px;
17
+ cursor: pointer;
18
+
19
+ font-size:1.2em;
20
+ line-height:2em;
21
+ color:#FFF;
22
+ }
23
+
24
+ .tabs li:hover {
25
+ background:#d35400;
26
+ }
27
+
28
+ .tabs li.current{
29
+ background: #e67e22;
30
+ color: #FFF;
31
+ }
32
+
33
+ .tab-content{
34
+ display: none;
35
+ background: #ededed;
36
+ padding: 15px;
37
+
38
+ line-height:1.4;
39
+ }
40
+
41
+ .tab-content.current{
42
+ display: inherit;
43
+ }
44
+
45
+ @media only screen and ( max-width: 400px ) {
46
+ .tabs li {
47
+ display: block;
48
+ }
49
+ }
50
+ </style>
51
+
52
+
53
  <div class="page-title">
54
  <h1><?php echo $this->__('FAQ List'); ?></h1>
55
  </div>
56
 
57
+ <?php //if ($this->hasFaq()): ?>
58
+ <?php if ($this->getCategoryCollection()) : ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
+ <ul class="tabs">
61
+ <li class="tab current" data-tab="tab-1">All</li>
62
+ <?php $index=2; foreach ($this->getCategoryCollection() as $category) : ?>
63
+ <li class="tab" data-tab="tab-<?php echo $index;?>"><?php echo $this->htmlEscape($category->getName()); ?></li>
64
+ <?php $index++; endforeach; ?>
65
+ </ul>
66
+ <div id="tab-1" class="tab-content current">
67
+ <p><dl class="faq-items">
68
  <?php foreach ($this->getFaqCollection() as $faqItem): ?>
69
+
70
+ <dt id="faq-que-<?php echo $faqItem->getId() ?>" onclick="slide1('faq-que-<?php echo $faqItem->getId() ?>','faq-ans-<?php echo $faqItem->getId() ?>')">
71
  <?php echo $this->htmlEscape($faqItem->getQuestion()) ?>
72
  </dt>
73
  <dd id="faq-ans-<?php echo $faqItem->getId() ?>" style="display:none;">
75
  <?php echo $_process->filter($faqItem->getAnswer()); ?>
76
  </dd>
77
  <?php endforeach; ?>
78
+ </dl></p>
 
 
 
79
  <script type="text/javascript">
80
+ function slide1(element1, element2){
81
  new Effect.toggle(element2,'Slide', {duration:1});
82
+ if( jQuery(element1).hasClassName("active") ){
83
+ jQuery(element1).removeClassName("active");
84
+ }
85
+ else{
86
+ jQuery(element1).addClassName("active");
87
+ }
88
+ }
89
+ </script>
90
+ </div>
91
+
92
+ <?php $indexx=2; foreach ($this->getCategoryCollection() as $category) : ?>
93
+ <div id="tab-<?php echo $indexx;?>" class="tab-content">
94
+
95
+ <p><dl class="faq-items">
96
+ <?php foreach ($this->getItemCollectionByCategory($category) as $faqItem): ?>
97
+
98
+ <dt id="faq-que2-<?php echo $faqItem->getId() ?>" onclick="slide2('faq-que2-<?php echo $faqItem->getId() ?>','faq-ans2-<?php echo $faqItem->getId() ?>')">
99
+ <?php echo $this->htmlEscape($faqItem->getQuestion()) ?>
100
+ </dt>
101
+ <dd id="faq-ans2-<?php echo $faqItem->getId() ?>" style="display:none;">
102
+ <?php $_process = Mage::helper('cms')->getBlockTemplateProcessor();?>
103
+ <?php echo $_process->filter($faqItem->getAnswer()); ?>
104
+ </dd>
105
+ <?php endforeach; ?>
106
+ </dl></p>
107
+ <script type="text/javascript">
108
+ function slide2(element3, element4){
109
+ new Effect.toggle(element4,'Slide', {duration:1});
110
+ if( jQuery(element3).hasClassName("active") ){
111
+ jQuery(element3).removeClassName("active");
112
  }
113
  else{
114
+ jQuery(element3).addClassName("active");
115
  }
116
  }
117
  </script>
118
+ </div>
119
+ <?php $indexx++; endforeach; ?>
120
+ <?php else: ?>
121
+ <p class="faq-items"><?php echo $this->__('There are no FAQ items at the moment.') ?></p>
122
+ <?php endif; ?>
123
+
124
+
125
+
126
+
127
+
128
+ <script type="text/javascript">
129
+ // JavaScript Document
130
+
131
+ jQuery(document).ready(function(){
132
+
133
+ var type = window.location.hash.substr(1);
134
+
135
+ if( type != "" ){
136
+
137
+ jQuery('ul.tabs li').removeClass('current');
138
+ jQuery('.tab-content').removeClass('current');
139
+
140
+ jQuery('ul.tabs li[ data-tab="'+ type +'" ]').addClass('current');
141
+ jQuery("#"+type).addClass('current');
142
+ }
143
+
144
+ //alert(type);
145
+
146
+ jQuery('ul.tabs li').click(function(){
147
+ var tab_id = jQuery(this).attr('data-tab');
148
+
149
+ jQuery('ul.tabs li').removeClass('current');
150
+ jQuery('.tab-content').removeClass('current');
151
+
152
+ jQuery(this).addClass('current');
153
+ jQuery("#"+tab_id).addClass('current');
154
+ })
155
+
156
+
157
+
158
+ })
159
+ </script>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>tv_faq_new</name>
4
- <version>0.1.1</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>This extension allows admin to enter questions and answers and list them on front end.</summary>
10
  <description>This extension allows admin to enter questions and answers and list them on front end.</description>
11
- <notes>Second Vrsion</notes>
12
  <authors><author><name>tarun vishnoi</name><user>tarun_ons</user><email>honeyvishnoi@gmail.com</email></author></authors>
13
- <date>2016-09-29</date>
14
- <time>18:28:00</time>
15
- <contents><target name="magelocal"><dir name="TV"><dir name="Faq"><dir name="Block"><dir name="Adminhtml"><dir name="Category"><dir name="Edit"><file name="Form.php" hash="92dff8a012206aae13e4c2ae3759c5f9"/><dir name="Tab"><file name="Form.php" hash="46d4ab06cbd0099a31e4ac99b6de39fc"/></dir><file name="Tabs.php" hash="69bd08df860a478ccf90fc9fa2c56ae7"/></dir><file name="Edit.php" hash="3b58bcd78038a5e943b90da796598d4c"/><file name="Grid.php" hash="319356af6e0e6329a42b779834456bc0"/></dir><file name="Category.php" hash="59a310d0fa62886828e9a53afcf35954"/><dir name="Item"><dir name="Edit"><file name="Form.php" hash="6ec7bc1dea4b127e65298a15ffbe3ee4"/><dir name="Tab"><file name="Form.php" hash="1d9bf36cf280acdee246b61e62ef5320"/></dir><file name="Tabs.php" hash="1fc1ab43dcf72b6e63bc785f4e83effb"/></dir><file name="Edit.php" hash="ee55af3d2c18c06d99c91f50bc38bce6"/><file name="Grid.php" hash="b172258c705c6ac5a10cd28fd513ac2a"/></dir><file name="Item.php" hash="de90e2d7348bf60db6cb0a852f4b558b"/></dir><dir name="Frontend"><file name="Detail.php" hash="2425432562d71949bb7bbc1166915b49"/><file name="List.php" hash="ca84aa33f29c6c817623cd42043cab5a"/></dir></dir><dir name="Helper"><file name="Data.php" hash="b6c919e0c4d5e54e28779c389872f7c2"/><file name="Jumplist.php" hash="c6b5469ffddef4afbb9825787af363ae"/><file name="JumplistItem.php" hash="3323517e20c5db4c5b41caa17a56dd2e"/></dir><dir name="Model"><file name="Category.php" hash="9e928e4f26ac0ad1965b912bd43ff0d4"/><file name="Faq.php" hash="c93d162961776b7c1d4a887b12e15d98"/><dir name="Mysql4"><dir name="Category"><file name="Collection.php" hash="c6f262642e9a3558ef599582e402cf39"/></dir><file name="Category.php" hash="c084383e9031018b4bb93fed37bad39e"/><dir name="Faq"><file name="Collection.php" hash="909b63da3d8c1fb177a49855286ce951"/></dir><file name="Faq.php" hash="691c7c4015628e45671daa9f6a847daf"/></dir></dir><dir name="Wysiwyg"><dir name="Images"><dir name="Content"><file name="Files.php" hash="96ba466e162a5b304e05581a1b9981c2"/><file name="Newfolder.php" hash="e53addca9a2a2a705e97bd493c57833c"/><file name="Uploader.php" hash="d46965540d2986ff74f9c2c030f2dbb4"/></dir><file name="Content.php" hash="fa97cc6ae723a62eeb137dcb23851225"/><file name="Tree.php" hash="6de3fa85978962413118cfc15b5f8f82"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Faq"><file name="CategoryController.php" hash="f66c2305c654f36cb5dc8e2682e135f2"/></dir><file name="FaqController.php" hash="876b26440bb40188b38cfc7b98a38b21"/></dir><file name="IndexController.php" hash="3e8c7abb09eb92da75cf562eb8d3a890"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8a4d6da6397de73caad6d78cd433ed88"/><file name="config.xml" hash="42ecc7df781233659a4d274fa7b11e4b"/></dir><dir name="sql"><dir name="faq_setup"><file name="mysql4-install-0.1.0.php" hash="1a5a6fc58d62fb45706bd94a4c9073cf"/><file name="mysql4-install-1.0.7.php" hash="5914476063c2aef33bb3adb0bdc3effe"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="b63f7b5b2ff00f632b0be0582ef7a530"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TV_Faq.xml" hash="690d6d2c3226982e59507bfc619ceed2"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="faq.xml" hash="d6d4c73235f8fec0b08f545f178db4eb"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="faq.xml" hash="9306a6a1548a87e27a41ce1802d78251"/></dir><dir name="template"><dir name="faq"><file name="detail.phtml" hash="945c73c968c7c980c1acc4bed4a4cc4a"/><file name="list.phtml" hash="104cc35852b68e88a201fa270623d3d1"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="tv"><file name="style.css" hash="c9ac6f68292f8c3d725a42c6713dfb18"/><file name="toggle-minus.png" hash="31d75504726b3f09a9e7af2115fb58c9"/><file name="toggle-plus.png" hash="c8b91476d2cf1c55b6e2010c02a96074"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>tv_faq_new</name>
4
+ <version>0.1.2</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>This extension allows admin to enter questions and answers and list them on front end.</summary>
10
  <description>This extension allows admin to enter questions and answers and list them on front end.</description>
11
+ <notes>Third Version</notes>
12
  <authors><author><name>tarun vishnoi</name><user>tarun_ons</user><email>honeyvishnoi@gmail.com</email></author></authors>
13
+ <date>2016-10-04</date>
14
+ <time>16:04:30</time>
15
+ <contents><target name="magelocal"><dir name="TV"><dir name="Faq"><dir name="Block"><dir name="Adminhtml"><dir name="Category"><dir name="Edit"><file name="Form.php" hash="92dff8a012206aae13e4c2ae3759c5f9"/><dir name="Tab"><file name="Form.php" hash="46d4ab06cbd0099a31e4ac99b6de39fc"/></dir><file name="Tabs.php" hash="69bd08df860a478ccf90fc9fa2c56ae7"/></dir><file name="Edit.php" hash="3b58bcd78038a5e943b90da796598d4c"/><file name="Grid.php" hash="319356af6e0e6329a42b779834456bc0"/></dir><file name="Category.php" hash="59a310d0fa62886828e9a53afcf35954"/><dir name="Item"><dir name="Edit"><file name="Form.php" hash="6ec7bc1dea4b127e65298a15ffbe3ee4"/><dir name="Tab"><file name="Form.php" hash="888a4e97344957faaa6e8eb2f87fe630"/></dir><file name="Tabs.php" hash="1fc1ab43dcf72b6e63bc785f4e83effb"/></dir><file name="Edit.php" hash="ee55af3d2c18c06d99c91f50bc38bce6"/><file name="Grid.php" hash="b172258c705c6ac5a10cd28fd513ac2a"/></dir><file name="Item.php" hash="de90e2d7348bf60db6cb0a852f4b558b"/></dir><dir name="Frontend"><file name="Detail.php" hash="2425432562d71949bb7bbc1166915b49"/><file name="List.php" hash="ca84aa33f29c6c817623cd42043cab5a"/></dir></dir><dir name="Helper"><file name="Data.php" hash="b6c919e0c4d5e54e28779c389872f7c2"/><file name="Jumplist.php" hash="c6b5469ffddef4afbb9825787af363ae"/><file name="JumplistItem.php" hash="3323517e20c5db4c5b41caa17a56dd2e"/></dir><dir name="Model"><file name="Category.php" hash="9e928e4f26ac0ad1965b912bd43ff0d4"/><file name="Faq.php" hash="c93d162961776b7c1d4a887b12e15d98"/><dir name="Mysql4"><dir name="Category"><file name="Collection.php" hash="c6f262642e9a3558ef599582e402cf39"/></dir><file name="Category.php" hash="c084383e9031018b4bb93fed37bad39e"/><dir name="Faq"><file name="Collection.php" hash="909b63da3d8c1fb177a49855286ce951"/></dir><file name="Faq.php" hash="691c7c4015628e45671daa9f6a847daf"/></dir></dir><dir name="Wysiwyg"><dir name="Images"><dir name="Content"><file name="Files.php" hash="96ba466e162a5b304e05581a1b9981c2"/><file name="Newfolder.php" hash="e53addca9a2a2a705e97bd493c57833c"/><file name="Uploader.php" hash="d46965540d2986ff74f9c2c030f2dbb4"/></dir><file name="Content.php" hash="fa97cc6ae723a62eeb137dcb23851225"/><file name="Tree.php" hash="6de3fa85978962413118cfc15b5f8f82"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Faq"><file name="CategoryController.php" hash="f66c2305c654f36cb5dc8e2682e135f2"/></dir><file name="FaqController.php" hash="876b26440bb40188b38cfc7b98a38b21"/></dir><file name="IndexController.php" hash="3e8c7abb09eb92da75cf562eb8d3a890"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8a4d6da6397de73caad6d78cd433ed88"/><file name="config.xml" hash="42ecc7df781233659a4d274fa7b11e4b"/></dir><dir name="sql"><dir name="faq_setup"><file name="mysql4-install-0.1.0.php" hash="1a5a6fc58d62fb45706bd94a4c9073cf"/><file name="mysql4-install-1.0.7.php" hash="5914476063c2aef33bb3adb0bdc3effe"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="b63f7b5b2ff00f632b0be0582ef7a530"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TV_Faq.xml" hash="690d6d2c3226982e59507bfc619ceed2"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="faq.xml" hash="d6d4c73235f8fec0b08f545f178db4eb"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="faq.xml" hash="9306a6a1548a87e27a41ce1802d78251"/></dir><dir name="template"><dir name="faq"><file name="detail.phtml" hash="945c73c968c7c980c1acc4bed4a4cc4a"/><file name="list.phtml" hash="4f062bee9a27f37fa39cfa659564efff"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="tv"><file name="style.css" hash="b3d8c3aa6e12fb7de64140fb65c2b73f"/><file name="toggle-minus.png" hash="31d75504726b3f09a9e7af2115fb58c9"/><file name="toggle-plus.png" hash="c8b91476d2cf1c55b6e2010c02a96074"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
skin/frontend/base/default/css/tv/style.css CHANGED
@@ -18,4 +18,5 @@ dl.faq-items dt.active{
18
  background-image: url('toggle-minus.png') !important;
19
  background-position: 10px center;
20
  background-repeat: no-repeat;
21
- }
 
18
  background-image: url('toggle-minus.png') !important;
19
  background-position: 10px center;
20
  background-repeat: no-repeat;
21
+ }
22
+