Version Notes
First stable release of Mash Category Read more.
Download this release
Release Info
Developer | Adam Collins |
Extension | Mash_Read_More |
Version | 0.0.1 |
Comparing to | |
See all releases |
Version 0.0.1
- app/code/community/Mash/ReadMore/.DS_Store +0 -0
- app/code/community/Mash/ReadMore/Helper/.DS_Store +0 -0
- app/code/community/Mash/ReadMore/Helper/Data.php +4 -0
- app/code/community/Mash/ReadMore/Helper/_notes/dwsync.xml +1 -0
- app/code/community/Mash/ReadMore/etc/.DS_Store +0 -0
- app/code/community/Mash/ReadMore/etc/_notes/dwsync.xml +1 -0
- app/code/community/Mash/ReadMore/etc/config.xml +83 -0
- app/code/community/Mash/ReadMore/etc/system.xml +41 -0
- app/code/community/Mash/ReadMore/model/.DS_Store +0 -0
- app/code/community/Mash/ReadMore/model/Mash_ReadMore_Model_Category.php +11 -0
- app/code/community/Mash/ReadMore/model/_notes/dwsync.xml +1 -0
- app/code/community/Mash/ReadMore/sql/.DS_Store +0 -0
- app/code/community/Mash/ReadMore/sql/readmore_attr_setup/.DS_Store +0 -0
- app/code/community/Mash/ReadMore/sql/readmore_attr_setup/_notes/dwsync.xml +1 -0
- app/code/community/Mash/ReadMore/sql/readmore_attr_setup/mysql4-install-0.0.1.php +23 -0
- app/design/frontend/base/default/layout/readmore.xml +13 -0
- app/design/frontend/base/default/template/readmore/readmorejs.phtml +51 -0
- app/etc/modules/Mash_ReadMore.xml +10 -0
- package.xml +18 -0
- skin/frontend/base/default/js/readmore.js +67 -0
app/code/community/Mash/ReadMore/.DS_Store
ADDED
Binary file
|
app/code/community/Mash/ReadMore/Helper/.DS_Store
ADDED
Binary file
|
app/code/community/Mash/ReadMore/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mash_ReadMore_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
}
|
app/code/community/Mash/ReadMore/Helper/_notes/dwsync.xml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
app/code/community/Mash/ReadMore/etc/.DS_Store
ADDED
Binary file
|
app/code/community/Mash/ReadMore/etc/_notes/dwsync.xml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
app/code/community/Mash/ReadMore/etc/config.xml
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Mash_ReadMore>
|
5 |
+
<version>0.0.4</version>
|
6 |
+
</Mash_ReadMore>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<helpers>
|
10 |
+
<readmore>
|
11 |
+
<class>Mash_ReadMore_Helper</class>
|
12 |
+
</readmore>
|
13 |
+
</helpers>
|
14 |
+
<models>
|
15 |
+
<!-- ... -->
|
16 |
+
<readmore>
|
17 |
+
<class>Mash_ReadMore_Model</class>
|
18 |
+
</readmore>
|
19 |
+
|
20 |
+
<!-- ... -->
|
21 |
+
</models>
|
22 |
+
<resources>
|
23 |
+
<readmore_attr_setup>
|
24 |
+
<setup>
|
25 |
+
<module>Mash_ReadMore</module>
|
26 |
+
<class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
|
27 |
+
</setup>
|
28 |
+
<connection>
|
29 |
+
<use>core_setup</use>
|
30 |
+
</connection>
|
31 |
+
</readmore_attr_setup>
|
32 |
+
<readmore_attr_setup_write>
|
33 |
+
<connection>
|
34 |
+
<use>core_write</use>
|
35 |
+
</connection>
|
36 |
+
</readmore_attr_setup_write>
|
37 |
+
<readmore_attr_setup_read>
|
38 |
+
<connection>
|
39 |
+
<use>core_read</use>
|
40 |
+
</connection>
|
41 |
+
</readmore_attr_setup_read>
|
42 |
+
</resources>
|
43 |
+
</global>
|
44 |
+
|
45 |
+
<frontend>
|
46 |
+
<layout>
|
47 |
+
<updates>
|
48 |
+
<readmore>
|
49 |
+
<file>readmore.xml</file>
|
50 |
+
</readmore>
|
51 |
+
</updates>
|
52 |
+
</layout>
|
53 |
+
</frontend>
|
54 |
+
<adminhtml>
|
55 |
+
<acl>
|
56 |
+
<resources>
|
57 |
+
<admin>
|
58 |
+
<children>
|
59 |
+
<system>
|
60 |
+
<children>
|
61 |
+
<config>
|
62 |
+
<children>
|
63 |
+
<readmoreconfig_options>
|
64 |
+
<title>Read More Settings</title>
|
65 |
+
</readmoreconfig_options>
|
66 |
+
</children>
|
67 |
+
</config>
|
68 |
+
</children>
|
69 |
+
</system>
|
70 |
+
</children>
|
71 |
+
</admin>
|
72 |
+
</resources>
|
73 |
+
</acl>
|
74 |
+
</adminhtml>
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
</config>
|
81 |
+
|
82 |
+
|
83 |
+
|
app/code/community/Mash/ReadMore/etc/system.xml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<readmoreconfig translate="label" module="readmore">
|
5 |
+
<label>Mash Read More</label>
|
6 |
+
<sort_order>99999</sort_order>
|
7 |
+
</readmoreconfig>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<readmoreconfig_options translate="label" module="readmore">
|
11 |
+
<label>Settings</label>
|
12 |
+
<tab>readmoreconfig</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>1000</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<read_more_settings translate="label">
|
20 |
+
<label>Read More Config Settings</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>1</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<readmore_show_paragraphs>
|
28 |
+
<label>Show Paragraphs</label>
|
29 |
+
<frontend_type>text</frontend_type>
|
30 |
+
<sort_order>1</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
</readmore_show_paragraphs>
|
35 |
+
|
36 |
+
</fields>
|
37 |
+
</read_more_settings>
|
38 |
+
</groups>
|
39 |
+
</readmoreconfig_options>
|
40 |
+
</sections>
|
41 |
+
</config>
|
app/code/community/Mash/ReadMore/model/.DS_Store
ADDED
Binary file
|
app/code/community/Mash/ReadMore/model/Mash_ReadMore_Model_Category.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mash_ReadMore_Model_Category extends Mage_Catalog_Model_Category{
|
4 |
+
|
5 |
+
public function getReadAttr(){
|
6 |
+
|
7 |
+
return $this->getReadmoreAttribute();
|
8 |
+
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
app/code/community/Mash/ReadMore/model/_notes/dwsync.xml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
app/code/community/Mash/ReadMore/sql/.DS_Store
ADDED
Binary file
|
app/code/community/Mash/ReadMore/sql/readmore_attr_setup/.DS_Store
ADDED
Binary file
|
app/code/community/Mash/ReadMore/sql/readmore_attr_setup/_notes/dwsync.xml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
app/code/community/Mash/ReadMore/sql/readmore_attr_setup/mysql4-install-0.0.1.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$this->startSetup();
|
3 |
+
$this->addAttribute('catalog_category', 'readmore_attribute', array(
|
4 |
+
'group' => 'General Information',
|
5 |
+
'input' => 'select',
|
6 |
+
'type' => 'int',
|
7 |
+
'label' => 'Disable Auto Readmore ',
|
8 |
+
'backend' => '',
|
9 |
+
'visible' => true,
|
10 |
+
'required' => false,
|
11 |
+
'user_defined' => false,
|
12 |
+
'default' => '0',
|
13 |
+
'searchable' => false,
|
14 |
+
'filterable' => false,
|
15 |
+
'comparable' => false,
|
16 |
+
'visible_on_front' => false,
|
17 |
+
'source' => 'eav/entity_attribute_source_boolean',
|
18 |
+
'unique' => false,
|
19 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL
|
20 |
+
));
|
21 |
+
|
22 |
+
$this->endSetup();
|
23 |
+
|
app/design/frontend/base/default/layout/readmore.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<block type="core/template" name="readmore" template="readmore/readmorejs.phtml" />
|
6 |
+
<action method="addItem">
|
7 |
+
<type>skin_js</type>
|
8 |
+
<name>js/readmore.js</name>
|
9 |
+
<params/>
|
10 |
+
</action>
|
11 |
+
</reference>
|
12 |
+
</default>
|
13 |
+
</layout>
|
app/design/frontend/base/default/template/readmore/readmorejs.phtml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
?>
|
26 |
+
<?php // if (Mage::getStoreConfig('readmoreconfig_options/read_more_settings/readmore_show_paragraphs')) : ?>
|
27 |
+
<?php
|
28 |
+
$jqueryenabled = Mage::getStoreConfig('readmoreconfig_options/read_more_settings/readmore_enabled');
|
29 |
+
if($jqueryenabled):
|
30 |
+
?>
|
31 |
+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
32 |
+
<?php endif;
|
33 |
+
?>
|
34 |
+
<script type="text/javascript">
|
35 |
+
jQuery( window ).load(function(){
|
36 |
+
var readmore_number = <?php echo Mage::getStoreConfig('readmoreconfig_options/read_more_settings/readmore_show_paragraphs') ?>;
|
37 |
+
var active_read_more = <?php if (Mage::registry('current_category')){
|
38 |
+
$readmore_active = Mage::registry('current_category')->getReadmoreAttribute();
|
39 |
+
if(empty($readmore_active)){
|
40 |
+
echo '0';
|
41 |
+
}else{
|
42 |
+
echo Mage::registry('current_category')->getReadmoreAttribute();
|
43 |
+
}
|
44 |
+
}?>;
|
45 |
+
if(active_read_more == 0 ){
|
46 |
+
readmorep(readmore_number);
|
47 |
+
}
|
48 |
+
});
|
49 |
+
</script>
|
50 |
+
|
51 |
+
<?php // endif ?>
|
app/etc/modules/Mash_ReadMore.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Mash_ReadMore>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<version>2.0</version>
|
8 |
+
</Mash_ReadMore>
|
9 |
+
</modules>
|
10 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Mash_Read_More</name>
|
4 |
+
<version>0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>Open Software License (OSL) </license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Easily add dynamic read more functionality to your category descriptions.</summary>
|
10 |
+
<description>Mash Category Read More allows you to easily add fool proof read more functionality to your website without having to touch a line of code. Great for non technical customers.</description>
|
11 |
+
<notes>First stable release of Mash Category Read more.</notes>
|
12 |
+
<authors><author><name>Adam Collins</name><user>mash_web_design</user><email>info@mash-webdesign.co.uk</email></author></authors>
|
13 |
+
<date>2014-06-30</date>
|
14 |
+
<time>17:40:11</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Mash"><dir name="ReadMore"><dir name="Helper"><file name="Data.php" hash="73b4751f2117ddd2bba1c66d549a9374"/><dir name="_notes"><file name="dwsync.xml" hash="f7e51457a4a77213c03c907a36fc2c1e"/></dir><file name=".DS_Store" hash="b32c25a917b2cc0cb607ee96f6569235"/></dir><dir name="etc"><dir name="_notes"><file name="dwsync.xml" hash="79812def939b4eff9ecf12a43603cb94"/></dir><file name="config.xml" hash="6b8fdcad02c16226c828bd7c87f89b86"/><file name="system.xml" hash="2d0ee87dec64f6fd389b32bbda442f8e"/><file name=".DS_Store" hash="e619a4275ee17cc8ab69faeed2185b4c"/></dir><dir name="model"><file name="Mash_ReadMore_Model_Category.php" hash="45b72b38af51a2045aaa5fc1c5564a2c"/><dir name="_notes"><file name="dwsync.xml" hash="e798a2955cf74bfddb1eb33e114c439e"/></dir><file name=".DS_Store" hash="43f3f31ec4e288153b6bc0539aabe5af"/></dir><dir name="sql"><dir name="readmore_attr_setup"><dir name="_notes"><file name="dwsync.xml" hash="77e233b24f98a120e9ec72ee2477322b"/></dir><file name="mysql4-install-0.0.1.php" hash="b892a94eedf8c08c10f4ff3338a9cd87"/><file name=".DS_Store" hash="f89a09ec9528588833d7656468f935b3"/></dir><file name=".DS_Store" hash="b75d65a1c29432dc8fb7f1442ad3ecd4"/></dir><file name=".DS_Store" hash="0f2c78dbdfacd9a9068c36cc70040c42"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="readmore.xml" hash="138b56632e6b6c87892d8288518749a8"/></dir><dir name="template"><dir name="readmore"><file name="readmorejs.phtml" hash="eca4ac9d4cb81b9bf221c7ba2c226081"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mash_ReadMore.xml" hash="a4559c6ecfc527ab7e7208f37a2aa242"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="js"><file name="readmore.js" hash="37bc5959132904e9c654318b5df8a904"/></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/js/readmore.js
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
function getOuterHTML(object) {
|
3 |
+
var element;
|
4 |
+
if (!object) return null;
|
5 |
+
element = document.createElement("div");
|
6 |
+
element.appendChild(object.cloneNode(true));
|
7 |
+
return element.innerHTML;
|
8 |
+
}
|
9 |
+
function readmorep(pnumber){
|
10 |
+
var pCount = 1;
|
11 |
+
var numOfP = jQuery('.category-description > p, .short-description .std p').length;
|
12 |
+
var testArray = [];
|
13 |
+
if(pnumber < numOfP){
|
14 |
+
jQuery('.category-description, .short-description .std').children().each(function(){
|
15 |
+
if(pCount==pnumber)
|
16 |
+
{ if(jQuery(this).is('h2,h3,h4,h5,h6,ul,ol,table,td,tr')){
|
17 |
+
return true;
|
18 |
+
}
|
19 |
+
var hiddenDiv = jQuery(this).after('<div class="hiddencontent" />');
|
20 |
+
}
|
21 |
+
if(pCount>pnumber)
|
22 |
+
{
|
23 |
+
testArray.push(getOuterHTML(jQuery(this)[0]));
|
24 |
+
|
25 |
+
jQuery(this).remove();
|
26 |
+
|
27 |
+
}
|
28 |
+
if(jQuery(this).is('h2,h3,h4,h5,h6,ul,ol,table,td,tr')){
|
29 |
+
return true;
|
30 |
+
}
|
31 |
+
pCount++;
|
32 |
+
|
33 |
+
|
34 |
+
});
|
35 |
+
}
|
36 |
+
|
37 |
+
testArray = testArray.join('');
|
38 |
+
jQuery('.hiddencontent').append('<p>').html(testArray);
|
39 |
+
|
40 |
+
|
41 |
+
jQuery('.hiddencontent').css('display', 'none').after('<a href="javascript:void(0);" title="readmore" class="contentreadmore">Read More</a>');
|
42 |
+
|
43 |
+
jQuery('.contentreadmore').click(function(){
|
44 |
+
|
45 |
+
jQuery(this).prev().toggleClass('selecteddiv').slideToggle();
|
46 |
+
|
47 |
+
var button = jQuery('.contentreadmore').text();
|
48 |
+
|
49 |
+
if(button == 'Read More'){
|
50 |
+
|
51 |
+
jQuery(this).text('Read Less');
|
52 |
+
|
53 |
+
}
|
54 |
+
if(button == 'Read Less'){
|
55 |
+
|
56 |
+
|
57 |
+
jQuery(this).text('Read More');
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
});
|
65 |
+
}
|
66 |
+
|
67 |
+
|