Avik_Faq - Version 1.6.1

Version Notes

We are bringing jQuery enable and disable configuration features which will help user to use jQuey min as per necessity.

Download this release

Release Info

Developer Avik Roy
Extension Avik_Faq
Version 1.6.1
Comparing to
See all releases


Code changes from version 1.6.0 to 1.6.1

app/code/local/Avik/Faq/Block/Adminhtml/Faq/Edit/Form.php CHANGED
@@ -45,7 +45,7 @@ class Avik_Faq_Block_Adminhtml_Faq_Edit_Form extends Mage_Adminhtml_Block_Widget
45
  'required' => true,
46
  ));
47
 
48
- if (!Mage::app()->isSingleStoreMode()) {
49
  $fieldset->addField('store_id', 'multiselect', array(
50
  'name' => 'stores[]',
51
  'label' => Mage::helper('checkout')->__('Store View'),
@@ -54,13 +54,13 @@ class Avik_Faq_Block_Adminhtml_Faq_Edit_Form extends Mage_Adminhtml_Block_Widget
54
  'values' => Mage::getSingleton('adminhtml/system_store')
55
  ->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
- }
64
  $fieldset->addField('faq_description', 'editor',
65
  array (
66
  'name' => 'faq_description',
45
  'required' => true,
46
  ));
47
 
48
+ //if (!Mage::app()->isSingleStoreMode()) {
49
  $fieldset->addField('store_id', 'multiselect', array(
50
  'name' => 'stores[]',
51
  'label' => Mage::helper('checkout')->__('Store View'),
54
  'values' => Mage::getSingleton('adminhtml/system_store')
55
  ->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
+ //}
64
  $fieldset->addField('faq_description', 'editor',
65
  array (
66
  'name' => 'faq_description',
app/code/local/Avik/Faq/Block/List.php CHANGED
@@ -37,8 +37,9 @@ class Avik_Faq_Block_List extends Mage_Core_Block_Template {
37
  $offset = ($curr_page - 1) * $limit;
38
  $collection = Mage::getModel('avik_faq/faq')->getCollection();
39
  $store_id=Mage::app()->getStore()->getStoreId();
40
- $collection->addFieldToFilter('is_active', array('eq' =>1))->addStoreFilter($store_id);
41
  $collection->getSelect()->limit($limit,$offset);
 
42
  return $collection;
43
  }
44
 
37
  $offset = ($curr_page - 1) * $limit;
38
  $collection = Mage::getModel('avik_faq/faq')->getCollection();
39
  $store_id=Mage::app()->getStore()->getStoreId();
40
+ $collection->addFieldToFilter('is_active', array('eq' =>1))->addFieldToFilter('store_id', array('like' =>'%'.$store_id.'%'));
41
  $collection->getSelect()->limit($limit,$offset);
42
+
43
  return $collection;
44
  }
45
 
app/code/local/Avik/Faq/controllers/Adminhtml/FaqController.php CHANGED
@@ -49,16 +49,23 @@ class Avik_Faq_Adminhtml_FaqController extends Mage_Adminhtml_Controller_Action
49
  ->_addContent($this->getLayout()->createBlock('avik_faq/adminhtml_faq_edit')->setData('action', $this->getUrl('*/*/save')))
50
  ->renderLayout();
51
  }
52
-
 
 
 
 
 
 
 
 
53
  public function saveAction()
54
  {
55
  if ($postData = $this->getRequest()->getPost()) {
56
  $model = Mage::getSingleton('avik_faq/faq');
57
  if(isset($postData['stores'])) {
58
  if(in_array('0',$postData['stores'])){
59
- $postData['store_id'] = '0';
60
-
61
- }
62
  else{
63
  $postData['store_id'] = implode(",", $postData['stores']);
64
 
49
  ->_addContent($this->getLayout()->createBlock('avik_faq/adminhtml_faq_edit')->setData('action', $this->getUrl('*/*/save')))
50
  ->renderLayout();
51
  }
52
+ public function getAllStore(){
53
+ $allStores = Mage::app()->getStores();
54
+ $storeId=array();
55
+ foreach ($allStores as $_eachStoreId => $val)
56
+ {
57
+ $storeId[] = Mage::app()->getStore($_eachStoreId)->getId();
58
+ }
59
+ return implode(',',$storeId);
60
+ }
61
  public function saveAction()
62
  {
63
  if ($postData = $this->getRequest()->getPost()) {
64
  $model = Mage::getSingleton('avik_faq/faq');
65
  if(isset($postData['stores'])) {
66
  if(in_array('0',$postData['stores'])){
67
+ $postData['store_id'] = $this->getAllStore();
68
+ }
 
69
  else{
70
  $postData['store_id'] = implode(",", $postData['stores']);
71
 
app/code/local/Avik/Faq/etc/system.xml CHANGED
@@ -39,6 +39,16 @@
39
  <show_in_website>1</show_in_website>
40
  <show_in_store>1</show_in_store>
41
  </pagination_limit>
 
 
 
 
 
 
 
 
 
 
42
  </fields>
43
  </messages>
44
  </groups>
39
  <show_in_website>1</show_in_website>
40
  <show_in_store>1</show_in_store>
41
  </pagination_limit>
42
+ <enabled translate="label">
43
+ <label>Enabled JQuery: </label>
44
+ <comment></comment>
45
+ <frontend_type>select</frontend_type>
46
+ <sort_order>0</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ <source_model>adminhtml/system_config_source_yesno</source_model>
51
+ </enabled>
52
  </fields>
53
  </messages>
54
  </groups>
app/design/frontend/base/default/layout/avik_faq.xml CHANGED
@@ -3,7 +3,7 @@
3
  <faq_handle><!-- declare a custom handle so you won't duplicate the code -->
4
  <reference name="head">
5
 
6
- <action method="addJs">
7
  <script>faq/jquery.min.js</script>
8
  </action>
9
  <action method="addJs">
3
  <faq_handle><!-- declare a custom handle so you won't duplicate the code -->
4
  <reference name="head">
5
 
6
+ <action method="addJs" ifconfig="faq_options_new/messages/enabled">
7
  <script>faq/jquery.min.js</script>
8
  </action>
9
  <action method="addJs">
app/design/frontend/base/default/template/avik/faq/list.phtml CHANGED
@@ -11,21 +11,26 @@
11
  <?php echo $this->getPagerHtml(); ?>
12
 
13
  <!-- responsive accordian -->
14
- <?php foreach($collection AS $faq): ?>
15
-
16
- <div id="ID_<?php echo $faq->getData('faq_id');?>" class="expandContent">
17
- <h3 class="faq-header">
18
- <div class="plus icon" id="plus"></div>
19
- <div class="headerColumn1"><?php echo $this->htmlEscape($faq->getData('faq_title'));?> </div>
20
-
21
- <div class="expandedContentClearFloat"></div>
22
- </h3>
23
- <div class="expandedContent">
24
- <?php echo $__helper->filter($faq->getData('faq_description')); ?>
25
- </div>
26
- </div>
27
- <div class="clearfloat"></div>
28
- <?php endforeach; ?>
 
 
 
 
 
29
  <?php echo $this->getPagerHtml(); ?>
30
 
31
  </div>
11
  <?php echo $this->getPagerHtml(); ?>
12
 
13
  <!-- responsive accordian -->
14
+ <?php
15
+ if(count($collection)>0){
16
+ foreach($collection AS $faq): ?>
17
+
18
+ <div id="ID_<?php echo $faq->getData('faq_id');?>" class="expandContent">
19
+ <h3 class="faq-header">
20
+ <div class="plus icon" id="plus"></div>
21
+ <div class="headerColumn1"><?php echo $this->htmlEscape($faq->getData('faq_title'));?> </div>
22
+
23
+ <div class="expandedContentClearFloat"></div>
24
+ </h3>
25
+ <div class="expandedContent">
26
+ <?php echo $__helper->filter($faq->getData('faq_description')); ?>
27
+ </div>
28
+ </div>
29
+ <div class="clearfloat"></div>
30
+ <?php endforeach; ?>
31
+ <?php } else {?>
32
+ <div><?php echo $this->__('No Record Found.');?></div>
33
+ <?php } ?>
34
  <?php echo $this->getPagerHtml(); ?>
35
 
36
  </div>
js/faq/ResponsiveAccordianMenu.js CHANGED
@@ -1,56 +1,56 @@
1
- var $ = jQuery.noConflict();
2
- $(window).load(function() {
3
 
4
- var divs = $('.expandContent'),
5
  content = divs.children('div');
6
 
7
  // hide all divs initially
8
  content.hide();
9
 
10
  // drop down menu - on change show the selected div
11
- $('#SelectMenu').on('change', function() {
12
  content.hide();
13
  showDiv(this.value);
14
  });
15
 
16
  // function that shows the selected div
17
  function showDiv(divID) {
18
- $(".styled option").removeClass("selected");
19
- $(".styled option").removeAttr("style");
20
- var thisContent = $('#'+divID).find('.expandedContent')
21
- if ($(thisContent).is(':visible')) {
22
  thisContent.slideUp("slow");
23
- $('#'+divID).find('.header .expand img').attr('src', 'plus.png');
24
- $('#'+divID+' .icon').removeClass('minus');
25
- $('#'+divID+' .icon').addClass('plus');
26
  }
27
  else {
28
  content.not(thisContent).slideUp("slow", function() {
29
- $('#'+divID).parent().find('.header .expand img').attr('src', 'plus.png');
30
- $('.icon').removeClass('minus');
31
- $('.icon').addClass('plus');
32
  });
33
  thisContent.slideDown("slow", function() {
34
  // scroll to selected div
35
- $('html, body').animate({
36
- scrollTop: $("#"+divID).offset().top
37
  }, 500);
38
 
39
  // change drop down menu's selected option
40
- $('#SelectMenu').val(divID);
41
- $('#SelectMenu option[value="'+divID+'"]').addClass("selected");
42
 
43
  //change + icon to -
44
- $('#'+divID).find('.header .expand img').attr('src', 'minus.png');
45
 
46
- $('#'+divID+' .icon').removeClass('plus');
47
- $('#'+divID+' .icon').addClass('minus');
48
  });
49
  }
50
  }
51
 
52
  // on click show the selected div
53
  divs.click(function() {
54
- showDiv($(this).attr('id'));
55
  });
56
  });
1
+ var jQuery = jQuery.noConflict();
2
+ jQuery(window).load(function() {
3
 
4
+ var divs = jQuery('.expandContent'),
5
  content = divs.children('div');
6
 
7
  // hide all divs initially
8
  content.hide();
9
 
10
  // drop down menu - on change show the selected div
11
+ jQuery('#SelectMenu').on('change', function() {
12
  content.hide();
13
  showDiv(this.value);
14
  });
15
 
16
  // function that shows the selected div
17
  function showDiv(divID) {
18
+ jQuery(".styled option").removeClass("selected");
19
+ jQuery(".styled option").removeAttr("style");
20
+ var thisContent = jQuery('#'+divID).find('.expandedContent')
21
+ if (jQuery(thisContent).is(':visible')) {
22
  thisContent.slideUp("slow");
23
+ jQuery('#'+divID).find('.header .expand img').attr('src', 'plus.png');
24
+ jQuery('#'+divID+' .icon').removeClass('minus');
25
+ jQuery('#'+divID+' .icon').addClass('plus');
26
  }
27
  else {
28
  content.not(thisContent).slideUp("slow", function() {
29
+ jQuery('#'+divID).parent().find('.header .expand img').attr('src', 'plus.png');
30
+ jQuery('.icon').removeClass('minus');
31
+ jQuery('.icon').addClass('plus');
32
  });
33
  thisContent.slideDown("slow", function() {
34
  // scroll to selected div
35
+ jQuery('html, body').animate({
36
+ scrollTop: jQuery("#"+divID).offset().top
37
  }, 500);
38
 
39
  // change drop down menu's selected option
40
+ jQuery('#SelectMenu').val(divID);
41
+ jQuery('#SelectMenu option[value="'+divID+'"]').addClass("selected");
42
 
43
  //change + icon to -
44
+ jQuery('#'+divID).find('.header .expand img').attr('src', 'minus.png');
45
 
46
+ jQuery('#'+divID+' .icon').removeClass('plus');
47
+ jQuery('#'+divID+' .icon').addClass('minus');
48
  });
49
  }
50
  }
51
 
52
  // on click show the selected div
53
  divs.click(function() {
54
+ showDiv(jQuery(this).attr('id'));
55
  });
56
  });
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Avik_Faq</name>
4
- <version>1.6.0</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Faq module</summary>
10
- <description>Faq module</description>
11
- <notes>Faq module</notes>
12
  <authors><author><name>Avik Roy</name><user>avik_roy</user><email>royavik88@gmail.com</email></author></authors>
13
- <date>2016-07-12</date>
14
- <time>13:25:22</time>
15
- <contents><target name="magelocal"><dir name="Avik"><dir name="Faq"><dir name="Block"><dir name="Adminhtml"><dir name="Faq"><dir name="Edit"><file name="Form.php" hash="935632b84aff9e998913ab7c3d59c01d"/></dir><file name="Edit.php" hash="3e7ddef140e4d3d5daf6b160cd577cb2"/><file name="Grid.php" hash="f97482809c5047463781054a8498cebe"/></dir><file name="Faq.php" hash="31401332625ef3b42532ea1dcacb630f"/></dir><file name="List.php" hash="163dafe09cd209416bbfc8e8bf6dbba4"/></dir><dir name="Helper"><file name="Data.php" hash="685ea9106ef162d12f8bc00477eec9fb"/></dir><dir name="Model"><file name="Faq.php" hash="5fb92d83c52737a4cb2f3c6462e12e12"/><dir name="Mysql4"><dir name="Faq"><file name="Collection.php" hash="644c0e19163150ff025644f18db3d02e"/></dir><file name="Faq.php" hash="7795d1a42cf4641e3e0bd2af1a2688c5"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="FaqController.php" hash="77a3a4c89f012217018e4ef8f9544940"/></dir><file name="IndexController.php" hash="1c14bd4aba9ab842da165a4e49e50afb"/></dir><dir name="etc"><file name="adminhtml.xml" hash="e71edc76b19103b4ec579efda8f9d9d5"/><file name="config.xml" hash="3b712f2b12847a02c1f1c668a545290b"/><file name="system.xml" hash="77709268cacd7067f185222047cdccbb"/></dir><dir name="sql"><dir name="avik_faq_setup"><file name="install-1.6.0.0.php" hash="e1cb9f56825b3c20ef83d44337c9b529"/><file name="mysql4-install-1.0.0.0" hash="899792a6a57cbdb67815d3cbf38fd217"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="faq"><file name="minus.png" hash="3c258e2a5c3f3013068a7f6241ab4e9a"/><file name="plus.png" hash="1b6592c568e00b07864f48d5520b1f2e"/></dir></dir><dir name="css"><dir name="faq"><file name="ResponsiveAccordianMenu.css" hash="0ada45b7924a7a732f41ab6908d8b1c8"/><file name="faq.css" hash="1d473e865324764cd438fe0655115021"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="faq"><file name="ResponsiveAccordianMenu.js" hash="de5c4355e1596fe1a59fd2bf04d25815"/><file name="jquery.min.js" hash="397754ba49e9e0cf4e7c190da78dda05"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="avik_faq.xml" hash="d3794b92c7e23c2b3f7a604ede23e895"/></dir><dir name="template"><dir name="avik"><dir name="faq"><file name="list.phtml" hash="83f38bd0daef3af04079661dca83cb24"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="avik"><file name="faq.xml" hash="d80d2fdbd90538126c360536a95789f7"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Avik_Faq.xml" hash="6afa433f90e362fc0f6b204db3caac91"/></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>Avik_Faq</name>
4
+ <version>1.6.1</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Faq with Accordion</summary>
10
+ <description>Faq with Accordion</description>
11
+ <notes>We are bringing jQuery enable and disable configuration features which will help user to use jQuey min as per necessity. </notes>
12
  <authors><author><name>Avik Roy</name><user>avik_roy</user><email>royavik88@gmail.com</email></author></authors>
13
+ <date>2016-07-15</date>
14
+ <time>07:11:03</time>
15
+ <contents><target name="magelocal"><dir name="Avik"><dir name="Faq"><dir name="Block"><dir name="Adminhtml"><dir name="Faq"><dir name="Edit"><file name="Form.php" hash="e62929fecd6c67a0a058753630c5e658"/></dir><file name="Edit.php" hash="3e7ddef140e4d3d5daf6b160cd577cb2"/><file name="Grid.php" hash="f97482809c5047463781054a8498cebe"/></dir><file name="Faq.php" hash="31401332625ef3b42532ea1dcacb630f"/></dir><file name="List.php" hash="2dc9c603a9395e881c713fb0bd9b3969"/></dir><dir name="Helper"><file name="Data.php" hash="685ea9106ef162d12f8bc00477eec9fb"/></dir><dir name="Model"><file name="Faq.php" hash="5fb92d83c52737a4cb2f3c6462e12e12"/><dir name="Mysql4"><dir name="Faq"><file name="Collection.php" hash="644c0e19163150ff025644f18db3d02e"/></dir><file name="Faq.php" hash="7795d1a42cf4641e3e0bd2af1a2688c5"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="FaqController.php" hash="aacbbf6df6373850c75863605b2c0325"/></dir><file name="IndexController.php" hash="1c14bd4aba9ab842da165a4e49e50afb"/></dir><dir name="etc"><file name="adminhtml.xml" hash="e71edc76b19103b4ec579efda8f9d9d5"/><file name="config.xml" hash="3b712f2b12847a02c1f1c668a545290b"/><file name="system.xml" hash="7cb5ee2755babfe197a30b0a5ad4c807"/></dir><dir name="sql"><dir name="avik_faq_setup"><file name="install-1.6.0.0.php" hash="e1cb9f56825b3c20ef83d44337c9b529"/><file name="mysql4-install-1.0.0.0" hash="899792a6a57cbdb67815d3cbf38fd217"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="avik"><file name="faq.xml" hash="d80d2fdbd90538126c360536a95789f7"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="avik_faq.xml" hash="8bc8f9515a3160acb1270895a38060b2"/></dir><dir name="template"><dir name="avik"><dir name="faq"><file name="list.phtml" hash="1f85a01f6ee83231c4f67d106cbfe955"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="faq"><file name="ResponsiveAccordianMenu.css" hash="0ada45b7924a7a732f41ab6908d8b1c8"/><file name="faq.css" hash="1d473e865324764cd438fe0655115021"/></dir></dir><dir name="images"><dir name="faq"><file name="minus.png" hash="3c258e2a5c3f3013068a7f6241ab4e9a"/><file name="plus.png" hash="1b6592c568e00b07864f48d5520b1f2e"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Avik_Faq.xml" hash="6afa433f90e362fc0f6b204db3caac91"/></dir></target><target name="mage"><dir name="js"><dir name="faq"><file name="ResponsiveAccordianMenu.js" hash="c372cca49792505b003d7adf203f0e32"/><file name="jquery.min.js" hash="397754ba49e9e0cf4e7c190da78dda05"/></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>