Sitewards_B2BProfessional - Version 2.0.0

Version Notes

Re-factored code base.
Fixed minor bugs with category and customer group implementation.

Download this release

Release Info

Developer Sitewards Magento Team
Extension Sitewards_B2BProfessional
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.0.5 to 2.0.0

Files changed (25) hide show
  1. app/code/community/Sitewards/B2BProfessional/Block/Bundle/Catalog/Price.php +45 -0
  2. app/code/community/Sitewards/B2BProfessional/Block/Bundle/Catalog/Product/View/Type/Bundle/Option/Checkbox.php +39 -55
  3. app/code/community/Sitewards/B2BProfessional/Block/Bundle/Catalog/Product/View/Type/Bundle/Option/Multi.php +24 -46
  4. app/code/community/Sitewards/B2BProfessional/Block/Bundle/Catalog/Product/View/Type/Bundle/Option/Radio.php +24 -46
  5. app/code/community/Sitewards/B2BProfessional/Block/Bundle/Catalog/Product/View/Type/Bundle/Option/Select.php +23 -45
  6. app/code/community/Sitewards/B2BProfessional/Block/Configurable.php +19 -40
  7. app/code/community/Sitewards/B2BProfessional/Block/Price.php +45 -61
  8. app/code/community/Sitewards/B2BProfessional/Block/Product/View/Options/Type/Date.php +0 -48
  9. app/code/community/Sitewards/B2BProfessional/Block/Product/View/Options/Type/Default.php +0 -48
  10. app/code/community/Sitewards/B2BProfessional/Block/Product/View/Options/Type/File.php +0 -46
  11. app/code/community/Sitewards/B2BProfessional/Block/Product/View/Options/Type/Select.php +0 -48
  12. app/code/community/Sitewards/B2BProfessional/Block/Product/View/Options/Type/Text.php +0 -46
  13. app/code/community/Sitewards/B2BProfessional/Block/View.php +0 -44
  14. app/code/community/Sitewards/B2BProfessional/Helper/Data.php +227 -223
  15. app/code/community/Sitewards/B2BProfessional/Model/Customer.php +55 -72
  16. app/code/community/Sitewards/B2BProfessional/Model/Observer.php +0 -51
  17. app/code/community/Sitewards/B2BProfessional/Model/Resource/Eav/Mysql4/Product.php +0 -29
  18. app/code/community/Sitewards/B2BProfessional/Model/System/Config/Source/Category.php +35 -57
  19. app/code/community/Sitewards/B2BProfessional/controllers/CartController.php +44 -74
  20. app/code/community/Sitewards/B2BProfessional/etc/adminhtml.xml +26 -36
  21. app/code/community/Sitewards/B2BProfessional/etc/config.xml +93 -110
  22. app/code/community/Sitewards/B2BProfessional/etc/system.xml +148 -258
  23. app/etc/modules/Sitewards_B2BProfessional.xml +25 -5
  24. app/locale/de_DE/Sitewards_B2BProfessional.csv +23 -2
  25. package.xml +23 -11
app/code/community/Sitewards/B2BProfessional/Block/Bundle/Catalog/Price.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sitewards_B2BProfessional_Block_Price
4
+ * - Check that the current product is active and display custom text
5
+ *
6
+ * @author david.manners <david.manners@sitewards.com>
7
+ * @category Sitewards
8
+ * @package Sitewards_B2BProfessional
9
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
10
+ */
11
+ class Sitewards_B2BProfessional_Block_Bundle_Catalog_Price extends Mage_Bundle_Block_Catalog_Product_Price {
12
+ /**
13
+ * The last product Id
14
+ *
15
+ * @var int
16
+ */
17
+ protected static $_iLastProductId = 0;
18
+
19
+ /**
20
+ * Check that the current product is active
21
+ * - Override the text with the module text
22
+ *
23
+ * @return string
24
+ */
25
+ protected function _toHtml() {
26
+ $sPriceHtml = parent::_toHtml();
27
+ $iCurrentProductId = $this->getProduct()->getId();
28
+
29
+ if (Mage::helper('b2bprofessional')->checkActive($iCurrentProductId)) {
30
+ if ($iCurrentProductId == self::$_iLastProductId) {
31
+ return '';
32
+ }
33
+ self::$_iLastProductId = $iCurrentProductId;
34
+
35
+ // text displayed instead of price
36
+ if (Mage::getStoreConfig('b2bprofessional/languagesettings/languageoverride') == 1) {
37
+ $sReplacementText = Mage::getStoreConfig('b2bprofessional/languagesettings/logintext');
38
+ } else {
39
+ $sReplacementText = $this->__('Please login');
40
+ }
41
+ return $sReplacementText;
42
+ }
43
+ return $sPriceHtml;
44
+ }
45
+ }
app/code/community/Sitewards/B2BProfessional/Block/Bundle/Catalog/Product/View/Type/Bundle/Option/Checkbox.php CHANGED
@@ -1,56 +1,40 @@
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
- * 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 Mage
22
- * @package Mage_Bundle
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- /**
29
- * Bundle option checkbox type renderer
30
- *
31
- * @category Mage
32
- * @package Mage_Bundle
33
- * @author Magento Core Team <core@magentocommerce.com>
34
- */
35
- class Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Checkbox
36
- extends Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox
37
- {
38
- public function getSelectionTitlePrice($_selection, $includeContainer = true)
39
- {
40
- if (Mage::helper('b2bprofessional')->checkActive()){
41
- return $_selection->getName();
42
- }
43
- else {
44
- return parent::getSelectionTitlePrice($_selection, $includeContainer = true);
45
- }
46
- }
47
- public function getSelectionQtyTitlePrice($_selection, $includeContainer = true)
48
- {
49
- if (Mage::helper('b2bprofessional')->checkActive()){
50
- return $_selection->getSelectionQty()*1 . ' x ' . $_selection->getName();
51
- }
52
- else {
53
- return parent::getSelectionQtyTitlePrice($_selection, $includeContainer = true);
54
- }
55
- }
56
  }
