Version Notes
Getting ready for the new FishPig SEO extension and adding support for the layered navigation features.
Download this release
Release Info
Developer | fishpig |
Extension | Fishpigs_Attribute_Splash_Page |
Version | 3.3.7.3 |
Comparing to | |
See all releases |
Version 3.3.7.3
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Dashboard.php +63 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Extend.php +12 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Form/Field/Urlkey.php +64 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group.php +21 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit.php +77 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Form.php +27 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Tab/Abstract.php +41 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Tab/Content.php +60 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Tab/Design.php +55 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Tab/General.php +100 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Tab/Meta.php +50 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Tab/Seo.php +55 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Tabs.php +38 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Grid.php +207 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page.php +21 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit.php +71 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Form.php +27 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Js.php +101 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tab/Abstract.php +41 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tab/Attributes.php +78 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tab/Content.php +60 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tab/Design.php +74 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tab/General.php +102 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tab/Images.php +53 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tab/Meta.php +50 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tabs.php +52 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Grid.php +218 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Helper/Image.php +24 -0
- app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Xmlsitemap.php +17 -0
- app/code/community/Fishpig/AttributeSplash/Block/Group/View.php +113 -0
- app/code/community/Fishpig/AttributeSplash/Block/Layer/View.php +38 -0
- app/code/community/Fishpig/AttributeSplash/Block/Page/View.php +132 -0
- app/code/community/Fishpig/AttributeSplash/Block/Page/View/Product/List.php +40 -0
- app/code/community/Fishpig/AttributeSplash/Controller/Router.php +202 -0
- app/code/community/Fishpig/AttributeSplash/FPAdmin/Block/Adminhtml/Extend.php +458 -0
- app/code/community/Fishpig/AttributeSplash/FPAdmin/etc/config.xml +114 -0
- app/code/community/Fishpig/AttributeSplash/FPAdmin/template/large.phtml +41 -0
- app/code/community/Fishpig/AttributeSplash/FPAdmin/template/small.phtml +39 -0
- app/code/community/Fishpig/AttributeSplash/Helper/Data.php +77 -0
- app/code/community/Fishpig/AttributeSplash/Helper/Image.php +354 -0
- app/code/community/Fishpig/AttributeSplash/Model/Abstract.php +225 -0
- app/code/community/Fishpig/AttributeSplash/Model/Group.php +133 -0
- app/code/community/Fishpig/AttributeSplash/Model/Indexer.php +62 -0
- app/code/community/Fishpig/AttributeSplash/Model/Layer.php +110 -0
- app/code/community/Fishpig/AttributeSplash/Model/Observer.php +169 -0
- app/code/community/Fishpig/AttributeSplash/Model/Page.php +142 -0
- app/code/community/Fishpig/AttributeSplash/Model/Resource/Abstract.php +252 -0
- app/code/community/Fishpig/AttributeSplash/Model/Resource/Collection/Abstract.php +129 -0
- app/code/community/Fishpig/AttributeSplash/Model/Resource/Group.php +122 -0
- app/code/community/Fishpig/AttributeSplash/Model/Resource/Group/Collection.php +51 -0
- app/code/community/Fishpig/AttributeSplash/Model/Resource/Page.php +320 -0
- app/code/community/Fishpig/AttributeSplash/Model/Resource/Page/Collection.php +111 -0
- app/code/community/Fishpig/AttributeSplash/Model/System/Config/Source/Attribute/Abstract.php +103 -0
- app/code/community/Fishpig/AttributeSplash/Model/System/Config/Source/Attribute/Splashable.php +31 -0
- app/code/community/Fishpig/AttributeSplash/Model/System/Config/Source/Attribute/Splashed.php +30 -0
- app/code/community/Fishpig/AttributeSplash/Model/System/Config/Source/Layout.php +22 -0
- app/code/community/Fishpig/AttributeSplash/controllers/Adminhtml/AttributeSplash/GroupController.php +128 -0
- app/code/community/Fishpig/AttributeSplash/controllers/Adminhtml/AttributeSplash/PageController.php +216 -0
- app/code/community/Fishpig/AttributeSplash/controllers/Adminhtml/AttributeSplashController.php +107 -0
- app/code/community/Fishpig/AttributeSplash/controllers/GroupController.php +107 -0
- app/code/community/Fishpig/AttributeSplash/controllers/PageController.php +132 -0
- app/code/community/Fishpig/AttributeSplash/controllers/SitemapController.php +37 -0
- app/code/community/Fishpig/AttributeSplash/etc/adminhtml.xml +46 -0
- app/code/community/Fishpig/AttributeSplash/etc/config.xml +159 -0
- app/code/community/Fishpig/AttributeSplash/etc/system.xml +120 -0
- app/code/community/Fishpig/AttributeSplash/license.txt +31 -0
- app/code/community/Fishpig/AttributeSplash/notes.txt +144 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-1.9.16-1.9.17.php +42 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-1.9.5-1.9.6.php +71 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-2.0.1-2.0.2.php +14 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-2.0.12-2.0.13.php +13 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-2.0.5-2.0.6.php +14 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-2.0.6-2.0.7.php +14 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-2.0.8-2.0.9.php +18 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-2.0.9-2.0.10.php +21 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-2.2.0.5-2.2.0.6.php +14 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-2.2.0.7-2.2.0.8.php +35 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-2.2.0.8-2.2.0.9.php +58 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-2.2.1.0-2.2.1.1.php +34 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-2.2.1.1-2.2.1.2.php +14 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-3.0.1.10-3.0.1.11.php +20 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-3.0.1.9-3.0.1.10.php +39 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-3.0.4.0-3.0.5.0.php +14 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-3.1.1.0-3.1.2.0.php +37 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-3.3.3.0-3.3.4.0.php +18 -0
- app/code/community/Fishpig/AttributeSplash/sql/attributeSplash_setup/mysql4-upgrade-3.3.6.2-3.3.6.3.php +13 -0
- app/design/adminhtml/default/default/layout/attribute-splash.xml +76 -0
- app/design/frontend/base/default/layout/attribute-splash.xml +44 -0
- app/design/frontend/base/default/template/attribute-splash/group/view.phtml +52 -0
- app/design/frontend/base/default/template/attribute-splash/page/view.phtml +39 -0
- app/etc/modules/Fishpig_AttributeSplash.xml +13 -0
- package.xml +18 -0
- skin/frontend/base/default/css/attribute-splash.css +70 -0
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Dashboard.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Dashboard extends Mage_Adminhtml_Block_Widget_Tabs
|
10 |
+
{
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
|
15 |
+
$this->setId('splash_dashboard_tabs');
|
16 |
+
$this->setDestElementId('splash_tab_content');
|
17 |
+
$this->setTitle($this->__('Attribute Splash Pages'));
|
18 |
+
$this->setTemplate('widget/tabshoriz.phtml');
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareLayout()
|
22 |
+
{
|
23 |
+
$tabs = array(
|
24 |
+
'group' => 'Groups',
|
25 |
+
'page' => 'Pages',
|
26 |
+
);
|
27 |
+
|
28 |
+
$_layout = $this->getLayout();
|
29 |
+
|
30 |
+
foreach($tabs as $alias => $label) {
|
31 |
+
$this->addTab($alias, array(
|
32 |
+
'label' => Mage::helper('catalog')->__($label),
|
33 |
+
'content' => $_layout->createBlock('attributeSplash/adminhtml_' . $alias)->toHtml(),
|
34 |
+
'active' => $alias === 'page',
|
35 |
+
));
|
36 |
+
}
|
37 |
+
|
38 |
+
Mage::dispatchEvent('attributesplash_dashboard_tabs_prepare_layout', array('tabs' => $this));
|
39 |
+
|
40 |
+
if (!isset($this->_tabs['xmlsitemap'])) {
|
41 |
+
$this->addTab('xmlsitemap', array(
|
42 |
+
'label' => Mage::helper('catalog')->__('XML Sitemap'),
|
43 |
+
'content' => $_layout->createBlock('attributeSplash/adminhtml_extend')
|
44 |
+
->setTemplate('large.phtml')
|
45 |
+
->setModule('Fishpig_AttributeSplash')
|
46 |
+
->setMedium('XML Sitemap Tab')
|
47 |
+
->setLimit(1)
|
48 |
+
->setPreferred(array('Fishpig_AttributeSplash_Addon_XmlSitemap'))
|
49 |
+
->toHtml(),
|
50 |
+
));
|
51 |
+
}
|
52 |
+
|
53 |
+
if ($extend = $_layout->createBlock('attributeSplash/adminhtml_extend')) {
|
54 |
+
$extend->setNameInLayout('fishpig.extend')
|
55 |
+
->setTabLabel($this->__('Add-Ons'))
|
56 |
+
->setTabUrl('*/*/extend');
|
57 |
+
|
58 |
+
$this->addTab('extend', $extend);
|
59 |
+
}
|
60 |
+
|
61 |
+
return parent::_prepareLayout();
|
62 |
+
}
|
63 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Extend.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Include the FPAdmin Extend Block class
|
10 |
+
require_once(Mage::getModuleDir('', 'Fishpig_AttributeSplash') . DS . implode(DS, array('FPAdmin', 'Block', 'Adminhtml', 'Extend.php')));
|
11 |
+
|
12 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Extend extends Fishpig_FPAdmin_Block_Adminhtml_Extend {}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Form/Field/Urlkey.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Form_Field_Urlkey extends Mage_Adminhtml_Block_System_Config_Form_Field
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Retrieve the HTML for the element
|
13 |
+
*
|
14 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
18 |
+
{
|
19 |
+
if ($type = $this->getSplashType()) {
|
20 |
+
if (($object = Mage::registry('splash_' . $type)) !== null) {
|
21 |
+
$this->setSplashBaseUrl($object->getUrlBase());
|
22 |
+
$this->setUrlSuffix($object->getUrlSuffix());
|
23 |
+
|
24 |
+
return parent::_getElementHtml($element)
|
25 |
+
. $this->_getRouteJs($element);
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
return parent::_getElementHtml($element);
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Retrieve the JS to display the route
|
34 |
+
*
|
35 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
36 |
+
* @return string
|
37 |
+
*/
|
38 |
+
protected function _getRouteJs($element)
|
39 |
+
{
|
40 |
+
return sprintf("
|
41 |
+
<script type=\"text/javascript\">
|
42 |
+
(function() {
|
43 |
+
var inp = $('%s');
|
44 |
+
var SPLASH_BASE_URL = '%s';
|
45 |
+
var URL_SUFFIX = '%s';
|
46 |
+
|
47 |
+
inp.insert({'after': new Element('p', {'class': 'note', 'id': inp.id + '-note'})});
|
48 |
+
|
49 |
+
var nt = $(inp.id + '-note');
|
50 |
+
|
51 |
+
inp.observe('blur', function(event) {
|
52 |
+
inp.setValue(inp.getValue().toLowerCase().replace(/([^a-z0-9\-\/]{1,})/, ''));
|
53 |
+
nt.innerHTML = SPLASH_BASE_URL + inp.getValue() + URL_SUFFIX;
|
54 |
+
});
|
55 |
+
|
56 |
+
setTimeout(function() {
|
57 |
+
inp.focus();
|
58 |
+
inp.blur();
|
59 |
+
}.bind(this), 1000);
|
60 |
+
})();
|
61 |
+
</script>
|
62 |
+
", $element->getHtmlId(), $this->getSplashBaseUrl(), $this->getUrlSuffix());
|
63 |
+
}
|
64 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Group extends Mage_Adminhtml_Block_Widget_Grid_Container
|
10 |
+
{
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
|
15 |
+
$this->_controller = 'adminhtml_group';
|
16 |
+
$this->_blockGroup = 'attributeSplash';
|
17 |
+
$this->_headerText = 'Splash: ' . $this->__('Groups');
|
18 |
+
|
19 |
+
$this->_removeButton('add');
|
20 |
+
}
|
21 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Group_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
10 |
+
{
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
|
15 |
+
$this->_controller = 'adminhtml_group';
|
16 |
+
$this->_blockGroup = 'attributeSplash';
|
17 |
+
$this->_headerText = $this->_getHeaderText();
|
18 |
+
|
19 |
+
$this->_addButton('save_and_edit_button', array(
|
20 |
+
'label' => Mage::helper('catalog')->__('Save and Continue Edit'),
|
21 |
+
'onclick' => 'editForm.submit(\''.$this->getSaveAndContinueUrl().'\')',
|
22 |
+
'class' => 'save'
|
23 |
+
));
|
24 |
+
|
25 |
+
if ($group = Mage::registry('splash_group')) {
|
26 |
+
if ($group->getId() && $group->canDelete()) {
|
27 |
+
# $this->_removeButton('delete');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Retrieve the URL used for the save and continue link
|
34 |
+
* This is the same URL with the back parameter added
|
35 |
+
*
|
36 |
+
* @return string
|
37 |
+
*/
|
38 |
+
public function getSaveAndContinueUrl()
|
39 |
+
{
|
40 |
+
return $this->getUrl('*/*/save', array(
|
41 |
+
'_current' => true,
|
42 |
+
'back' => 'edit',
|
43 |
+
));
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Enable WYSIWYG editor
|
48 |
+
*
|
49 |
+
*/
|
50 |
+
protected function _prepareLayout()
|
51 |
+
{
|
52 |
+
parent::_prepareLayout();
|
53 |
+
|
54 |
+
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
|
55 |
+
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
|
56 |
+
}
|
57 |
+
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Retrieve the header text
|
63 |
+
* If splash group exists, use name
|
64 |
+
*
|
65 |
+
* @return string
|
66 |
+
*/
|
67 |
+
protected function _getHeaderText()
|
68 |
+
{
|
69 |
+
if ($group = Mage::registry('splash_group')) {
|
70 |
+
if ($displayName = $group->getDisplayName()) {
|
71 |
+
return $displayName;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
return $this->__('Edit Attribute Splash Group');
|
76 |
+
}
|
77 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Form.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Group_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
10 |
+
{
|
11 |
+
protected function _prepareForm()
|
12 |
+
{
|
13 |
+
$form = new Varien_Data_Form(
|
14 |
+
array(
|
15 |
+
'id' => 'edit_form',
|
16 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
17 |
+
'method' => 'post',
|
18 |
+
'enctype' => 'multipart/form-data'
|
19 |
+
)
|
20 |
+
);
|
21 |
+
|
22 |
+
$form->setUseContainer(true);
|
23 |
+
$this->setForm($form);
|
24 |
+
|
25 |
+
return parent::_prepareForm();
|
26 |
+
}
|
27 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Tab/Abstract.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
abstract class Fishpig_AttributeSplash_Block_Adminhtml_Group_Edit_Tab_Abstract extends Mage_Adminhtml_Block_Widget_Form
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Generate the form object
|
13 |
+
*
|
14 |
+
* @return $this
|
15 |
+
*/
|
16 |
+
protected function _prepareForm()
|
17 |
+
{
|
18 |
+
$form = new Varien_Data_Form();
|
19 |
+
|
20 |
+
$form->setHtmlIdPrefix('splash_');
|
21 |
+
$form->setFieldNameSuffix('splash');
|
22 |
+
|
23 |
+
$this->setForm($form);
|
24 |
+
|
25 |
+
return parent::_prepareForm();
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Retrieve the data used for the form
|
30 |
+
*
|
31 |
+
* @return array
|
32 |
+
*/
|
33 |
+
protected function _getFormData()
|
34 |
+
{
|
35 |
+
if ($page = Mage::registry('splash_group')) {
|
36 |
+
return $page->getData();
|
37 |
+
}
|
38 |
+
|
39 |
+
return array('is_enabled' => 1, 'store_id' => array(0));
|
40 |
+
}
|
41 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Tab/Content.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Group_Edit_Tab_Content extends Fishpig_AttributeSplash_Block_Adminhtml_Group_Edit_Tab_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Prepare the form
|
13 |
+
*
|
14 |
+
* @return $this
|
15 |
+
*/
|
16 |
+
protected function _prepareForm()
|
17 |
+
{
|
18 |
+
parent::_prepareForm();
|
19 |
+
|
20 |
+
$fieldset = $this->getForm()->addFieldset('splash_group_content', array(
|
21 |
+
'legend'=> $this->helper('adminhtml')->__('Content'),
|
22 |
+
'class' => 'fieldset-wide',
|
23 |
+
));
|
24 |
+
|
25 |
+
$htmlConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array(
|
26 |
+
'add_widgets' => true,
|
27 |
+
'add_variables' => true,
|
28 |
+
'add_image' => true,
|
29 |
+
'files_browser_window_url' => $this->getUrl('adminhtml/cms_wysiwyg_images/index')
|
30 |
+
));
|
31 |
+
|
32 |
+
$fields = array(
|
33 |
+
'short_description' => 'Short Description',
|
34 |
+
'description' => 'Description',
|
35 |
+
);
|
36 |
+
|
37 |
+
foreach($fields as $field => $label) {
|
38 |
+
$fieldset->addField($field, 'editor', array(
|
39 |
+
'name' => $field,
|
40 |
+
'label' => $this->helper('adminhtml')->__($label),
|
41 |
+
'title' => $this->helper('adminhtml')->__($label),
|
42 |
+
'style' => 'width:100%; height:400px;',
|
43 |
+
'config' => $htmlConfig,
|
44 |
+
));
|
45 |
+
}
|
46 |
+
|
47 |
+
$this->getForm()->setValues($this->_getFormData());
|
48 |
+
|
49 |
+
return $this;
|
50 |
+
}
|
51 |
+
|
52 |
+
protected function _prepareLayout()
|
53 |
+
{
|
54 |
+
parent::_prepareLayout();
|
55 |
+
|
56 |
+
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
|
57 |
+
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Tab/Design.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Group_Edit_Tab_Design extends Fishpig_AttributeSplash_Block_Adminhtml_Group_Edit_Tab_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Add the design elements to the form
|
13 |
+
*
|
14 |
+
* @return $this
|
15 |
+
*/
|
16 |
+
protected function _prepareForm()
|
17 |
+
{
|
18 |
+
parent::_prepareForm();
|
19 |
+
|
20 |
+
$fieldset = $this->getForm()->addFieldset('splash_design_menu', array(
|
21 |
+
'legend'=> $this->helper('adminhtml')->__('Menu'),
|
22 |
+
'class' => 'fieldset-wide',
|
23 |
+
));
|
24 |
+
|
25 |
+
$fieldset->addField('include_in_menu', 'select', array(
|
26 |
+
'name' => 'include_in_menu',
|
27 |
+
'label' => $this->__('Include in Navigation Menu'),
|
28 |
+
'title' => $this->__('Include in Navigation Menu'),
|
29 |
+
'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
|
30 |
+
));
|
31 |
+
|
32 |
+
$fieldset = $this->getForm()->addFieldset('splash_design_group_layout', array(
|
33 |
+
'legend'=> $this->helper('adminhtml')->__('Page Layout'),
|
34 |
+
'class' => 'fieldset-wide',
|
35 |
+
));
|
36 |
+
|
37 |
+
$fieldset->addField('page_layout', 'select', array(
|
38 |
+
'name' => 'page_layout',
|
39 |
+
'label' => $this->__('Page Layout'),
|
40 |
+
'title' => $this->__('Page Layout'),
|
41 |
+
'values' => Mage::getSingleton('attributeSplash/system_config_source_layout')->toOptionArray(),
|
42 |
+
));
|
43 |
+
|
44 |
+
$fieldset->addField('layout_update_xml', 'editor', array(
|
45 |
+
'name' => 'layout_update_xml',
|
46 |
+
'label' => $this->__('Layout Update XML'),
|
47 |
+
'title' => $this->__('Layout Update XML'),
|
48 |
+
'style' => 'width:600px;',
|
49 |
+
));
|
50 |
+
|
51 |
+
$this->getForm()->setValues($this->_getFormData());
|
52 |
+
|
53 |
+
return $this;
|
54 |
+
}
|
55 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Tab/General.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Group_Edit_Tab_General extends Fishpig_AttributeSplash_Block_Adminhtml_Group_Edit_Tab_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Setup the form fields
|
13 |
+
*
|
14 |
+
* @return $this
|
15 |
+
*/
|
16 |
+
protected function _prepareForm()
|
17 |
+
{
|
18 |
+
parent::_prepareForm();
|
19 |
+
|
20 |
+
$fieldset = $this->getForm()
|
21 |
+
->addFieldset('splash_page_information', array(
|
22 |
+
'legend'=> $this->__('Page Information')
|
23 |
+
));
|
24 |
+
|
25 |
+
$fieldset->addField('display_name', 'text', array(
|
26 |
+
'name' => 'display_name',
|
27 |
+
'label' => $this->__('Name'),
|
28 |
+
'title' => $this->__('Name'),
|
29 |
+
'required' => true,
|
30 |
+
'class' => 'required-entry',
|
31 |
+
));
|
32 |
+
|
33 |
+
$field = $fieldset->addField('url_key', 'text', array(
|
34 |
+
'name' => 'url_key',
|
35 |
+
'label' => $this->__('URL Key'),
|
36 |
+
'title' => $this->__('URL Key'),
|
37 |
+
));
|
38 |
+
|
39 |
+
$field->setRenderer(
|
40 |
+
$this->getLayout()->createBlock('attributeSplash/adminhtml_form_field_urlkey')
|
41 |
+
->setSplashType('group')
|
42 |
+
);
|
43 |
+
|
44 |
+
$fieldset->addField('attribute_id', 'select', array(
|
45 |
+
'name' => 'attribute_id',
|
46 |
+
'label' => $this->__('Attribute'),
|
47 |
+
'title' => $this->__('Attribute'),
|
48 |
+
'values' => Mage::getSingleton('attributeSplash/system_config_source_attribute_splashable')->toOptionArray(true),
|
49 |
+
'required' => true,
|
50 |
+
'disabled' => !is_null(Mage::registry('splash_group')),
|
51 |
+
));
|
52 |
+
|
53 |
+
$fieldset->addField('category_id', 'text', array(
|
54 |
+
'name' => 'category_id',
|
55 |
+
'label' => $this->__('Category ID'),
|
56 |
+
'title' => $this->__('Category ID'),
|
57 |
+
'note' => $this->__('Used to populate category filters in the layered navigation'),
|
58 |
+
));
|
59 |
+
|
60 |
+
$group = Mage::registry('splash_group');
|
61 |
+
|
62 |
+
|
63 |
+
if (!Mage::app()->isSingleStoreMode() && (!$group || !$group->isGlobal())) {
|
64 |
+
$field = $fieldset->addField('store_ids', 'multiselect', array(
|
65 |
+
'name' => 'store_ids[]',
|
66 |
+
'label' => Mage::helper('cms')->__('Store View'),
|
67 |
+
'title' => Mage::helper('cms')->__('Store View'),
|
68 |
+
'required' => true,
|
69 |
+
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
|
70 |
+
));
|
71 |
+
|
72 |
+
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
|
73 |
+
|
74 |
+
if ($renderer) {
|
75 |
+
$field->setRenderer($renderer);
|
76 |
+
}
|
77 |
+
}
|
78 |
+
else {
|
79 |
+
$fieldset->addField('store_ids_hidden', 'hidden', array(
|
80 |
+
'name' => 'store_ids[]',
|
81 |
+
'value' => Mage::app()->getStore()->getId(),
|
82 |
+
));
|
83 |
+
|
84 |
+
if (($group = Mage::registry('splash_group')) !== null) {
|
85 |
+
$group->setStoreId(Mage::app()->getStore()->getId());
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
$fieldset->addField('is_enabled', 'select', array(
|
90 |
+
'name' => 'is_enabled',
|
91 |
+
'title' => $this->__('Enabled'),
|
92 |
+
'label' => $this->__('Enabled'),
|
93 |
+
'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
|
94 |
+
));
|
95 |
+
|
96 |
+
$this->getForm()->setValues($this->_getFormData());
|
97 |
+
|
98 |
+
return $this;
|
99 |
+
}
|
100 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Tab/Meta.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Group_Edit_Tab_Meta extends Fishpig_AttributeSplash_Block_Adminhtml_Group_Edit_Tab_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Add the meta fields to the form
|
13 |
+
*
|
14 |
+
* @return $this
|
15 |
+
*/
|
16 |
+
protected function _prepareForm()
|
17 |
+
{
|
18 |
+
parent::_prepareForm();
|
19 |
+
|
20 |
+
$fieldset = $this->getForm()->addFieldset('splash_page_meta', array(
|
21 |
+
'legend'=> $this->helper('adminhtml')->__('Meta Data'),
|
22 |
+
'class' => 'fieldset-wide',
|
23 |
+
));
|
24 |
+
|
25 |
+
|
26 |
+
$fieldset->addField('page_title', 'text', array(
|
27 |
+
'name' => 'page_title',
|
28 |
+
'label' => $this->__('Page Title'),
|
29 |
+
'title' => $this->__('Page Title'),
|
30 |
+
));
|
31 |
+
|
32 |
+
$fieldset->addField('meta_description', 'editor', array(
|
33 |
+
'name' => 'meta_description',
|
34 |
+
'label' => $this->__('Description'),
|
35 |
+
'title' => $this->__('Description'),
|
36 |
+
'style' => 'width:98%; height:110px;',
|
37 |
+
));
|
38 |
+
|
39 |
+
$fieldset->addField('meta_keywords', 'editor', array(
|
40 |
+
'name' => 'meta_keywords',
|
41 |
+
'label' => $this->__('Keywords'),
|
42 |
+
'title' => $this->__('Keywords'),
|
43 |
+
'style' => 'width:98%; height:110px;',
|
44 |
+
));
|
45 |
+
|
46 |
+
$this->getForm()->setValues($this->_getFormData());
|
47 |
+
|
48 |
+
return $this;
|
49 |
+
}
|
50 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Tab/Seo.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Group_Edit_Tab_Seo extends Mage_Adminhtml_Block_Widget_Form
|
10 |
+
{
|
11 |
+
protected function _prepareForm()
|
12 |
+
{
|
13 |
+
$form = new Varien_Data_Form();
|
14 |
+
|
15 |
+
$form->setHtmlIdPrefix('splash_');
|
16 |
+
$form->setFieldNameSuffix('splash');
|
17 |
+
|
18 |
+
$this->setForm($form);
|
19 |
+
|
20 |
+
$fieldset = $form->addFieldset('splash_seo', array('legend'=> $this->__('Search Engine Optimizations')));
|
21 |
+
|
22 |
+
$fieldset->addField('url_key', 'text', array(
|
23 |
+
'name' => 'url_key',
|
24 |
+
'label' => $this->__('URL Key'),
|
25 |
+
'title' => $this->__('URL Key'),
|
26 |
+
'note' => $this->__('If left empty the URL key will be automatically generated based on the name field'),
|
27 |
+
));
|
28 |
+
|
29 |
+
$fieldset->addField('page_title', 'text', array(
|
30 |
+
'name' => 'page_title',
|
31 |
+
'label' => $this->__('Page Title'),
|
32 |
+
'title' => $this->__('Page Title'),
|
33 |
+
));
|
34 |
+
|
35 |
+
$fieldset->addField('meta_description', 'editor', array(
|
36 |
+
'name' => 'meta_description',
|
37 |
+
'label' => $this->__('Meta Description'),
|
38 |
+
'title' => $this->__('Meta Description'),
|
39 |
+
'style' => 'width:98%; height:110px;',
|
40 |
+
));
|
41 |
+
|
42 |
+
$fieldset->addField('meta_keywords', 'editor', array(
|
43 |
+
'name' => 'meta_keywords',
|
44 |
+
'label' => $this->__('Meta Keywords'),
|
45 |
+
'title' => $this->__('Meta Keywords'),
|
46 |
+
'style' => 'width:98%; height:110px;',
|
47 |
+
));
|
48 |
+
|
49 |
+
if ($splashGroup = Mage::registry('splash_group')) {
|
50 |
+
$form->setValues($splashGroup->getData());
|
51 |
+
}
|
52 |
+
|
53 |
+
return parent::_prepareForm();
|
54 |
+
}
|
55 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Edit/Tabs.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Group_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
10 |
+
{
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
$this->setId('splash_group_tabs');
|
15 |
+
$this->setDestElementId('edit_form');
|
16 |
+
$this->setTitle($this->__('Splash Group Information'));
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _beforeToHtml()
|
20 |
+
{
|
21 |
+
$tabs = array(
|
22 |
+
'general' => 'Page Information',
|
23 |
+
'content' => 'Content',
|
24 |
+
'design' => 'Design',
|
25 |
+
'meta' => 'Meta Data',
|
26 |
+
);
|
27 |
+
|
28 |
+
foreach($tabs as $alias => $label) {
|
29 |
+
$this->addTab($alias, array(
|
30 |
+
'label' => $this->__($label),
|
31 |
+
'title' => $this->__($label),
|
32 |
+
'content' => $this->getLayout()->createBlock('attributeSplash/adminhtml_group_edit_tab_' . $alias)->toHtml(),
|
33 |
+
));
|
34 |
+
}
|
35 |
+
|
36 |
+
return parent::_beforeToHtml();
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Group/Grid.php
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Group_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
10 |
+
{
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
|
15 |
+
$this->setId('splash_group_grid');
|
16 |
+
$this->setDefaultSort('group_id');
|
17 |
+
$this->setDefaultDir('asc');
|
18 |
+
$this->setSaveParametersInSession(false);
|
19 |
+
$this->setUseAjax(true);
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Insert the Add New button
|
24 |
+
*
|
25 |
+
* @return $this
|
26 |
+
*/
|
27 |
+
protected function _prepareLayout()
|
28 |
+
{
|
29 |
+
$this->setChild('add_button',
|
30 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
31 |
+
->setData(array(
|
32 |
+
'label' => Mage::helper('adminhtml')->__('Add New Group'),
|
33 |
+
'class' => 'add',
|
34 |
+
'onclick' => "setLocation('" . $this->getUrl('*/attributeSplash_group/new') . "');",
|
35 |
+
))
|
36 |
+
);
|
37 |
+
|
38 |
+
return parent::_prepareLayout();
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Retrieve the main buttons html
|
43 |
+
*
|
44 |
+
* @return string
|
45 |
+
*/
|
46 |
+
public function getMainButtonsHtml()
|
47 |
+
{
|
48 |
+
return parent::getMainButtonsHtml()
|
49 |
+
. $this->getChildHtml('add_button');
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Initialise and set the collection for the grid
|
54 |
+
*
|
55 |
+
* @return $this
|
56 |
+
*/
|
57 |
+
protected function _prepareCollection()
|
58 |
+
{
|
59 |
+
$this->setCollection(
|
60 |
+
Mage::getResourceModel('attributeSplash/group_collection')
|
61 |
+
);
|
62 |
+
|
63 |
+
return parent::_prepareCollection();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Add store information to pages
|
68 |
+
*
|
69 |
+
* @return $this
|
70 |
+
*/
|
71 |
+
protected function _afterLoadCollection()
|
72 |
+
{
|
73 |
+
$this->getCollection()->walk('afterLoad');
|
74 |
+
|
75 |
+
parent::_afterLoadCollection();
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Apply the store filter
|
80 |
+
*
|
81 |
+
* @param $collection
|
82 |
+
* @param $column
|
83 |
+
* @return void
|
84 |
+
*/
|
85 |
+
protected function _filterStoreCondition($collection, $column)
|
86 |
+
{
|
87 |
+
if (!$value = $column->getFilter()->getValue()) {
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
|
91 |
+
$this->getCollection()->addStoreFilter($value);
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Add the columns to the grid
|
96 |
+
*
|
97 |
+
*/
|
98 |
+
protected function _prepareColumns()
|
99 |
+
{
|
100 |
+
$this->addColumn('group_id', array(
|
101 |
+
'header' => $this->__('ID'),
|
102 |
+
'align' => 'right',
|
103 |
+
'width' => 1,
|
104 |
+
'index' => 'group_id',
|
105 |
+
));
|
106 |
+
|
107 |
+
$this->addColumn('attribute_id', array(
|
108 |
+
'header' => $this->__('Attribute'),
|
109 |
+
'align' => 'left',
|
110 |
+
'index' => 'attribute_id',
|
111 |
+
'filter_index' => '_attribute_table.attribute_code',
|
112 |
+
'type' => 'options',
|
113 |
+
'options' => Mage::getSingleton('attributeSplash/system_config_source_attribute_splashed')->setLabelField('attribute_code')->toOptionHash(),
|
114 |
+
));
|
115 |
+
|
116 |
+
$this->addColumn('display_name', array(
|
117 |
+
'header' => $this->__('Name'),
|
118 |
+
'align' => 'left',
|
119 |
+
'index' => 'display_name',
|
120 |
+
));
|
121 |
+
|
122 |
+
$this->addColumn('url_key', array(
|
123 |
+
'header' => $this->__('URL Key'),
|
124 |
+
'align' => 'left',
|
125 |
+
'index' => 'url_key',
|
126 |
+
));
|
127 |
+
|
128 |
+
$this->addColumn('include_in_menu', array(
|
129 |
+
'header' => $this->__('Include in Menu'),
|
130 |
+
'align' => 'left',
|
131 |
+
'index' => 'include_in_menu',
|
132 |
+
'type' => 'options',
|
133 |
+
'options' => array(
|
134 |
+
1 => $this->__('Enabled'),
|
135 |
+
0 => $this->__('Disabled'),
|
136 |
+
),
|
137 |
+
));
|
138 |
+
|
139 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
140 |
+
$this->addColumn('store_ids', array(
|
141 |
+
'header' => $this->__('Store'),
|
142 |
+
'align' => 'left',
|
143 |
+
'index' => 'store_ids',
|
144 |
+
'type' => 'store',
|
145 |
+
'store_all' => true,
|
146 |
+
'store_view' => true,
|
147 |
+
'sortable' => false,
|
148 |
+
'filter_condition_callback' => array($this, '_filterStoreCondition'),
|
149 |
+
'options' => $this->getStores(),
|
150 |
+
));
|
151 |
+
}
|
152 |
+
|
153 |
+
$this->addColumn('action', array(
|
154 |
+
'type' => 'action',
|
155 |
+
'getter' => 'getId',
|
156 |
+
'actions' => array(
|
157 |
+
array(
|
158 |
+
'caption' => Mage::helper('catalog')->__('Edit'),
|
159 |
+
'url' => array(
|
160 |
+
'base'=>'*/attributeSplash_group/edit',
|
161 |
+
),
|
162 |
+
'field' => 'id'
|
163 |
+
)),
|
164 |
+
'filter' => false,
|
165 |
+
'sortable' => false,
|
166 |
+
'align' => 'center',
|
167 |
+
));
|
168 |
+
|
169 |
+
return parent::_prepareColumns();
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Retrieve the URL used to modify the grid via AJAX
|
174 |
+
*
|
175 |
+
* @return string
|
176 |
+
*/
|
177 |
+
public function getGridUrl()
|
178 |
+
{
|
179 |
+
return $this->getUrl('*/*/groupGrid');
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Retrieve the URL for the row
|
184 |
+
*
|
185 |
+
*/
|
186 |
+
public function getRowUrl($row)
|
187 |
+
{
|
188 |
+
return $this->getUrl('*/attributeSplash_group/edit', array('id' => $row->getId()));
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Retrieve an array of all of the stores
|
193 |
+
*
|
194 |
+
* @return array
|
195 |
+
*/
|
196 |
+
protected function getStores()
|
197 |
+
{
|
198 |
+
$options = array(0 => $this->__('Global'));
|
199 |
+
$stores = Mage::getResourceModel('core/store_collection')->load();
|
200 |
+
|
201 |
+
foreach($stores as $store) {
|
202 |
+
$options[$store->getId()] = $store->getWebsite()->getName() . ' > ' . $store->getName();
|
203 |
+
}
|
204 |
+
|
205 |
+
return $options;
|
206 |
+
}
|
207 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Page extends Mage_Adminhtml_Block_Widget_Grid_Container
|
10 |
+
{
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
|
15 |
+
$this->_controller = 'adminhtml_page';
|
16 |
+
$this->_blockGroup = 'attributeSplash';
|
17 |
+
$this->_headerText = 'Splash: ' . $this->__('Pages');
|
18 |
+
|
19 |
+
$this->_removeButton('add');
|
20 |
+
}
|
21 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
10 |
+
{
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
|
15 |
+
$this->_controller = 'adminhtml_page';
|
16 |
+
$this->_blockGroup = 'attributeSplash';
|
17 |
+
$this->_headerText = $this->_getHeaderText();
|
18 |
+
|
19 |
+
$this->_addButton('save_and_edit_button', array(
|
20 |
+
'label' => Mage::helper('catalog')->__('Save and Continue Edit'),
|
21 |
+
'onclick' => 'editForm.submit(\''.$this->getSaveAndContinueUrl().'\')',
|
22 |
+
'class' => 'save'
|
23 |
+
));
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Retrieve the URL used for the save and continue link
|
28 |
+
* This is the same URL with the back parameter added
|
29 |
+
*
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
+
public function getSaveAndContinueUrl()
|
33 |
+
{
|
34 |
+
return $this->getUrl('*/*/save', array(
|
35 |
+
'_current' => true,
|
36 |
+
'back' => 'edit',
|
37 |
+
));
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Enable WYSIWYG editor
|
42 |
+
*
|
43 |
+
*/
|
44 |
+
protected function _prepareLayout()
|
45 |
+
{
|
46 |
+
parent::_prepareLayout();
|
47 |
+
|
48 |
+
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
|
49 |
+
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
|
50 |
+
}
|
51 |
+
|
52 |
+
return $this;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Retrieve the header text
|
57 |
+
* If splash page exists, use name
|
58 |
+
*
|
59 |
+
* @return string
|
60 |
+
*/
|
61 |
+
protected function _getHeaderText()
|
62 |
+
{
|
63 |
+
if ($page = Mage::registry('splash_page')) {
|
64 |
+
if ($displayName = $page->getDisplayName()) {
|
65 |
+
return $displayName;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
return $this->__('Edit Attribute Splash Page');
|
70 |
+
}
|
71 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Form.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
10 |
+
{
|
11 |
+
protected function _prepareForm()
|
12 |
+
{
|
13 |
+
$form = new Varien_Data_Form(
|
14 |
+
array(
|
15 |
+
'id' => 'edit_form',
|
16 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
17 |
+
'method' => 'post',
|
18 |
+
'enctype' => 'multipart/form-data'
|
19 |
+
)
|
20 |
+
);
|
21 |
+
|
22 |
+
$form->setUseContainer(true);
|
23 |
+
$this->setForm($form);
|
24 |
+
|
25 |
+
return parent::_prepareForm();
|
26 |
+
}
|
27 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Js.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Js extends Mage_Core_Block_Text
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Add the JS
|
13 |
+
*
|
14 |
+
* @return $this
|
15 |
+
*/
|
16 |
+
protected function _prepareLayout()
|
17 |
+
{
|
18 |
+
$this->setText(sprintf("
|
19 |
+
<script type=\"text/javascript\">
|
20 |
+
//<![CDATA[
|
21 |
+
(function() {
|
22 |
+
var create = {
|
23 |
+
go: function() {
|
24 |
+
this.attr = $('splash_attribute_id');
|
25 |
+
this.opt = $('splash_option_id');
|
26 |
+
|
27 |
+
if (!this.attr || !this.opt) {
|
28 |
+
throw 'Missing required input fields';
|
29 |
+
}
|
30 |
+
|
31 |
+
this.name = $('splash_display_name');
|
32 |
+
|
33 |
+
this.options = new Array();
|
34 |
+
this.onAttributeChange();
|
35 |
+
|
36 |
+
this.attr.observe('change', this.onAttributeChange.bindAsEventListener(this));
|
37 |
+
|
38 |
+
this.opt.observe('change', this.onOptionChange.bindAsEventListener(this));
|
39 |
+
},
|
40 |
+
hasOptions: function() {
|
41 |
+
return typeof this.options[this.attr.getValue()] !== 'undefined';
|
42 |
+
},
|
43 |
+
updateOptions: function() {
|
44 |
+
this.opt.options = null;
|
45 |
+
|
46 |
+
this.opt.options[0] = new Option('%s', '');
|
47 |
+
|
48 |
+
this.options[this.attr.getValue()].each(function(elem, ind) {
|
49 |
+
this.opt.options[ind+1] = new Option(elem.label, elem.value);
|
50 |
+
}.bind(this));
|
51 |
+
},
|
52 |
+
getOptions: function() {
|
53 |
+
new Ajax.Request('%s?attribute=' + this.attr.getValue(), {
|
54 |
+
onSuccess: function(transport) {
|
55 |
+
var json = transport.responseText.evalJSON();
|
56 |
+
|
57 |
+
if (json.error) {
|
58 |
+
throw json.error;
|
59 |
+
}
|
60 |
+
|
61 |
+
this.options[this.attr.getValue()] = new Array();
|
62 |
+
|
63 |
+
json.options.each(function(elem, ind) {
|
64 |
+
this.options[this.attr.getValue()].push({'value': elem.value, 'label': elem.label});
|
65 |
+
}.bind(this));
|
66 |
+
|
67 |
+
this.updateOptions();
|
68 |
+
}.bind(this)
|
69 |
+
});
|
70 |
+
},
|
71 |
+
onAttributeChange: function() {
|
72 |
+
if (this.hasOptions()) {
|
73 |
+
this.updateOptions();
|
74 |
+
}
|
75 |
+
else {
|
76 |
+
this.getOptions();
|
77 |
+
}
|
78 |
+
},
|
79 |
+
onOptionChange: function() {
|
80 |
+
if (this.opt.getValue()) {
|
81 |
+
if (this.name.getValue() === '') {
|
82 |
+
this.name.setValue(this.opt.options[this.opt.selectedIndex].label);
|
83 |
+
}
|
84 |
+
}
|
85 |
+
}
|
86 |
+
};
|
87 |
+
|
88 |
+
try {
|
89 |
+
return create.go();
|
90 |
+
}
|
91 |
+
catch (e) {
|
92 |
+
alert(e);
|
93 |
+
}
|
94 |
+
})();
|
95 |
+
//]]>
|
96 |
+
</script>
|
97 |
+
", Mage::helper('adminhtml')->__('-- Please Select --'), Mage::getModel('adminhtml/url')->getUrl('*/*/options')));
|
98 |
+
|
99 |
+
return parent::_prepareLayout();
|
100 |
+
}
|
101 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tab/Abstract.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
abstract class Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Tab_Abstract extends Mage_Adminhtml_Block_Widget_Form
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Generate the form object
|
13 |
+
*
|
14 |
+
* @return $this
|
15 |
+
*/
|
16 |
+
protected function _prepareForm()
|
17 |
+
{
|
18 |
+
$form = new Varien_Data_Form();
|
19 |
+
|
20 |
+
$form->setHtmlIdPrefix('splash_');
|
21 |
+
$form->setFieldNameSuffix('splash');
|
22 |
+
|
23 |
+
$this->setForm($form);
|
24 |
+
|
25 |
+
return parent::_prepareForm();
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Retrieve the data used for the form
|
30 |
+
*
|
31 |
+
* @return array
|
32 |
+
*/
|
33 |
+
protected function _getFormData()
|
34 |
+
{
|
35 |
+
if ($page = Mage::registry('splash_page')) {
|
36 |
+
return $page->getData();
|
37 |
+
}
|
38 |
+
|
39 |
+
return array('is_enabled' => 1, 'store_ids' => array(0), 'include_in_menu' => 1);
|
40 |
+
}
|
41 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tab/Attributes.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Tab_Attributes extends Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Tab_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Add the design elements to the form
|
13 |
+
*
|
14 |
+
* @return $this
|
15 |
+
*/
|
16 |
+
protected function _prepareForm()
|
17 |
+
{
|
18 |
+
parent::_prepareForm();
|
19 |
+
|
20 |
+
$fieldset = $this->getForm()->addFieldset('splash_attributes', array(
|
21 |
+
'legend'=> $this->helper('adminhtml')->__('Attributes'),
|
22 |
+
'class' => 'fieldset-wide',
|
23 |
+
));
|
24 |
+
|
25 |
+
$page = Mage::registry('splash_page');
|
26 |
+
|
27 |
+
$fieldset->addField('attribute_id', 'select', array(
|
28 |
+
'name' => 'attribute_id',
|
29 |
+
'label' => $this->__('Attribute'),
|
30 |
+
'title' => $this->__('Attribute'),
|
31 |
+
'values' => Mage::getSingleton('attributeSplash/system_config_source_attribute_splashable')->toOptionArray(true),
|
32 |
+
'required' => true,
|
33 |
+
'disabled' => !is_null($page),
|
34 |
+
));
|
35 |
+
|
36 |
+
$fieldset->addField('option_id', 'select', array(
|
37 |
+
'name' => 'option_id',
|
38 |
+
'label' => $this->__('Option'),
|
39 |
+
'title' => $this->__('Option'),
|
40 |
+
'values' => $this->_getPageOptionValues($page),
|
41 |
+
'required' => true,
|
42 |
+
'disabled' => !is_null($page),
|
43 |
+
));
|
44 |
+
|
45 |
+
$this->getForm()->setValues($this->_getFormData());
|
46 |
+
|
47 |
+
return $this;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Retrieve the option values for the page
|
52 |
+
*
|
53 |
+
* @param Fishpig_AttributeSplash_Model_Page $page = null
|
54 |
+
* @return array
|
55 |
+
*/
|
56 |
+
protected function _getPageOptionValues($page = null)
|
57 |
+
{
|
58 |
+
if (is_null($page)) {
|
59 |
+
return array();
|
60 |
+
}
|
61 |
+
|
62 |
+
$option = Mage::getResourceModel('eav/entity_attribute_option_collection')
|
63 |
+
->setStoreFilter($page->getStoreId())
|
64 |
+
->addFieldToFilter('main_table.option_id', $page->getOptionId())
|
65 |
+
->setPageSize(1)
|
66 |
+
->load()
|
67 |
+
->getFirstItem();
|
68 |
+
|
69 |
+
if (!$option->getId()) {
|
70 |
+
return array();
|
71 |
+
}
|
72 |
+
|
73 |
+
return array(array(
|
74 |
+
'value' => $page->getOptionId(),
|
75 |
+
'label' => $option->getValue(),
|
76 |
+
));
|
77 |
+
}
|
78 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tab/Content.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Tab_Content extends Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Tab_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Prepare the form
|
13 |
+
*
|
14 |
+
* @return $this
|
15 |
+
*/
|
16 |
+
protected function _prepareForm()
|
17 |
+
{
|
18 |
+
parent::_prepareForm();
|
19 |
+
|
20 |
+
$fieldset = $this->getForm()->addFieldset('splash_page_content', array(
|
21 |
+
'legend'=> $this->helper('adminhtml')->__('Content'),
|
22 |
+
'class' => 'fieldset-wide',
|
23 |
+
));
|
24 |
+
|
25 |
+
$htmlConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array(
|
26 |
+
'add_widgets' => true,
|
27 |
+
'add_variables' => true,
|
28 |
+
'add_image' => true,
|
29 |
+
'files_browser_window_url' => $this->getUrl('adminhtml/cms_wysiwyg_images/index')
|
30 |
+
));
|
31 |
+
|
32 |
+
$fields = array(
|
33 |
+
'short_description' => 'Short Description',
|
34 |
+
'description' => 'Description',
|
35 |
+
);
|
36 |
+
|
37 |
+
foreach($fields as $field => $label) {
|
38 |
+
$fieldset->addField($field, 'editor', array(
|
39 |
+
'name' => $field,
|
40 |
+
'label' => $this->helper('adminhtml')->__($label),
|
41 |
+
'title' => $this->helper('adminhtml')->__($label),
|
42 |
+
'style' => 'width:100%; height:400px;',
|
43 |
+
'config' => $htmlConfig,
|
44 |
+
));
|
45 |
+
}
|
46 |
+
|
47 |
+
$this->getForm()->setValues($this->_getFormData());
|
48 |
+
|
49 |
+
return $this;
|
50 |
+
}
|
51 |
+
|
52 |
+
protected function _prepareLayout()
|
53 |
+
{
|
54 |
+
parent::_prepareLayout();
|
55 |
+
|
56 |
+
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
|
57 |
+
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tab/Design.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Tab_Design extends Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Tab_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Add the design elements to the form
|
13 |
+
*
|
14 |
+
* @return $this
|
15 |
+
*/
|
16 |
+
protected function _prepareForm()
|
17 |
+
{
|
18 |
+
parent::_prepareForm();
|
19 |
+
|
20 |
+
$fieldset = $this->getForm()->addFieldset('splash_design_menu', array(
|
21 |
+
'legend'=> $this->helper('adminhtml')->__('Menu'),
|
22 |
+
'class' => 'fieldset-wide',
|
23 |
+
));
|
24 |
+
|
25 |
+
$fieldset->addField('include_in_menu', 'select', array(
|
26 |
+
'name' => 'include_in_menu',
|
27 |
+
'label' => $this->__('Include in Navigation Menu'),
|
28 |
+
'title' => $this->__('Include in Navigation Menu'),
|
29 |
+
'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
|
30 |
+
));
|
31 |
+
|
32 |
+
$fieldset = $this->getForm()->addFieldset('splash_design_page_layout', array(
|
33 |
+
'legend'=> $this->helper('adminhtml')->__('Page Layout'),
|
34 |
+
'class' => 'fieldset-wide',
|
35 |
+
));
|
36 |
+
|
37 |
+
$fieldset->addField('page_layout', 'select', array(
|
38 |
+
'name' => 'page_layout',
|
39 |
+
'label' => $this->__('Page Layout'),
|
40 |
+
'title' => $this->__('Page Layout'),
|
41 |
+
'values' => Mage::getSingleton('attributeSplash/system_config_source_layout')->toOptionArray(),
|
42 |
+
));
|
43 |
+
|
44 |
+
$fieldset->addField('layout_update_xml', 'editor', array(
|
45 |
+
'name' => 'layout_update_xml',
|
46 |
+
'label' => $this->__('Layout Update XML'),
|
47 |
+
'title' => $this->__('Layout Update XML'),
|
48 |
+
'style' => 'width:600px;',
|
49 |
+
));
|
50 |
+
|
51 |
+
$fieldset = $this->getForm()->addFieldset('splash_design_display_settings', array(
|
52 |
+
'legend'=> $this->helper('adminhtml')->__('Display Settings'),
|
53 |
+
'class' => 'fieldset-wide',
|
54 |
+
));
|
55 |
+
|
56 |
+
$fieldset->addField('display_mode', 'select', array(
|
57 |
+
'name' => 'display_mode',
|
58 |
+
'label' => $this->__('Display Mode'),
|
59 |
+
'title' => $this->__('Display Mode'),
|
60 |
+
'values' => Mage::getModel('catalog/category_attribute_source_mode')->getAllOptions(),
|
61 |
+
));
|
62 |
+
|
63 |
+
$fieldset->addField('cms_block', 'select', array(
|
64 |
+
'name' => 'cms_block',
|
65 |
+
'label' => $this->__('CMS Block'),
|
66 |
+
'title' => $this->__('CMS Block'),
|
67 |
+
'values' => Mage::getModel('catalog/category_attribute_source_page')->getAllOptions(),
|
68 |
+
));
|
69 |
+
|
70 |
+
$this->getForm()->setValues($this->_getFormData());
|
71 |
+
|
72 |
+
return $this;
|
73 |
+
}
|
74 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tab/General.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Tab_General extends Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Tab_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Setup the form fields
|
13 |
+
*
|
14 |
+
* @return $this
|
15 |
+
*/
|
16 |
+
protected function _prepareForm()
|
17 |
+
{
|
18 |
+
parent::_prepareForm();
|
19 |
+
|
20 |
+
$fieldset = $this->getForm()
|
21 |
+
->addFieldset('splash_page_information', array(
|
22 |
+
'legend'=> $this->__('Page Information')
|
23 |
+
));
|
24 |
+
|
25 |
+
$fieldset->addField('display_name', 'text', array(
|
26 |
+
'name' => 'display_name',
|
27 |
+
'label' => $this->__('Name'),
|
28 |
+
'title' => $this->__('Name'),
|
29 |
+
'required' => true,
|
30 |
+
'class' => 'required-entry',
|
31 |
+
));
|
32 |
+
|
33 |
+
$field = $fieldset->addField('url_key', 'text', array(
|
34 |
+
'name' => 'url_key',
|
35 |
+
'label' => $this->__('URL Key'),
|
36 |
+
'title' => $this->__('URL Key'),
|
37 |
+
));
|
38 |
+
|
39 |
+
$field->setRenderer(
|
40 |
+
$this->getLayout()->createBlock('attributeSplash/adminhtml_form_field_urlkey')
|
41 |
+
->setSplashType('page')
|
42 |
+
);
|
43 |
+
|
44 |
+
if ($page = Mage::registry('splash_page')) {
|
45 |
+
$fieldset->addField('attribute_id', 'hidden', array(
|
46 |
+
'name' => 'attribute_id',
|
47 |
+
'value' => $page->getAttributeId(),
|
48 |
+
));
|
49 |
+
|
50 |
+
$fieldset->addField('option_id', 'hidden', array(
|
51 |
+
'name' => 'option_id',
|
52 |
+
'value' => $page->getOptionId(),
|
53 |
+
));
|
54 |
+
}
|
55 |
+
|
56 |
+
$fieldset->addField('category_id', 'text', array(
|
57 |
+
'name' => 'category_id',
|
58 |
+
'label' => $this->__('Category ID'),
|
59 |
+
'title' => $this->__('Category ID'),
|
60 |
+
'note' => $this->__('Used to populate category filters in the layered navigation'),
|
61 |
+
));
|
62 |
+
|
63 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
64 |
+
$field = $fieldset->addField('store_ids', 'multiselect', array(
|
65 |
+
'name' => 'store_ids[]',
|
66 |
+
'label' => Mage::helper('cms')->__('Store View'),
|
67 |
+
'title' => Mage::helper('cms')->__('Store View'),
|
68 |
+
'required' => true,
|
69 |
+
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
|
70 |
+
));
|
71 |
+
|
72 |
+
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
|
73 |
+
|
74 |
+
if ($renderer) {
|
75 |
+
$field->setRenderer($renderer);
|
76 |
+
}
|
77 |
+
}
|
78 |
+
else {
|
79 |
+
if (($page = Mage::registry('splash_page')) !== null) {
|
80 |
+
$page->setStoreId(Mage::app()->getStore()->getId());
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
$fieldset->addField('is_enabled', 'select', array(
|
85 |
+
'name' => 'is_enabled',
|
86 |
+
'title' => $this->__('Enabled'),
|
87 |
+
'label' => $this->__('Enabled'),
|
88 |
+
'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
|
89 |
+
));
|
90 |
+
|
91 |
+
$fieldset->addField('is_featured', 'select', array(
|
92 |
+
'name' => 'is_featured',
|
93 |
+
'title' => $this->__('Featured'),
|
94 |
+
'label' => $this->__('Featured'),
|
95 |
+
'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
|
96 |
+
));
|
97 |
+
|
98 |
+
$this->getForm()->setValues($this->_getFormData());
|
99 |
+
|
100 |
+
return $this;
|
101 |
+
}
|
102 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tab/Images.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Tab_Images extends Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Tab_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Retrieve Additional Element Types
|
13 |
+
*
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
protected function _getAdditionalElementTypes()
|
17 |
+
{
|
18 |
+
return array(
|
19 |
+
'image' => Mage::getConfig()->getBlockClassName('attributeSplash/adminhtml_page_helper_image')
|
20 |
+
);
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Setup the form fields
|
25 |
+
*
|
26 |
+
* @return $this
|
27 |
+
*/
|
28 |
+
protected function _prepareForm()
|
29 |
+
{
|
30 |
+
parent::_prepareForm();
|
31 |
+
|
32 |
+
$fieldset = $this->getForm()
|
33 |
+
->addFieldset('splash_image', array('legend'=> $this->__('Images')));
|
34 |
+
|
35 |
+
$this->_addElementTypes($fieldset);
|
36 |
+
|
37 |
+
$fieldset->addField('image', 'image', array(
|
38 |
+
'name' => 'image',
|
39 |
+
'label' => $this->__('Banner'),
|
40 |
+
'title' => $this->__('Banner'),
|
41 |
+
));
|
42 |
+
|
43 |
+
$fieldset->addField('thumbnail', 'image', array(
|
44 |
+
'name' => 'thumbnail',
|
45 |
+
'label' => $this->__('Logo'),
|
46 |
+
'title' => $this->__('Logo'),
|
47 |
+
));
|
48 |
+
|
49 |
+
$this->getForm()->setValues($this->_getFormData());
|
50 |
+
|
51 |
+
return $this;
|
52 |
+
}
|
53 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tab/Meta.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Tab_Meta extends Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Tab_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Add the meta fields to the form
|
13 |
+
*
|
14 |
+
* @return $this
|
15 |
+
*/
|
16 |
+
protected function _prepareForm()
|
17 |
+
{
|
18 |
+
parent::_prepareForm();
|
19 |
+
|
20 |
+
$fieldset = $this->getForm()->addFieldset('splash_page_meta', array(
|
21 |
+
'legend'=> $this->helper('adminhtml')->__('Meta Data'),
|
22 |
+
'class' => 'fieldset-wide',
|
23 |
+
));
|
24 |
+
|
25 |
+
|
26 |
+
$fieldset->addField('page_title', 'text', array(
|
27 |
+
'name' => 'page_title',
|
28 |
+
'label' => $this->__('Page Title'),
|
29 |
+
'title' => $this->__('Page Title'),
|
30 |
+
));
|
31 |
+
|
32 |
+
$fieldset->addField('meta_description', 'editor', array(
|
33 |
+
'name' => 'meta_description',
|
34 |
+
'label' => $this->__('Description'),
|
35 |
+
'title' => $this->__('Description'),
|
36 |
+
'style' => 'width:98%; height:110px;',
|
37 |
+
));
|
38 |
+
|
39 |
+
$fieldset->addField('meta_keywords', 'editor', array(
|
40 |
+
'name' => 'meta_keywords',
|
41 |
+
'label' => $this->__('Keywords'),
|
42 |
+
'title' => $this->__('Keywords'),
|
43 |
+
'style' => 'width:98%; height:110px;',
|
44 |
+
));
|
45 |
+
|
46 |
+
$this->getForm()->setValues($this->_getFormData());
|
47 |
+
|
48 |
+
return $this;
|
49 |
+
}
|
50 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Edit/Tabs.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Page_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Init the tabs block
|
13 |
+
*
|
14 |
+
* @return void
|
15 |
+
*/
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
+
parent::__construct();
|
19 |
+
$this->setId('splash_page_tabs');
|
20 |
+
$this->setDestElementId('edit_form');
|
21 |
+
$this->setTitle($this->__('Splash Page Information'));
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Add tabs to the block
|
26 |
+
*
|
27 |
+
* @return $this
|
28 |
+
*/
|
29 |
+
protected function _beforeToHtml()
|
30 |
+
{
|
31 |
+
$tabs = array(
|
32 |
+
'general' => 'Page Information',
|
33 |
+
'attributes' => 'Attributes',
|
34 |
+
'content' => 'Content',
|
35 |
+
'images' => 'Images',
|
36 |
+
'design' => 'Design',
|
37 |
+
'meta' => 'Meta Data',
|
38 |
+
);
|
39 |
+
|
40 |
+
foreach($tabs as $alias => $label) {
|
41 |
+
$this->addTab($alias, array(
|
42 |
+
'label' => $this->__($label),
|
43 |
+
'title' => $this->__($label),
|
44 |
+
'content' => $this->getLayout()->createBlock('attributeSplash/adminhtml_page_edit_tab_' . $alias)->toHtml(),
|
45 |
+
));
|
46 |
+
}
|
47 |
+
|
48 |
+
Mage::dispatchEvent('attributesplash_adminhtml_page_edit_tabs', array('tabs' => $this));
|
49 |
+
|
50 |
+
return parent::_beforeToHtml();
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Fishpig/AttributeSplash/Block/Adminhtml/Page/Grid.php
ADDED
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Fishpig
|
4 |
+
* @package Fishpig_AttributeSplash
|
5 |
+
* @license http://fishpig.co.uk/license.txt
|
6 |
+
* @author Ben Tideswell <help@fishpig.co.uk>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Fishpig_AttributeSplash_Block_Adminhtml_Page_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
10 |
+
{
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
|
15 |
+
$this->setId('splash_page_grid');
|
16 |
+
$this->setDefaultSort('page_id');
|
17 |
+
$this->setDefaultDir('asc');
|
18 |
+
$this->setSaveParametersInSession(false);
|
19 |
+
$this->setUseAjax(true);
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Insert the Add New button
|
24 |
+
*
|
25 |
+
* @return $this
|
26 |
+
*/
|
27 |
+
protected function _prepareLayout()
|
28 |
+
{
|
29 |
+
$this->setChild('add_button',
|
30 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
31 |
+
->setData(array(
|
32 |
+
'label' => Mage::helper('adminhtml')->__('Add New Page'),
|
33 |
+
'class' => 'add',
|
34 |
+
'onclick' => "setLocation('" . $this->getUrl('*/attributeSplash_page/new') . "');",
|
35 |
+
))
|
36 |
+
);
|
37 |
+
|
38 |
+
return parent::_prepareLayout();
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Retrieve the main buttons html
|
43 |
+
*
|
44 |
+
* @return string
|
45 |
+
*/
|
46 |
+
public function getMainButtonsHtml()
|
47 |
+
{
|
48 |
+
return parent::getMainButtonsHtml()
|
49 |
+
. $this->getChildHtml('add_button');
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Initialise and set the collection for the grid
|
54 |
+
*
|
55 |
+
*/
|
56 |
+
protected function _prepareCollection()
|
57 |
+
{
|
58 |
+
$this->setCollection(
|
59 |
+
Mage::getResourceModel('attributeSplash/page_collection')
|
60 |
+
);
|
61 |
+
|
62 |
+
return parent::_prepareCollection();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Add store information to pages
|
67 |
+
*
|
68 |
+
* @return $this
|
69 |
+
*/
|
70 |
+
protected function _afterLoadCollection()
|
71 |
+
{
|
72 |
+
$this->getCollection()->walk('afterLoad');
|
73 |
+
|
74 |
+
parent::_afterLoadCollection();
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Apply the store filter
|
79 |
+
*
|
80 |
+
* @param $collection
|
81 |
+
* @param $column
|
82 |
+
* @return void
|
83 |
+
*/
|
84 |
+
protected function _filterStoreCondition($collection, $column)
|
85 |
+
{
|
86 |
+
if (!$value = $column->getFilter()->getValue()) {
|
87 |
+
return;
|
88 |
+
}
|
89 |
+
|
90 |
+
$this->getCollection()->addStoreFilter($value);
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Add the columns to the grid
|
95 |
+
*
|
96 |
+
*/
|
97 |
+
protected function _prepareColumns()
|
98 |
+
{
|
99 |
+
$this->addColumn('page_id', array(
|
100 |
+
'header' => $this->__('ID'),
|
101 |
+
'align' => 'right',
|
102 |
+
'width' => 1,
|
103 |
+
'index' => 'page_id',
|
104 |
+
));
|
105 |
+
|
106 |
+
$this->addColumn('attribute_id', array(
|
107 |
+
'header' => $this->__('Attribute'),
|
108 |
+
'align' => 'left',
|
109 |
+
'index' => 'attribute_id',
|
110 |
+
'filter_index' => '_attribute_table.attribute_id',
|
111 |
+
'type' => 'options',
|
112 |
+
'options' => Mage::getSingleton('attributeSplash/system_config_source_attribute_splashed')->setLabelField('attribute_code')->toOptionHash(),
|
113 |
+
));
|
114 |
+
|
115 |
+
$this->addColumn('display_name', array(
|
116 |
+
'header' => $this->__('Name'),
|
117 |
+
'align' => 'left',
|
118 |
+
'index' => 'display_name',
|
119 |
+
));
|
120 |
+
|
121 |
+
$this->addColumn('url_key', array(
|
122 |
+
'header' => $this->__('URL Key'),
|
123 |
+
'align' => 'left',
|
124 |
+
'index' => 'url_key',
|
125 |
+
));
|
126 |
+
|
127 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
128 |
+
$this->addColumn('store_ids', array(
|
129 |
+
'header' => $this->__('Store'),
|
130 |
+
'align' => 'left',
|
131 |
+
'index' => 'store_ids',
|
132 |
+
'type' => 'store',
|
133 |
+
'store_all' => true,
|
134 |
+
'store_view' => true,
|
135 |
+
'sortable' => false,
|
136 |
+
'filter_condition_callback' => array($this, '_filterStoreCondition'),
|
137 |
+
'options' => $this->getStores(),
|
138 |
+
));
|
139 |
+
}
|
140 |
+
|
141 |
+
|
142 |
+
$this->addColumn('is_enabled', array(
|
143 |
+
'width' => 1,
|
144 |
+
'header' => $this->__('Enabled'),
|
145 |
+
'index' => 'is_enabled',
|
146 |
+
'type' => 'options',
|
147 |
+
'options' => array(
|
148 |
+
1 => $this->__('Enabled'),
|
149 |
+
0 => $this->__('Disabled'),
|
150 |
+
),
|
151 |
+
));
|
152 |
+
|
153 |
+
$this->addColumn('action', array(
|
154 |
+
'type' => 'action',
|
155 |
+
'getter' => 'getId',
|
156 |
+
'actions' => array(array(
|
157 |
+
'caption' => Mage::helper('catalog')->__('Edit'),
|
158 |
+
'url' => array(
|
159 |
+
'base'=>'*/attributeSplash_page/edit',
|
160 |
+
),
|
161 |
+
'field' => 'id'
|
162 |
+
)),
|
163 |
+
'filter' => false,
|
164 |
+
'sortable' => false,
|
165 |
+
'align' => 'center',
|
166 |
+
));
|
167 |
+
|
168 |
+
return parent::_prepareColumns();
|
169 |
+
}
|
170 |
+
|
171 |
+
protected function _prepareMassaction()
|
172 |
+
{
|
173 |
+
$this->setMassactionIdField('page_id');
|
174 |
+
$this->getMassactionBlock()->setFormFieldName('page');
|
175 |
+
|
176 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
177 |
+
'label'=> $this->__('Delete'),
|
178 |
+
'url' => $this->getUrl('*/attributeSplash_page/massDelete'),
|
179 |
+
'confirm' => Mage::helper('catalog')->__('Are you sure?')
|
180 |
+
));
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Retrieve the URL used to modify the grid via AJAX
|
185 |
+
*
|
186 |
+
* @return string
|
187 |
+
*/
|
188 |
+
public function getGridUrl()
|
189 |
+
{
|
190 |
+
return $this->getUrl('*/*/pageGrid');
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Retrieve the URL for the row
|
195 |
+
*
|
196 |
+
*/
|
197 |
+
public function getRowUrl($row)
|
198 |
+
{
|
199 |
+
return $this->getUrl('*/attributeSplash_page/edit', array('id' => $row->getId()));
|
200 |
+
}
|
201 |
+
|
202 |
+
|