Version Notes
Add fix for double template output on product page
Download this release
Release Info
Developer | Sven Haertwig |
Extension | Narfstudios_ProductNavigation-stable |
Version | 1.0.5 |
Comparing to | |
See all releases |
Version 1.0.5
- app/code/community/Narfstudios/Base/Block/Adminhtml/System/Config/Form.php +116 -0
- app/code/community/Narfstudios/Base/Block/Adminhtml/System/Config/Form/Fieldset.php +59 -0
- app/code/community/Narfstudios/Base/Model/Feed.php +79 -0
- app/code/community/Narfstudios/Base/etc/config.xml +121 -0
- app/code/community/Narfstudios/ProductNavigation/Block/Catalog/Product/View.php +28 -0
- app/code/community/Narfstudios/ProductNavigation/Helper/.Data.php.swp +0 -0
- app/code/community/Narfstudios/ProductNavigation/Helper/Data.php +87 -0
- app/code/community/Narfstudios/ProductNavigation/Model/Sitemap.php +138 -0
- app/code/community/Narfstudios/ProductNavigation/etc/config.xml +71 -0
- app/design/frontend/base/default/layout/productnavigation.xml +72 -0
- app/design/frontend/base/default/template/productnavigation/catalog/product/view.phtml +159 -0
- app/design/frontend/base/default/template/productnavigation/catalog/product/view/navigation.phtml +9 -0
- app/etc/modules/Narfstudios_Base.xml +10 -0
- app/etc/modules/Narfstudios_ProductNavigation.xml +14 -0
- app/locale/de_AT/Narfstudios_ProductNavigation.csv +3 -0
- app/locale/de_CH/Narfstudios_ProductNavigation.csv +3 -0
- app/locale/de_DE/Narfstudios_ProductNavigation.csv +3 -0
- package.xml +38 -0
app/code/community/Narfstudios/Base/Block/Adminhtml/System/Config/Form.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* narf-studios GmbH
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the GPL Version 3 that means that
|
8 |
+
*
|
9 |
+
* - anyone can use the code anywhere, in any situation but the original author
|
10 |
+
* narf-studios must be named
|
11 |
+
* - anyone can redistribute the code to anyone else, as long as the source code
|
12 |
+
* is included and the distribution license remains the GPL
|
13 |
+
* - anyone can create a derivative work of the code and redistribute it,
|
14 |
+
* as long as the resulting source code is also made available at redistribution
|
15 |
+
* time, and as long as the resulting source code is licensed under the terms of the GPL.
|
16 |
+
*
|
17 |
+
* @category narf-studios
|
18 |
+
* @package Narfstudios/Base
|
19 |
+
* @copyright Copyright (c) 2011 narf-studios GmbH (http://www.narf-studios.de)
|
20 |
+
* @license http://www.gnu.org/licenses/gpl.txt
|
21 |
+
*/
|
22 |
+
class Narfstudios_Base_Block_Adminhtml_System_Config_Form extends Mage_Adminhtml_Block_System_Config_Form
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* initialize
|
26 |
+
*
|
27 |
+
* @return Mage_Adminhtml_Block_System_Config_Form
|
28 |
+
*/
|
29 |
+
public function initForm()
|
30 |
+
{
|
31 |
+
|
32 |
+
$this->_initObjects();
|
33 |
+
|
34 |
+
$form = new Varien_Data_Form();
|
35 |
+
|
36 |
+
$sections = $this->_configFields->getSection($this->getSectionCode(), $this->getWebsiteCode(), $this->getStoreCode());
|
37 |
+
if (empty($sections)) {
|
38 |
+
$sections = array();
|
39 |
+
}
|
40 |
+
foreach ($sections as $section) {
|
41 |
+
/* @var $section Varien_Simplexml_Element */
|
42 |
+
if (!$this->_canShowField($section)) {
|
43 |
+
continue;
|
44 |
+
}
|
45 |
+
foreach ($section->groups as $groups){
|
46 |
+
|
47 |
+
$groups = (array)$groups;
|
48 |
+
usort($groups, array($this, '_sortForm'));
|
49 |
+
|
50 |
+
foreach ($groups as $group){
|
51 |
+
/* @var $group Varien_Simplexml_Element */
|
52 |
+
if (!$this->_canShowField($group)) {
|
53 |
+
continue;
|
54 |
+
}
|
55 |
+
|
56 |
+
if ($group->frontend_model) {
|
57 |
+
$fieldsetRenderer = Mage::getBlockSingleton((string)$group->frontend_model);
|
58 |
+
} else {
|
59 |
+
$fieldsetRenderer = $this->_defaultFieldsetRenderer;
|
60 |
+
}
|
61 |
+
|
62 |
+
$fieldsetRenderer->setForm($this);
|
63 |
+
$fieldsetRenderer->setConfigData($this->_configData);
|
64 |
+
$fieldsetRenderer->setGroup($group);
|
65 |
+
|
66 |
+
if ($this->_configFields->hasChildren($group, $this->getWebsiteCode(), $this->getStoreCode())) {
|
67 |
+
|
68 |
+
$helperName = $this->_configFields->getAttributeModule($section, $group);
|
69 |
+
|
70 |
+
$fieldsetConfig = array('legend' => Mage::helper($helperName)->__((string)$group->label));
|
71 |
+
if (!empty($group->comment)) {
|
72 |
+
$fieldsetConfig['comment'] = (string)$group->comment;
|
73 |
+
}
|
74 |
+
if (!empty($group->expanded)) {
|
75 |
+
$fieldsetConfig['expanded'] = (bool)$group->expanded;
|
76 |
+
}
|
77 |
+
|
78 |
+
// addtion
|
79 |
+
if (!empty($group->logo)) {
|
80 |
+
$fieldsetConfig['logo'] = '<img src="../../../../../../../../skin/adminhtml/default/default/images/'.(string)$group->logo.'" alt="logo" class="admin_config_logo"/>';
|
81 |
+
}
|
82 |
+
if (!empty($group->message)) {
|
83 |
+
$fieldsetConfig['message'] = Mage::helper($helperName)->__((string)$group->message);
|
84 |
+
}
|
85 |
+
|
86 |
+
$fieldset = $form->addFieldset(
|
87 |
+
$section->getName() . '_' . $group->getName(), $fieldsetConfig)
|
88 |
+
->setRenderer($fieldsetRenderer);
|
89 |
+
$this->_prepareFieldOriginalData($fieldset, $group);
|
90 |
+
$this->_addElementTypes($fieldset);
|
91 |
+
|
92 |
+
if ($group->clone_fields) {
|
93 |
+
if ($group->clone_model) {
|
94 |
+
$cloneModel = Mage::getModel((string)$group->clone_model);
|
95 |
+
} else {
|
96 |
+
Mage::throwException('Config form fieldset clone model required to be able to clone fields');
|
97 |
+
}
|
98 |
+
foreach ($cloneModel->getPrefixes() as $prefix) {
|
99 |
+
$this->initFields($fieldset, $group, $section, $prefix['field'], $prefix['label']);
|
100 |
+
}
|
101 |
+
} else {
|
102 |
+
$this->initFields($fieldset, $group, $section);
|
103 |
+
}
|
104 |
+
|
105 |
+
$this->_fieldsets[$group->getName()] = $fieldset;
|
106 |
+
|
107 |
+
}
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
$this->setForm($form);
|
113 |
+
return $this;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
?>
|
app/code/community/Narfstudios/Base/Block/Adminhtml/System/Config/Form/Fieldset.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* narf-studios GmbH
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the GPL Version 3 that means that
|
8 |
+
*
|
9 |
+
* - anyone can use the code anywhere, in any situation but the original author
|
10 |
+
* narf-studios must be named
|
11 |
+
* - anyone can redistribute the code to anyone else, as long as the source code
|
12 |
+
* is included and the distribution license remains the GPL
|
13 |
+
* - anyone can create a derivative work of the code and redistribute it,
|
14 |
+
* as long as the resulting source code is also made available at redistribution
|
15 |
+
* time, and as long as the resulting source code is licensed under the terms of the GPL.
|
16 |
+
*
|
17 |
+
* @category narf-studios
|
18 |
+
* @package Narfstudios/Base
|
19 |
+
* @copyright Copyright (c) 2011 narf-studios GmbH (http://www.narf-studios.de)
|
20 |
+
* @license http://www.gnu.org/licenses/gpl.txt
|
21 |
+
*/
|
22 |
+
class Narfstudios_Base_Block_Adminhtml_System_Config_Form_Fieldset extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Return header html for fieldset
|
26 |
+
*
|
27 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
28 |
+
* @return string
|
29 |
+
*/
|
30 |
+
protected function _getHeaderHtml($element)
|
31 |
+
{
|
32 |
+
$default = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store');
|
33 |
+
|
34 |
+
$html = '<div class="entry-edit-head collapseable" ><a id="'.$element->getHtmlId().'-head" href="#" onclick="Fieldset.toggleCollapse(\''.$element->getHtmlId().'\', \''.$this->getUrl('*/*/state').'\'); return false;">'.$element->getLegend().'</a></div>';
|
35 |
+
$html.= '<input id="'.$element->getHtmlId().'-state" name="config_state['.$element->getId().']" type="hidden" value="'.(int)$this->_getCollapseState($element).'" />';
|
36 |
+
$html.= '<fieldset class="'.$this->_getFieldsetCss().'" id="'.$element->getHtmlId().'">';
|
37 |
+
$html.= '<legend>'.$element->getLegend().'</legend>';
|
38 |
+
|
39 |
+
if ($element->getComment()) {
|
40 |
+
$html .= '<div class="comment">'.$element->getComment().'</div>';
|
41 |
+
}
|
42 |
+
if ($element->getLogo()) {
|
43 |
+
$html .= '<div class="admin_config_logo">'.$element->getLogo().'</div>';
|
44 |
+
}
|
45 |
+
if ($element->getMessage()) {
|
46 |
+
$html .= '<div class="admin_config_message">'.$element->getMessage().'</div>';
|
47 |
+
}
|
48 |
+
|
49 |
+
// field label column
|
50 |
+
$html.= '<table cellspacing="0" class="form-list"><colgroup class="label" /><colgroup class="value" />';
|
51 |
+
if (!$default) {
|
52 |
+
$html.= '<colgroup class="use-default" />';
|
53 |
+
}
|
54 |
+
$html.= '<colgroup class="scope-label" /><colgroup class="" /><tbody>';
|
55 |
+
|
56 |
+
return $html;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
?>
|
app/code/community/Narfstudios/Base/Model/Feed.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* narf-studios GmbH
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the GPL Version 3 that means that
|
8 |
+
*
|
9 |
+
* - anyone can use the code anywhere, in any situation but the original author
|
10 |
+
* narf-studios must be named
|
11 |
+
* - anyone can redistribute the code to anyone else, as long as the source code
|
12 |
+
* is included and the distribution license remains the GPL
|
13 |
+
* - anyone can create a derivative work of the code and redistribute it,
|
14 |
+
* as long as the resulting source code is also made available at redistribution
|
15 |
+
* time, and as long as the resulting source code is licensed under the terms of the GPL.
|
16 |
+
*
|
17 |
+
* @category narf-studios
|
18 |
+
* @package Narfstudios/Base
|
19 |
+
* @copyright Copyright (c) 2011 narf-studios GmbH (http://www.narf-studios.de)
|
20 |
+
* @license http://www.gnu.org/licenses/gpl.txt
|
21 |
+
*/
|
22 |
+
class Narfstudios_Base_Model_Feed extends Mage_AdminNotification_Model_Feed {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Get the Feed URL from narf-studios
|
26 |
+
* @return <type>
|
27 |
+
*/
|
28 |
+
public function getFeedUrl() {
|
29 |
+
$protocol = 'http://';
|
30 |
+
if(Mage::getStoreConfigFlag(self::XML_USE_HTTPS_PATH)) {
|
31 |
+
$protocol = 'https://';
|
32 |
+
}
|
33 |
+
|
34 |
+
$url = Mage::getStoreConfig('base/feed/url');
|
35 |
+
|
36 |
+
return $protocol.$url;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Check fpr current news from the feed
|
41 |
+
* @author Manuel Neukum
|
42 |
+
*/
|
43 |
+
public function checkForNews() {
|
44 |
+
$model = Mage::getModel('base/feed');
|
45 |
+
$model->checkUpdate();
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Parste the Narfstudios Feed
|
50 |
+
* @author Manuel Neukum
|
51 |
+
* @return Narfstudios_Base_Model_Feed
|
52 |
+
*/
|
53 |
+
public function checkUpdate(){
|
54 |
+
$feedData = array();
|
55 |
+
|
56 |
+
$feedXml = $this->getFeedData();
|
57 |
+
|
58 |
+
if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
|
59 |
+
foreach ($feedXml->channel->item as $item) {
|
60 |
+
$feedData[] = array(
|
61 |
+
'severity' => (isset($item->severity)) ? (int)$item->severity : Mage_AdminNotification_Model_Inbox::SEVERITY_MINOR,
|
62 |
+
'date_added' => $this->getDate((string)$item->pubDate),
|
63 |
+
'title' => (string)$item->title,
|
64 |
+
'description' => (string)$item->description,
|
65 |
+
'url' => (string)$item->link,
|
66 |
+
);
|
67 |
+
}
|
68 |
+
if ($feedData) {
|
69 |
+
Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
|
70 |
+
}
|
71 |
+
|
72 |
+
}
|
73 |
+
$this->setLastUpdate();
|
74 |
+
|
75 |
+
return $this;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
?>
|
app/code/community/Narfstudios/Base/etc/config.xml
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Narfstudios_Base>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Narfstudios_Base>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<Base>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Narfstudios_Base</module>
|
14 |
+
<frontName>Base</frontName>
|
15 |
+
</args>
|
16 |
+
</Base>
|
17 |
+
</routers>
|
18 |
+
<translate>
|
19 |
+
<modules>
|
20 |
+
<Narfstudios_Base>
|
21 |
+
<files>
|
22 |
+
<default>Narfstudios_Base.csv</default>
|
23 |
+
</files>
|
24 |
+
</Narfstudios_Base>
|
25 |
+
</modules>
|
26 |
+
</translate>
|
27 |
+
<layout>
|
28 |
+
<updates>
|
29 |
+
<Base>
|
30 |
+
<file>Base.xml</file>
|
31 |
+
</Base>
|
32 |
+
</updates>
|
33 |
+
</layout>
|
34 |
+
<events></events>
|
35 |
+
</frontend>
|
36 |
+
<admin>
|
37 |
+
<routers>
|
38 |
+
<Base>
|
39 |
+
<use>admin</use>
|
40 |
+
<args>
|
41 |
+
<module>Narfstudios_Base</module>
|
42 |
+
<frontName>Base</frontName>
|
43 |
+
</args>
|
44 |
+
</Base>
|
45 |
+
</routers>
|
46 |
+
</admin>
|
47 |
+
<adminhtml>
|
48 |
+
<acl>
|
49 |
+
<resources>
|
50 |
+
<all>
|
51 |
+
<title>Allow Everything</title>
|
52 |
+
</all>
|
53 |
+
<admin>
|
54 |
+
<children>
|
55 |
+
<Narfstudios_Base>
|
56 |
+
<title>Base Module</title>
|
57 |
+
<sort_order>10</sort_order>
|
58 |
+
</Narfstudios_Base>
|
59 |
+
</children>
|
60 |
+
</admin>
|
61 |
+
</resources>
|
62 |
+
</acl>
|
63 |
+
<translate>
|
64 |
+
<modules>
|
65 |
+
<Narfstudios_Base>
|
66 |
+
<files>
|
67 |
+
<default>Narfstudios_Base.csv</default>
|
68 |
+
</files>
|
69 |
+
</Narfstudios_Base>
|
70 |
+
</modules>
|
71 |
+
</translate>
|
72 |
+
<layout>
|
73 |
+
<updates>
|
74 |
+
<Base>
|
75 |
+
<file>Base.xml</file>
|
76 |
+
</Base>
|
77 |
+
</updates>
|
78 |
+
</layout>
|
79 |
+
<events>
|
80 |
+
<controller_action_predispatch>
|
81 |
+
<observers>
|
82 |
+
<narfstudios_base>
|
83 |
+
<type>singleton</type>
|
84 |
+
<class>base/feed</class>
|
85 |
+
<method>checkForNews</method>
|
86 |
+
</narfstudios_base>
|
87 |
+
</observers>
|
88 |
+
</controller_action_predispatch>
|
89 |
+
</events>
|
90 |
+
</adminhtml>
|
91 |
+
<global>
|
92 |
+
<models>
|
93 |
+
<base>
|
94 |
+
<class>Narfstudios_Base_Model</class>
|
95 |
+
</base>
|
96 |
+
</models>
|
97 |
+
<blocks>
|
98 |
+
<Base>
|
99 |
+
<class>Narfstudios_Base_Block</class>
|
100 |
+
</Base>
|
101 |
+
<adminhtml>
|
102 |
+
<rewrite>
|
103 |
+
<system_config_form>Narfstudios_Base_Block_Adminhtml_System_Config_Form</system_config_form>
|
104 |
+
<system_config_form_fieldset>Narfstudios_Base_Block_Adminhtml_System_Config_Form_Fieldset</system_config_form_fieldset>
|
105 |
+
</rewrite>
|
106 |
+
</adminhtml>
|
107 |
+
</blocks>
|
108 |
+
<helpers>
|
109 |
+
<Base>
|
110 |
+
<class>Narfstudios_Base_Helper</class>
|
111 |
+
</Base>
|
112 |
+
</helpers>
|
113 |
+
</global>
|
114 |
+
<default>
|
115 |
+
<base>
|
116 |
+
<feed>
|
117 |
+
<url>www.narf-studios.de/de/magento.xml</url>
|
118 |
+
</feed>
|
119 |
+
</base>
|
120 |
+
</default>
|
121 |
+
</config>
|
app/code/community/Narfstudios/ProductNavigation/Block/Catalog/Product/View.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Product View block
|
4 |
+
*
|
5 |
+
* @package Narfstudios
|
6 |
+
* @module ProductNavigation
|
7 |
+
*/
|
8 |
+
class Narfstudios_ProductNavigation_Block_Catalog_Product_View extends Mage_Catalog_Block_Product_View
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Return the Navigation urls from the XML file for the current category
|
12 |
+
* @return <type>
|
13 |
+
*/
|
14 |
+
public function getNavigationUrls() {
|
15 |
+
// get the current category
|
16 |
+
$burl = $this->helper('core/url')->getCurrentUrl();
|
17 |
+
$layer = Mage::getSingleton('catalog/layer');
|
18 |
+
$_category = $layer->getCurrentCategory();
|
19 |
+
|
20 |
+
// load the url array
|
21 |
+
$navigateProducts = Mage::helper('ProductNavigation')->getCategoryProductUrls($this->getProduct()->getId(), $_category->getId());
|
22 |
+
if(!empty($navigateProducts['currentPosition'])) {
|
23 |
+
return $navigateProducts;
|
24 |
+
} else {
|
25 |
+
return array();
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
app/code/community/Narfstudios/ProductNavigation/Helper/.Data.php.swp
ADDED
Binary file
|
app/code/community/Narfstudios/ProductNavigation/Helper/Data.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Helper
|
4 |
+
*
|
5 |
+
* @package Narfstudios
|
6 |
+
* @module ProductNavigation
|
7 |
+
*/
|
8 |
+
class Narfstudios_ProductNavigation_Helper_Data extends Mage_Core_Helper_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* returns the optimizer xml path
|
13 |
+
* @return string Path to the file
|
14 |
+
*/
|
15 |
+
function getXmlFilepath() {
|
16 |
+
// prepare model and path
|
17 |
+
$sitemap = Mage::getModel('ProductNavigation/sitemap');
|
18 |
+
$path = $_SERVER['DOCUMENT_ROOT'].'/sitemap/';
|
19 |
+
|
20 |
+
// Get the filename of the xml
|
21 |
+
if($sitemap) {
|
22 |
+
return $path.$sitemap->getOptimizedSitemapFilename();
|
23 |
+
}
|
24 |
+
// default
|
25 |
+
return $path.'sitemap-optimizer.xml';
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Looking for the current position of the product/category combination in the xml an return
|
31 |
+
* whole url array with the pointer to the current position
|
32 |
+
* @param $productid
|
33 |
+
* @param $categoryid
|
34 |
+
* @return array The url array
|
35 |
+
*/
|
36 |
+
public function getCategoryProductUrls($productid, $categoryid) {
|
37 |
+
|
38 |
+
// get the data from the sitemap-optimizer.xml
|
39 |
+
$file = $this->getXmlFilepath();
|
40 |
+
if (file_exists($file)) {
|
41 |
+
$xml = simplexml_load_file($file);
|
42 |
+
|
43 |
+
// variables to prepare navigation
|
44 |
+
$i=0;
|
45 |
+
$next = false;
|
46 |
+
|
47 |
+
// check each element
|
48 |
+
foreach($xml as $index => $elem) {
|
49 |
+
$ns_dc = $elem->children('http://www.narf-studios.de');
|
50 |
+
$locurl = (string)$elem->loc;
|
51 |
+
$type = (string)$ns_dc->type;
|
52 |
+
$catid = (int)$ns_dc->catid;
|
53 |
+
$pid = (int)$ns_dc->pid;
|
54 |
+
|
55 |
+
if( $catid == $categoryid && $type == 'category_product' ) {
|
56 |
+
$i++;
|
57 |
+
|
58 |
+
// save the next
|
59 |
+
if($next == true) {
|
60 |
+
$navigateProducts[1] = $locurl;
|
61 |
+
$next = false;
|
62 |
+
}
|
63 |
+
|
64 |
+
// current element
|
65 |
+
if($productid == $pid) {
|
66 |
+
// get the one before
|
67 |
+
$navigateProducts[0] = $before;
|
68 |
+
// save the current
|
69 |
+
$navigateProducts['currentPosition'] = $i;
|
70 |
+
// make sure next will be loaded
|
71 |
+
$next = true;
|
72 |
+
}
|
73 |
+
|
74 |
+
// element before
|
75 |
+
$before = $locurl;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
$navigateProducts['count'] = $i;
|
79 |
+
return $navigateProducts;
|
80 |
+
|
81 |
+
} else {
|
82 |
+
Mage::log('Sitemap not found in '.$file);
|
83 |
+
}
|
84 |
+
return array();
|
85 |
+
}
|
86 |
+
}
|
87 |
+
?>
|
app/code/community/Narfstudios/ProductNavigation/Model/Sitemap.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Navigation URL model
|
4 |
+
*
|
5 |
+
* @package Narfstudios
|
6 |
+
* @module ProductNavigation
|
7 |
+
*/
|
8 |
+
class Narfstudios_ProductNavigation_Model_Sitemap extends Mage_Sitemap_Model_Sitemap
|
9 |
+
{
|
10 |
+
private $urlkeys;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Returns the name of the xml file
|
14 |
+
* TODO: get the value from systemconfig
|
15 |
+
*/
|
16 |
+
public function getOptimizedSitemapFilename() {
|
17 |
+
return 'sitemap-optimizer.xml';
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Returns an xml file with contains the urls for
|
22 |
+
* - categories url
|
23 |
+
* - products in categories (with the ids of products and category)
|
24 |
+
* - products url
|
25 |
+
* - other cms pages
|
26 |
+
* This can e.g. be used to create a horizontal navigation in the product view
|
27 |
+
* @return Mage_Sitemap_Model_Sitemap
|
28 |
+
*/
|
29 |
+
public function generateXml()
|
30 |
+
{
|
31 |
+
$io = new Varien_Io_File();
|
32 |
+
$io->setAllowCreateFolders(true);
|
33 |
+
$io->open(array('path' => $this->getPath()));
|
34 |
+
|
35 |
+
|
36 |
+
if ($io->fileExists($this->getOptimizedSitemapFilename()) && !$io->isWriteable($this->getOptimizedSitemapFilename())) {
|
37 |
+
Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getOptimizedSitemapFilename(), $this->getPath()));
|
38 |
+
}
|
39 |
+
|
40 |
+
$io->streamOpen($this->getOptimizedSitemapFilename());
|
41 |
+
|
42 |
+
$io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
|
43 |
+
$io->streamWrite('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:narfstudios="http://www.narf-studios.de">');
|
44 |
+
|
45 |
+
$storeId = $this->getStoreId();
|
46 |
+
$date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
|
47 |
+
$baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Generate categories sitemap
|
51 |
+
*/
|
52 |
+
$changefreq = (string)Mage::getStoreConfig('sitemap/category/changefreq', $storeId);
|
53 |
+
$priority = (string)Mage::getStoreConfig('sitemap/category/priority', $storeId);
|
54 |
+
$collection = Mage::getResourceModel('sitemap/catalog_category')->getCollection($storeId);
|
55 |
+
foreach ($collection as $item) {
|
56 |
+
$url = $baseUrl . $item->getUrl();
|
57 |
+
$url = str_replace('/index.php', '', $url);
|
58 |
+
$xml = sprintf('<url><narfstudios:type>category</narfstudios:type><narfstudios:catid>'.$item->getId().'</narfstudios:catid><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>',
|
59 |
+
htmlspecialchars($url),
|
60 |
+
$date,
|
61 |
+
$changefreq,
|
62 |
+
$priority
|
63 |
+
);
|
64 |
+
$io->streamWrite($xml);
|
65 |
+
}
|
66 |
+
unset($collection);
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Generate products in categories sitemap
|
70 |
+
*/
|
71 |
+
$collection = Mage::getResourceModel('sitemap/catalog_category')->getCollection($storeId);
|
72 |
+
foreach ($collection as $item) {
|
73 |
+
$category = Mage::getModel('catalog/category')->load($item->getId());
|
74 |
+
|
75 |
+
$pCollection= $category->getProductCollection();
|
76 |
+
$pCollection->addAttributeToFilter('status', 1);
|
77 |
+
$pCollection->addAttributeToFilter('visibility', 4); //catalog, search
|
78 |
+
$pCollection->addAttributeToSort('name', 'asc');
|
79 |
+
foreach ($pCollection as $product)
|
80 |
+
{
|
81 |
+
$product = Mage::getModel('catalog/product')->load($product->getId());
|
82 |
+
$burl = Mage::getBaseUrl().Mage::getModel('core/url_rewrite')->loadByIdPath('product/'.$product->getId().'/'.$category->getId())->getRequestPath();
|
83 |
+
$url = str_replace('/index.php', '', $burl);
|
84 |
+
|
85 |
+
$xml = sprintf('<url><narfstudios:type>category_product</narfstudios:type><narfstudios:catid>'.$category->getId().'</narfstudios:catid><narfstudios:pid>'.$product->getId().'</narfstudios:pid><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>',
|
86 |
+
htmlspecialchars($url),
|
87 |
+
$date,
|
88 |
+
$changefreq,
|
89 |
+
$priority);
|
90 |
+
$io->streamWrite($xml);
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Generate products sitemap
|
96 |
+
*/
|
97 |
+
$changefreq = (string)Mage::getStoreConfig('sitemap/product/changefreq', $storeId);
|
98 |
+
$priority = (string)Mage::getStoreConfig('sitemap/product/priority', $storeId);
|
99 |
+
$collection = Mage::getResourceModel('sitemap/catalog_product')->getCollection($storeId);
|
100 |
+
foreach ($collection as $item) {
|
101 |
+
$xml = sprintf('<url><narfstudios:type>product</narfstudios:type><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>',
|
102 |
+
htmlspecialchars($baseUrl . $item->getUrl()),
|
103 |
+
$date,
|
104 |
+
$changefreq,
|
105 |
+
$priority
|
106 |
+
);
|
107 |
+
$io->streamWrite($xml);
|
108 |
+
}
|
109 |
+
unset($collection);
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Generate cms pages sitemap
|
113 |
+
*/
|
114 |
+
$changefreq = (string)Mage::getStoreConfig('sitemap/page/changefreq', $storeId);
|
115 |
+
$priority = (string)Mage::getStoreConfig('sitemap/page/priority', $storeId);
|
116 |
+
$collection = Mage::getResourceModel('sitemap/cms_page')->getCollection($storeId);
|
117 |
+
foreach ($collection as $item) {
|
118 |
+
$xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>',
|
119 |
+
htmlspecialchars($baseUrl . $item->getUrl()),
|
120 |
+
$date,
|
121 |
+
$changefreq,
|
122 |
+
$priority
|
123 |
+
);
|
124 |
+
$io->streamWrite($xml);
|
125 |
+
}
|
126 |
+
unset($collection);
|
127 |
+
|
128 |
+
$io->streamWrite('</urlset>');
|
129 |
+
$io->streamClose();
|
130 |
+
|
131 |
+
$this->setSitemapTime(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
|
132 |
+
$this->save();
|
133 |
+
|
134 |
+
parent::generateXml();
|
135 |
+
|
136 |
+
return $this;
|
137 |
+
}
|
138 |
+
}
|
app/code/community/Narfstudios/ProductNavigation/etc/config.xml
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Narfstudios_ProductNavigation>
|
5 |
+
<version>1.0.3</version>
|
6 |
+
</Narfstudios_ProductNavigation>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<ProductNavigation>
|
11 |
+
<class>Narfstudios_ProductNavigation_Model</class>
|
12 |
+
<resourceModel>ProductNavigation_mysql4</resourceModel>
|
13 |
+
</ProductNavigation>
|
14 |
+
<sitemap>
|
15 |
+
<rewrite>
|
16 |
+
<sitemap>Narfstudios_ProductNavigation_Model_Sitemap</sitemap>
|
17 |
+
</rewrite>
|
18 |
+
</sitemap>
|
19 |
+
<productnavigation_mysql4>
|
20 |
+
<class>Mage_Sitemap_Model_Mysql4</class>
|
21 |
+
<entities>
|
22 |
+
<sitemap>
|
23 |
+
<table>sitemap</table>
|
24 |
+
</sitemap>
|
25 |
+
</entities>
|
26 |
+
</productnavigation_mysql4>
|
27 |
+
</models>
|
28 |
+
<blocks>
|
29 |
+
<ProductNavigation>
|
30 |
+
<class>Narfstudios_ProductNavigation_Block</class>
|
31 |
+
</ProductNavigation>
|
32 |
+
<catalog>
|
33 |
+
<rewrite>
|
34 |
+
<product_view>Narfstudios_ProductNavigation_Block_Catalog_Product_View</product_view>
|
35 |
+
</rewrite>
|
36 |
+
</catalog>
|
37 |
+
</blocks>
|
38 |
+
<helpers>
|
39 |
+
<ProductNavigation>
|
40 |
+
<class>Narfstudios_ProductNavigation_Helper</class>
|
41 |
+
</ProductNavigation>
|
42 |
+
</helpers>
|
43 |
+
</global>
|
44 |
+
<frontend>
|
45 |
+
<routers>
|
46 |
+
<ProductNavigation>
|
47 |
+
<use>standard</use>
|
48 |
+
<args>
|
49 |
+
<module>Narfstudios_ProductNavigation</module>
|
50 |
+
<frontName>productnavigation</frontName>
|
51 |
+
</args>
|
52 |
+
</ProductNavigation>
|
53 |
+
</routers>
|
54 |
+
<layout>
|
55 |
+
<updates>
|
56 |
+
<ProductNavigation>
|
57 |
+
<file>productnavigation.xml</file>
|
58 |
+
</ProductNavigation>
|
59 |
+
</updates>
|
60 |
+
</layout>
|
61 |
+
<translate>
|
62 |
+
<modules>
|
63 |
+
<Narfstudios_ProductNavigation>
|
64 |
+
<files>
|
65 |
+
<default>Narfstudios_ProductNavigation.csv</default>
|
66 |
+
</files>
|
67 |
+
</Narfstudios_ProductNavigation>
|
68 |
+
</modules>
|
69 |
+
</translate>
|
70 |
+
</frontend>
|
71 |
+
</config>
|
app/design/frontend/base/default/layout/productnavigation.xml
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<catalog_product_view>
|
4 |
+
<reference name="product.info">
|
5 |
+
<action method="setTemplate"><template>productnavigation/catalog/product/view.phtml</template></action>
|
6 |
+
<action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/summary.phtml</template></action>
|
7 |
+
<action method="addReviewSummaryTemplate"><type>short</type><template>review/helper/summary_short.phtml</template></action>
|
8 |
+
<action method="addReviewSummaryTemplate"><type>...</type><template>...</template></action>
|
9 |
+
|
10 |
+
<block type="ProductNavigation/catalog_product_view" name="product.horizontal.navigation" as="horizontal_navigation" template="productnavigation/catalog/product/view/navigation.phtml"/>
|
11 |
+
<block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml"/>
|
12 |
+
<block type="core/text_list" name="alert.urls" as="alert_urls" translate="label">
|
13 |
+
<label>Alert Urls</label>
|
14 |
+
</block>
|
15 |
+
|
16 |
+
<action method="setTierPriceTemplate"><template>catalog/product/view/tierprices.phtml</template></action>
|
17 |
+
|
18 |
+
<block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="catalog/product/list/upsell.phtml">
|
19 |
+
<action method="setColumnCount"><columns>4</columns></action>
|
20 |
+
<action method="setItemLimit"><type>upsell</type><limit>4</limit></action>
|
21 |
+
</block>
|
22 |
+
|
23 |
+
<block type="catalog/product_view_additional" name="product.info.additional" as="product_additional_data" />
|
24 |
+
<block type="catalog/product_view_description" name="product.description" as="description" template="catalog/product/view/description.phtml">
|
25 |
+
<action method="addToParentGroup"><group>detailed_info</group></action>
|
26 |
+
</block>
|
27 |
+
<block type="catalog/product_view_attributes" name="product.attributes" as="additional" template="catalog/product/view/attributes.phtml">
|
28 |
+
<action method="addToParentGroup"><group>detailed_info</group></action>
|
29 |
+
</block>
|
30 |
+
<block type="catalog/product_view" name="product.info.addto" as="addto" template="catalog/product/view/addto.phtml"/>
|
31 |
+
<block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="catalog/product/view/addtocart.phtml"/>
|
32 |
+
|
33 |
+
<block type="core/text_list" name="product.info.extrahint" as="extrahint" translate="label">
|
34 |
+
<label>Product View Extra Hint</label>
|
35 |
+
</block>
|
36 |
+
|
37 |
+
<block type="catalog/product_view" name="product.info.options.wrapper" as="product_options_wrapper" template="catalog/product/view/options/wrapper.phtml" translate="label">
|
38 |
+
<label>Info Column Options Wrapper</label>
|
39 |
+
<block type="core/template" name="options_js" template="catalog/product/view/options/js.phtml"/>
|
40 |
+
<block type="catalog/product_view_options" name="product.info.options" as="product_options" template="catalog/product/view/options.phtml">
|
41 |
+
<action method="addOptionRenderer"><type>text</type><block>catalog/product_view_options_type_text</block><template>catalog/product/view/options/type/text.phtml</template></action>
|
42 |
+
<action method="addOptionRenderer"><type>file</type><block>catalog/product_view_options_type_file</block><template>catalog/product/view/options/type/file.phtml</template></action>
|
43 |
+
<action method="addOptionRenderer"><type>select</type><block>catalog/product_view_options_type_select</block><template>catalog/product/view/options/type/select.phtml</template></action>
|
44 |
+
<action method="addOptionRenderer"><type>date</type><block>catalog/product_view_options_type_date</block><template>catalog/product/view/options/type/date.phtml</template></action>
|
45 |
+
</block>
|
46 |
+
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
|
47 |
+
</block>
|
48 |
+
<block type="catalog/product_view" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="catalog/product/view/options/wrapper/bottom.phtml" translate="label">
|
49 |
+
<label>Bottom Block Options Wrapper</label>
|
50 |
+
<action method="insert"><block>product.tierprices</block></action>
|
51 |
+
<block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/>
|
52 |
+
<action method="append"><block>product.info.addtocart</block></action>
|
53 |
+
<action method="append"><block>product.info.addto</block></action>
|
54 |
+
</block>
|
55 |
+
|
56 |
+
<block type="core/template_facade" name="product.info.container1" as="container1">
|
57 |
+
<action method="setDataByKey"><key>alias_in_layout</key><value>container1</value></action>
|
58 |
+
<action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
|
59 |
+
<action method="append"><block>product.info.options.wrapper</block></action>
|
60 |
+
<action method="append"><block>product.info.options.wrapper.bottom</block></action>
|
61 |
+
</block>
|
62 |
+
<block type="core/template_facade" name="product.info.container2" as="container2">
|
63 |
+
<action method="setDataByKey"><key>alias_in_layout</key><value>container2</value></action>
|
64 |
+
<action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
|
65 |
+
<action method="append"><block>product.info.options.wrapper</block></action>
|
66 |
+
<action method="append"><block>product.info.options.wrapper.bottom</block></action>
|
67 |
+
</block>
|
68 |
+
<action method="unsetCallChild"><child>container1</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
|
69 |
+
<action method="unsetCallChild"><child>container2</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
|
70 |
+
</reference>
|
71 |
+
</catalog_product_view>
|
72 |
+
</layout>
|
app/design/frontend/base/default/template/productnavigation/catalog/product/view.phtml
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Product view template
|
29 |
+
*
|
30 |
+
* @see Mage_Catalog_Block_Product_View
|
31 |
+
* @see Mage_Review_Block_Product_View
|
32 |
+
*/
|
33 |
+
?>
|
34 |
+
<?php $_helper = $this->helper('catalog/output'); ?>
|
35 |
+
<?php $_product = $this->getProduct(); ?>
|
36 |
+
<script type="text/javascript">
|
37 |
+
var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
|
38 |
+
</script>
|
39 |
+
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
|
40 |
+
<div class="product-view">
|
41 |
+
<div class="product-essential">
|
42 |
+
<form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
|
43 |
+
<div class="no-display">
|
44 |
+
<input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
|
45 |
+
<input type="hidden" name="related_product" id="related-products-field" value="" />
|
46 |
+
</div>
|
47 |
+
|
48 |
+
<div class="product-shop">
|
49 |
+
<div class="product-name">
|
50 |
+
<h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
|
51 |
+
<?php echo $this->getChildHtml('horizontal_navigation') ?>
|
52 |
+
</div>
|
53 |
+
|
54 |
+
<?php if ($this->canEmailToFriend()): ?>
|
55 |
+
<p class="email-friend"><a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>"><?php echo $this->__('Email to a Friend') ?></a></p>
|
56 |
+
<?php endif; ?>
|
57 |
+
|
58 |
+
<?php echo $this->getReviewsSummaryHtml($_product, false, true)?>
|
59 |
+
<?php echo $this->getChildHtml('alert_urls') ?>
|
60 |
+
<?php echo $this->getChildHtml('product_type_data') ?>
|
61 |
+
<?php echo $this->getTierPriceHtml() ?>
|
62 |
+
<?php echo $this->getChildHtml('extrahint') ?>
|
63 |
+
|
64 |
+
<?php if (!$this->hasOptions()):?>
|
65 |
+
<div class="add-to-box">
|
66 |
+
<?php if($_product->isSaleable()): ?>
|
67 |
+
<?php echo $this->getChildHtml('addtocart') ?>
|
68 |
+
<?php if( $this->helper('wishlist')->isAllow() || $_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product)): ?>
|
69 |
+
<span class="or"><?php echo $this->__('OR') ?></span>
|
70 |
+
<?php endif; ?>
|
71 |
+
<?php endif; ?>
|
72 |
+
<?php echo $this->getChildHtml('addto') ?>
|
73 |
+
</div>
|
74 |
+
<?php echo $this->getChildHtml('extra_buttons') ?>
|
75 |
+
<?php endif; ?>
|
76 |
+
|
77 |
+
<?php if ($_product->getShortDescription()):?>
|
78 |
+
<div class="short-description">
|
79 |
+
<h2><?php echo $this->__('Quick Overview') ?></h2>
|
80 |
+
<div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>
|
81 |
+
</div>
|
82 |
+
<?php endif;?>
|
83 |
+
|
84 |
+
<?php echo $this->getChildHtml('other');?>
|
85 |
+
|
86 |
+
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
|
87 |
+
<?php echo $this->getChildChildHtml('container1', '', true, true) ?>
|
88 |
+
<?php endif;?>
|
89 |
+
|
90 |
+
</div>
|
91 |
+
|
92 |
+
<div class="product-img-box">
|
93 |
+
<?php echo $this->getChildHtml('media') ?>
|
94 |
+
</div>
|
95 |
+
|
96 |
+
<div class="clearer"></div>
|
97 |
+
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
|
98 |
+
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
|
99 |
+
<?php endif;?>
|
100 |
+
</form>
|
101 |
+
<script type="text/javascript">
|
102 |
+
//<![CDATA[
|
103 |
+
var productAddToCartForm = new VarienForm('product_addtocart_form');
|
104 |
+
productAddToCartForm.submit = function(button, url) {
|
105 |
+
if (this.validator.validate()) {
|
106 |
+
var form = this.form;
|
107 |
+
var oldUrl = form.action;
|
108 |
+
|
109 |
+
if (url) {
|
110 |
+
form.action = url;
|
111 |
+
}
|
112 |
+
var e = null;
|
113 |
+
try {
|
114 |
+
this.form.submit();
|
115 |
+
} catch (e) {
|
116 |
+
}
|
117 |
+
this.form.action = oldUrl;
|
118 |
+
if (e) {
|
119 |
+
throw e;
|
120 |
+
}
|
121 |
+
|
122 |
+
if (button && button != 'undefined') {
|
123 |
+
button.disabled = true;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}.bind(productAddToCartForm);
|
127 |
+
|
128 |
+
productAddToCartForm.submitLight = function(button, url){
|
129 |
+
if(this.validator) {
|
130 |
+
var nv = Validation.methods;
|
131 |
+
delete Validation.methods['required-entry'];
|
132 |
+
delete Validation.methods['validate-one-required'];
|
133 |
+
delete Validation.methods['validate-one-required-by-name'];
|
134 |
+
if (this.validator.validate()) {
|
135 |
+
if (url) {
|
136 |
+
this.form.action = url;
|
137 |
+
}
|
138 |
+
this.form.submit();
|
139 |
+
}
|
140 |
+
Object.extend(Validation.methods, nv);
|
141 |
+
}
|
142 |
+
}.bind(productAddToCartForm);
|
143 |
+
//]]>
|
144 |
+
</script>
|
145 |
+
</div>
|
146 |
+
|
147 |
+
<div class="product-collateral">
|
148 |
+
<?php foreach ($this->getChildGroup('detailed_info', 'getChildHtml') as $alias => $html):?>
|
149 |
+
<div class="box-collateral <?php echo "box-{$alias}"?>">
|
150 |
+
<?php if ($title = $this->getChildData($alias, 'title')):?>
|
151 |
+
<h2><?php echo $this->escapeHtml($title); ?></h2>
|
152 |
+
<?php endif;?>
|
153 |
+
<?php echo $html; ?>
|
154 |
+
</div>
|
155 |
+
<?php endforeach;?>
|
156 |
+
<?php echo $this->getChildHtml('upsell_products') ?>
|
157 |
+
<?php echo $this->getChildHtml('product_additional_data') ?>
|
158 |
+
</div>
|
159 |
+
</div>
|
app/design/frontend/base/default/template/productnavigation/catalog/product/view/navigation.phtml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $navigateProductsArray = $this->getNavigationUrls(); ?>
|
2 |
+
<?php if(!empty($navigateProductsArray)) : ?>
|
3 |
+
<span id="product-horizontal-navigation" style="float: right;">
|
4 |
+
<?php if($navigateProductsArray[0] != '') { ?><a href="<?php echo $navigateProductsArray[0]; ?>" title="<?php echo Mage::helper('ProductNavigation')->__('previous product') ?>" style="text-decoration: none;"><span> <strong><</strong> </span></a><?php } ?>
|
5 |
+
<?php if($navigateProductsArray['count'] > 1) { ?><span><?php echo $navigateProductsArray['currentPosition']; ?> <?php echo Mage::helper('ProductNavigation')->__('of') ?> <?php echo $navigateProductsArray['count']; ?></span><?php } ?>
|
6 |
+
<?php if($navigateProductsArray[1] != '') { ?><a href="<?php echo $navigateProductsArray[1]; ?>" title="<?php echo Mage::helper('ProductNavigation')->__('next product') ?>" style="text-decoration: none;"><span> <strong>></strong> </span></a><?php } ?>
|
7 |
+
</span>
|
8 |
+
<div style="clear: both;"></div>
|
9 |
+
<?php endif; ?>
|
app/etc/modules/Narfstudios_Base.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Narfstudios_Base>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
<active>true</active>
|
7 |
+
<codePool>community</codePool>
|
8 |
+
</Narfstudios_Base>
|
9 |
+
</modules>
|
10 |
+
</config>
|
app/etc/modules/Narfstudios_ProductNavigation.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Narfstudios_ProductNavigation>
|
5 |
+
<version>1.0.3</version>
|
6 |
+
<active>true</active>
|
7 |
+
<codePool>community</codePool>
|
8 |
+
<depends>
|
9 |
+
<Mage_Sitemap />
|
10 |
+
<Narfstudios_Base />
|
11 |
+
</depends>
|
12 |
+
</Narfstudios_ProductNavigation>
|
13 |
+
</modules>
|
14 |
+
</config>
|
app/locale/de_AT/Narfstudios_ProductNavigation.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
"previous product", "vorheriges Produkt"
|
2 |
+
"next product", "nächstes Produkt"
|
3 |
+
"of", "von"
|
app/locale/de_CH/Narfstudios_ProductNavigation.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
"previous product", "vorheriges Produkt"
|
2 |
+
"next product", "nächstes Produkt"
|
3 |
+
"of", "von"
|
app/locale/de_DE/Narfstudios_ProductNavigation.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
"previous product", "vorheriges Produkt"
|
2 |
+
"next product", "nächstes Produkt"
|
3 |
+
"of", "von"
|
package.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Narfstudios_ProductNavigation-stable</name>
|
4 |
+
<version>1.0.5</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This module offers a horizontal navigation in the products view to the other products in this category.</summary>
|
10 |
+
<description>This module offers a horizontal navigation in the products view to the other products in this category.
|
11 |
+
This will be realized over a sitemap-optimizer.xml file which contains following urls:
|
12 |
+
categories
|
13 |
+
products
|
14 |
+
products in different categories
|
15 |
+
cms pages
|
16 |
+

|
17 |
+
Requirements:
|
18 |
+
Magento 1.4.x, 1.5.x, 1.6.x</li>
|
19 |
+
Mage_Sitemap module must be enabled
|
20 |
+
Narfstudios_Base must be installed and can be found under https://github.com/narf-studios/magento-narfstudios-base
|
21 |
+

|
22 |
+
Installation:
|
23 |
+
Copy the folder structure into your Magento system
|
24 |
+
Create a sitemap folder in your Magento root directory
|
25 |
+
Go to Catalog/Google Sitemap in your Adminarea and generate a sitemap in the sitemap/ folder
|
26 |
+
Configure the templates if you want to change the look and the position of the navigation
|
27 |
+

|
28 |
+
I do not see a navigation. What can I do?
|
29 |
+
Check if there is a file called sitemap-optimizer.xml in your sitemap folder</li>
|
30 |
+
Check if the navigation templates are configured correctly</description>
|
31 |
+
<notes>Add fix for double template output on product page</notes>
|
32 |
+
<authors><author><name>Sven Haertwig</name><user>shaertwig</user><email>s.haertwig@narf-studios.de</email></author></authors>
|
33 |
+
<date>2011-11-04</date>
|
34 |
+
<time>13:13:10</time>
|
35 |
+
<contents><target name="magecommunity"><dir name="Narfstudios"><dir name="ProductNavigation"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="View.php" hash="4ed771e64ed34bdfc9a68c2bceafd176"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="9cdd38284e9113332f02e4b6691db95c"/><file name=".Data.php.swp" hash="428b36d04afc333dbb5d63c370477001"/></dir><dir name="Model"><file name="Sitemap.php" hash="e23dd2009858f8e61b3b013c50aeda71"/></dir><dir name="etc"><file name="config.xml" hash="2ecd54bad7aac3a58dbe14e92ed3043f"/></dir></dir><dir name="Base"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Fieldset.php" hash="610f581fb8b77c45b0ff399bada9255b"/></dir><file name="Form.php" hash="568924ddd2f6be037ec13a4b49b45cd6"/></dir></dir></dir></dir><dir name="Model"><file name="Feed.php" hash="a0cb6222f90df6b680a5ce78b57a67aa"/></dir><dir name="etc"><file name="config.xml" hash="1d12923f47c31c61df571009eb95f3ca"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="productnavigation"><dir name="catalog"><dir name="product"><dir name="view"><file name="navigation.phtml" hash="8150b686331b81d2575e59f10b9fd6fb"/></dir><file name="view.phtml" hash="cb6f5e8febbbc711fb8afb9b1522f9e3"/></dir></dir></dir></dir><dir name="layout"><file name="productnavigation.xml" hash="5ef2370e679e0700e94eca216b5c9fc6"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Narfstudios_ProductNavigation.xml" hash="b9558898a7a8c0e950906905266955e6"/><file name="Narfstudios_Base.xml" hash="27335eabd894339509cce33d5f99cae6"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Narfstudios_ProductNavigation.csv" hash="608581f26289881f61ff2464e057f384"/></dir><dir name="de_CH"><file name="Narfstudios_ProductNavigation.csv" hash="608581f26289881f61ff2464e057f384"/></dir><dir name="de_AT"><file name="Narfstudios_ProductNavigation.csv" hash="608581f26289881f61ff2464e057f384"/></dir></target></contents>
|
36 |
+
<compatible/>
|
37 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
38 |
+
</package>
|