1
+ <?php
2
+ /**
3
+ * Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Checkbox
4
+ * - Validate that the selection is active and display the custom information
5
+ *
6
+ * @category Sitewards
7
+ * @package Sitewards_B2BProfessional
8
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
9
+ */
10
+ class Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Checkbox extends Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox {
11
+ /**
12
+ * Validate the it is active the display the selection name
13
+ *
14
+ * @param Mage_Catalog_Model_Product $oBundleSelection
15
+ * @param boolean $bIncludeContainer
16
+ * @return string
17
+ */
18
+ public function getSelectionTitlePrice($oBundleSelection, $bIncludeContainer = true) {
19
+ if (Mage::helper('b2bprofessional')->checkActive()) {
20
+ return $oBundleSelection->getName();
21
+ } else {
22
+ return parent::getSelectionTitlePrice($oBundleSelection, $bIncludeContainer);
23
+ }
24
+ }
25
+
26
+ /**
27
+ * Validate the it is active the display the selection quantity and name
28
+ *
29
+ * @param Mage_Catalog_Model_Product $oBundleSelection
30
+ * @param boolean $bIncludeContainer
31
+ * @return string
32
+ */
33
+ public function getSelectionQtyTitlePrice($oBundleSelection, $bIncludeContainer = true) {
34
+ if (Mage::helper ( 'b2bprofessional' )->checkActive ()) {
35
+ return $oBundleSelection->getSelectionQty() * 1 . ' x ' . $oBundleSelection->getName();
36
+ } else {
37
+ return parent::getSelectionQtyTitlePrice($oBundleSelection, $bIncludeContainer);
38
+ }
39
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
app/code/community/Sitewards/B2BProfessional/Block/Bundle/Catalog/Product/View/Type/Bundle/Option/Multi.php CHANGED
@@ -1,47 +1,25 @@
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
- * 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 Mage
22
- * @package Mage_Bundle
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- /**
29
- * Bundle option multi select type renderer
30
- *
31
- * @category Mage
32
- * @package Mage_Bundle
33
- * @author Magento Core Team <core@magentocommerce.com>
34
- */
35
- class Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Multi
36
- extends Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Multi
37
- {
38
- public function getSelectionTitlePrice($_selection, $includeContainer = true)
39
- {
40
- if (Mage::helper('b2bprofessional')->checkActive()){
41
- return $_selection->getName();
42
- }
43
- else {
44
- return parent::getSelectionTitlePrice($_selection, $includeContainer = true);
45
- }
46
- }
47
  }
1
+ <?php
2
+ /**
3
+ * Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Multi
4
+ * - Validate that the selection is active and display the custom information
5
+ *
6
+ * @category Sitewards
7
+ * @package Sitewards_B2BProfessional
8
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
9
+ */
10
+ class Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Multi extends Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Multi {
11
+ /**
12
+ * Validate that the selection is active and display custom information
13
+ *
14
+ * @param Mage_Catalog_Model_Product $oBundleSelection
15
+ * @param boolean $bIncludeContainer
16
+ * @return string
17
+ */
18
+ public function getSelectionTitlePrice($oBundleSelection, $bIncludeContainer = true) {
19
+ if (Mage::helper('b2bprofessional')->checkActive()) {
20
+ return $oBundleSelection->getName();
21
+ } else {
22
+ return parent::getSelectionTitlePrice($oBundleSelection, $bIncludeContainer);
23
+ }
24
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  }
app/code/community/Sitewards/B2BProfessional/Block/Bundle/Catalog/Product/View/Type/Bundle/Option/Radio.php CHANGED
@@ -1,47 +1,25 @@
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
- * 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 Mage
22
- * @package Mage_Bundle
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- /**
29
- * Bundle option radiobox type renderer
30
- *
31
- * @category Mage
32
- * @package Mage_Bundle
33
- * @author Magento Core Team <core@magentocommerce.com>
34
- */
35
- class Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Radio
36
- extends Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Radio
37
- {
38
- public function getSelectionTitlePrice($_selection, $includeContainer = true)
39
- {
40
- if (Mage::helper('b2bprofessional')->checkActive()){
41
- return $_selection->getName();
42
- }
43
- else {
44
- return parent::getSelectionTitlePrice($_selection, $includeContainer = true);
45
- }
46
- }
47
  }
1
+ <?php
2
+ /**
3
+ * Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Radio
4
+ * - Validate that the selection is active and display the custom information
5
+ *
6
+ * @category Sitewards
7
+ * @package Sitewards_B2BProfessional
8
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
9
+ */
10
+ class Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Radio extends Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Radio {
11
+ /**
12
+ * Validate that the selection is active and display custom information
13
+ *
14
+ * @param Mage_Catalog_Model_Product $oBundleSelection
15
+ * @param boolean $bIncludeContainer
16
+ * @return string
17
+ */
18
+ public function getSelectionTitlePrice($oBundleSelection, $bIncludeContainer = true) {
19
+ if (Mage::helper('b2bprofessional')->checkActive()) {
20
+ return $oBundleSelection->getName();
21
+ } else {
22
+ return parent::getSelectionTitlePrice($oBundleSelection, $bIncludeContainer);
23
+ }
24
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  }
app/code/community/Sitewards/B2BProfessional/Block/Bundle/Catalog/Product/View/Type/Bundle/Option/Select.php CHANGED
@@ -1,47 +1,25 @@
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
- * 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 Mage
22
- * @package Mage_Bundle
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- /**
29
- * Bundle option dropdown type renderer
30
- *
31
- * @category Mage
32
- * @package Mage_Bundle
33
- * @author Magento Core Team <core@magentocommerce.com>
34
- */
35
- class Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Select
36
- extends Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Select
37
- {
38
- public function getSelectionTitlePrice($_selection, $includeContainer = true)
39
- {
40
- if (Mage::helper('b2bprofessional')->checkActive()){
41
- return $_selection->getName();
42
- }
43
- else {
44
- return parent::getSelectionTitlePrice($_selection, $includeContainer = true);
45
- }
46
- }
47
  }
1
+ <?php
2
  /**
3
+ * Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Select
4
+ * - Validate that the selection is active and display the custom information
5
+ *
6
+ * @category Sitewards
7
+ * @package Sitewards_B2BProfessional
8
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
9
+ */
10
+ class Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Select extends Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Select {
11
+ /**
12
+ * Validate that the selection is active and display custom information
13
+ *
14
+ * @param Mage_Catalog_Model_Product $oBundleSelection
15
+ * @param boolean $bIncludeContainer
16
+ * @return string
17
+ */
18
+ public function getSelectionTitlePrice($oBundleSelection, $bIncludeContainer = true) {
19
+ if (Mage::helper('b2bprofessional')->checkActive()) {
20
+ return $oBundleSelection->getName();
21
+ } else {
22
+ return parent::getSelectionTitlePrice($oBundleSelection, $bIncludeContainer);
23
+ }
24
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  }
app/code/community/Sitewards/B2BProfessional/Block/Configurable.php CHANGED
@@ -1,46 +1,25 @@
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
- * 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 Mage
22
- * @package Mage_Catalog
23
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- /**
29
- * Product price block
30
- *
31
- * @category Mage
32
- * @package Mage_Catalog
33
  */
34
- class Sitewards_B2BProfessional_Block_Configurable extends Mage_Catalog_Block_Product_View_Type_Configurable
35
- {
36
-
37
- protected function _preparePrice($price, $isPercent=false)
38
- {
39
-
40
- if (Mage::helper('b2bprofessional')->checkActive()){
 
 
 
 
41
  return false;
42
  }
43
-
44
- return parent::_preparePrice($price, $isPercent=false);
45
  }
46
- }
1
+ <?php
2
  /**
3
+ * Sitewards_B2BProfessional_Block_Configurable
4
+ * - Check that the current product is active and override the price
5
  *
6
+ * @category Sitewards
7
+ * @package Sitewards_B2BProfessional
8
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  */
10
+ class Sitewards_B2BProfessional_Block_Configurable extends Mage_Catalog_Block_Product_View_Type_Configurable {
11
+ /**
12
+ * Check that the product is active
13
+ * - If it is not active the override the price
14
+ *
15
+ * @param float $fProductPrice
16
+ * @param boolean $bIsPercent
17
+ * @return boolean
18
+ */
19
+ protected function _preparePrice($fProductPrice, $bIsPercent = false) {
20
+ if (Mage::helper('b2bprofessional')->checkActive()) {
21
  return false;
22
  }
23
+ return parent::_preparePrice($fProductPrice, $bIsPercent);
 
24
  }
25
+ }
app/code/community/Sitewards/B2BProfessional/Block/Price.php CHANGED
@@ -1,62 +1,46 @@
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
- * 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 Mage
22
- * @package Mage_Catalog
23
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- /**
29
- * Product price block
30
- *
31
- * @category Mage
32
- * @package Mage_Catalog
33
- */
34
- class Sitewards_B2BProfessional_Block_Price extends Mage_Catalog_Block_Product_Price
35
- {
36
-
37
- protected static $_lastPid = 0;
38
-
39
- protected function _toHtml(){
40
-
41
- $_toHtml = parent::_toHtml();
42
- $currentPid = $this->getProduct()->getId();
43
-
44
-
45
-
46
- if (Mage::helper('b2bprofessional')->checkActive($currentPid)){
47
- if($currentPid == self::$_lastPid){ return ''; }
48
- self::$_lastPid = $currentPid;
49
-
50
- // text displayed instead of price
51
- if(Mage::getStoreConfig('b2bprofessional/languagesettings/languageoverride') == 1){
52
- $text = Mage::getStoreConfig('b2bprofessional/languagesettings/logintext');
53
- }
54
- else {
55
- $text = $this->__('Please login');
56
- }
57
- return $text;
58
- }
59
- return $_toHtml;
60
-
61
- }
62
  }
1
+ <?php
2
+ /**
3
+ * Sitewards_B2BProfessional_Block_Price
4
+ * - Check that the current product is active and display custom text
5
+ *
6
+ * @category Sitewards
7
+ * @package Sitewards_B2BProfessional
8
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
9
+ */
10
+ class Sitewards_B2BProfessional_Block_Price extends Mage_Catalog_Block_Product_Price {
11
+ /**
12
+ * The last product Id
13
+ *
14
+ * @var int
15
+ */
16
+ protected static $_iLastProductId = 0;
17
+
18
+ /**
19
+ * Check that the current product is active
20
+ * - Override the text with the module text
21
+ *
22
+ * @return string
23
+ */
24
+ protected function _toHtml() {
25
+ $sPriceHtml = parent::_toHtml();
26
+ $iCurrentProductId = $this->getProduct()->getId();
27
+ /* @var $oB2BHelper Sitewards_B2BProfessional_Helper_Data */
28
+ $oB2BHelper = Mage::helper('b2bprofessional');
29
+
30
+ if ($oB2BHelper->checkActive($iCurrentProductId)) {
31
+ if ($iCurrentProductId == self::$_iLastProductId) {
32
+ return '';
33
+ }
34
+ self::$_iLastProductId = $iCurrentProductId;
35
+
36
+ // text displayed instead of price
37
+ if (Mage::getStoreConfig('b2bprofessional/languagesettings/languageoverride') == 1) {
38
+ $sReplacementText = Mage::getStoreConfig('b2bprofessional/languagesettings/logintext');
39
+ } else {
40
+ $sReplacementText = $this->__('Please login');
41
+ }
42
+ return $sReplacementText;
43
+ }
44
+ return $sPriceHtml;
45
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
app/code/community/Sitewards/B2BProfessional/Block/Product/View/Options/Type/Date.php DELETED
@@ -1,48 +0,0 @@
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
- * 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 Mage
22
- * @package Mage_Catalog
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- /**
29
- * Product options text type block
30
- *
31
- * @category Mage
32
- * @package Mage_Catalog
33
- * @author Magento Core Team <core@magentocommerce.com>
34
- */
35
- class Sitewards_B2BProfessional_Block_Product_View_Options_Type_Date extends Mage_Catalog_Block_Product_View_Options_Type_Date
36
- {
37
-
38
- public function getFormatedPrice()
39
- {
40
- if (Mage::helper('b2bprofessional')->checkActive()){
41
- return '';
42
- }
43
- else {
44
- return parent::getFormatedPrice();
45
- }
46
- }
47
-
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Product/View/Options/Type/Default.php DELETED
@@ -1,48 +0,0 @@
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
- * 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 Mage
22
- * @package Mage_Catalog
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- /**
29
- * Product options default type block
30
- *
31
- * @category Mage
32
- * @package Mage_Catalog
33
- * @author Magento Core Team <core@magentocommerce.com>
34
- */
35
- class Sitewards_B2BProfessional_Block_Product_View_Options_Type_Default extends Mage_Catalog_Block_Product_View_Options_Type_Default
36
- {
37
-
38
- public function getFormatedPrice()
39
- {
40
- if (Mage::helper('b2bprofessional')->checkActive()){
41
- return '';
42
- }
43
- else {
44
- return parent::getFormatedPrice();
45
- }
46
- }
47
-
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Product/View/Options/Type/File.php DELETED
@@ -1,46 +0,0 @@
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
- * 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 Mage
22
- * @package Mage_Catalog
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- /**
29
- * Product options text type block
30
- *
31
- * @category Mage
32
- * @package Mage_Catalog
33
- * @author Magento Core Team <core@magentocommerce.com>
34
- */
35
- class Sitewards_B2BProfessional_Block_Product_View_Options_Type_File extends Mage_Catalog_Block_Product_View_Options_Type_File
36
- {
37
- public function getFormatedPrice()
38
- {
39
- if (Mage::helper('b2bprofessional')->checkActive()){
40
- return '';
41
- }
42
- else {
43
- return parent::getFormatedPrice();
44
- }
45
- }
46
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Product/View/Options/Type/Select.php DELETED
@@ -1,48 +0,0 @@
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
- * 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 Mage
22
- * @package Mage_Catalog
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- /**
29
- * Product options text type block
30
- *
31
- * @category Mage
32
- * @package Mage_Catalog
33
- * @author Magento Core Team <core@magentocommerce.com>
34
- */
35
- class Sitewards_B2BProfessional_Block_Product_View_Options_Type_Select extends Mage_Catalog_Block_Product_View_Options_Type_Select
36
- {
37
-
38
- public function getFormatedPrice()
39
- {
40
- if (Mage::helper('b2bprofessional')->checkActive()){
41
- return '';
42
- }
43
- else {
44
- return parent::getFormatedPrice();
45
- }
46
- }
47
-
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Product/View/Options/Type/Text.php DELETED
@@ -1,46 +0,0 @@
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
- * 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 Mage
22
- * @package Mage_Catalog
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- /**
29
- * Product options text type block
30
- *
31
- * @category Mage
32
- * @package Mage_Catalog
33
- * @author Magento Core Team <core@magentocommerce.com>
34
- */
35
- class Sitewards_B2BProfessional_Block_Product_View_Options_Type_Text extends Mage_Catalog_Block_Product_View_Options_Type_Text
36
- {
37
- public function getFormatedPrice()
38
- {
39
- if (Mage::helper('b2bprofessional')->checkActive()){
40
- return '';
41
- }
42
- else {
43
- return parent::getFormatedPrice();
44
- }
45
- }
46
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/View.php DELETED
@@ -1,44 +0,0 @@
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
- * 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 Mage
22
- * @package Mage_Catalog
23
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- /**
29
- * Product View block
30
- *
31
- * @category Mage
32
- * @package Mage_Catalog
33
- * @module Catalog
34
- */
35
- class Sitewards_B2BProfessional_Block_View extends Mage_Catalog_Block_Product_View
36
- {
37
- public function getProduct()
38
- {
39
-
40
- die();
41
-
42
- return parent::getProduct();
43
- }
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Helper/Data.php CHANGED
@@ -1,223 +1,227 @@
1
- <?php
2
- class Sitewards_B2BProfessional_Helper_Data extends Mage_Core_Helper_Abstract {
3
-
4
- function __construct(){
5
-
6
- //Mage::app()->getResponse()->setRedirect(Mage::getUrl('customer/account/login'))->sendHeaders();
7
-
8
- }
9
-
10
-
11
- function checkAllowed() {
12
-
13
- // if option is not active return true!
14
- if(Mage::getStoreConfig('b2bprofessional/generalsettings/activecustomers'))
15
- return true;
16
-
17
- $userStoreId = Mage::getSingleton('customer/session')->getCustomer()->getStore()->getGroupID();
18
- $currentStore = Mage::app()->getStore()->getGroupID();
19
- if($userStoreId == $currentStore)
20
- return true;
21
-
22
- return false;
23
-
24
- }
25
-
26
- function checkCategoryIsActive($productId = null) {
27
-
28
- $currentCategories = array();
29
-
30
- // activate by category
31
- if($productId !== null){
32
- $product = Mage::getModel('catalog/product')->load($productId);
33
-
34
-
35
-
36
- $parentIdArray = $product->loadParentProductIds()->getData('parent_product_ids');
37
-
38
- if(!empty($parentIdArray) && $product->isGrouped()){
39
- foreach($parentIdArray as $parentId){
40
- $parentProduct = Mage::getModel('catalog/product')->load($parentId);
41
- $parentProductCategories = $parentProduct->getCategoryIds();
42
- $currentCategories = array_merge($currentCategories,$parentProductCategories);
43
- }
44
- }
45
- else {
46
-
47
- $currentCategories = $product->getCategoryIds();
48
-
49
- }
50
-
51
-
52
-
53
-
54
- //var_dump($product->isGrouped());
55
-
56
- }
57
- else { $currentCategories = Mage::getModel('catalog/product')->getCategoryId(); }
58
-
59
- //weitere kategorien der unterprodukte
60
- /*
61
-
62
- $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
63
- $col = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
64
- foreach($col as $simple_product){
65
- var_dump($simple_product->getId());
66
- }
67
-
68
-
69
-
70
- if($product->isGrouped()) {
71
- $p = $this->childProducts($productId);
72
-
73
-
74
- }
75
-
76
- */
77
-
78
-
79
-
80
-
81
-
82
-
83
- $activeCategories = explode(',',Mage::getStoreConfig('b2bprofessional/activatebycategorysettings/activecategories'));
84
-
85
- if(!is_array($currentCategories)){
86
- $currentCategories = array($currentCategories);
87
- }
88
- $active = false;
89
- foreach($currentCategories as $category) {
90
- if(in_array($category,$activeCategories)) {
91
- $active = true;
92
- }
93
- }
94
- return $active;
95
- }
96
-
97
- function checkCustomerIsActive() {
98
-
99
- // activate by customer group
100
- $currentCustomerGroup = Mage::getModel('customer/session')->getCustomer()->getGroupID();
101
- $activeCustomerGroups = explode(',',Mage::getStoreConfig('b2bprofessional/activatebycustomersettings/activecustomers'));
102
-
103
- if(in_array($currentCustomerGroup,$activeCustomerGroups)){
104
- return true;
105
- }
106
- else {
107
- return false;
108
- }
109
-
110
- }
111
-
112
- function checkGlobalActive() {
113
-
114
- if(Mage::getStoreConfig('b2bprofessional/generalsettings/active') == 1){
115
- return true;
116
- }
117
- else {
118
- return false;
119
- }
120
-
121
- }
122
-
123
- function checkLoggedIn() {
124
- $loggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
125
- if(!Mage::helper('b2bprofessional')->checkAllowed()){
126
- $loggedIn = false;
127
- }
128
- return $loggedIn;
129
- }
130
-
131
- function checkActive($productId = null) {
132
-
133
- // global extension activation
134
- if (self::checkGlobalActive()) {
135
-
136
- // check user logged in and has store access
137
- if(self::checkLoggedIn()){
138
- $returnIsActive = false;
139
- }
140
- else {
141
- $returnIsActive = true;
142
- }
143
-
144
- // check activate by category
145
- if(Mage::getStoreConfig('b2bprofessional/activatebycategorysettings/activebycategory') == 1) {
146
- if (!self::checkCategoryIsActive($productId)) {
147
- $returnIsActive = false;
148
- }
149
- }
150
-
151
- // check activate by customer group
152
- if(Mage::getStoreConfig('b2bprofessional/activatebycustomersettings/activebycustomer') == 1) {
153
- if (!self::checkCustomerIsActive()) {
154
- $returnIsActive = false;
155
- }
156
- }
157
- }
158
- else {
159
- $returnIsActive = false;
160
- }
161
- return $returnIsActive;
162
- }
163
-
164
-
165
- function childProducts($entity_id) {
166
- $resource = Mage::getSingleton('core/resource');
167
- $read = $resource->getConnection('catalog_read');
168
- $productLinkTable = $resource->getTableName('catalog/product_link');
169
-
170
- $select_products = $read->select()
171
- ->from(array('plt' =>$productLinkTable))
172
- ->where('plt.product_id = ?', $entity_id);
173
-
174
- $items = $read->fetchAll($select_products);
175
-
176
- $simpleproducts = Mage::getModel('catalog/product')->load($entity_id)->getData();
177
-
178
-
179
-
180
- return $simpleproduct;
181
-
182
- }
183
-
184
-
185
-
186
- /*
187
- function checkProductCheckoutAllowed($productId) {
188
- $rule = '';
189
- if(empty($productId)){
190
- $rule .= ' No poductId given ';
191
- return false;
192
- }
193
- if(!self::checkGlobalActive()){
194
- return true;
195
- }
196
- if(self::checkCustomerIsActive()){
197
- $rule .= ' Customer group not allowed to checkout ';
198
- return false;
199
- }
200
- if(Mage::getStoreConfig('b2bprofessional/activatebycategorysettings/activebycategory') == 0 || self::checkLoggedIn()) {
201
- return true;
202
- }
203
- $product = Mage::getModel('catalog/product')->load($productId);
204
- $categories = $product->getCategoryIds();
205
- $activeCategories = explode(',',Mage::getStoreConfig('b2bprofessional/activatebycategorysettings/activecategories'));
206
- if(is_array($categories)) {
207
- $checkout = true;
208
- foreach($categories as $category) {
209
- if(in_array($category,$activeCategories)) {
210
- $rule .= ' Can not checkout from this product category ';
211
- $checkout = false;
212
- }
213
- }
214
- return $checkout;
215
- }
216
- else {
217
- $rule .= ' No category id available for this product ';
218
- return false;
219
- }
220
- }
221
- */
222
-
223
- }
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sitewards_B2BProfessional_Helper_Data
4
+ * - Create functions to,
5
+ * - Check if user is allowed on store,
6
+ * - Check if product category is active,
7
+ * - Check customer group is active,
8
+ * - Check module global flag,
9
+ * - Check that customer is logged in and active,
10
+ * - Check that the product/customer is activated,
11
+ *
12
+ * @category Sitewards
13
+ * @package Sitewards_B2BProfessional
14
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
15
+ */
16
+ class Sitewards_B2BProfessional_Helper_Data extends Mage_Core_Helper_Abstract {
17
+ /**
18
+ * Check to see if the user is allowed on the current store
19
+ *
20
+ * @return boolean
21
+ */
22
+ public function checkAllowed() {
23
+ // if option is not active return true!
24
+ if (Mage::getStoreConfig('b2bprofessional/generalsettings/activecustomers')) {
25
+ return true;
26
+ }
27
+
28
+ $iUserStoreId = Mage::getSingleton('customer/session')->getCustomer()->getStore()->getGroupID();
29
+ $iCurrentStoreId = Mage::app()->getStore()->getGroupID();
30
+
31
+ if ($iUserStoreId == $iCurrentStoreId) {
32
+ return true;
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Validate that the category of a give product is activated in the module
38
+ *
39
+ * @param int $iProductId
40
+ * @return boolean
41
+ */
42
+ public function checkCategoryIsActive($iProductId = null) {
43
+ $aCurrentCategories = array ();
44
+
45
+ // activate by category
46
+ if ($iProductId !== null) {
47
+ /* @var $oProduct Mage_Catalog_Model_Product */
48
+ $oProduct = Mage::getModel('catalog/product')->load($iProductId);
49
+ $aParentProductIds = $oProduct->loadParentProductIds()->getData('parent_product_ids');
50
+ if (!empty($aParentProductIds) && $oProduct->isGrouped()) {
51
+ foreach ($aParentProductIds as $iParentProductId) {
52
+ /* @var $oParentProduct Mage_Catalog_Model_Product */
53
+ $oParentProduct = Mage::getModel('catalog/product')->load($iParentProductId);
54
+ $aParentProductCategories = $oParentProduct->getCategoryIds();
55
+ $aCurrentCategories = array_merge($aCurrentCategories, $aParentProductCategories);
56
+ }
57
+ } else {
58
+ $aCurrentCategories = $oProduct->getCategoryIds();
59
+ }
60
+ } else {
61
+ $aCurrentCategories = array(Mage::getModel('catalog/product')->getCategoryId());
62
+ }
63
+ $aCurrentCategories = array_unique($aCurrentCategories);
64
+
65
+ $aActiveCategories = $this->getActiveCategories();
66
+ if (!is_array($aCurrentCategories)) {
67
+ $aCurrentCategories = array (
68
+ $aCurrentCategories
69
+ );
70
+ }
71
+ $bActive = false;
72
+ foreach ($aCurrentCategories as $iCategoryId) {
73
+ if (in_array($iCategoryId, $aActiveCategories)) {
74
+ $bActive = true;
75
+ }
76
+ }
77
+ return $bActive;
78
+ }
79
+
80
+ /**
81
+ * Check that the current customer has an active group id
82
+ *
83
+ * @return boolean
84
+ */
85
+ public function checkCustomerIsActive() {
86
+ // activate by customer group
87
+ /* @var $oCustomerSession Mage_Customer_Model_Session */
88
+ $oCustomerSession = Mage::getModel('customer/session');
89
+ $iCurrentCustomerGroupId = $oCustomerSession->getCustomerGroupId();
90
+ $aActiveCustomerGroupIds = explode(',', Mage::getStoreConfig('b2bprofessional/activatebycustomersettings/activecustomers'));
91
+
92
+ /*
93
+ * Always add the guest user when activated by customer group
94
+ * Note: the the group code for the guest user can not be changed via the admin section
95
+ */
96
+ $iGuestGroupId = Mage::getModel('customer/group')->load('NOT LOGGED IN', 'customer_group_code')->getId();
97
+ $aActiveCustomerGroupIds[] = $iGuestGroupId;
98
+
99
+ if (in_array($iCurrentCustomerGroupId, $aActiveCustomerGroupIds)) {
100
+ return true;
101
+ } else {
102
+ return false;
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Check the global active flag
108
+ *
109
+ * @return boolean
110
+ */
111
+ public function checkGlobalActive() {
112
+ if (Mage::getStoreConfig('b2bprofessional/generalsettings/active') == 1) {
113
+ return true;
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Check that a customer is logged in,
119
+ * - If they are logged in validate their account usint the checkAllowed function
120
+ *
121
+ * @return boolean
122
+ */
123
+ public function checkLoggedIn() {
124
+ $bLoggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
125
+ if (!$this->checkAllowed()) {
126
+ $bLoggedIn = false;
127
+ }
128
+ return $bLoggedIn;
129
+ }
130
+
131
+ /**
132
+ * Check that the product/customer is activated
133
+ *
134
+ * @param int $iProductId
135
+ * @return boolean
136
+ */
137
+ public function checkActive($iProductId = null) {
138
+ $bIsLoggedIn = false;
139
+ // global extension activation
140
+ if ($this->checkGlobalActive()) {
141
+ // check user logged in and has store access
142
+ if ($this->checkLoggedIn()) {
143
+ $bIsLoggedIn = true;
144
+ }
145
+
146
+ $bCheckUser = Mage::getStoreConfigFlag('b2bprofessional/activatebycustomersettings/activebycustomer');
147
+ $bCheckCategory = Mage::getStoreConfigFlag('b2bprofessional/activatebycategorysettings/activebycategory');
148
+
149
+ if($bCheckUser == true && $bCheckCategory == true) {
150
+ // check both the category and customer group is active via the extension
151
+ if ($this->checkCategoryIsActive($iProductId) && $this->checkCustomerIsActive()) {
152
+ $bIsActive = true;
153
+ } else {
154
+ $bIsActive = false;
155
+ }
156
+ } elseif($bCheckUser == true) {
157
+ // check user group is active via the extension
158
+ if ($this->checkCustomerIsActive()) {
159
+ $bIsActive = true;
160
+ } else {
161
+ $bIsActive = false;
162
+ }
163
+ } elseif ($bCheckCategory == true) {
164
+ // check category is active via the extension
165
+ if (!$this->checkCategoryIsActive($iProductId) || $bIsLoggedIn == true) {
166
+ $bIsActive = false;
167
+ } else {
168
+ $bIsActive = true;
169
+ }
170
+ } else {
171
+ if ($bIsLoggedIn == false) {
172
+ $bIsActive = true;
173
+ } else {
174
+ $bIsActive = false;
175
+ }
176
+ }
177
+ } else {
178
+ $bIsActive = false;
179
+ }
180
+ return $bIsActive;
181
+ }
182
+
183
+ /**
184
+ * Get all active categories
185
+ * - allow for sub categories also
186
+ * @param boolean $bIncludeSubCategories
187
+ * @return array
188
+ * array(
189
+ * cat_id_1,
190
+ * cat_id_2
191
+ * )
192
+ */
193
+ public function getActiveCategories($bIncludeSubCategories = true) {
194
+ $aCurrentActiveCategories = explode(',', Mage::getStoreConfig('b2bprofessional/activatebycategorysettings/activecategories'));
195
+ if($bIncludeSubCategories == false) {
196
+ return $aCurrentActiveCategories;
197
+ }
198
+
199
+ $aSubActiveCategories = array();
200
+ foreach ($aCurrentActiveCategories as $iCategoryId) {
201
+ $aSubActiveCategories = $this->addCategoryChildren($iCategoryId, $aSubActiveCategories);
202
+ }
203
+ return array_unique($aSubActiveCategories);
204
+ }
205
+
206
+ /**
207
+ * From given category id load all child ids into an array
208
+ *
209
+ * @param int $iCategoryId
210
+ * @param array $aCurrentCategories
211
+ * array(
212
+ * cat_id_1,
213
+ * cat_id_2
214
+ * )
215
+ * @return array
216
+ * array(
217
+ * cat_id_1,
218
+ * cat_id_2
219
+ * )
220
+ */
221
+ public function addCategoryChildren($iCategoryId, $aCurrentCategories = array()) {
222
+ /* @var $oCurrentCategory Mage_Catalog_Model_Category */
223
+ $oCurrentCategory = Mage::getModel('catalog/category');
224
+ $oCurrentCategory = $oCurrentCategory->load($iCategoryId);
225
+ return array_merge($aCurrentCategories, $oCurrentCategory->getAllChildren(true));
226
+ }
227
+ }
app/code/community/Sitewards/B2BProfessional/Model/Customer.php CHANGED
@@ -1,72 +1,55 @@
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
- * 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 Mage
22
- * @package Mage_Customer
23
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
- /**
28
- * Customer model
29
- *
30
- * @author Magento Core Team <core@magentocommerce.com>
31
- */
32
-
33
- class Sitewards_B2BProfessional_Model_Customer extends Mage_Customer_Model_Customer
34
- {
35
- const XML_PATH_DISTRIBUTOR_EMAIL_TEMPLATE = 'customer/create_account/email_distributor_template';
36
-
37
- const EXCEPTION_CUSTOMER_NOT_ACTIVATED = 996;
38
-
39
- /**
40
- * Authenticate customer
41
- *
42
- * @param string $login
43
- * @param string $password
44
- * @return true
45
- * @throws Exception
46
- */
47
- public function authenticate($login, $password)
48
- {
49
- $this->loadByEmail($login);
50
- if ($this->getConfirmation() && $this->isConfirmationRequired()) {
51
- throw new Exception(Mage::helper('customer')->__('This account is not confirmed.'), self::EXCEPTION_EMAIL_NOT_CONFIRMED);
52
- }
53
- if (!$this->validatePassword($password)) {
54
- throw new Exception(Mage::helper('customer')->__('Invalid login or password.'), self::EXCEPTION_INVALID_EMAIL_OR_PASSWORD);
55
- }
56
-
57
- if (!$this->getData('customer_activated')) {
58
- if (Mage::app()->getRequest()->getActionName() == 'createpost') {
59
- $session->addSuccess(Mage::helper('customer')->__('Please wait for your account to be activated'));
60
- } else {
61
- throw new Exception(Mage::helper('customer')->__('This account is not activated.'), self::EXCEPTION_CUSTOMER_NOT_ACTIVATED);
62
- }
63
- }
64
-
65
- Mage::dispatchEvent('customer_customer_authenticated', array(
66
- 'model' => $this,
67
- 'password' => $password,
68
- ));
69
-
70
- return true;
71
- }
72
- }
1
+ <?php
2
+ /**
3
+ * Sitewards_B2BProfessional_Model_Customer
4
+ * - Authenticate the user and display correct message
5
+ *
6
+ * @category Sitewards
7
+ * @package Sitewards_B2BProfessional
8
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
9
+ */
10
+ class Sitewards_B2BProfessional_Model_Customer extends Mage_Customer_Model_Customer {
11
+ const XML_PATH_DISTRIBUTOR_EMAIL_TEMPLATE = 'customer/create_account/email_distributor_template';
12
+ const EXCEPTION_CUSTOMER_NOT_ACTIVATED = 996;
13
+
14
+ /**
15
+ * Authenticate customer,
16
+ * - Check they have been confirmed,
17
+ * - Validate password,
18
+ * - If cusomter is not active,
19
+ * - Throw correct exception or add system message,
20
+ *
21
+ * @param string $sLoginEmail
22
+ * @param string $sLoginPassword
23
+ * @return true
24
+ * @throws Exception
25
+ * - Customer is not confirmed and confirmation is required,
26
+ * - When password is not valid,
27
+ * - If customer is not active and the action name is not 'createpost'
28
+ */
29
+ public function authenticate($sLoginEmail, $sLoginPassword) {
30
+ /* @var $oCustomerHelper Mage_Customer_Helper_Data */
31
+ $oCustomerHelper = Mage::helper('customer');
32
+ $this->loadByEmail($sLoginEmail);
33
+ if ($this->getConfirmation() && $this->isConfirmationRequired()) {
34
+ throw new Exception($oCustomerHelper->__('This account is not confirmed.'), self::EXCEPTION_EMAIL_NOT_CONFIRMED );
35
+ }
36
+ if (!$this->validatePassword($sLoginPassword)) {
37
+ throw new Exception($oCustomerHelper->__('Invalid login or password.'), self::EXCEPTION_INVALID_EMAIL_OR_PASSWORD );
38
+ }
39
+
40
+ if (!$this->getData('customer_activated')) {
41
+ if (Mage::app()->getRequest()->getActionName() == 'createpost') {
42
+ $oSession->addSuccess($oCustomerHelper->__('Please wait for your account to be activated'));
43
+ } else {
44
+ throw new Exception ($oCustomerHelper->__ ('This account is not activated.'), self::EXCEPTION_CUSTOMER_NOT_ACTIVATED );
45
+ }
46
+ }
47
+
48
+ Mage::dispatchEvent('customer_customer_authenticated', array(
49
+ 'model' => $this,
50
+ 'password' => $sLoginPassword
51
+ ));
52
+
53
+ return true;
54
+ }
55
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Model/Observer.php DELETED
@@ -1,51 +0,0 @@
1
- <?php
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 Mage
17
- * @package Sitewards_B2BProfessional
18
- * @copyright Copyright (c) 2010 Sitewards GmbH - www.sitewards.com
19
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
- */
21
- class Sitewards_B2BProfessional_Model_Observer extends Mage_Core_Model_Abstract
22
- {
23
- /**
24
- * @param Varien_Event_Observer $observer
25
- */
26
- public function loginredirectEvent($observer)
27
- {
28
- // only redirect if extension and redirect option are active and user is not logged in
29
- if(
30
- Mage::getStoreConfig('b2bprofessional/generalsettings/redirect') != 1 ||
31
- Mage::getStoreConfig('b2bprofessional/generalsettings/active') != 1 ||
32
- Mage::helper('b2bprofessional')->checkLoggedIn()
33
- ){
34
- return true;
35
- }
36
-
37
- // get current controller
38
- $controller = Mage::app()->getRequest()->getControllerName();
39
-
40
- switch($controller){
41
- // allow account access (login, password request, registration, ...)
42
- case "account": continue;
43
- // redirect all other requests to login page
44
- default:
45
- Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::app()->getRequest()->getRequestUri());
46
- Mage::app()->getResponse()->setRedirect(Mage::helper('adminhtml')->getUrl("customer/account/login"));
47
- }
48
-
49
- }
50
-
51
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Model/Resource/Eav/Mysql4/Product.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
-
3
- class Sitewards_B2BProfessional_Model_Resource_Eav_Mysql4_Product extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product {
4
- public function getParentProductIds($object)
5
- {
6
- $childId = $object->getId();
7
-
8
- $groupedProductsTable = $this->getTable('catalog/product_link');
9
- $groupedLinkTypeId = Mage_Catalog_Model_Product_Link::LINK_TYPE_GROUPED;
10
-
11
- $configurableProductsTable = $this->getTable('catalog/product_super_link');
12
-
13
- $groupedSelect = $this->_getReadAdapter()->select()
14
- ->from(array('g'=>$groupedProductsTable), 'g.product_id')
15
- ->where("g.linked_product_id = ?", $childId)
16
- ->where("link_type_id = ?", $groupedLinkTypeId);
17
-
18
- $groupedIds = $this->_getReadAdapter()->fetchCol($groupedSelect);
19
-
20
- $configurableSelect = $this->_getReadAdapter()->select()
21
- ->from(array('c'=>$configurableProductsTable), 'c.parent_id')
22
- ->where("c.product_id = ?", $childId);
23
-
24
- $configurableIds = $this->_getReadAdapter()->fetchCol($configurableSelect);
25
- return array_merge($groupedIds, $configurableIds);
26
- }
27
- }
28
-
29
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Model/System/Config/Source/Category.php CHANGED
@@ -1,61 +1,39 @@
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
- * 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 Mage
22
- * @package Mage_Adminhtml
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
- /**
28
- * Config category source
29
- *
30
- * @category Mage
31
- * @package Mage_Adminhtml
32
- * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
- class Sitewards_B2BProfessional_Model_System_Config_Source_Category extends Mage_Adminhtml_Model_System_Config_Source_Category
35
- {
36
- public function toOptionArray($addEmpty = true)
37
- {
38
- $tree = Mage::getResourceModel('catalog/category_tree');
39
- $collection = Mage::getResourceModel('catalog/category_collection');
40
-
41
- $collection->addAttributeToSelect('name')
42
- ->load();
43
-
44
- $options = array();
45
-
46
- if ($addEmpty) {
47
- $options[] = array(
48
- 'label' => Mage::helper('adminhtml')->__('-- Please select at least one category --'),
49
- 'value' => ''
50
- );
51
- }
52
- foreach ($collection as $category) {
53
- $options[] = array(
54
- 'label' => $category->getName(),
55
- 'value' => $category->getId()
56
- );
57
- }
58
-
59
- return $options;
60
- }
61
- }
 
 
1
  <?php
2
  /**
3
+ * Sitewards_B2BProfessional_Model_System_Config_Source_Category
4
+ * - Create an options array with the current system categories
5
  *
6
+ * @category Sitewards
7
+ * @package Sitewards_B2BProfessional
8
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  */
10
+ class Sitewards_B2BProfessional_Model_System_Config_Source_Category extends Mage_Adminhtml_Model_System_Config_Source_Category {
11
+ /**
12
+ * Populate an options array with the current system categories
13
+ *
14
+ * @param boolean $bAddEmpty
15
+ * @return array
16
+ */
17
+ public function toOptionArray($bAddEmpty = true) {
18
+ /* @var $oCategoryCollection Mage_Catalog_Model_Resource_Category_Collection */
19
+ $oCategoryCollection = Mage::getResourceModel('catalog/category_collection');
20
+ $oCategoryCollection->addAttributeToSelect('name')->load();
21
+
22
+ $aCategoryOptions = array ();
23
+ if ($bAddEmpty) {
24
+ $aCategoryOptions [] = array (
25
+ 'label' => Mage::helper('adminhtml')->__ ('-- Please select at least one category --'),
26
+ 'value' => ''
27
+ );
28
+ }
29
+ foreach ($oCategoryCollection as $oCategory) {
30
+ /* @var $oCategory Mage_Catalog_Model_Category */
31
+ $aCategoryOptions [] = array (
32
+ 'label' => $oCategory->getName(),
33
+ 'value' => $oCategory->getId()
34
+ );
35
+ }
36
+
37
+ return $aCategoryOptions;
38
+ }
39
+ }
app/code/community/Sitewards/B2BProfessional/controllers/CartController.php CHANGED
@@ -1,79 +1,49 @@
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
- * 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 Mage
22
- * @package Mage_Checkout
23
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
- /**
28
- * Shopping cart controller
29
  */
30
-
31
  require_once 'Mage/Checkout/controllers/CartController.php';
32
-
33
- class Sitewards_B2BProfessional_CartController extends Mage_Checkout_CartController
34
- {
35
- public function preDispatch()
36
- {
37
-
38
- parent::preDispatch();
39
-
40
- $request = $this->getRequest();
41
- $productId = $request->get('product');
42
-
43
-
44
- // check for grouped products
45
-
46
- $allowed = true;
47
- $multiProducts = $request->getPost('super_group');
48
- if(!empty($multiProducts)){
49
- foreach($multiProducts as $key => $value){
50
- if($value > 0){
51
- if(Mage::helper('b2bprofessional')->checkActive($key)){
52
- $allowed = false;
53
- }
54
- }
55
- }
56
- }
57
-
58
- // var_dump($allowed); die();
59
-
60
- /*
61
- var_dump($productId); die();
62
- if ($request->isPost) {
63
-
64
- }
65
- */
66
-
67
- if((!empty($productId) && Mage::helper('b2bprofessional')->checkActive($productId)) || !$allowed){
68
- $this->setFlag('', 'no-dispatch', true);
69
- if(Mage::getStoreConfig('b2bprofessional/languagesettings/languageoverride') == 1){
70
- Mage::getSingleton('customer/session')->addError(Mage::getStoreConfig('b2bprofessional/languagesettings/errortext'));
71
- } else {
72
- Mage::getSingleton('customer/session')->addError($this->__('Your account is not allowed to access this store.'));
73
- }
74
- Mage::app()->getResponse()->setRedirect(Mage::getUrl('customer/account/login'))->sendHeaders();
75
- }
76
-
77
- }
78
-
79
- }
1
  <?php
2
  /**
3
+ * Sitewards_B2BProfessional_CartController
4
+ * - Add product check on the preDispatch function
5
  *
6
+ * @category Sitewards
7
+ * @package Sitewards_B2BProfessional
8
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  */
 
10
  require_once 'Mage/Checkout/controllers/CartController.php';
11
+ class Sitewards_B2BProfessional_CartController extends Mage_Checkout_CartController {
12
+ /**
13
+ * On checkout cart controller preDispatch
14
+ * - validate that all products are active for customer/customer group,
15
+ * - assign error message,
16
+ * - redirect to customer login page,
17
+ */
18
+ public function preDispatch() {
19
+ parent::preDispatch ();
20
+
21
+ $oRequest = $this->getRequest();
22
+ $iProductId = $oRequest->get('product');
23
+ /* @var $oB2BHelper Sitewards_B2BProfessional_Helper_Data */
24
+ $oB2BHelper = Mage::helper('b2bprofessional');
25
+
26
+ // check for grouped products
27
+ $bAllowed = true;
28
+ $aMultiProducts = $oRequest->getPost('super_group');
29
+ if (!empty($aMultiProducts)) {
30
+ foreach ($aMultiProducts as $iMultiProductId => $iMultiProductValue) {
31
+ if ($iMultiProductValue > 0) {
32
+ if ($oB2BHelper->checkActive($iMultiProductId)) {
33
+ $bAllowed = false;
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ if ((!empty($iProductId) && $oB2BHelper->checkActive($iProductId)) || ! $bAllowed) {
40
+ $this->setFlag('', 'no-dispatch', true);
41
+ if (Mage::getStoreConfig('b2bprofessional/languagesettings/languageoverride') == 1) {
42
+ Mage::getSingleton('customer/session')->addError(Mage::getStoreConfig('b2bprofessional/languagesettings/errortext'));
43
+ } else {
44
+ Mage::getSingleton('customer/session')->addError($this->__('Your account is not allowed to access this store.'));
45
+ }
46
+ Mage::app()->getResponse()->setRedirect(Mage::getUrl('customer/account/login'))->sendHeaders();
47
+ }
48
+ }
49
+ }
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/etc/adminhtml.xml CHANGED
@@ -1,43 +1,33 @@
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 Sitewards
17
- * @package Sitewards_B2BProfessional
18
- * @copyright Copyright (c) 2009 Sitewards GmbH (http://www.sitewards.de)
19
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
22
  <config>
23
- <acl>
24
- <resources>
25
- <admin>
26
- <children>
27
- <system>
28
- <children>
29
- <config>
30
- <children>
31
- <b2bprofessional translate="title" module="b2bprofessional">
32
- <title>B2B Professional</title>
33
- <sort_order>50</sort_order>
34
- </b2bprofessional>
35
- </children>
36
- </config>
37
- </children>
38
- </system>
39
- </children>
40
- </admin>
41
- </resources>
42
- </acl>
43
- </config>
1
  <?xml version="1.0"?>
2
  <!--
3
  /**
4
+ * adminhtml.xml
5
+ * - create acl for this module
6
  *
7
+ * @category Sitewards
8
+ * @package Sitewards_B2BProfessional
9
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
 
 
 
 
 
 
 
 
 
 
 
10
  */
11
  -->
12
  <config>
13
+ <acl>
14
+ <resources>
15
+ <admin>
16
+ <children>
17
+ <system>
18
+ <children>
19
+ <config>
20
+ <children>
21
+ <b2bprofessional translate="title" module="b2bprofessional">
22
+ <title>B2B Professional</title>
23
+ <sort_order>50</sort_order>
24
+ </b2bprofessional>
25
+ </children>
26
+ </config>
27
+ </children>
28
+ </system>
29
+ </children>
30
+ </admin>
31
+ </resources>
32
+ </acl>
33
+ </config>
app/code/community/Sitewards/B2BProfessional/etc/config.xml CHANGED
@@ -1,125 +1,108 @@
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 Sitewards
17
- * @package Sitewards_B2BProfessional
18
- * @copyright Copyright (c) 2009 Sitewards GmbH (http://www.sitewards.de)
19
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
22
  <config>
23
- <modules>
24
- <Sitewards_B2BProfessional>
25
- <version>1.0.5</version>
26
- </Sitewards_B2BProfessional>
27
- </modules>
28
- <global>
29
- <models>
30
- <catalog_resource_eav_mysql4>
31
- <rewrite>
32
- <product>Sitewards_B2BProfessional_Model_Resource_Eav_Mysql4_Product</product>
33
- </rewrite>
34
- </catalog_resource_eav_mysql4>
35
- </models>
36
- <blocks>
37
- <bundle>
38
- <rewrite>
39
- <catalog_product_price>Sitewards_B2BProfessional_Block_Price</catalog_product_price>
40
- </rewrite>
41
- <rewrite>
42
- <catalog_product_view_type_bundle_option_checkbox>Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Checkbox</catalog_product_view_type_bundle_option_checkbox>
43
- <catalog_product_view_type_bundle_option_multi>Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Multi</catalog_product_view_type_bundle_option_multi>
44
- <catalog_product_view_type_bundle_option_radio>Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Radio</catalog_product_view_type_bundle_option_radio>
45
- <catalog_product_view_type_bundle_option_select>Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Select</catalog_product_view_type_bundle_option_select>
46
- </rewrite>
47
- </bundle>
48
- <catalog>
49
- <rewrite>
50
- <product_view_options_type_date>Sitewards_B2BProfessional_Block_Product_View_Options_Type_Date</product_view_options_type_date>
51
- <product_view_options_type_default>Sitewards_B2BProfessional_Block_Product_View_Options_Type_Default</product_view_options_type_default>
52
- <product_view_options_type_file>Sitewards_B2BProfessional_Block_Product_View_Options_Type_File</product_view_options_type_file>
53
- <product_view_options_type_select>Sitewards_B2BProfessional_Block_Product_View_Options_Type_Select</product_view_options_type_select>
54
- <product_view_options_type_text>Sitewards_B2BProfessional_Block_Product_View_Options_Type_Text</product_view_options_type_text>
55
- </rewrite>
56
- <rewrite>
57
- <product_price>Sitewards_B2BProfessional_Block_Price</product_price>
58
- </rewrite>
59
- <rewrite>
60
- <product_view_type_configurable>Sitewards_B2BProfessional_Block_Configurable</product_view_type_configurable>
61
- </rewrite>
62
- </catalog>
63
- <b2bprofessional>
64
- <class>Sitewards_B2BProfessional_Block</class>
65
- </b2bprofessional>
66
- </blocks>
67
- <helpers>
68
- <b2bprofessional>
69
- <class>Sitewards_B2BProfessional_Helper</class>
70
- </b2bprofessional>
71
- </helpers>
72
- <rewrite>
73
- <sitewards_B2BProfessional_cart>
74
- <from><![CDATA[#^/checkout/cart/#]]></from>
75
- <to>B2BProfessional/cart/</to>
76
- </sitewards_B2BProfessional_cart>
77
- </rewrite>
78
- </global>
79
- <frontend>
80
- <events>
81
- <http_response_send_before>
82
- <observers>
83
  <b2bprofessional>
84
- <type>singleton</type>
85
- <class>Sitewards_B2BProfessional_Model_Observer</class>
86
- <method>loginredirectEvent</method>
87
  </b2bprofessional>
88
- </observers>
89
- </http_response_send_before>
90
- </events>
91
- <routers>
92
- <Sitewards_B2BProfessional>
93
- <use>standard</use>
94
- <args>
95
- <module>Sitewards_B2BProfessional</module>
96
- <frontName>B2BProfessional</frontName>
97
- </args>
98
- </Sitewards_B2BProfessional>
99
- </routers>
100
- <layout>
101
- <updates>
102
- <b2bprofessional>
103
- <file>B2BProfessional.xml</file>
104
- </b2bprofessional>
105
- </updates>
106
- </layout>
107
- <translate>
108
- <modules>
109
- <Sitewards_B2BProfessional>
110
- <files>
111
- <default>Sitewards_B2BProfessional.csv</default>
112
- </files>
113
- </Sitewards_B2BProfessional>
114
- </modules>
115
- </translate>
116
- </frontend>
117
- <default>
118
- <b2bprofessional>
119
  <languagesettings>
120
  <logintext>Please login</logintext>
121
  <errortext>Your account is not allowed to access this store.</errortext>
122
  </languagesettings>
123
  </b2bprofessional>
124
  </default>
125
- </config>
1
  <?xml version="1.0"?>
2
  <!--
3
  /**
4
+ * config.xml
5
+ * - rewrite blocks,
6
+ * - set-up helper,
7
+ * - set-up url rewrite,
8
+ * - define router,
9
+ * - set-up layout.xml,
10
+ * - set-up translation file,
11
+ * - define default values
12
  *
13
+ * @category Sitewards
14
+ * @package Sitewards_B2BProfessional
15
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
 
 
 
 
 
 
 
 
 
 
 
16
  */
17
  -->
18
  <config>
19
+ <modules>
20
+ <Sitewards_B2BProfessional>
21
+ <version>2.0.0</version>
22
+ </Sitewards_B2BProfessional>
23
+ </modules>
24
+ <global>
25
+ <blocks>
26
+ <bundle>
27
+ <rewrite>
28
+ <catalog_product_price>Sitewards_B2BProfessional_Block_Bundle_Catalog_Price</catalog_product_price>
29
+ <catalog_product_view_type_bundle_option_checkbox>Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Checkbox</catalog_product_view_type_bundle_option_checkbox>
30
+ <catalog_product_view_type_bundle_option_multi>Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Multi</catalog_product_view_type_bundle_option_multi>
31
+ <catalog_product_view_type_bundle_option_radio>Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Radio</catalog_product_view_type_bundle_option_radio>
32
+ <catalog_product_view_type_bundle_option_select>Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Select</catalog_product_view_type_bundle_option_select>
33
+ </rewrite>
34
+ </bundle>
35
+ <catalog>
36
+ <rewrite>
37
+ <product_price>Sitewards_B2BProfessional_Block_Price</product_price>
38
+ <product_view_type_configurable>Sitewards_B2BProfessional_Block_Configurable</product_view_type_configurable>
39
+ </rewrite>
40
+ </catalog>
41
+ <b2bprofessional>
42
+ <class>Sitewards_B2BProfessional_Block</class>
43
+ </b2bprofessional>
44
+ </blocks>
45
+ <helpers>
46
+ <b2bprofessional>
47
+ <class>Sitewards_B2BProfessional_Helper</class>
48
+ </b2bprofessional>
49
+ </helpers>
50
+ <models>
51
+ <b2bprofessional>
52
+ <class>Sitewards_B2BProfessional_Model</class>
53
+ </b2bprofessional>
54
+ </models>
55
+ <rewrite>
56
+ <sitewards_B2BProfessional_cart>
57
+ <from><![CDATA[#^/checkout/cart/#]]></from>
58
+ <to>B2BProfessional/cart/</to>
59
+ </sitewards_B2BProfessional_cart>
60
+ </rewrite>
61
+ </global>
62
+ <frontend>
63
+ <routers>
64
+ <Sitewards_B2BProfessional>
65
+ <use>standard</use>
66
+ <args>
67
+ <module>Sitewards_B2BProfessional</module>
68
+ <frontName>B2BProfessional</frontName>
69
+ </args>
70
+ </Sitewards_B2BProfessional>
71
+ </routers>
72
+ <layout>
73
+ <updates>
 
 
 
 
 
74
  <b2bprofessional>
75
+ <file>B2BProfessional.xml</file>
 
 
76
  </b2bprofessional>
77
+ </updates>
78
+ </layout>
79
+ <translate>
80
+ <modules>
81
+ <Sitewards_B2BProfessional>
82
+ <files>
83
+ <default>Sitewards_B2BProfessional.csv</default>
84
+ </files>
85
+ </Sitewards_B2BProfessional>
86
+ </modules>
87
+ </translate>
88
+ </frontend>
89
+ <adminhtml>
90
+ <translate>
91
+ <modules>
92
+ <Sitewards_B2BProfessional>
93
+ <files>
94
+ <default>Sitewards_B2BProfessional.csv</default>
95
+ </files>
96
+ </Sitewards_B2BProfessional>
97
+ </modules>
98
+ </translate>
99
+ </adminhtml>
100
+ <default>
101
+ <b2bprofessional>
 
 
 
 
 
 
102
  <languagesettings>
103
  <logintext>Please login</logintext>
104
  <errortext>Your account is not allowed to access this store.</errortext>
105
  </languagesettings>
106
  </b2bprofessional>
107
  </default>
108
+ </config>
app/code/community/Sitewards/B2BProfessional/etc/system.xml CHANGED
@@ -1,272 +1,162 @@
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 Sitewards
17
- * @package Sitewards_B2BProfessional
18
- * @copyright Copyright (c) 2009 Sitewards GmbH (http://www.sitewards.de)
19
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
  -->
22
  <config>
23
- <tabs>
24
- <b2bprofessional translate="label" module="b2bprofessional">
25
- <label>B2B Professional</label>
26
- <sort_order>301</sort_order>
27
- </b2bprofessional>
28
- </tabs>
29
- <sections>
30
- <b2bprofessional translate="label" module="b2bprofessional">
31
- <label>B2B Professional</label>
32
- <tab>general</tab>
33
- <frontend_type>text</frontend_type>
34
- <sort_order>990</sort_order>
35
- <show_in_default>1</show_in_default>
36
- <show_in_website>1</show_in_website>
37
- <show_in_store>1</show_in_store>
38
- <groups>
39
- <generalsettings translate="label">
40
- <label>General settings</label>
41
- <frontend_type>text</frontend_type>
42
- <sort_order>1</sort_order>
43
- <show_in_default>1</show_in_default>
44
- <show_in_website>1</show_in_website>
45
- <show_in_store>1</show_in_store>
46
- <fields>
47
- <active translate="label">
48
- <label>Enable B2B extension</label>
49
- <frontend_type>select</frontend_type>
50
- <source_model>adminhtml/system_config_source_yesno</source_model>
51
- <sort_order>1</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
- <comment><![CDATA[Enable or disable extension. Customer activation behaviour can be configured under <br />"Customer Configuration > Customer activation"]]></comment>
56
- </active>
57
- <redirect translate="label">
58
- <label>Redirect to login page</label>
59
- <frontend_type>select</frontend_type>
60
- <source_model>adminhtml/system_config_source_yesno</source_model>
61
- <sort_order>2</sort_order>
62
- <show_in_default>1</show_in_default>
63
- <show_in_website>1</show_in_website>
64
- <show_in_store>1</show_in_store>
65
- <comment><![CDATA[Always redirect to login page if user is not logged in. That means no access to the whole site.]]></comment>
66
- </redirect>
67
- <activecustomers translate="label">
68
- <label>Global customer activation</label>
69
- <frontend_type>select</frontend_type>
70
- <source_model>adminhtml/system_config_source_yesno</source_model>
71
- <sort_order>3</sort_order>
72
- <show_in_default>1</show_in_default>
73
- <show_in_website>1</show_in_website>
74
- <show_in_store>1</show_in_store>
75
- <comment>
76
- <![CDATA[Activate customers for all stores. Otherwise they will only see the prices in the store, they have registered for.]]>
77
- </comment>
78
- </activecustomers>
79
- <notes translate="label">
80
- <label>Developer Notes</label>
81
- <frontend_type>note</frontend_type>
82
- <sort_order>999</sort_order>
83
  <show_in_default>1</show_in_default>
84
  <show_in_website>1</show_in_website>
85
  <show_in_store>1</show_in_store>
86
- <comment><![CDATA[<b>If you are happy with our extension, please</b><br /><a href="http://www.magentocommerce.com/magento-connect/Sitewards/extension/4864/sitewards_b2bprofessional/reviews" target="_blank">give us some feedback</a>]]></comment>
87
- </notes>
 
 
 
 
 
 
 
 
 
 
88
  </fields>
89
  </generalsettings>
90
- <languagesettings translate="label">
91
- <label>Language settings</label>
92
- <frontend_type>text</frontend_type>
93
- <sort_order>2</sort_order>
94
- <show_in_default>1</show_in_default>
95
- <show_in_website>1</show_in_website>
96
- <show_in_store>1</show_in_store>
97
- <fields>
98
- <languageoverride translate="label">
99
- <label>Override language file</label>
100
- <frontend_type>select</frontend_type>
101
- <source_model>adminhtml/system_config_source_yesno</source_model>
102
- <sort_order>3</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
- <comment>
107
- <![CDATA[
108
- Override language file text with text specified below
109
- ]]>
110
- </comment>
111
- </languageoverride>
112
-
113
- <logintext translate="label">
114
- <label>Custom text for price</label>
115
- <frontend_type>textarea</frontend_type>
116
- <sort_order>4</sort_order>
117
- <show_in_default>1</show_in_default>
118
- <show_in_website>1</show_in_website>
119
- <show_in_store>1</show_in_store>
120
- <comment>
121
- <![CDATA[
122
- Text to be displayed instead of the prices.<br />
123
- Only visible when language override is active.<br />
124
- Otherwise text in language file is used.<br />
125
- May contain HTML
126
- ]]>
127
- </comment>
128
- </logintext>
129
- <errortext translate="label">
130
- <label>Custom text for checkout-error</label>
131
- <frontend_type>textarea</frontend_type>
132
- <sort_order>5</sort_order>
133
- <show_in_default>1</show_in_default>
134
- <show_in_website>1</show_in_website>
135
- <show_in_store>1</show_in_store>
136
- <comment>
137
- <![CDATA[
138
- Text to be displayed when customer is not allowed to checkout product.<br />
139
- Only visible when language override is active.<br />
140
- Otherwise text in language file is used.<br />
141
- May contain HTML
142
- ]]>
143
- </comment>
144
- </errortext>
145
  </fields>
146
  </languagesettings>
147
- <activatebycategorysettings translate="label">
148
- <label>Activate by category</label>
149
- <frontend_type>text</frontend_type>
150
- <sort_order>3</sort_order>
151
- <show_in_default>1</show_in_default>
152
- <show_in_website>1</show_in_website>
153
- <show_in_store>1</show_in_store>
154
- <fields>
155
- <activebycategory translate="label">
156
- <label>Activate by category</label>
157
- <frontend_type>select</frontend_type>
158
- <source_model>adminhtml/system_config_source_yesno</source_model>
159
- <sort_order>5</sort_order>
160
- <show_in_default>1</show_in_default>
161
- <show_in_website>1</show_in_website>
162
- <show_in_store>1</show_in_store>
163
- <comment>
164
- <![CDATA[
165
- Activate extension only for categories selected below
166
- ]]>
167
- </comment>
168
- </activebycategory>
169
-
170
- <activecategories translate="label">
171
- <label>Active categories</label>
172
- <frontend_type>multiselect</frontend_type>
173
- <source_model>Sitewards_B2BProfessional_model_system_config_source_category</source_model>
174
- <sort_order>6</sort_order>
175
- <show_in_default>1</show_in_default>
176
- <show_in_website>1</show_in_website>
177
- <show_in_store>1</show_in_store>
178
- <comment>
179
- <![CDATA[
180
- Select categories for which the extension should be active.
181
- Hold down Ctrl-key for multiple selection.<br />
182
- Be aware, that a product with multiple categories can not be checked out if one of its categories is selected here.
183
- ]]>
184
- </comment>
185
- </activecategories>
186
-
187
- </fields>
188
- </activatebycategorysettings>
189
- <activatebycustomersettings translate="label">
190
- <label>Activate by customer group</label>
191
- <frontend_type>text</frontend_type>
192
- <sort_order>4</sort_order>
193
- <show_in_default>1</show_in_default>
194
- <show_in_website>1</show_in_website>
195
- <show_in_store>1</show_in_store>
196
- <fields>
197
- <activebycustomer translate="label">
198
- <label>Activate by customer group</label>
199
- <frontend_type>select</frontend_type>
200
- <source_model>adminhtml/system_config_source_yesno</source_model>
201
- <sort_order>5</sort_order>
202
- <show_in_default>1</show_in_default>
203
- <show_in_website>1</show_in_website>
204
- <show_in_store>1</show_in_store>
205
- <comment>
206
- <![CDATA[
207
- Activate extension only for customer groups selected below
208
- ]]>
209
- </comment>
210
- </activebycustomer>
211
-
212
- <activecustomers translate="label">
213
- <label>Active categories</label>
214
- <frontend_type>multiselect</frontend_type>
215
- <source_model>Sitewards_B2BProfessional_model_customer_attribute_source_group</source_model>
216
- <sort_order>6</sort_order>
217
- <show_in_default>1</show_in_default>
218
- <show_in_website>1</show_in_website>
219
- <show_in_store>1</show_in_store>
220
- <comment>
221
- <![CDATA[
222
- Select customer groups for which the extension should be active.
223
- Hold down Ctrl-key for multiple selection.
224
- ]]>
225
- </comment>
226
- </activecustomers>
227
- </fields>
228
- </activatebycustomersettings>
229
- <activatebycustomersettings translate="label">
230
- <label>Activate by customer group</label>
231
- <frontend_type>text</frontend_type>
232
- <sort_order>4</sort_order>
233
- <show_in_default>1</show_in_default>
234
- <show_in_website>1</show_in_website>
235
- <show_in_store>1</show_in_store>
236
- <fields>
237
- <activebycustomer translate="label">
238
- <label>Activate by customer group</label>
239
- <frontend_type>select</frontend_type>
240
- <source_model>adminhtml/system_config_source_yesno</source_model>
241
- <sort_order>5</sort_order>
242
- <show_in_default>1</show_in_default>
243
- <show_in_website>1</show_in_website>
244
- <show_in_store>1</show_in_store>
245
- <comment>
246
- <![CDATA[
247
- Activate extension only for customer groups selected below
248
- ]]>
249
- </comment>
250
- </activebycustomer>
251
-
252
- <activecustomers translate="label">
253
- <label>Active customer groups</label>
254
- <frontend_type>multiselect</frontend_type>
255
- <source_model>Mage_Adminhtml_Model_System_Config_Source_Customer_Group</source_model>
256
- <sort_order>6</sort_order>
257
- <show_in_default>1</show_in_default>
258
- <show_in_website>1</show_in_website>
259
- <show_in_store>1</show_in_store>
260
- <comment>
261
- <![CDATA[
262
- Select customer groups for which the extension should be active.
263
- Hold down Ctrl-key for multiple selection.
264
- ]]>
265
- </comment>
266
- </activecustomers>
267
- </fields>
268
- </activatebycustomersettings>
269
- </groups>
270
- </b2bprofessional>
271
- </sections>
272
- </config>
1
  <?xml version="1.0"?>
2
  <!--
3
  /**
4
+ * sytem.xml
5
+ * - create admin config tab,
6
+ * - assign admin config fields to sections
7
  *
8
+ * @category Sitewards
9
+ * @package Sitewards_B2BProfessional
10
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
 
 
 
 
 
 
 
 
 
 
 
11
  */
12
  -->
13
  <config>
14
+ <tabs>
15
+ <b2bprofessional translate="label" module="b2bprofessional">
16
+ <label>B2B Professional</label>
17
+ <sort_order>301</sort_order>
18
+ </b2bprofessional>
19
+ </tabs>
20
+ <sections>
21
+ <b2bprofessional translate="label" module="b2bprofessional">
22
+ <label>B2B Professional</label>
23
+ <tab>general</tab>
24
+ <frontend_type>text</frontend_type>
25
+ <sort_order>990</sort_order>
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
+ <groups>
30
+ <generalsettings translate="label">
31
+ <label>General settings</label>
32
+ <frontend_type>text</frontend_type>
33
+ <sort_order>1</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ <fields>
38
+ <active translate="label,comment">
39
+ <label>Enable B2B extension</label>
40
+ <frontend_type>select</frontend_type>
41
+ <source_model>adminhtml/system_config_source_yesno</source_model>
42
+ <sort_order>1</sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  <show_in_default>1</show_in_default>
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>1</show_in_store>
46
+ <comment><![CDATA[Enable or disable extension. Customer activation behaviour can be configured under <br />"Customer Configuration > Customer activation"]]></comment>
47
+ </active>
48
+ <activecustomers translate="label comment">
49
+ <label>Global customer activation</label>
50
+ <frontend_type>select</frontend_type>
51
+ <source_model>adminhtml/system_config_source_yesno</source_model>
52
+ <sort_order>3</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ <comment><![CDATA[Activate customers for all stores. Otherwise they will only see the prices in the store, they have registered for.]]></comment>
57
+ </activecustomers>
58
  </fields>
59
  </generalsettings>
60
+ <languagesettings translate="label comment">
61
+ <label>Language settings</label>
62
+ <frontend_type>text</frontend_type>
63
+ <sort_order>2</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>1</show_in_store>
67
+ <fields>
68
+ <languageoverride translate="label comment">
69
+ <label>Override language file</label>
70
+ <frontend_type>select</frontend_type>
71
+ <source_model>adminhtml/system_config_source_yesno</source_model>
72
+ <sort_order>3</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ <comment><![CDATA[Override language file text with text specified below]]></comment>
77
+ </languageoverride>
78
+ <logintext translate="label comment">
79
+ <label>Custom text for price</label>
80
+ <frontend_type>textarea</frontend_type>
81
+ <sort_order>4</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ <comment><![CDATA[Text to be displayed instead of the prices.<br />Only visible when language override is active.<br />Otherwise text in language file ist used.<br />May contain HTML]]></comment>
86
+ </logintext>
87
+ <errortext translate="label comment">
88
+ <label>Custom text for checkout-error</label>
89
+ <frontend_type>textarea</frontend_type>
90
+ <sort_order>5</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ <comment><![CDATA[Text to be displayed when customer is not allowed to checkout product.<br />Only visible when language override is active.<br />Otherwise text in language file is used.<br />May contain HTML]]></comment>
95
+ </errortext>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  </fields>
97
  </languagesettings>
98
+ <activatebycategorysettings translate="label comment">
99
+ <label>Activate by category</label>
100
+ <frontend_type>text</frontend_type>
101
+ <sort_order>3</sort_order>
102
+ <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
+ <show_in_store>1</show_in_store>
105
+ <fields>
106
+ <activebycategory translate="label comment">
107
+ <label>Activate by category</label>
108
+ <frontend_type>select</frontend_type>
109
+ <source_model>adminhtml/system_config_source_yesno</source_model>
110
+ <sort_order>5</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ <show_in_website>1</show_in_website>
113
+ <show_in_store>1</show_in_store>
114
+ <comment><![CDATA[Activate extension only for categories selected below]]></comment>
115
+ </activebycategory>
116
+ <activecategories translate="label comment">
117
+ <label>Active categories</label>
118
+ <frontend_type>multiselect</frontend_type>
119
+ <source_model>b2bprofessional/system_config_source_category</source_model>
120
+ <sort_order>6</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ <comment><![CDATA[Select categories for which the extension should be active.<br />Hold down Ctrl-key for multiple selection.<br />Be aware, that a product with multiple categories can not be checked out if one of its categories is selected here.]]></comment>
125
+ </activecategories>
126
+ </fields>
127
+ </activatebycategorysettings>
128
+ <activatebycustomersettings translate="label comment">
129
+ <label>Activate by customer group</label>
130
+ <frontend_type>text</frontend_type>
131
+ <sort_order>4</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
+ <comment><![CDATA[When activating this extension by customer group the guest user is also included.]]></comment>
136
+ <fields>
137
+ <activebycustomer translate="label comment">
138
+ <label>Activate by customer group</label>
139
+ <frontend_type>select</frontend_type>
140
+ <source_model>adminhtml/system_config_source_yesno</source_model>
141
+ <sort_order>5</sort_order>
142
+ <show_in_default>1</show_in_default>
143
+ <show_in_website>1</show_in_website>
144
+ <show_in_store>1</show_in_store>
145
+ <comment><![CDATA[Activate extension only for customer groups selected below]]></comment>
146
+ </activebycustomer>
147
+ <activecustomers translate="label comment">
148
+ <label>Active customer groups</label>
149
+ <frontend_type>multiselect</frontend_type>
150
+ <source_model>adminhtml/system_config_source_customer_group</source_model>
151
+ <sort_order>6</sort_order>
152
+ <show_in_default>1</show_in_default>
153
+ <show_in_website>1</show_in_website>
154
+ <show_in_store>1</show_in_store>
155
+ <comment><![CDATA[Select customer groups for which the extension should be active.<br />Hold down Ctrl-key for multiple selection.]]></comment>
156
+ </activecustomers>
157
+ </fields>
158
+ </activatebycustomersettings>
159
+ </groups>
160
+ </b2bprofessional>
161
+ </sections>
162
+ </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/Sitewards_B2BProfessional.xml CHANGED
@@ -1,9 +1,29 @@
1
  <?xml version="1.0"?>
 
 
 
 
 
 
 
 
 
 
 
 
2
  <config>
3
- <modules>
4
  <Sitewards_B2BProfessional>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </Sitewards_B2BProfessional>
8
- </modules>
 
 
 
 
 
 
 
 
9
  </config>
1
  <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Sitewards_B2BProfessional.xml
5
+ * - Activate module,
6
+ * - Specify code pool,
7
+ * - Set-up dependencies
8
+ *
9
+ * @category Sitewards
10
+ * @package Sitewards_B2BProfessional
11
+ * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
12
+ */
13
+ -->
14
  <config>
15
+ <modules>
16
  <Sitewards_B2BProfessional>
17
+ <active>true</active>
18
+ <codePool>community</codePool>
19
+ <depends>
20
+ <Mage_Adminhtml />
21
+ <Mage_Bundle />
22
+ <Mage_Catalog />
23
+ <Mage_Checkout />
24
+ <Mage_Customer />
25
+ <Netzarbeiter_CustomerActivation />
26
+ </depends>
27
+ </Sitewards_B2BProfessional>
28
+ </modules>
29
  </config>
app/locale/de_DE/Sitewards_B2BProfessional.csv CHANGED
@@ -1,2 +1,23 @@
1
- "Your account is not allowed to access this store.","Ihr Benutzerkonto ist f�r diesen Shop nicht freigeschaltet."
2
- "Please login","Bitte einloggen"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Your account is not allowed to access this store.","Ihr Benutzerkonto ist für diesen Shop nicht freigeschaltet."
2
+ "Please login","Bitte einloggen"
3
+ "General settings","Allgemeine Einstellungen"
4
+ "Enable B2B extension","B2B Extension aktivieren"
5
+ "Global customer activation","Globale Kundenaktivierung"
6
+ "Language settings","Spracheinstellungen"
7
+ "Override language file","Sprachdateien ignorieren"
8
+ "Custom text for price","Text für Preis"
9
+ "Custom text for checkout-error","Text für Checkout-Fehler"
10
+ "Activate by category","Für Kategorien aktivieren"
11
+ "Active categories","Aktive Kategorien"
12
+ "Activate by customer group","Für Kundengruppen aktivieren"
13
+ "Active customer groups","Aktive Kundengruppen"
14
+ "Enable or disable extension. Customer activation behaviour can be configured under <br />""Customer Configuration > Customer activation""","Aktivieren oder Deaktivieren der Extension. Verhalten bei der Kundenaktivierung kann konfiguriert werden unter<br />""Kundenkonfiguration > Kundenaktivierung"""
15
+ "Activate customers for all stores. Otherwise they will only see the prices in the store, they have registered for.","Kunden für alle Ladenansichten aktivieren. Anderenfalls werden sie nur in den Ladenansichten Preise sehen können, für die sie sich registriert haben."
16
+ "Override language file text with text specified below","Sprachdateien ignorieren und folgenden Text benutzen"
17
+ "Text to be displayed instead of the prices.<br />Only visible when language override is active.<br />Otherwise text in language file ist used.<br />May contain HTML","Text, der statt der Preise angezeigt wird.<br />Nur sichtbar, wenn ""Sprachdateien ignorieren"" aktiviert ist.<br />Anderenfalls werden die Sprachdateien benutzt.<br />Kann HTML enthalten"
18
+ "Text to be displayed when customer is not allowed to checkout product.<br />Only visible when language override is active.<br />Otherwise text in language file is used.<br />May contain HTML","Text, der angezeigt wird, wenn der Kunde nicht mit dem Produkt auschecken darf.<br />Nur sichtbar, wenn ""Sprachdateien ignorieren"" aktiviert ist.<br />Anderenfalls werden die Sprachdateien benutzt.<br />Kann HTML enthalten"
19
+ "Activate extension only for categories selected below","Extension nur für folgende Kategorien aktivieren"
20
+ "Select categories for which the extension should be active.<br />Hold down Ctrl-key for multiple selection.<br />Be aware, that a product with multiple categories can not be checked out if one of its categories is selected here.","Kategorien auswählen, für die die Extension aktiviert werden soll.<br />Für Mehrfachauswahl Strg-Taste halten.<br />Beachten Sie bitte, dass man nicht mit einem Produkt auschecken kann, wenn er mindestens einer dieser Kategorien zugeordnet ist."
21
+ "Activate extension only for customer groups selected below","Extension nur für Kunden aus folgenden Kundengruppen aktivieren."
22
+ "Select customer groups for which the extension should be active.<br />Hold down Ctrl-key for multiple selection.","Kundengruppen auswählen, für die die Extension aktiviert werden soll.<br />Für Mehrfachauswahl Strg-Taste halten."
23
+ "When activating this extension by customer group the guest user is also included.","Beim Aktivieren von Kundengruppen wird die Extension ebenfalls für Gast-Benutzer freigeschaltet"
package.xml CHANGED
@@ -1,19 +1,31 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sitewards_B2BProfessional</name>
4
- <version>1.0.5</version>
5
  <stability>stable</stability>
6
- <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>This extension adds a b2b function to magento.</summary>
10
- <description>The Sitewards B2B Extension extends your webshop with some essential functions to realize a B2B Store.</description>
11
- <notes>Updates for Magento 1.4.2
12
- Added support for simple product custom options</notes>
13
- <authors><author><name>Kai M&#xFC;ller</name><user>auto-converted</user><email>magento@sitewards.com</email></author></authors>
14
- <date>2011-02-08</date>
15
- <time>08:10:33</time>
16
- <contents><target name="magelocale"><dir name="de_DE"><file name="Sitewards_B2BProfessional.csv" hash="b7c6f9ed467ebc2ae8afb1a9b9962943"/></dir><dir name="en_US"><file name="Sitewards_B2BProfessional.csv" hash="79a587f13911889839f6aeb93693d0b6"/></dir></target><target name="mageetc"><dir name="modules"><file name="Sitewards_B2BProfessional.xml" hash="696c9afdd2747bcc4f1a394abf1bd182"/></dir></target><target name="magecommunity"><dir name="Sitewards"><dir name="B2BProfessional"><dir name="Block"><dir name="Bundle"><dir name="Catalog"><dir name="Product"><dir name="View"><dir name="Type"><dir name="Bundle"><dir name="Option"><file name="Checkbox.php" hash="becac00a2fc689d3a2a3e4a6c8b03f89"/><file name="Multi.php" hash="fbddee88eb56bc2b9068cef81c98e740"/><file name="Radio.php" hash="ff8ec0dc15fa21c386cc0fc9d608c963"/><file name="Select.php" hash="6b43ee2329b14db7c64c76d730b3b282"/></dir></dir></dir></dir></dir></dir></dir><dir name="Product"><dir name="View"><dir name="Options"><dir name="Type"><file name="Date.php" hash="f2bf6406deae111f07df3905c3717e0c"/><file name="Default.php" hash="569d569a77e560621ffab6c9b1c0a373"/><file name="File.php" hash="f5688c168f0d4f82cc186494cb48596a"/><file name="Select.php" hash="3a056d80e8bb66933984b911f47ff92f"/><file name="Text.php" hash="1c3aacfa87c957a355cd5c345f768b57"/></dir></dir></dir></dir><file name="Configurable.php" hash="008a3d862a68269eedfa737bcea0776d"/><file name="Price.php" hash="32974b441d39c01d25d219571d80c6e0"/><file name="View.php" hash="2a1542f9286d37976ee9ddd1116fe786"/></dir><dir name="controllers"><file name="CartController.php" hash="7b039ed3b39e4ec65fcc22e1b541242f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="228de24542cb0644a7021abbe661cdbb"/><file name="config.xml" hash="1676a1a30c32744df41b029e2753f2e1"/><file name="system.xml" hash="337b8d4be206486c44b6afa65751721e"/></dir><dir name="Helper"><file name="Data.php" hash="5e9163e20750d9e3a7f675ac0d620f8b"/></dir><dir name="Model"><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Product.php" hash="f23b6b110d80c0fb7473249199b03c6e"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Category.php" hash="86334262072b15086dc97812f8c9d3cd"/></dir></dir></dir><file name="Customer.php" hash="051b1cda9a0272bbb2914763e4376283"/><file name="Observer.php" hash="1b0294d523947d30084ba6f8c22a1056"/></dir></dir></dir></target></contents>
 
 
 
 
 
 
 
 
 
 
 
 
17
  <compatible/>
18
- <dependencies><required><package><name>Netzarbeiter_CustomerActivation</name><channel>community</channel><min>0.2.7</min><max>0.2.9</max></package></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sitewards_B2BProfessional</name>
4
+ <version>2.0.0</version>
5
  <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>The Sitewards B2B Extension extends your webshop with some essential functions to realize a B2B Store.</summary>
10
+ <description>The Sitewards B2B Extension extends your webshop with some essential functions to realize a business-to-business store. Product prices and add-to-cart functions are only available for registered customer accounts that were approved by the site administrator. All other product details remain visible for non-registered users.&#xD;
11
+ &#xD;
12
+ Features of the B2BProfessional Extension:&#xD;
13
+ &#xB7; Customers can register, but have to be approved to see product prices and to order products&#xD;
14
+ &#xB7; Prices of all product types and options are only visible for approved customers&#xD;
15
+ &#xB7; Consequently, the Shopping Cart and Checkout are only available for approved customers&#xD;
16
+ &#xB7; Multi-store: The extension can be activated for each store/view separately&#xD;
17
+ &#xB7; Create both, B2B and B2C stores in one Magento installation&#xD;
18
+ &#xB7; Optional info message (e.g. &#x201D;Please login to see price &#x201D;) in place of price&#xD;
19
+ &#xB7; Multilanguage support (German and English installed, extendible to other languages)&#xD;
20
+ &#xB7; Activation for specific product categories&#xD;
21
+ &#xB7; Activation for specific customer groups&#xD;
22
+ &#xB7; Optional require login to access store</description>
23
+ <notes>Re-factored code base.&#xD;
24
+ Fixed minor bugs with category and customer group implementation.</notes>
25
+ <authors><author><name>Sitewards Magento Team</name><user>sitewards</user><email>magento@sitewards.com</email></author></authors>
26
+ <date>2013-01-16</date>
27
+ <time>11:21:33</time>
28
+ <contents><target name="magecommunity"><dir name="Sitewards"><dir name="B2BProfessional"><dir name="Block"><dir name="Bundle"><dir name="Catalog"><file name="Price.php" hash="29947f4d2db1edb62d31ab2bb26d5612"/><dir name="Product"><dir name="View"><dir name="Type"><dir name="Bundle"><dir name="Option"><file name="Checkbox.php" hash="97e3e7ce97a873c0bf438dcbb9d63538"/><file name="Multi.php" hash="aade197dae894c11df15ded6b90c5fa6"/><file name="Radio.php" hash="6bae85356183c20b8f7327018f4939fe"/><file name="Select.php" hash="b90a778084796edf552d6c87e888404f"/></dir></dir></dir></dir></dir></dir></dir><file name="Configurable.php" hash="f0624a9393a8e6b92d5d09d11c2a5d05"/><file name="Price.php" hash="1826b3c8059e2925a9e2459aab26060c"/></dir><dir name="Helper"><file name="Data.php" hash="fe0d9260ed62e1e6c8ebff94c2c90731"/></dir><dir name="Model"><file name="Customer.php" hash="965cddbd586db90e693e7cef0bfba762"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Category.php" hash="115526ef80ee1f799e0c68f81a45fc9f"/></dir></dir></dir></dir><dir name="controllers"><file name="CartController.php" hash="6dfb9530a9361dd2636ce5229369de3c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="4532de80b3439c3047ea70776b8420a5"/><file name="config.xml" hash="5a19d431a91b279dbca8fa746a64c01a"/><file name="system.xml" hash="f5e551776e65e8079280349ec65261e3"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sitewards_B2BProfessional.xml" hash="3eb7e7a0f796d39faf60cf3f30c40ff2"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Sitewards_B2BProfessional.csv" hash="3b2c1c96558ba09f119f40c69ce7e353"/></dir><dir name="en_US"><file name="Sitewards_B2BProfessional.csv" hash="79a587f13911889839f6aeb93693d0b6"/></dir></target></contents>
29
  <compatible/>
30
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Netzarbeiter_CustomerActivation</name><channel>communtiy</channel><min>0.3.0</min><max>0.4.1</max></package></required></dependencies>
31
  </package>