├── README.md ├── app ├── code │ └── community │ │ └── TM │ │ └── EasyTabs │ │ ├── Block │ │ ├── Abstract.php │ │ ├── Adminhtml │ │ │ ├── Edit.php │ │ │ ├── Edit │ │ │ │ ├── Form.php │ │ │ │ ├── Tab │ │ │ │ │ ├── Conditions.php │ │ │ │ │ └── Main.php │ │ │ │ └── Tabs.php │ │ │ ├── List.php │ │ │ ├── List │ │ │ │ └── Grid.php │ │ │ ├── Tab │ │ │ │ └── Options.php │ │ │ └── Widget │ │ │ │ └── Chosen.php │ │ ├── Product.php │ │ ├── Tab │ │ │ ├── Attribute.php │ │ │ ├── Cms.php │ │ │ ├── Html.php │ │ │ ├── Product │ │ │ │ ├── Additional.php │ │ │ │ ├── Description.php │ │ │ │ ├── Review.php │ │ │ │ └── Tags.php │ │ │ └── Template.php │ │ └── Widget.php │ │ ├── Controller │ │ └── Adminhtml │ │ │ └── Abstract.php │ │ ├── Helper │ │ └── Data.php │ │ ├── Model │ │ ├── Config │ │ │ ├── Layout.php │ │ │ ├── Status.php │ │ │ └── Tabs.php │ │ ├── Product │ │ │ └── Attribute │ │ │ │ └── Collection.php │ │ ├── Resource │ │ │ ├── Tab.php │ │ │ └── Tab │ │ │ │ └── Collection.php │ │ ├── Rule │ │ │ └── Condition │ │ │ │ ├── Combine.php │ │ │ │ └── Customer.php │ │ ├── Tab.php │ │ ├── Tabs.php │ │ └── Template │ │ │ └── Filter.php │ │ ├── controllers │ │ └── Adminhtml │ │ │ └── Easytabs │ │ │ ├── ProductController.php │ │ │ └── WidgetController.php │ │ ├── data │ │ └── easytabs_setup │ │ │ ├── data-upgrade-2.3.8-2.4.0.php │ │ │ └── data-upgrade-3.0.0-3.0.1.php │ │ ├── etc │ │ ├── adminhtml.xml │ │ ├── config.xml │ │ ├── easytabs.xml │ │ ├── system.xml │ │ ├── tmamp.xml │ │ └── widget.xml │ │ └── sql │ │ └── easytabs_setup │ │ ├── upgrade-2.3.8-2.4.0.php │ │ └── upgrade-3.0.3-3.1.0.php ├── design │ ├── adminhtml │ │ └── default │ │ │ └── default │ │ │ └── layout │ │ │ └── tm │ │ │ └── easytabs.xml │ └── frontend │ │ ├── base │ │ └── default │ │ │ ├── layout │ │ │ └── tm │ │ │ │ └── easytabs.xml │ │ │ └── template │ │ │ └── tm │ │ │ └── easytabs │ │ │ ├── tab │ │ │ ├── catalog │ │ │ │ └── product │ │ │ │ │ ├── attribute.phtml │ │ │ │ │ └── view │ │ │ │ │ ├── attributes.phtml │ │ │ │ │ └── description.phtml │ │ │ ├── cms.phtml │ │ │ ├── review │ │ │ │ └── product │ │ │ │ │ └── view │ │ │ │ │ └── list.phtml │ │ │ └── tag │ │ │ │ └── product │ │ │ │ └── list.phtml │ │ │ └── tabs.phtml │ │ └── tmamp │ │ └── default │ │ └── template │ │ └── tm │ │ └── easytabs │ │ └── tabs.phtml ├── etc │ └── modules │ │ └── TM_EasyTabs.xml └── locale │ ├── el_GR │ └── TM_EasyTabs.csv │ ├── en_US │ └── TM_EasyTabs.csv │ ├── es_ES │ └── TM_EasyTabs.csv │ ├── fr_FR │ └── TM_EasyTabs.csv │ ├── it_IT │ └── TM_EasyTabs.csv │ ├── nl_NL │ └── TM_EasyTabs.csv │ └── pt_PT │ └── TM_EasyTabs.csv ├── composer.json ├── modman └── skin ├── adminhtml └── default │ └── default │ └── images │ └── widget │ ├── easytabs__widget.gif │ ├── easytabs__widget_2.gif │ └── easytabs__widget_transparent.png └── frontend └── base └── default └── tm └── easytabs ├── css ├── styles.css └── tmamp.scss └── js ├── main.js ├── product.js └── prototype.sticky-kit.js /README.md: -------------------------------------------------------------------------------- 1 | # Easy Tabs 2 | Easy Tabs 3.0 - Magento Tabs extension for product page and any other page. 3 | 4 | - show unlimited number of tabs on product page 5 | - create your custom tabs and place them anywhere you want 6 | - widget for Magento CMS 7 | - responsive design, works fine on mobile devices 8 | - unset blocks display in tab to avoid content duplication 9 | - use custom templates for tab content 10 | - show other extensions content in tab using Custom Block tab 11 | - show number of reviews, tags, questions, etc by calling eval code in tab title 12 | 13 | More details about Easy Tabs you can find at [documentation page](http://docs.swissuplabs.com/m1/extensions/easytabs/). 14 | Including configuration description and use cases. 15 | -------------------------------------------------------------------------------- /app/code/community/TM/EasyTabs/Block/Abstract.php: -------------------------------------------------------------------------------- 1 | getCollection(); 15 | $storeId = Mage::app()->getStore()->getStoreId(); 16 | return $collection 17 | ->addStoreFilter($storeId) 18 | ->addFieldToFilter('status', array('eq' => 1)) 19 | ->setOrder('sort_order', Varien_Data_Collection::SORT_ORDER_ASC); 20 | } 21 | 22 | protected function _prepareLayout() 23 | { 24 | if (!Mage::getStoreConfig('tm_easytabs/general/enabled')) { 25 | return parent::_prepareLayout(); 26 | } 27 | 28 | $collection = $this->_getCollection(); 29 | 30 | $filterTabs = $this->getFilterTabs(); 31 | if (!empty($filterTabs)) { 32 | $filterTabs = str_replace(' ', '', $filterTabs); 33 | $filterTabs = explode(',', $filterTabs); 34 | $collection->addFieldToFilter('alias', array('in' => $filterTabs)); 35 | } 36 | 37 | foreach ($collection as $tab) { 38 | 39 | if (!$tab->getConditions()->validate($this->getObjectToValidate())) 40 | continue; 41 | 42 | $this->addTab( 43 | $tab->getAlias(), 44 | $tab->getTitle(), 45 | $tab->getBlock(), 46 | $tab->getTemplate(), 47 | $tab->getData() 48 | ); 49 | 50 | $unsets = (string) $tab->getUnset(); 51 | $unsets = explode(',', $unsets); 52 | foreach ($unsets as $unset) { 53 | if (false === strpos($unset, '::')) { 54 | continue; 55 | } 56 | list($blockName, $alias) = explode('::', $unset); 57 | $block = $this->getLayout()->getBlock($blockName); 58 | if ($block) { 59 | /** 60 | * @see http://www.magentocommerce.com/bug-tracking/issue/index/id/142 61 | * Call sortChildren before unset to fix Magento bug in 62 | * Mage_Core_Block_Abstract::sortChildren: 63 | * 1. Unset drop the key from the _sortedChildren array 64 | * 2. sortChildren method finds the block index to remove 65 | * 3. sortChildren method uses array_splice wich reorder array 66 | * and previously founded block index become incorrect. 67 | * 68 | * The fix is works because sort is called only once. 69 | * The correct way is to add the following line to 70 | * Mage_Core_Block_Abstract::unsetChild after 71 | * `unset($this->_sortedChildren[$key]);`: 72 | * 73 | * $this->_sortedChildren = array_values($this->_sortedChildren); 74 | */ 75 | $block->sortChildren(); 76 | $block->unsetChild($alias); 77 | } 78 | } 79 | } 80 | return parent::_prepareLayout(); 81 | } 82 | 83 | /** 84 | * @param string $title 85 | * @param string $block 86 | * @param string $template 87 | * @param array $attributes 88 | */ 89 | public function addTab($alias, $title, $block = false, $template = false, $attributes = array()) 90 | { 91 | if (!$title || ($block && $block !== 'easytabs/tab_html' && !$template)) { 92 | return false; 93 | } 94 | 95 | if (!$block) { 96 | $block = $this->getLayout()->getBlock($alias); 97 | if (!$block) { 98 | return false; 99 | } 100 | } else { 101 | // if (!Mage::registry('product') && strstr($block, 'product')) { 102 | // return false; 103 | // } 104 | 105 | $block = $this->getLayout() 106 | ->createBlock($block, $alias, $attributes) 107 | ->setTemplate($template); 108 | } 109 | 110 | $tab = array( 111 | 'alias' => $alias, 112 | 'title' => $title 113 | ); 114 | 115 | if (isset($attributes['sort_order'])) { 116 | $tab['sort_order'] = $attributes['sort_order']; 117 | } 118 | 119 | $this->_tabs[] = $tab; 120 | 121 | $this->setChild($alias, $block); 122 | } 123 | 124 | protected function _sort($tab1, $tab2) 125 | { 126 | if (!isset($tab2['sort_order'])) { 127 | return -1; 128 | } 129 | 130 | if (!isset($tab1['sort_order'])) { 131 | return 1; 132 | } 133 | 134 | if ($tab1['sort_order'] == $tab2['sort_order']) { 135 | return 0; 136 | } 137 | return ($tab1['sort_order'] < $tab2['sort_order']) ? -1 : 1; 138 | } 139 | 140 | public function getTabs() 141 | { 142 | usort($this->_tabs, array($this, '_sort')); 143 | return $this->_tabs; 144 | } 145 | 146 | /** 147 | * Check tab content for anything except html tags and spaces 148 | * 149 | * @param string $content 150 | * @return boolean 151 | */ 152 | public function isEmptyString($content) 153 | { 154 | $content = strip_tags( 155 | $content, 156 | '