Version Notes
Previous Next ProductPrevious Next Product
Download this release
Release Info
Developer | Fehérdi Lóránd |
Extension | PreviousNext |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Heaven7/Previousnext/Helper/Data.php +51 -0
- app/code/community/Heaven7/Previousnext/Model/Openin.php +18 -0
- app/code/community/Heaven7/Previousnext/Model/Position.php +34 -0
- app/code/community/Heaven7/Previousnext/Model/Type.php +18 -0
- app/code/community/Heaven7/Previousnext/etc/config.xml +95 -0
- app/code/community/Heaven7/Previousnext/etc/system.xml +152 -0
- app/design/frontend/base/default/layout/previousnext.xml +14 -0
- app/design/frontend/base/default/template/previousnext/after.phtml +86 -0
- app/design/frontend/base/default/template/previousnext/before.phtml +77 -0
- app/etc/modules/Heaven7_Previousnext.xml +29 -0
- package.xml +18 -0
- skin/frontend/base/default/css/previousnext.css +7 -0
app/code/community/Heaven7/Previousnext/Helper/Data.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Heaven7_Previousnext_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* @return Mage_Catalog_Model_Product or FALSE
|
6 |
+
*/
|
7 |
+
public function getPreviousProduct()
|
8 |
+
{
|
9 |
+
$prodId = Mage::registry('current_product')->getId();
|
10 |
+
$positions = Mage::getSingleton('core/session')->getInchooFilteredCategoryProductCollection();
|
11 |
+
if (!$positions && method_exists(Mage::registry('current_category'), 'getProductsPosition')) {
|
12 |
+
$positions = array_reverse(array_keys(Mage::registry('current_category')->getProductsPosition()));
|
13 |
+
} else{
|
14 |
+
return false;
|
15 |
+
}
|
16 |
+
$cpk = @array_search($prodId, $positions);
|
17 |
+
$slice = array_reverse(array_slice($positions, 0, $cpk));
|
18 |
+
foreach ($slice as $productId) {
|
19 |
+
$product = Mage::getModel('catalog/product')
|
20 |
+
->load($productId);
|
21 |
+
if ($product && $product->getId() && $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility()) {
|
22 |
+
return $product;
|
23 |
+
}
|
24 |
+
}
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
/**
|
28 |
+
* @return Mage_Catalog_Model_Product or FALSE
|
29 |
+
*/
|
30 |
+
public function getNextProduct()
|
31 |
+
{
|
32 |
+
$prodId = Mage::registry('current_product')->getId();
|
33 |
+
$positions = Mage::getSingleton('core/session')->getInchooFilteredCategoryProductCollection();
|
34 |
+
if (!$positions && method_exists(Mage::registry('current_category'), 'getProductsPosition')) {
|
35 |
+
$positions = array_reverse(array_keys(Mage::registry('current_category')->getProductsPosition()));
|
36 |
+
} else{
|
37 |
+
return false;
|
38 |
+
}
|
39 |
+
$cpk = @array_search($prodId, $positions);
|
40 |
+
$slice = array_slice($positions, $cpk + 1, count($positions));
|
41 |
+
foreach ($slice as $productId) {
|
42 |
+
$product = Mage::getModel('catalog/product')
|
43 |
+
->load($productId);
|
44 |
+
if ($product && $product->getId() && $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility()) {
|
45 |
+
return $product;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
return false;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
app/code/community/Heaven7/Previousnext/Model/Openin.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Date: 2013.01.03.
|
4 |
+
* Time: 9:27
|
5 |
+
*
|
6 |
+
* @author Fehérdi Lóránd <feherdi.lorand@gmail.com>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Heaven7_Previousnext_Model_Openin{
|
10 |
+
|
11 |
+
public function toOptionArray(){
|
12 |
+
|
13 |
+
$options = array ( 'new_tab' => 'New tab',
|
14 |
+
'same_tab' => 'Same tab');
|
15 |
+
|
16 |
+
return $options;
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Heaven7/Previousnext/Model/Position.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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 |
+
* @category Mage
|
16 |
+
* @package Mage_Paygate
|
17 |
+
* @copyright Copyright (c) 2004-2007 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class Heaven7_Previousnext_Model_Position
|
22 |
+
{
|
23 |
+
public function toOptionArray()
|
24 |
+
{
|
25 |
+
$options = array(
|
26 |
+
array('label'=>'Before', 'value'=>'before'),
|
27 |
+
array('label'=>'After', 'value'=>'after'),
|
28 |
+
array('label'=>'Both', 'value'=>'both'),
|
29 |
+
);
|
30 |
+
|
31 |
+
return $options;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
?>
|
app/code/community/Heaven7/Previousnext/Model/Type.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Date: 2013.01.03.
|
4 |
+
* Time: 9:29
|
5 |
+
*
|
6 |
+
* @author Fehérdi Lóránd <feherdi.lorand@gmail.com>
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Heaven7_Previousnext_Model_Type{
|
10 |
+
|
11 |
+
public function toOptionArray(){
|
12 |
+
|
13 |
+
$options = array('link' => 'Link',
|
14 |
+
'button' => 'Button');
|
15 |
+
|
16 |
+
return $options;
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Heaven7/Previousnext/etc/config.xml
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Heaven7_Previousnext>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Heaven7_Previousnext>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
|
10 |
+
<default>
|
11 |
+
<catalog>
|
12 |
+
<previousnext></previousnext>
|
13 |
+
</catalog>
|
14 |
+
</default>
|
15 |
+
|
16 |
+
|
17 |
+
<frontend>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<previousnext>
|
21 |
+
<file>previousnext.xml</file>
|
22 |
+
</previousnext>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
|
27 |
+
<global>
|
28 |
+
<models>
|
29 |
+
<previousnext>
|
30 |
+
<class>Heaven7_Previousnext_Model</class>
|
31 |
+
</previousnext>
|
32 |
+
</models>
|
33 |
+
|
34 |
+
<helpers>
|
35 |
+
<previousnext>
|
36 |
+
<class>Heaven7_Previousnext_Helper</class>
|
37 |
+
</previousnext>
|
38 |
+
</helpers>
|
39 |
+
</global>
|
40 |
+
|
41 |
+
<adminhtml>
|
42 |
+
<acl>
|
43 |
+
<resources>
|
44 |
+
<all>
|
45 |
+
<title>Heaven71</title>
|
46 |
+
</all>
|
47 |
+
<admin>
|
48 |
+
<children>
|
49 |
+
<system>
|
50 |
+
<children>
|
51 |
+
<config>
|
52 |
+
<children>
|
53 |
+
<heaven7_previousnext>
|
54 |
+
<title>Heaven7 Previous Next Product</title>
|
55 |
+
</heaven7_previousnext>
|
56 |
+
</children>
|
57 |
+
</config>
|
58 |
+
</children>
|
59 |
+
</system>
|
60 |
+
</children>
|
61 |
+
</admin>
|
62 |
+
</resources>
|
63 |
+
</acl>
|
64 |
+
<translate>
|
65 |
+
<modules>
|
66 |
+
<Heaven7_Previousnext>
|
67 |
+
<files>
|
68 |
+
<default>Heaven7_Previousnext.csv</default>
|
69 |
+
</files>
|
70 |
+
</Heaven7_Previousnext>
|
71 |
+
</modules>
|
72 |
+
</translate>
|
73 |
+
</adminhtml>
|
74 |
+
|
75 |
+
<default>
|
76 |
+
<heaven7_previousnext>
|
77 |
+
<general>
|
78 |
+
<enabled_select>1</enabled_select>
|
79 |
+
<position_select>both</position_select>
|
80 |
+
</general>
|
81 |
+
<previous>
|
82 |
+
<enabled_select>1</enabled_select>
|
83 |
+
<type_select>link</type_select>
|
84 |
+
<openin_select>same_tab</openin_select>
|
85 |
+
<label>« Previous (#product#)</label>
|
86 |
+
</previous>
|
87 |
+
<next>
|
88 |
+
<enabled_select>1</enabled_select>
|
89 |
+
<type_select>link</type_select>
|
90 |
+
<openin_select>same_tab</openin_select>
|
91 |
+
<label>Next » (#product#)</label>
|
92 |
+
</next>
|
93 |
+
</heaven7_previousnext>
|
94 |
+
</default>
|
95 |
+
</config>
|
app/code/community/Heaven7/Previousnext/etc/system.xml
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<heaven7_previousnext translate="label" module="previousnext">
|
5 |
+
<label>Heaven7 Extensions</label>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
</heaven7_previousnext>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<heaven7_previousnext translate="label" module="previousnext">
|
11 |
+
<label>Previous Next Product</label>
|
12 |
+
<tab>heaven7_previousnext</tab>
|
13 |
+
<sort_order>1000</sort_order>
|
14 |
+
<show_in_default>1</show_in_default>
|
15 |
+
<show_in_website>1</show_in_website>
|
16 |
+
<show_in_store>1</show_in_store>
|
17 |
+
<groups>
|
18 |
+
<general translate="label" module="previousnext">
|
19 |
+
<label>General</label>
|
20 |
+
<frontend_type>text</frontend_type>
|
21 |
+
<sort_order>1</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>1</show_in_store>
|
25 |
+
<fields>
|
26 |
+
<enabled_select translate="label">
|
27 |
+
<label>Enabled:</label>
|
28 |
+
<frontend_type>select</frontend_type>
|
29 |
+
<sort_order>10</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
34 |
+
</enabled_select>
|
35 |
+
|
36 |
+
<position_select translate="label">
|
37 |
+
<label>Position:</label>
|
38 |
+
<frontend_type>select</frontend_type>
|
39 |
+
<sort_order>30</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
<source_model>previousnext/position</source_model>
|
44 |
+
</position_select>
|
45 |
+
</fields>
|
46 |
+
</general>
|
47 |
+
|
48 |
+
<previous translate="label" module="previousnext">
|
49 |
+
<label>Previous product</label>
|
50 |
+
<frontend_type>text</frontend_type>
|
51 |
+
<sort_order>1000</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>1</show_in_store>
|
55 |
+
<fields>
|
56 |
+
<enabled_select translate="label">
|
57 |
+
<label>Enabled:</label>
|
58 |
+
<comment>Allow to display</comment>
|
59 |
+
<frontend_type>select</frontend_type>
|
60 |
+
<sort_order>10</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
65 |
+
</enabled_select>
|
66 |
+
|
67 |
+
<type_select translate="label">
|
68 |
+
<label>Type:</label>
|
69 |
+
<frontend_type>select</frontend_type>
|
70 |
+
<sort_order>20</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
<source_model>previousnext/type</source_model>
|
75 |
+
</type_select>
|
76 |
+
|
77 |
+
<openin_select translate="label">
|
78 |
+
<label>Open in:</label>
|
79 |
+
<frontend_type>select</frontend_type>
|
80 |
+
<sort_order>30</sort_order>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>1</show_in_website>
|
83 |
+
<show_in_store>1</show_in_store>
|
84 |
+
<source_model>previousnext/openin</source_model>
|
85 |
+
</openin_select>
|
86 |
+
|
87 |
+
<label translate="label">
|
88 |
+
<label>Label:</label>
|
89 |
+
<comment>Button or link text. Ex.: « Previous (#product#)</comment>
|
90 |
+
<frontend_type>text</frontend_type>
|
91 |
+
<sort_order>40</sort_order>
|
92 |
+
<show_in_default>1</show_in_default>
|
93 |
+
<show_in_website>1</show_in_website>
|
94 |
+
<show_in_store>1</show_in_store>
|
95 |
+
</label>
|
96 |
+
</fields>
|
97 |
+
</previous>
|
98 |
+
|
99 |
+
<next translate="label" module="previousnext">
|
100 |
+
<label>Next product</label>
|
101 |
+
<frontend_type>text</frontend_type>
|
102 |
+
<sort_order>1000</sort_order>
|
103 |
+
<show_in_default>1</show_in_default>
|
104 |
+
<show_in_website>1</show_in_website>
|
105 |
+
<show_in_store>1</show_in_store>
|
106 |
+
<fields>
|
107 |
+
<enabled_select translate="label">
|
108 |
+
<label>Enabled:</label>
|
109 |
+
<comment>Allow to display</comment>
|
110 |
+
<frontend_type>select</frontend_type>
|
111 |
+
<sort_order>10</sort_order>
|
112 |
+
<show_in_default>1</show_in_default>
|
113 |
+
<show_in_website>1</show_in_website>
|
114 |
+
<show_in_store>1</show_in_store>
|
115 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
116 |
+
</enabled_select>
|
117 |
+
|
118 |
+
<type_select translate="label">
|
119 |
+
<label>Type:</label>
|
120 |
+
<frontend_type>select</frontend_type>
|
121 |
+
<sort_order>20</sort_order>
|
122 |
+
<show_in_default>1</show_in_default>
|
123 |
+
<show_in_website>1</show_in_website>
|
124 |
+
<show_in_store>1</show_in_store>
|
125 |
+
<source_model>previousnext/type</source_model>
|
126 |
+
</type_select>
|
127 |
+
|
128 |
+
<openin_select translate="label">
|
129 |
+
<label>Open in:</label>
|
130 |
+
<frontend_type>select</frontend_type>
|
131 |
+
<sort_order>30</sort_order>
|
132 |
+
<show_in_default>1</show_in_default>
|
133 |
+
<show_in_website>1</show_in_website>
|
134 |
+
<show_in_store>1</show_in_store>
|
135 |
+
<source_model>previousnext/openin</source_model>
|
136 |
+
</openin_select>
|
137 |
+
|
138 |
+
<label translate="label">
|
139 |
+
<label>Label:</label>
|
140 |
+
<comment>Button or link text. Ex.: Next » (#product#)1</comment>
|
141 |
+
<frontend_type>text</frontend_type>
|
142 |
+
<sort_order>40</sort_order>
|
143 |
+
<show_in_default>1</show_in_default>
|
144 |
+
<show_in_website>1</show_in_website>
|
145 |
+
<show_in_store>1</show_in_store>
|
146 |
+
</label>
|
147 |
+
</fields>
|
148 |
+
</next>
|
149 |
+
</groups>
|
150 |
+
</heaven7_previousnext>
|
151 |
+
</sections>
|
152 |
+
</config>
|
app/design/frontend/base/default/layout/previousnext.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<catalog_product_view>
|
4 |
+
|
5 |
+
<reference name="head">
|
6 |
+
<action method="addItem" ifconfig="heaven7_previousnext/general/enabled_select"><type>skin_css</type><name>css/previousnext.css</name></action>
|
7 |
+
</reference>
|
8 |
+
|
9 |
+
<reference name="content">
|
10 |
+
<block type="core/template" template="previousnext/after.phtml" name="previousnext_after" after="-"></block>
|
11 |
+
<block type="core/template" template="previousnext/before.phtml" name="previousnext_before" before="-"></block>
|
12 |
+
</reference>
|
13 |
+
</catalog_product_view>
|
14 |
+
</layout>
|
app/design/frontend/base/default/template/previousnext/after.phtml
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if(Mage::getStoreConfig('heaven7_previousnext/general/enabled_select',Mage::app()->getStore())==1
|
2 |
+
&& (Mage::getStoreConfig('heaven7_previousnext/general/position_select',Mage::app()->getStore())=="both"
|
3 |
+
|| Mage::getStoreConfig('heaven7_previousnext/general/position_select',Mage::app()->getStore())=="after")):?>
|
4 |
+
<?php
|
5 |
+
/** @var $previous_product Mage_Catalog_Model_Product */
|
6 |
+
$previous_product = $this->helper('previousnext')->getPreviousProduct();
|
7 |
+
|
8 |
+
/** @var $previous_product Mage_Catalog_Model_Product */
|
9 |
+
$next_product = $this->helper('previousnext')->getNextProduct();
|
10 |
+
?>
|
11 |
+
<div class="previous_next_after_box block">
|
12 |
+
<div class="block-title">
|
13 |
+
<?php if ($previous_product!==false
|
14 |
+
&& Mage::getStoreConfig('heaven7_previousnext/previous/enabled_select',Mage::app()->getStore())==1):?>
|
15 |
+
<?php $label = Mage::getStoreConfig('heaven7_previousnext/previous/label',Mage::app()->getStore());?>
|
16 |
+
<?php $label = str_replace("#product#", $previous_product->getName(), $label);?>
|
17 |
+
|
18 |
+
<?php $openin = Mage::getStoreConfig('heaven7_previousnext/previous/openin_select',Mage::app()->getStore());?>
|
19 |
+
|
20 |
+
<?php switch(Mage::getStoreConfig('heaven7_previousnext/previous/type_select',Mage::app()->getStore())){
|
21 |
+
case 'link':
|
22 |
+
?>
|
23 |
+
<span class="previous_link_box">
|
24 |
+
<a class="previous_link" href="<?php echo $previous_product->getProductUrl();?>" <?php echo ($openin=="new_tab"?"target='_blank'":"");?>><?php echo $label;?></a>
|
25 |
+
</span>
|
26 |
+
<?php
|
27 |
+
break;
|
28 |
+
|
29 |
+
case 'button':
|
30 |
+
?>
|
31 |
+
<div class="previous_button_box">
|
32 |
+
<button class="previous_button button" type="button" onclick="<?php if ($openin=="new_tab"){ ?>window.open('<?php echo $previous_product->getProductUrl();?>', target='_blank')<?php }else{ ?>location.href='<?php echo $previous_product->getProductUrl();?>'<?php }?>" value="<?php //echo $label;?>" >
|
33 |
+
<span><span><?php echo $label;?></span></span>
|
34 |
+
</button>
|
35 |
+
</div>
|
36 |
+
<?php
|
37 |
+
break;
|
38 |
+
}
|
39 |
+
?>
|
40 |
+
<?php elseif ($previous_product===false
|
41 |
+
&& $next_product!==false
|
42 |
+
&& Mage::getStoreConfig('heaven7_previousnext/next/enabled_select',Mage::app()->getStore())==1): ?>
|
43 |
+
|
44 |
+
<span class="previous_empty">
|
45 |
+
<button class="previous_button button" type="button" >
|
46 |
+
<span><span>
|
47 |
+
</span></span>
|
48 |
+
</button>
|
49 |
+
</span>
|
50 |
+
<?php endif;?>
|
51 |
+
|
52 |
+
<?php if ($next_product!==false
|
53 |
+
&& Mage::getStoreConfig('heaven7_previousnext/next/enabled_select',Mage::app()->getStore())==1):?>
|
54 |
+
<?php $label = Mage::getStoreConfig('heaven7_previousnext/next/label',Mage::app()->getStore());?>
|
55 |
+
<?php $label = str_replace("#product#", $next_product->getName(), $label);?>
|
56 |
+
|
57 |
+
<?php $openin = Mage::getStoreConfig('heaven7_previousnext/next/openin_select',Mage::app()->getStore());?>
|
58 |
+
|
59 |
+
<?php switch(Mage::getStoreConfig('heaven7_previousnext/next/type_select',Mage::app()->getStore())){
|
60 |
+
case 'link':
|
61 |
+
?>
|
62 |
+
<span class="next_link_box">
|
63 |
+
<a class="next_link" href="<?php echo $next_product->getProductUrl();?>" <?php echo ($openin=="new_tab"?"target='_blank'":"");?>><?php echo $label;?></a>
|
64 |
+
</span>
|
65 |
+
<?php
|
66 |
+
break;
|
67 |
+
|
68 |
+
case 'button':
|
69 |
+
?>
|
70 |
+
<span class="next_button_box">
|
71 |
+
<button class="next_button button" type="button" onclick="<?php if ($openin=="new_tab"){ ?>window.open('<?php echo $next_product->getProductUrl();?>', target='_blank')<?php }else{ ?>location.href='<?php echo $next_product->getProductUrl();?>'<?php }?>" value="<?php //echo $label;?>">
|
72 |
+
<span><span><?php echo $label;?></span></span>
|
73 |
+
</button>
|
74 |
+
</span>
|
75 |
+
<?php
|
76 |
+
break;
|
77 |
+
}
|
78 |
+
?>
|
79 |
+
<?php elseif ($next_product===false
|
80 |
+
&& $previous_product!==false
|
81 |
+
&& Mage::getStoreConfig('heaven7_previousnext/previous/enabled_select',Mage::app()->getStore())==1): ?>
|
82 |
+
<span class="next_empty"></span>
|
83 |
+
<?php endif;?>
|
84 |
+
</div><!--end block title-->
|
85 |
+
</div>
|
86 |
+
<?php endif;?>
|
app/design/frontend/base/default/template/previousnext/before.phtml
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if(Mage::getStoreConfig('heaven7_previousnext/general/enabled_select',Mage::app()->getStore())==1
|
2 |
+
&& (Mage::getStoreConfig('heaven7_previousnext/general/position_select',Mage::app()->getStore())=="both"
|
3 |
+
|| Mage::getStoreConfig('heaven7_previousnext/general/position_select',Mage::app()->getStore())=="before")):?>
|
4 |
+
<?php
|
5 |
+
/** @var $previous_product Mage_Catalog_Model_Product */
|
6 |
+
$previous_product = $this->helper('previousnext')->getPreviousProduct();
|
7 |
+
|
8 |
+
/** @var $previous_product Mage_Catalog_Model_Product */
|
9 |
+
$next_product = $this->helper('previousnext')->getNextProduct();
|
10 |
+
?>
|
11 |
+
<div class="previous_next_before_box block">
|
12 |
+
<div class="block-title">
|
13 |
+
<?php if ($previous_product!==false && Mage::getStoreConfig('heaven7_previousnext/previous/enabled_select',Mage::app()->getStore())==1):?>
|
14 |
+
<?php $label = Mage::getStoreConfig('heaven7_previousnext/previous/label',Mage::app()->getStore());?>
|
15 |
+
<?php $label = str_replace("#product#", $previous_product->getName(), $label);?>
|
16 |
+
|
17 |
+
<?php $openin = Mage::getStoreConfig('heaven7_previousnext/previous/openin_select',Mage::app()->getStore());?>
|
18 |
+
|
19 |
+
<?php switch(Mage::getStoreConfig('heaven7_previousnext/previous/type_select',Mage::app()->getStore())){
|
20 |
+
case 'link':
|
21 |
+
?>
|
22 |
+
<span class="previous_link_box"><a class="previous_link" href="<?php echo $previous_product->getProductUrl();?>" <?php echo ($openin=="new_tab"?"target='_blank'":"");?>><?php echo $label;?></a></span>
|
23 |
+
<?php
|
24 |
+
break;
|
25 |
+
|
26 |
+
case 'button':
|
27 |
+
?>
|
28 |
+
<span class="previous_button_box"><button class="previous_button button" type="button" onclick="<?php if ($openin=="new_tab"){ ?>window.open('<?php echo $previous_product->getProductUrl();?>', target='_blank')<?php }else{ ?>location.href='<?php echo $previous_product->getProductUrl();?>'<?php }?>" value="<?php //echo $label;?>" >
|
29 |
+
<span><span><?php echo $label;?>
|
30 |
+
</span></span>
|
31 |
+
</button></span>
|
32 |
+
<?php
|
33 |
+
break;
|
34 |
+
}
|
35 |
+
?>
|
36 |
+
<?php elseif ($previous_product===false
|
37 |
+
&& $next_product!==false
|
38 |
+
&& Mage::getStoreConfig('heaven7_previousnext/next/enabled_select',Mage::app()->getStore())==1): ?>
|
39 |
+
<span class="previous_empty">
|
40 |
+
<button class="previous_button button" type="button" >
|
41 |
+
<span><span>
|
42 |
+
</span></span>
|
43 |
+
</button>
|
44 |
+
</span>
|
45 |
+
<?php endif;?>
|
46 |
+
|
47 |
+
<?php if ($next_product!==false && Mage::getStoreConfig('heaven7_previousnext/next/enabled_select',Mage::app()->getStore())==1):?>
|
48 |
+
<?php $label = Mage::getStoreConfig('heaven7_previousnext/next/label',Mage::app()->getStore());?>
|
49 |
+
<?php $label = str_replace("#product#", $next_product->getName(), $label);?>
|
50 |
+
|
51 |
+
<?php $openin = Mage::getStoreConfig('heaven7_previousnext/next/openin_select',Mage::app()->getStore());?>
|
52 |
+
|
53 |
+
<?php switch(Mage::getStoreConfig('heaven7_previousnext/next/type_select',Mage::app()->getStore())){
|
54 |
+
case 'link':
|
55 |
+
?>
|
56 |
+
<span class="next_link_box"><a class="next_link" href="<?php echo $next_product->getProductUrl();?>" <?php echo ($openin=="new_tab"?"target='_blank'":"");?>><?php echo $label;?></a></span>
|
57 |
+
<?php
|
58 |
+
break;
|
59 |
+
|
60 |
+
case 'button':
|
61 |
+
?>
|
62 |
+
<div class="next_button_box"><button class="next_button button" type="button" onclick="<?php if ($openin=="new_tab"){ ?>window.open('<?php echo $next_product->getProductUrl();?>', target='_blank')<?php }else{ ?>location.href='<?php echo $next_product->getProductUrl();?>'<?php }?>" value="<?php //echo $label;?>">
|
63 |
+
<span><span><?php echo $label;?>
|
64 |
+
</span></span>
|
65 |
+
</button></div>
|
66 |
+
<?php
|
67 |
+
break;
|
68 |
+
}
|
69 |
+
?>
|
70 |
+
<?php elseif ($next_product===false
|
71 |
+
&& $previous_product!==false
|
72 |
+
&& Mage::getStoreConfig('heaven7_previousnext/previous/enabled_select',Mage::app()->getStore())==1): ?>
|
73 |
+
<span class="next_empty"></span>
|
74 |
+
<?php endif;?>
|
75 |
+
</div><!--end block title-->
|
76 |
+
</div>
|
77 |
+
<?php endif;?>
|
app/etc/modules/Heaven7_Previousnext.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Phoenix
|
17 |
+
* @package Phoenix_Moneybookers
|
18 |
+
* @copyright Copyright (c) 2012 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
<config>
|
23 |
+
<modules>
|
24 |
+
<Heaven7_Previousnext>
|
25 |
+
<active>true</active>
|
26 |
+
<codePool>community</codePool>
|
27 |
+
</Heaven7_Previousnext>
|
28 |
+
</modules>
|
29 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>PreviousNext</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Previous Next Product</summary>
|
10 |
+
<description>Previous Next Product</description>
|
11 |
+
<notes>Previous Next ProductPrevious Next Product</notes>
|
12 |
+
<authors><author><name>Fehérdi Lóránd</name><user>heaven7</user><email>feherdi.lorand@gmail.com</email></author></authors>
|
13 |
+
<date>2013-10-14</date>
|
14 |
+
<time>13:29:59</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Heaven7"><dir name="Previousnext"><dir name="Helper"><file name="Data.php" hash="05b4b3c9ea6209e6f0500897987f47f3"/></dir><dir name="Model"><file name="Openin.php" hash="7d83853bd96c001279667069438596d7"/><file name="Position.php" hash="6f435b44930226935a07ee8c08623ead"/><file name="Type.php" hash="02d68d253a249868191038255bbb1973"/></dir><dir name="etc"><file name="config.xml" hash="8fdd7aa266ba11893947df3eee6c37e6"/><file name="system.xml" hash="a21fb319e79747cfa9f0103eea864459"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Heaven7_Previousnext.xml" hash="6ebd2c103f87a107d82f8e2279e2c32f"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="previousnext.xml" hash="bc5a441414a1f7014a38ec7fa8fe1c5b"/></dir><dir name="template"><dir name="previousnext"><file name="after.phtml" hash="34f15518d6093cd929498dc9d6eedad1"/><file name="before.phtml" hash="0ddf413e422e3859471ff633ec25e80a"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="previousnext.css" hash="f5e4264af369c3c98b364e6b7106d1e2"/></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.0.0</min><max>5.4.8</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/frontend/base/default/css/previousnext.css
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.previous_next_before_box, .previous_next_after_box{margin:0;}
|
2 |
+
.previous_next_before_box .block-title, .previous_next_after_box .block-title{padding: 0 5px;}
|
3 |
+
.next_link_box, .next_button_box{float:right;}
|
4 |
+
.previous_button_box, .next_button_box{max-width: 49%; display: inline-block;}
|
5 |
+
.previous_button, .next_button{max-width: 100%; overflow:hidden;}
|
6 |
+
.previous_empty, .next_empty{display: inline-block;}
|
7 |
+
.previous_empty .previous_button{visibility:hidden;}
|