Version Notes
1.0.1
fixed redirect to startpage not working when customer_startup_redirect_dashboard is disabled
fixed hive navigation option not working in ce 1.7
fixed fatal error on after login redirect in ce 1.5
1.0.0
initial release
Download this release
Release Info
Developer | Design:Slider GbR |
Extension | DS_PrivateSales |
Version | 1.0.1 |
Comparing to | |
See all releases |
Version 1.0.1
- app/code/community/DS/PrivateSales/Block/Navigation.php +46 -0
- app/code/community/DS/PrivateSales/Block/Topmenu.php +56 -0
- app/code/community/DS/PrivateSales/CHANGE.LOG +9 -0
- app/code/community/DS/PrivateSales/Helper/Data.php +123 -0
- app/code/community/DS/PrivateSales/Model/Observer.php +102 -0
- app/code/community/DS/PrivateSales/controllers/Customer/AccountController.php +164 -0
- app/code/community/DS/PrivateSales/etc/config.xml +98 -0
- app/code/community/DS/PrivateSales/etc/system.xml +125 -0
- app/etc/modules/DS_PrivateSales.xml +12 -0
- app/locale/de_DE/DS_PrivateSales.csv +15 -0
- package.xml +45 -0
app/code/community/DS/PrivateSales/Block/Navigation.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Extended Navigation Block
|
4 |
+
*
|
5 |
+
* @author Design:Slider GbR <magento@design-slider.de>
|
6 |
+
* @copyright (C)Design:Slider GbR <www.design-slider.de>
|
7 |
+
* @license OSL <http://opensource.org/licenses/osl-3.0.php>
|
8 |
+
* @link http://www.design-slider.de/magento-onlineshop/magento-extensions/private-sales/
|
9 |
+
* @package DS_PrivateSales
|
10 |
+
*/
|
11 |
+
class DS_PrivateSales_Block_Navigation extends Mage_Catalog_Block_Navigation
|
12 |
+
{
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Supress rendering for guests if hide navigation for guests is enabled
|
16 |
+
*
|
17 |
+
* @param int Level number for list item class to start from
|
18 |
+
* @param string Extra class of outermost list items
|
19 |
+
* @param string If specified wraps children list in div with this class
|
20 |
+
* @return string
|
21 |
+
* @see Mage_Catalog_Block_Navigation::renderCategoriesMenuHtml
|
22 |
+
*/
|
23 |
+
public function renderCategoriesMenuHtml($level = 0, $outermostItemClass = '', $childrenWrapClass = '')
|
24 |
+
{
|
25 |
+
if (Mage::helper('privatesales')->canShowNavigation())
|
26 |
+
{
|
27 |
+
return parent::renderCategoriesMenuHtml($level, $outermostItemClass, $childrenWrapClass);
|
28 |
+
}
|
29 |
+
|
30 |
+
return '';
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Add navigation can show state to block cache keys
|
35 |
+
*
|
36 |
+
* @return array
|
37 |
+
* @see Mage_Catalog_Block_Navigation::getCacheKeyInfo
|
38 |
+
*/
|
39 |
+
public function getCacheKeyInfo()
|
40 |
+
{
|
41 |
+
$cacheId = parent::getCacheKeyInfo();
|
42 |
+
$cacheId['can_show_navigation'] = Mage::helper('privatesales')->canShowNavigation();
|
43 |
+
$cacheId['short_cache_id'] = md5(implode('|', array_values($cacheId)));
|
44 |
+
return $cacheId;
|
45 |
+
}
|
46 |
+
}
|
app/code/community/DS/PrivateSales/Block/Topmenu.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Extended Top Menu Block
|
4 |
+
*
|
5 |
+
* @author Design:Slider GbR <magento@design-slider.de>
|
6 |
+
* @copyright (C)Design:Slider GbR <www.design-slider.de>
|
7 |
+
* @license OSL <http://opensource.org/licenses/osl-3.0.php>
|
8 |
+
* @link http://www.design-slider.de/magento-onlineshop/magento-extensions/private-sales/
|
9 |
+
* @package DS_PrivateSales
|
10 |
+
*/
|
11 |
+
class DS_PrivateSales_Block_Topmenu extends Mage_Page_Block_Html_Topmenu
|
12 |
+
{
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Init top menu tree structure
|
16 |
+
*/
|
17 |
+
public function _construct()
|
18 |
+
{
|
19 |
+
if (Mage::helper('privatesales')->canShowNavigation())
|
20 |
+
{
|
21 |
+
$this->_menu = new Varien_Data_Tree_Node(array(), 'root', new Varien_Data_Tree());
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Supress rendering for guests if hide navigation for guests is enabled
|
27 |
+
*
|
28 |
+
* @param string $outermostClass
|
29 |
+
* @param string $childrenWrapClass
|
30 |
+
* @return string
|
31 |
+
* @see Mage_Page_Block_Html_Topmenu::getHtml
|
32 |
+
*/
|
33 |
+
public function getHtml($outermostClass = '', $childrenWrapClass = '')
|
34 |
+
{
|
35 |
+
if (Mage::helper('privatesales')->canShowNavigation())
|
36 |
+
{
|
37 |
+
return parent::getHtml($outermostClass, $childrenWrapClass);
|
38 |
+
}
|
39 |
+
|
40 |
+
return '';
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Add navigation can show state to block cache keys
|
45 |
+
*
|
46 |
+
* @return array
|
47 |
+
* @see Mage_Page_Block_Html_Topmenu::getCacheKeyInfo
|
48 |
+
*/
|
49 |
+
public function getCacheKeyInfo()
|
50 |
+
{
|
51 |
+
$cacheId = parent::getCacheKeyInfo();
|
52 |
+
$cacheId['can_show_navigation'] = Mage::helper('privatesales')->canShowNavigation();
|
53 |
+
$cacheId['short_cache_id'] = md5(implode('|', array_values($cacheId)));
|
54 |
+
return $cacheId;
|
55 |
+
}
|
56 |
+
}
|
app/code/community/DS/PrivateSales/CHANGE.LOG
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
DS_PrivateSales
|
2 |
+
|
3 |
+
1.0.1
|
4 |
+
fixed redirect to startpage not working when customer_startup_redirect_dashboard is disabled
|
5 |
+
fixed hive navigation option not working in ce 1.7
|
6 |
+
fixed fatal error on after login redirect in ce 1.5
|
7 |
+
|
8 |
+
1.0.0
|
9 |
+
initial release
|
app/code/community/DS/PrivateSales/Helper/Data.php
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Default Helper
|
4 |
+
*
|
5 |
+
* @author Design:Slider GbR <magento@design-slider.de>
|
6 |
+
* @copyright (C)Design:Slider GbR <www.design-slider.de>
|
7 |
+
* @license OSL <http://opensource.org/licenses/osl-3.0.php>
|
8 |
+
* @link http://www.design-slider.de/magento-onlineshop/magento-extensions/private-sales/
|
9 |
+
* @package DS_PrivateSales
|
10 |
+
*/
|
11 |
+
class DS_PrivateSales_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
+
{
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Check if private sales is enabled
|
16 |
+
*
|
17 |
+
* @return boolean
|
18 |
+
*/
|
19 |
+
public function isEnabled()
|
20 |
+
{
|
21 |
+
return (bool)Mage::getStoreConfig('privatesales/general/enable');
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Check if current user is guest
|
26 |
+
*
|
27 |
+
* @return boolean
|
28 |
+
*/
|
29 |
+
public function haveGuest()
|
30 |
+
{
|
31 |
+
return !Mage::getSingleton('customer/session')->isLoggedIn();
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Check if catalog navigation can be shown
|
36 |
+
*
|
37 |
+
* @return boolean
|
38 |
+
*/
|
39 |
+
public function canShowNavigation()
|
40 |
+
{
|
41 |
+
if ($this->isEnabled() && $this->haveGuest())
|
42 |
+
{
|
43 |
+
return !(bool)Mage::getStoreConfig('privatesales/access/navigation');
|
44 |
+
}
|
45 |
+
|
46 |
+
return true;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Check if account registration can be shown
|
51 |
+
*
|
52 |
+
* @return boolean
|
53 |
+
*/
|
54 |
+
public function canShowRegistration()
|
55 |
+
{
|
56 |
+
if ($this->isEnabled() && $this->haveGuest())
|
57 |
+
{
|
58 |
+
return !(bool)Mage::getStoreConfig('privatesales/accounting/registration');
|
59 |
+
}
|
60 |
+
|
61 |
+
return true;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Check if forgot password can be shown
|
66 |
+
*
|
67 |
+
* @return boolean
|
68 |
+
*/
|
69 |
+
public function canShowForgotPassword()
|
70 |
+
{
|
71 |
+
if ($this->isEnabled() && $this->haveGuest())
|
72 |
+
{
|
73 |
+
return !(bool)Mage::getStoreConfig('privatesales/accounting/password');
|
74 |
+
}
|
75 |
+
|
76 |
+
return true;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Check if cms page can be shown
|
81 |
+
*
|
82 |
+
* @return boolean
|
83 |
+
*/
|
84 |
+
public function canShowCmsPage()
|
85 |
+
{
|
86 |
+
if ($this->isEnabled() && $this->haveGuest())
|
87 |
+
{
|
88 |
+
return !(bool)Mage::getStoreConfig('privatesales/access/content');
|
89 |
+
}
|
90 |
+
|
91 |
+
return true;
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Check if catalog page can be shown
|
96 |
+
*
|
97 |
+
* @return boolean
|
98 |
+
*/
|
99 |
+
public function canShowCatalogPage()
|
100 |
+
{
|
101 |
+
if ($this->isEnabled() && $this->haveGuest())
|
102 |
+
{
|
103 |
+
return !(bool)Mage::getStoreConfig('privatesales/access/catalog');
|
104 |
+
}
|
105 |
+
|
106 |
+
return true;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Check if overall authentication is required
|
111 |
+
*
|
112 |
+
* @return boolean
|
113 |
+
*/
|
114 |
+
public function canShowAnything()
|
115 |
+
{
|
116 |
+
if ($this->isEnabled() && $this->haveGuest())
|
117 |
+
{
|
118 |
+
return !(bool)Mage::getStoreConfig('privatesales/access/authonly');
|
119 |
+
}
|
120 |
+
|
121 |
+
return true;
|
122 |
+
}
|
123 |
+
}
|
app/code/community/DS/PrivateSales/Model/Observer.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Event Observer
|
4 |
+
*
|
5 |
+
* @author Design:Slider GbR <magento@design-slider.de>
|
6 |
+
* @copyright (C)Design:Slider GbR <www.design-slider.de>
|
7 |
+
* @license OSL <http://opensource.org/licenses/osl-3.0.php>
|
8 |
+
* @link http://www.design-slider.de/magento-onlineshop/magento-extensions/private-sales/
|
9 |
+
* @package DS_PrivateSales
|
10 |
+
*/
|
11 |
+
class DS_PrivateSales_Model_Observer
|
12 |
+
{
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Remember redirect state
|
16 |
+
* @var boolean
|
17 |
+
*/
|
18 |
+
private static $_virgin = true;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Environment Statics
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
private static $m, $c, $a;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Constructor
|
28 |
+
*/
|
29 |
+
public function __construct()
|
30 |
+
{
|
31 |
+
self::$m = Mage::app()->getRequest()->getModuleName();
|
32 |
+
self::$c = Mage::app()->getRequest()->getControllerName();
|
33 |
+
self::$a = Mage::app()->getRequest()->getActionName();
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Event Handler: Check if current page can be shown and if not, redirect to login
|
38 |
+
*/
|
39 |
+
public function checkPageAccess()
|
40 |
+
{
|
41 |
+
if (($this->_isBlockablePage()) && !Mage::helper('privatesales')->canShowAnything() ||
|
42 |
+
($this->_isCmsPage() && !Mage::helper('privatesales')->canShowCmsPage()) ||
|
43 |
+
($this->_isCatalogPage() && !Mage::helper('privatesales')->canShowCatalogPage()))
|
44 |
+
{
|
45 |
+
$this->_loginRedirect();
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Check if current page is generally blockable (whitelist)
|
51 |
+
*
|
52 |
+
* @return boolean
|
53 |
+
*/
|
54 |
+
private function _isBlockablePage()
|
55 |
+
{
|
56 |
+
return !(
|
57 |
+
(Mage::getSingleton('admin/session')->isLoggedIn()) ||
|
58 |
+
(self::$m=='admin') ||
|
59 |
+
(self::$m=='api') ||
|
60 |
+
(self::$m=='customer' && self::$c=='account')
|
61 |
+
);
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Check if current request points to blockable catalog page
|
66 |
+
*
|
67 |
+
* @return boolean
|
68 |
+
*/
|
69 |
+
private function _isCatalogPage()
|
70 |
+
{
|
71 |
+
return (self::$m=='catalog' || self::$m=='catalogsearch' || self::$m=='checkout');
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Check if current request points to blockable cms page
|
76 |
+
*
|
77 |
+
* @return boolean
|
78 |
+
*/
|
79 |
+
private function _isCmsPage()
|
80 |
+
{
|
81 |
+
return (self::$m=='cms' && self::$c=='page' && self::$a=='view');
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Redirect user to login page
|
86 |
+
*/
|
87 |
+
private function _loginRedirect()
|
88 |
+
{
|
89 |
+
if (self::$_virgin)
|
90 |
+
{
|
91 |
+
Mage::getSingleton('customer/session')->setBeforeAuthUrl(
|
92 |
+
Mage::helper('core/url')->getCurrentUrl()
|
93 |
+
);
|
94 |
+
|
95 |
+
Mage::app()->getResponse()->setRedirect(
|
96 |
+
Mage::getUrl('customer/account/login')
|
97 |
+
);
|
98 |
+
|
99 |
+
self::$_virgin = false;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
app/code/community/DS/PrivateSales/controllers/Customer/AccountController.php
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'Mage/Customer/controllers/AccountController.php';
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Extended Account Controller
|
6 |
+
*
|
7 |
+
* @author Design:Slider GbR <magento@design-slider.de>
|
8 |
+
* @copyright (C)Design:Slider GbR <www.design-slider.de>
|
9 |
+
* @license OSL <http://opensource.org/licenses/osl-3.0.php>
|
10 |
+
* @link http://www.design-slider.de/magento-onlineshop/magento-extensions/private-sales/
|
11 |
+
* @package DS_PrivateSales
|
12 |
+
*/
|
13 |
+
class DS_PrivateSales_Customer_AccountController extends Mage_Customer_AccountController
|
14 |
+
{
|
15 |
+
|
16 |
+
/**
|
17 |
+
* XML Path to customer dashboard redirect option
|
18 |
+
*
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
private $xmlPathCustomerStartupRedirectToDashboard = 'customer/startup/redirect_dashboard';
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Supress account registration page if disabled
|
25 |
+
*
|
26 |
+
* @see Mage_Customer_AccountController::createAction
|
27 |
+
*/
|
28 |
+
public function createAction()
|
29 |
+
{
|
30 |
+
if (!Mage::helper('privatesales')->canShowRegistration())
|
31 |
+
{
|
32 |
+
$this->_getSession()->addError($this->__('Account registration has been locked.'));
|
33 |
+
$this->_redirect('*/*');
|
34 |
+
return;
|
35 |
+
}
|
36 |
+
|
37 |
+
return parent::createAction();
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Supress account registration action if disabled
|
42 |
+
*
|
43 |
+
* @see Mage_Customer_AccountController::createPostAction
|
44 |
+
*/
|
45 |
+
public function createPostAction()
|
46 |
+
{
|
47 |
+
if (!Mage::helper('privatesales')->canShowRegistration())
|
48 |
+
{
|
49 |
+
$this->_getSession()->addError($this->__('Account registration has been locked.'));
|
50 |
+
$this->_redirect('*/*');
|
51 |
+
return;
|
52 |
+
}
|
53 |
+
|
54 |
+
return parent::createPostAction();
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Supress forgot password page if disabled
|
59 |
+
*
|
60 |
+
* @see Mage_Customer_AccountController::forgotPasswordAction
|
61 |
+
*/
|
62 |
+
public function forgotPasswordAction()
|
63 |
+
{
|
64 |
+
if (!Mage::helper('privatesales')->canShowForgotPassword())
|
65 |
+
{
|
66 |
+
$this->_getSession()->addError($this->__('Forgot password has been locked.'));
|
67 |
+
$this->_redirect('*/*');
|
68 |
+
return;
|
69 |
+
}
|
70 |
+
|
71 |
+
return parent::forgotPasswordAction();
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Supress forgot password action if disabled
|
76 |
+
*
|
77 |
+
* @see Mage_Customer_AccountController::forgotPasswordAction
|
78 |
+
*/
|
79 |
+
public function forgotPasswordPostAction()
|
80 |
+
{
|
81 |
+
if (!Mage::helper('privatesales')->canShowForgotPassword())
|
82 |
+
{
|
83 |
+
$this->_getSession()->addError($this->__('Forgot password has been locked.'));
|
84 |
+
$this->_redirect('*/*');
|
85 |
+
return;
|
86 |
+
}
|
87 |
+
|
88 |
+
return parent::forgotPasswordPostAction();
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Define target URL and redirect customer after logging in
|
93 |
+
*
|
94 |
+
* @see Mage_Customer_AccountController::_loginPostRedirect
|
95 |
+
*/
|
96 |
+
protected function _loginPostRedirect()
|
97 |
+
{
|
98 |
+
# retrieve xml path constant (ce >= 1.6)
|
99 |
+
if (defined('Mage_Customer_Helper_Data::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD'))
|
100 |
+
{
|
101 |
+
$this->xmlPathCustomerStartupRedirectToDashboard = Mage_Customer_Helper_Data::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD;
|
102 |
+
}
|
103 |
+
|
104 |
+
# use default behaviour if privatesales disabled or customer_startup_redirect_dashboard is configured
|
105 |
+
if (!Mage::helper('privatesales')->isEnabled() || Mage::getStoreConfigFlag($this->xmlPathCustomerStartupRedirectToDashboard)) {
|
106 |
+
return parent::_loginPostRedirect();
|
107 |
+
}
|
108 |
+
|
109 |
+
$session = $this->_getSession();
|
110 |
+
|
111 |
+
if (!$session->getBeforeAuthUrl()) { #no baseurl comparison here, default logic after here
|
112 |
+
|
113 |
+
# set default URL to redirect customer to
|
114 |
+
$session->setBeforeAuthUrl(Mage::helper('customer')->getAccountUrl());
|
115 |
+
|
116 |
+
# redirect customer to the last page visited after logging in
|
117 |
+
if ($session->isLoggedIn())
|
118 |
+
{
|
119 |
+
if (!Mage::getStoreConfigFlag($this->xmlPathCustomerStartupRedirectToDashboard))
|
120 |
+
{
|
121 |
+
$referer = $this->getRequest()->getParam(Mage_Customer_Helper_Data::REFERER_QUERY_PARAM_NAME);
|
122 |
+
if ($referer)
|
123 |
+
{
|
124 |
+
$referer = Mage::helper('core')->urlDecode($referer);
|
125 |
+
if ($this->_isUrlInternal($referer))
|
126 |
+
{
|
127 |
+
$session->setBeforeAuthUrl($referer);
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
131 |
+
elseif ($session->getAfterAuthUrl())
|
132 |
+
{
|
133 |
+
$session->setBeforeAuthUrl($session->getAfterAuthUrl(true));
|
134 |
+
}
|
135 |
+
}
|
136 |
+
else
|
137 |
+
{
|
138 |
+
$session->setBeforeAuthUrl(Mage::helper('customer')->getLoginUrl());
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
# previous url was logout
|
143 |
+
elseif ($session->getBeforeAuthUrl() == Mage::helper('customer')->getLogoutUrl())
|
144 |
+
{
|
145 |
+
$session->setBeforeAuthUrl(Mage::helper('customer')->getDashboardUrl());
|
146 |
+
}
|
147 |
+
|
148 |
+
# other previous url
|
149 |
+
else {
|
150 |
+
if (!$session->getAfterAuthUrl())
|
151 |
+
{
|
152 |
+
$session->setAfterAuthUrl($session->getBeforeAuthUrl());
|
153 |
+
}
|
154 |
+
|
155 |
+
if ($session->isLoggedIn())
|
156 |
+
{
|
157 |
+
$session->setBeforeAuthUrl($session->getAfterAuthUrl(true));
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
# perform redirect
|
162 |
+
$this->_redirectUrl($session->getBeforeAuthUrl(true));
|
163 |
+
}
|
164 |
+
}
|
app/code/community/DS/PrivateSales/etc/config.xml
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
|
4 |
+
<modules>
|
5 |
+
<DS_PrivateSales>
|
6 |
+
<version>1.0.1</version>
|
7 |
+
</DS_PrivateSales>
|
8 |
+
</modules>
|
9 |
+
|
10 |
+
<global>
|
11 |
+
<models>
|
12 |
+
<privatesales>
|
13 |
+
<class>DS_PrivateSales_Model</class>
|
14 |
+
</privatesales>
|
15 |
+
</models>
|
16 |
+
<helpers>
|
17 |
+
<privatesales>
|
18 |
+
<class>DS_PrivateSales_Helper</class>
|
19 |
+
</privatesales>
|
20 |
+
</helpers>
|
21 |
+
<blocks>
|
22 |
+
<catalog>
|
23 |
+
<rewrite>
|
24 |
+
<navigation>DS_PrivateSales_Block_Navigation</navigation>
|
25 |
+
</rewrite>
|
26 |
+
</catalog>
|
27 |
+
<page>
|
28 |
+
<rewrite>
|
29 |
+
<html_topmenu>DS_PrivateSales_Block_Topmenu</html_topmenu>
|
30 |
+
</rewrite>
|
31 |
+
</page>
|
32 |
+
</blocks>
|
33 |
+
|
34 |
+
<events>
|
35 |
+
<controller_action_layout_load_before>
|
36 |
+
<observers>
|
37 |
+
<privatesales>
|
38 |
+
<type>singleton</type>
|
39 |
+
<class>DS_PrivateSales_Model_Observer</class>
|
40 |
+
<method>checkPageAccess</method>
|
41 |
+
</privatesales>
|
42 |
+
</observers>
|
43 |
+
</controller_action_layout_load_before>
|
44 |
+
</events>
|
45 |
+
</global>
|
46 |
+
|
47 |
+
<frontend>
|
48 |
+
<routers>
|
49 |
+
<customer>
|
50 |
+
<args>
|
51 |
+
<modules>
|
52 |
+
<DS_PrivateSales before="Mage_Customer">DS_PrivateSales_Customer</DS_PrivateSales>
|
53 |
+
</modules>
|
54 |
+
</args>
|
55 |
+
</customer>
|
56 |
+
</routers>
|
57 |
+
<translate>
|
58 |
+
<modules>
|
59 |
+
<DS_PrivateSales>
|
60 |
+
<files>
|
61 |
+
<default>DS_PrivateSales.csv</default>
|
62 |
+
</files>
|
63 |
+
</DS_PrivateSales>
|
64 |
+
</modules>
|
65 |
+
</translate>
|
66 |
+
</frontend>
|
67 |
+
|
68 |
+
<adminhtml>
|
69 |
+
<acl>
|
70 |
+
<resources>
|
71 |
+
<admin>
|
72 |
+
<children>
|
73 |
+
<system>
|
74 |
+
<children>
|
75 |
+
<config>
|
76 |
+
<children>
|
77 |
+
<privatesales>
|
78 |
+
<title>DESIGN:SLIDER Private Sales</title>
|
79 |
+
</privatesales>
|
80 |
+
</children>
|
81 |
+
</config>
|
82 |
+
</children>
|
83 |
+
</system>
|
84 |
+
</children>
|
85 |
+
</admin>
|
86 |
+
</resources>
|
87 |
+
</acl>
|
88 |
+
<translate>
|
89 |
+
<modules>
|
90 |
+
<DS_PrivateSales>
|
91 |
+
<files>
|
92 |
+
<default>DS_PrivateSales.csv</default>
|
93 |
+
</files>
|
94 |
+
</DS_PrivateSales>
|
95 |
+
</modules>
|
96 |
+
</translate>
|
97 |
+
</adminhtml>
|
98 |
+
</config>
|
app/code/community/DS/PrivateSales/etc/system.xml
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
|
4 |
+
<tabs>
|
5 |
+
<designslider translate="label" module="privatesales">
|
6 |
+
<label>DESIGN:SLIDER EXTENSIONS</label>
|
7 |
+
<sort_order>999</sort_order>
|
8 |
+
</designslider>
|
9 |
+
</tabs>
|
10 |
+
|
11 |
+
<sections>
|
12 |
+
<privatesales translate="label" module="privatesales">
|
13 |
+
<tab>designslider</tab>
|
14 |
+
<label>Private Sales</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>16</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
<groups>
|
21 |
+
<general translate="label" module="privatesales">
|
22 |
+
<label>General Configuration</label>
|
23 |
+
<frontend_type>text</frontend_type>
|
24 |
+
<sort_order>1</sort_order>
|
25 |
+
<expanded/>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>1</show_in_store>
|
29 |
+
<fields>
|
30 |
+
<enable translate="label" module="privatesales">
|
31 |
+
<label>Use Private Sales</label>
|
32 |
+
<comment>Enables or disables this extension</comment>
|
33 |
+
<frontend_type>select</frontend_type>
|
34 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
35 |
+
<sort_order>1</sort_order>
|
36 |
+
<show_in_default>1</show_in_default>
|
37 |
+
<show_in_website>1</show_in_website>
|
38 |
+
<show_in_store>1</show_in_store>
|
39 |
+
</enable>
|
40 |
+
</fields>
|
41 |
+
</general>
|
42 |
+
<accounting translate="label" module="privatesales">
|
43 |
+
<label>Account Options</label>
|
44 |
+
<frontend_type>text</frontend_type>
|
45 |
+
<sort_order>2</sort_order>
|
46 |
+
<expanded/>
|
47 |
+
<show_in_default>1</show_in_default>
|
48 |
+
<show_in_website>1</show_in_website>
|
49 |
+
<show_in_store>1</show_in_store>
|
50 |
+
<fields>
|
51 |
+
<registration translate="label" module="privatesales">
|
52 |
+
<label>Disable Registration</label>
|
53 |
+
<frontend_type>select</frontend_type>
|
54 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
55 |
+
<sort_order>1</sort_order>
|
56 |
+
<show_in_default>1</show_in_default>
|
57 |
+
<show_in_website>1</show_in_website>
|
58 |
+
<show_in_store>1</show_in_store>
|
59 |
+
</registration>
|
60 |
+
<password translate="label" module="privatesales">
|
61 |
+
<label>Disable Forgot Password</label>
|
62 |
+
<frontend_type>select</frontend_type>
|
63 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
64 |
+
<sort_order>2</sort_order>
|
65 |
+
<show_in_default>1</show_in_default>
|
66 |
+
<show_in_website>1</show_in_website>
|
67 |
+
<show_in_store>1</show_in_store>
|
68 |
+
</password>
|
69 |
+
</fields>
|
70 |
+
</accounting>
|
71 |
+
<access translate="label" module="privatesales">
|
72 |
+
<label>Guest Access Options</label>
|
73 |
+
<frontend_type>text</frontend_type>
|
74 |
+
<sort_order>3</sort_order>
|
75 |
+
<expanded/>
|
76 |
+
<show_in_default>1</show_in_default>
|
77 |
+
<show_in_website>1</show_in_website>
|
78 |
+
<show_in_store>1</show_in_store>
|
79 |
+
<fields>
|
80 |
+
<authonly translate="label" module="privatesales">
|
81 |
+
<label>Authentication Required</label>
|
82 |
+
<comment>Set to yes to lock everything (including the home page)</comment>
|
83 |
+
<frontend_type>select</frontend_type>
|
84 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
85 |
+
<sort_order>1</sort_order>
|
86 |
+
<show_in_default>1</show_in_default>
|
87 |
+
<show_in_website>1</show_in_website>
|
88 |
+
<show_in_store>1</show_in_store>
|
89 |
+
</authonly>
|
90 |
+
<catalog translate="label" module="privatesales">
|
91 |
+
<label>Hide Catalog Pages</label>
|
92 |
+
<frontend_type>select</frontend_type>
|
93 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
94 |
+
<sort_order>2</sort_order>
|
95 |
+
<depends><authonly>0</authonly></depends>
|
96 |
+
<show_in_default>1</show_in_default>
|
97 |
+
<show_in_website>1</show_in_website>
|
98 |
+
<show_in_store>1</show_in_store>
|
99 |
+
</catalog>
|
100 |
+
<content translate="label" module="privatesales">
|
101 |
+
<label>Hide Content Pages</label>
|
102 |
+
<frontend_type>select</frontend_type>
|
103 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
104 |
+
<sort_order>3</sort_order>
|
105 |
+
<depends><authonly>0</authonly></depends>
|
106 |
+
<show_in_default>1</show_in_default>
|
107 |
+
<show_in_website>1</show_in_website>
|
108 |
+
<show_in_store>1</show_in_store>
|
109 |
+
</content>
|
110 |
+
<navigation translate="label" module="privatesales">
|
111 |
+
<label>Hide Catalog Navigation</label>
|
112 |
+
<frontend_type>select</frontend_type>
|
113 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
114 |
+
<sort_order>4</sort_order>
|
115 |
+
<show_in_default>1</show_in_default>
|
116 |
+
<show_in_website>1</show_in_website>
|
117 |
+
<show_in_store>1</show_in_store>
|
118 |
+
</navigation>
|
119 |
+
</fields>
|
120 |
+
</access>
|
121 |
+
</groups>
|
122 |
+
</privatesales>
|
123 |
+
</sections>
|
124 |
+
|
125 |
+
</config>
|
app/etc/modules/DS_PrivateSales.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<DS_PrivateSales>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Customer/>
|
9 |
+
</depends>
|
10 |
+
</DS_PrivateSales>
|
11 |
+
</modules>
|
12 |
+
</config>
|
app/locale/de_DE/DS_PrivateSales.csv
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Account Options","Kundenkonto Vorgänge"
|
2 |
+
"Account registration has been locked.","Die Neukundenanmeldung wurde gesperrt."
|
3 |
+
"Authentication Required","Anmeldung erzwingen"
|
4 |
+
"Disable Forgot Password","Passwort vergessen deaktivieren"
|
5 |
+
"Disable Registration","Registrierung deaktivieren"
|
6 |
+
"Enables or disables this extension","Diese Erweiterung an- und ausschalten"
|
7 |
+
"Forgot password has been locked.","Die Password vergessen Funktion wurde gesperrt."
|
8 |
+
"General Configuration","Allgemeine Einstellungen"
|
9 |
+
"Guest Access Options","Zugriffsbereiche für Gäste"
|
10 |
+
"Hide Catalog Navigation","Katalognavigation ausblenden"
|
11 |
+
"Hide Catalog Pages","Katalogseiten sperren"
|
12 |
+
"Hide Content Pages","Inhaltsseiten sperren"
|
13 |
+
"Login is required to view the desired page.","Für die Anzeige der gewünschten Seite ist eine Authentifizierung erforderlich."
|
14 |
+
"Set to yes to lock everything (including the home page)","Aktivieren, um alles zu sperren (inklusive Startseite)"
|
15 |
+
"Use Private Sales","Private Sales verwenden"
|
package.xml
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>DS_PrivateSales</name>
|
4 |
+
<version>1.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Adds the possibility to hide & lock certain parts of your stores for guests.</summary>
|
10 |
+
<description>Adds the possibility to hide & lock certain parts of your stores for guests, guiding them to authenticate themselves first.
|
11 |
+

|
12 |
+
Features:
|
13 |
+

|
14 |
+
- Registration can be disabled
|
15 |
+
- Forgot Password can be disabled
|
16 |
+
- Full Store can be blocked, and if not:
|
17 |
+
o Catalog&Product Views and Search can be blocked separately
|
18 |
+
o CMS page views can be blocked separately
|
19 |
+
- Catalog navigation can be hided
|
20 |
+
- Fixes redirect to startpage not working when customer_startup_redirect_dashboard is disabled
|
21 |
+
- Admin ACL for configuration
|
22 |
+

|
23 |
+
All restrictions move away once the user is logged in.
|
24 |
+

|
25 |
+
Included translations: de_DE
|
26 |
+

|
27 |
+
Future Updates planned, including:
|
28 |
+
- Hide product blocks without blocking entire page
|
29 |
+
- Login page customization (for reg & forgot pw options)
|
30 |
+
- Multiselect for certain store areas to block instead of single options
|
31 |
+
- Support for configuring rules for each user group</description>
|
32 |
+
<notes>1.0.1
|
33 |
+
fixed redirect to startpage not working when customer_startup_redirect_dashboard is disabled
|
34 |
+
fixed hive navigation option not working in ce 1.7
|
35 |
+
fixed fatal error on after login redirect in ce 1.5
|
36 |
+

|
37 |
+
1.0.0
|
38 |
+
initial release</notes>
|
39 |
+
<authors><author><name>Design:Slider GbR</name><user>DesignSliderGbR</user><email>magento@design-slider.de</email></author></authors>
|
40 |
+
<date>2013-03-05</date>
|
41 |
+
<time>18:05:15</time>
|
42 |
+
<contents><target name="magelocale"><dir><dir name="de_DE"><file name="DS_PrivateSales.csv" hash="08ae6aa62e3cdd321f71319969a30ba9"/></dir></dir></target><target name="magecommunity"><dir name="DS"><dir name="PrivateSales"><dir name="Block"><file name="Navigation.php" hash="585f907774ac18e7fbefa60f9fb2d746"/><file name="Topmenu.php" hash="41c13dedf4527c26b4f72eeef4a503cf"/></dir><file name="CHANGE.LOG" hash="5b178a53886517ab9a232101b9a56f4a"/><dir name="Helper"><file name="Data.php" hash="0295ece9d8712e162376a1a8dad7727b"/></dir><dir name="Model"><file name="Observer.php" hash="f127b2735a3cc2b681c09e9726944c34"/></dir><dir name="controllers"><dir name="Customer"><file name="AccountController.php" hash="cda005c0dc83d8df98ee12fd047c2c64"/></dir></dir><dir name="etc"><file name="config.xml" hash="41e18d9b255377a8a9d432a6b7e03c15"/><file name="system.xml" hash="243f646cdf929b3a204a534228b553db"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DS_PrivateSales.xml" hash="997309e4dfefc850ee34df380a4d3688"/></dir></target></contents>
|
43 |
+
<compatible/>
|
44 |
+
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php><package><name>Mage_Customer</name><channel>core</channel><min>1.4.0.0.13</min><max></max></package></required></dependencies>
|
45 |
+
</package>
|