Sitewards_B2BProfessional - Version 3.0.0

Version Notes

Updated the extension to improve code quality and extension speed.

Download this release

Release Info

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


Code changes from version 2.5.2 to 3.0.0

Files changed (61) hide show
  1. app/code/community/Sitewards/B2BProfessional/Block/Adminhtml/Order.php +0 -19
  2. app/code/community/Sitewards/B2BProfessional/Block/Catalog/Product/List.php +0 -24
  3. app/code/community/Sitewards/B2BProfessional/Block/Catalog/Product/New.php +0 -24
  4. app/code/community/Sitewards/B2BProfessional/Block/Catalog/Product/Widget/New.php +0 -24
  5. app/code/community/Sitewards/B2BProfessional/Block/Checkout/Links.php +0 -28
  6. app/code/community/Sitewards/B2BProfessional/Block/Order.php +0 -47
  7. app/code/community/Sitewards/B2BProfessional/Block/Order/Form.php +0 -12
  8. app/code/community/Sitewards/B2BProfessional/Block/Reports/Product/Compared.php +0 -24
  9. app/code/community/Sitewards/B2BProfessional/Block/Reports/Product/Viewed.php +0 -24
  10. app/code/community/Sitewards/B2BProfessional/Block/Reports/Product/Widget/Compared.php +0 -24
  11. app/code/community/Sitewards/B2BProfessional/Block/Reports/Product/Widget/Viewed.php +0 -24
  12. app/code/community/Sitewards/B2BProfessional/Helper/Catalog/Product/Compare.php +0 -23
  13. app/code/community/Sitewards/B2BProfessional/Helper/Category.php +166 -218
  14. app/code/community/Sitewards/B2BProfessional/Helper/Core.php +19 -28
  15. app/code/community/Sitewards/B2BProfessional/Helper/Customer.php +189 -168
  16. app/code/community/Sitewards/B2BProfessional/Helper/Data.php +201 -182
  17. app/code/community/Sitewards/B2BProfessional/Helper/Messages.php +0 -72
  18. app/code/community/Sitewards/B2BProfessional/Helper/Redirects.php +119 -29
  19. app/code/community/Sitewards/B2BProfessional/Helper/Replacements.php +0 -274
  20. app/code/community/Sitewards/B2BProfessional/Model/Customer.php +0 -57
  21. app/code/community/Sitewards/B2BProfessional/Model/Observer.php +241 -447
  22. app/code/community/Sitewards/B2BProfessional/Model/Order.php +0 -39
  23. app/code/community/Sitewards/B2BProfessional/Model/Quote.php +0 -24
  24. app/code/community/Sitewards/B2BProfessional/Model/Resource/Order.php +0 -46
  25. app/code/community/Sitewards/B2BProfessional/Model/Resource/Order/Collection.php +0 -8
  26. app/code/community/Sitewards/B2BProfessional/Model/Resource/Quote.php +0 -37
  27. app/code/community/Sitewards/B2BProfessional/Model/Resource/Quote/Collection.php +0 -8
  28. app/code/community/Sitewards/B2BProfessional/Model/System/Config/Source/Category.php +32 -29
  29. app/code/community/Sitewards/B2BProfessional/Model/System/Config/Source/Identifiers.php +0 -42
  30. app/code/community/Sitewards/B2BProfessional/Model/System/Config/Source/Page.php +27 -24
  31. app/code/community/Sitewards/B2BProfessional/Model/System/Config/Source/Tags.php +0 -50
  32. app/code/community/Sitewards/B2BProfessional/Test/Helper/Data.php +15 -14
  33. app/code/community/Sitewards/B2BProfessional/controllers/CartController.php +0 -115
  34. app/code/community/Sitewards/B2BProfessional/controllers/OrderController.php +0 -45
  35. app/code/community/Sitewards/B2BProfessional/controllers/ProductController.php +0 -64
  36. app/code/community/Sitewards/B2BProfessional/etc/adminhtml.xml +22 -22
  37. app/code/community/Sitewards/B2BProfessional/etc/config.xml +97 -306
  38. app/code/community/Sitewards/B2BProfessional/etc/system.xml +149 -421
  39. app/code/community/Sitewards/B2BProfessional/sql/sitewards_b2bprofessional/upgrade-2.3.0-2.4.0.php +0 -20
  40. app/design/adminhtml/default/default/layout/sitewards/b2bprofessional.xml +0 -13
  41. app/design/adminhtml/default/default/template/sitewards/b2bprofessional/order.phtml +0 -22
  42. app/design/adminhtml/default/default/template/sitewards/b2bprofessional/sales/order/info.phtml +0 -2
  43. app/design/frontend/base/default/layout/sitewards/b2bprofessional.xml +0 -77
  44. app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-post-180/checkbox.phtml +0 -52
  45. app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-post-180/multi.phtml +0 -49
  46. app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-post-180/radio.phtml +0 -74
  47. app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-post-180/select.phtml +0 -63
  48. app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-pre-180/checkbox.phtml +0 -34
  49. app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-pre-180/multi.phtml +0 -31
  50. app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-pre-180/radio.phtml +0 -47
  51. app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-pre-180/select.phtml +0 -37
  52. app/design/frontend/base/default/template/sitewards/b2bprofessional/checkout/billing/extra.phtml +0 -31
  53. app/design/frontend/base/default/template/sitewards/b2bprofessional/order.phtml +0 -21
  54. app/design/frontend/base/default/template/sitewards/b2bprofessional/order/form.phtml +0 -37
  55. app/etc/modules/Sitewards_B2BProfessional.xml +15 -18
  56. app/locale/de_DE/Sitewards_B2BProfessional.csv +1 -40
  57. app/locale/en_US/Sitewards_B2BProfessional.csv +17 -3
  58. js/sitewards/b2bprofessional.js +0 -358
  59. package.xml +6 -6
  60. skin/frontend/base/default/css/sitewards/b2bprofessional.css +0 -22
  61. skin/frontend/base/default/images/sitewards/loading.gif +0 -0
app/code/community/Sitewards/B2BProfessional/Block/Adminhtml/Order.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Block_Adminhtml_Order
4
- *
5
- * @category Sitewards
6
- * @package Sitewards_B2BProfessional
7
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
8
- */
9
- class Sitewards_B2BProfessional_Block_Adminhtml_Order extends Mage_Adminhtml_Block_Sales_Order_Abstract {
10
- /**
11
- * @return array
12
- */
13
- public function getB2BProfessionalVars () {
14
- $oModel = Mage::getModel('b2bprofessional/order');
15
- return $oModel->getByOrder(
16
- $this->getOrder()
17
- ->getId());
18
- }
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Catalog/Product/List.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Block_Catalog_Product_List
4
- * - rewrite the getAddToCartUrl function to check if the product is active
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_Block_Catalog_Product_List extends Mage_Catalog_Block_Product_List {
11
- /**
12
- * Check if the product is valid
13
- * - return the replacement text for the add to cart url when required
14
- *
15
- * @param Mage_Catalog_Model_Product $oProduct
16
- * @param array $aAdditional
17
- * @return string
18
- */
19
- public function getAddToCartUrl($oProduct, $aAdditional = array()) {
20
- /* @var $oB2BReplacementsHelper Sitewards_B2BProfessional_Helper_Replacements */
21
- $oB2BReplacementsHelper = Mage::helper('b2bprofessional/replacements');
22
- return $oB2BReplacementsHelper->replaceAddToCart($oProduct->getId(), parent::getAddToCartUrl($oProduct, $aAdditional));
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Catalog/Product/New.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Block_Catalog_Product_New
4
- * - rewrite the getAddToCartUrl function to check if the product is active
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_Block_Catalog_Product_New extends Mage_Catalog_Block_Product_New {
11
- /**
12
- * Check if the product is valid
13
- * - return the replacement text for the add to cart url when required
14
- *
15
- * @param Mage_Catalog_Model_Product $oProduct
16
- * @param array $aAdditional
17
- * @return string
18
- */
19
- public function getAddToCartUrl($oProduct, $aAdditional = array()) {
20
- /* @var $oB2BReplacementsHelper Sitewards_B2BProfessional_Helper_Replacements */
21
- $oB2BReplacementsHelper = Mage::helper('b2bprofessional/replacements');
22
- return $oB2BReplacementsHelper->replaceAddToCart($oProduct->getId(), parent::getAddToCartUrl($oProduct, $aAdditional));
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Catalog/Product/Widget/New.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Block_Catalog_Product_Widget_New
4
- * - rewrite the getAddToCartUrl function to check if the product is active
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_Block_Catalog_Product_Widget_New extends Mage_Catalog_Block_Product_Widget_New {
11
- /**
12
- * Check if the product is valid
13
- * - return the replacement text for the add to cart url when required
14
- *
15
- * @param Mage_Catalog_Model_Product $oProduct
16
- * @param array $aAdditional
17
- * @return string
18
- */
19
- public function getAddToCartUrl($oProduct, $aAdditional = array()) {
20
- /* @var $oB2BReplacementsHelper Sitewards_B2BProfessional_Helper_Replacements */
21
- $oB2BReplacementsHelper = Mage::helper('b2bprofessional/replacements');
22
- return $oB2BReplacementsHelper->replaceAddToCart($oProduct->getId(), parent::getAddToCartUrl($oProduct, $aAdditional));
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Checkout/Links.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Block_Checkout_Links
4
- * - Override the addCheckoutLink to validate the current cart
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_Block_Checkout_Links extends Mage_Checkout_Block_Links {
11
- /**
12
- * Validate the user's cart
13
- * - when inactive remove the link
14
- * - when active continue to the parent function
15
- *
16
- * @return Mage_Checkout_Block_Links
17
- */
18
- public function addCheckoutLink() {
19
- /* @var $oB2BHelper Sitewards_B2BProfessional_Helper_Data */
20
- $oB2BHelper = Mage::helper('b2bprofessional');
21
-
22
- if (!$oB2BHelper->hasValidCart()) {
23
- return $this;
24
- } else {
25
- return parent::addCheckoutLink();
26
- }
27
- }
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Order.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Block_Order
4
- *
5
- * @category Sitewards
6
- * @package Sitewards_B2BProfessional
7
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
8
- */
9
- class Sitewards_B2BProfessional_Block_Order extends Mage_Core_Block_Template {
10
- /**
11
- * return special b2bprof vars
12
- *
13
- * @return mixed
14
- */
15
- public function getB2BProfessionalVars() {
16
- $oModel = Mage::getModel('b2bprofessional/order');
17
- return $oModel->getByOrder(
18
- $this->getOrder()
19
- ->getId()
20
- );
21
- }
22
-
23
- /**
24
- * @return Mage_Sales_Model_Order
25
- */
26
- public function getOrder () {
27
- return Mage::registry('current_order');
28
- }
29
-
30
- /**
31
- * @return bool
32
- */
33
- public function canCancel() {
34
- $oModel = Mage::getModel('b2bprofessional/order');
35
- return $oModel->canCancel(
36
- $this->getOrder()
37
- ->getId()
38
- );
39
- }
40
-
41
- /**
42
- * @return string
43
- */
44
- public function getCancelUrl() {
45
- return $this->getUrl('b2bprofessional/order/cancel', array('id' => $this->getOrder()->getId()));
46
- }
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Order/Form.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Block_Order_Form
4
- * - content of New Order Form page
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_Block_Order_Form extends Mage_Core_Block_Template {
11
-
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Reports/Product/Compared.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Block_Reports_Product_Compared
4
- * - rewrite the getAddToCartUrl function to check if the product is active
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_Block_Reports_Product_Compared extends Mage_Reports_Block_Product_Compared {
11
- /**
12
- * Check if the product is valid
13
- * - return the replacement text for the add to cart url when required
14
- *
15
- * @param Mage_Catalog_Model_Product $oProduct
16
- * @param array $aAdditional
17
- * @return string
18
- */
19
- public function getAddToCartUrl($oProduct, $aAdditional = array()) {
20
- /* @var $oB2BReplacementsHelper Sitewards_B2BProfessional_Helper_Replacements */
21
- $oB2BReplacementsHelper = Mage::helper('b2bprofessional/replacements');
22
- return $oB2BReplacementsHelper->replaceAddToCart($oProduct->getId(), parent::getAddToCartUrl($oProduct, $aAdditional));
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Reports/Product/Viewed.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Block_Reports_Product_Viewed
4
- * - rewrite the getAddToCartUrl function to check if the product is active
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_Block_Reports_Product_Viewed extends Mage_Reports_Block_Product_Viewed {
11
- /**
12
- * Check if the product is valid
13
- * - return the replacement text for the add to cart url when required
14
- *
15
- * @param Mage_Catalog_Model_Product $oProduct
16
- * @param array $aAdditional
17
- * @return string
18
- */
19
- public function getAddToCartUrl($oProduct, $aAdditional = array()) {
20
- /* @var $oB2BReplacementsHelper Sitewards_B2BProfessional_Helper_Replacements */
21
- $oB2BReplacementsHelper = Mage::helper('b2bprofessional/replacements');
22
- return $oB2BReplacementsHelper->replaceAddToCart($oProduct->getId(), parent::getAddToCartUrl($oProduct, $aAdditional));
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Reports/Product/Widget/Compared.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Block_Reports_Product_Widget_Compared
4
- * - rewrite the getAddToCartUrl function to check if the product is active
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_Block_Reports_Product_Widget_Compared extends Mage_Reports_Block_Product_Widget_Compared {
11
- /**
12
- * Check if the product is valid
13
- * - return the replacement text for the add to cart url when required
14
- *
15
- * @param Mage_Catalog_Model_Product $oProduct
16
- * @param array $aAdditional
17
- * @return string
18
- */
19
- public function getAddToCartUrl($oProduct, $aAdditional = array()) {
20
- /* @var $oB2BReplacementsHelper Sitewards_B2BProfessional_Helper_Replacements */
21
- $oB2BReplacementsHelper = Mage::helper('b2bprofessional/replacements');
22
- return $oB2BReplacementsHelper->replaceAddToCart($oProduct->getId(), parent::getAddToCartUrl($oProduct, $aAdditional));
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Reports/Product/Widget/Viewed.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Block_Reports_Product_Widget_Viewed
4
- * - rewrite the getAddToCartUrl function to check if the product is active
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_Block_Reports_Product_Widget_Viewed extends Mage_Reports_Block_Product_Widget_Viewed {
11
- /**
12
- * Check if the product is valid
13
- * - return the replacement text for the add to cart url when required
14
- *
15
- * @param Mage_Catalog_Model_Product $oProduct
16
- * @param array $aAdditional
17
- * @return string
18
- */
19
- public function getAddToCartUrl($oProduct, $aAdditional = array()) {
20
- /* @var $oB2BReplacementsHelper Sitewards_B2BProfessional_Helper_Replacements */
21
- $oB2BReplacementsHelper = Mage::helper('b2bprofessional/replacements');
22
- return $oB2BReplacementsHelper->replaceAddToCart($oProduct->getId(), parent::getAddToCartUrl($oProduct, $aAdditional));
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Helper/Catalog/Product/Compare.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Helper_Catalog_Product_Compare
4
- * - rewrite the getAddToCartUrl function to check if the product is active
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_Helper_Catalog_Product_Compare extends Mage_Catalog_Helper_Product_Compare {
11
- /**
12
- * Check if the product is valid
13
- * - return the replacement text for the add to cart url when required
14
- *
15
- * @param Mage_Catalog_Model_Product $oProduct
16
- * @return string
17
- */
18
- public function getAddToCartUrl($oProduct) {
19
- /* @var $oB2BReplacementsHelper Sitewards_B2BProfessional_Helper_Replacements */
20
- $oB2BReplacementsHelper = Mage::helper('b2bprofessional/replacements');
21
- return $oB2BReplacementsHelper->replaceAddToCart($oProduct->getId(), parent::getAddToCartUrl($oProduct));
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Helper/Category.php CHANGED
@@ -1,225 +1,173 @@
1
  <?php
 
2
  /**
3
- * Class Sitewards_B2BProfessional_Helper_Category
4
- * - function to check if extension is activated by category
5
- * - function to check if category is active
6
- * - function to check if category is active by a given product id
7
- * - function to get the current category id and all children ids
8
- * - function to get the category ids of each category filter set
9
- * - function to check that at least one of the given category ids is active
10
- * - function to get the current category object
11
- * - function to get all category ids activated via the system config
12
- * - function to get an array of category ids activated via the admin config section
13
- * - function to load all child category ids into an array from a given category id
14
  *
15
  * @category Sitewards
16
  * @package Sitewards_B2BProfessional
17
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
18
  */
19
- class Sitewards_B2BProfessional_Helper_Category extends Mage_Core_Helper_Abstract {
20
- /**
21
- * Check to see if the extension is activated by category
22
- *
23
- * @return bool
24
- */
25
- public function isExtensionActivatedByCategory() {
26
- return Mage::getStoreConfigFlag(Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/' . Sitewards_B2BProfessional_Helper_Core::CONFIG_CATEGORY_SETTINGS_NODE . '/activebycategory');
27
- }
28
-
29
- /**
30
- * Validate that the category is activated in the module
31
- *
32
- * @return boolean
33
- */
34
- public function isCategoryActive() {
35
- /*
36
- * Check if there is a filtered category
37
- * - If not check for a current_category,
38
- * - If not load the store default category,
39
- */
40
- $aB2BProfFilters = Mage::registry('b2bprof_category_filters');
41
- if(empty($aB2BProfFilters)) {
42
- $aCurrentCategories = $this->getCurrentCategoryIds();
43
- } else {
44
- $aCurrentCategories = $this->getCategoryIdsByB2BProfFilters($aB2BProfFilters);
45
- }
46
- $aCurrentCategories = array_unique($aCurrentCategories);
47
-
48
- if (!is_array($aCurrentCategories)) {
49
- $aCurrentCategories = array (
50
- $aCurrentCategories
51
- );
52
- }
53
- return $this->hasActiveCategory($aCurrentCategories);
54
- }
55
-
56
- /**
57
- * Validate that the category of a give product is activated in the module
58
- *
59
- * @param int $iProductId
60
- * @return boolean
61
- */
62
- public function isCategoryActiveByProduct($iProductId) {
63
- /* @var $oProduct Mage_Catalog_Model_Product */
64
- $oProduct = Mage::getModel('catalog/product')->load($iProductId);
65
- $aCurrentCategories = $oProduct->getCategoryIds();
66
- $aParentProductIds = array();
67
-
68
- if($oProduct->isGrouped()) {
69
- /* @var $oGroupedProductModel Mage_Catalog_Model_Product_Type_Grouped */
70
- $oGroupedProductModel = Mage::getModel('catalog/product_type_grouped');
71
- $aParentProductIds = $oGroupedProductModel->getParentIdsByChild($iProductId);
72
- } elseif($oProduct->isConfigurable()) {
73
- /* @var $oConfigurableProductModel Mage_Catalog_Model_Product_Type_Configurable */
74
- $oConfigurableProductModel = Mage::getModel('catalog/product_type_configurable');
75
- $aParentProductIds = $oConfigurableProductModel->getParentIdsByChild($iProductId);
76
- }
77
-
78
- if(!empty($aParentProductIds)) {
79
- foreach ($aParentProductIds as $iParentProductId) {
80
- /* @var $oParentProduct Mage_Catalog_Model_Product */
81
- $oParentProduct = Mage::getModel('catalog/product')->load($iParentProductId);
82
- $aParentProductCategories = $oParentProduct->getCategoryIds();
83
- $aCurrentCategories = array_merge($aCurrentCategories, $aParentProductCategories);
84
- }
85
- }
86
- $aCurrentCategories = array_unique($aCurrentCategories);
87
-
88
- if (!is_array($aCurrentCategories)) {
89
- $aCurrentCategories = array (
90
- $aCurrentCategories
91
- );
92
- }
93
- return $this->hasActiveCategory($aCurrentCategories);
94
- }
95
-
96
- /**
97
- * Get the current category id and all children ids
98
- *
99
- * @return array
100
- */
101
- private function getCurrentCategoryIds() {
102
- /* @var $oCategory Mage_Catalog_Model_Category */
103
- $oCategory = $this->getCurrentCategory();
104
-
105
- $aCurrentCategories = $oCategory->getAllChildren(true);
106
- $aCurrentCategories[] = $oCategory->getId();
107
-
108
- return $aCurrentCategories;
109
- }
110
-
111
- /**
112
- * Get the category ids of each category filter set
113
- *
114
- * @param array $aB2BProfFilters
115
- * array(
116
- * cat_id_1,
117
- * cat_id_2
118
- * )
119
- * @return array
120
- */
121
- private function getCategoryIdsByB2BProfFilters($aB2BProfFilters) {
122
- $aCurrentCategories = $aB2BProfFilters;
123
- foreach($aB2BProfFilters as $iCategoryId) {
124
- /* @var $oCategory Mage_Catalog_Model_Category */
125
- $oCategory = Mage::getModel('catalog/category')->load($iCategoryId);
126
-
127
- $aCurrentCategories = array_merge($aCurrentCategories, $oCategory->getAllChildren(true));
128
- }
129
- return $aCurrentCategories;
130
- }
131
-
132
- /**
133
- * Check that at least one of the given category ids is active
134
- *
135
- * @param array $aCategoryIds
136
- * @return bool
137
- */
138
- private function hasActiveCategory($aCategoryIds) {
139
- $aActiveCategoryIds = $this->getActiveCategories();
140
- foreach ($aCategoryIds as $iCategoryId) {
141
- if (in_array($iCategoryId, $aActiveCategoryIds)) {
142
- return true;
143
- }
144
- }
145
- }
146
-
147
- /**
148
- * Get the current category object
149
- * - Use the "filter category" if set
150
- * - Use the "current_category" if set
151
- * - Use the store root category
152
- *
153
- * @return Mage_Catalog_Model_Category
154
- */
155
- private function getCurrentCategory() {
156
- /* @var $oCategory Mage_Catalog_Model_Category */
157
- $oCategory = Mage::registry('current_category_filter');
158
- if(is_null($oCategory)) {
159
- $oCategory = Mage::registry('current_category');
160
- if(is_null($oCategory)) {
161
- $oCategory = Mage::getModel('catalog/category')->load(Mage::app()->getStore()->getRootCategoryId());
162
- }
163
- }
164
- return $oCategory;
165
- }
166
-
167
- /**
168
- * Get all category ids activated via the system config
169
- * - Include the children category ids
170
- *
171
- * @return array
172
- * array(
173
- * cat_id_1,
174
- * cat_id_2
175
- * )
176
- */
177
- private function getActiveCategories() {
178
- $aCurrentActiveCategories = $this->getActivatedCategoryIds();
179
-
180
- /**
181
- * Loop through each activated category ids and add children category ids
182
- */
183
- $aSubActiveCategories = array();
184
- foreach ($aCurrentActiveCategories as $iCategoryId) {
185
- $aSubActiveCategories = $this->addCategoryChildren($iCategoryId, $aSubActiveCategories);
186
- }
187
- return array_unique($aSubActiveCategories);
188
- }
189
-
190
- /**
191
- * Get an array of category ids activated via the admin config section
192
- *
193
- * @return array
194
- */
195
- private function getActivatedCategoryIds() {
196
- /*
197
- * Category Ids are saved in the config in format
198
- * - "category1,category2"
199
- */
200
- $sActivatedCategoryIds = Mage::getStoreConfig(Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/' . Sitewards_B2BProfessional_Helper_Core::CONFIG_CATEGORY_SETTINGS_NODE . '/activecategories');
201
- return explode(',', $sActivatedCategoryIds);
202
- }
203
-
204
- /**
205
- * From given category id load all child ids into an array
206
- *
207
- * @param int $iCategoryId
208
- * @param array $aCurrentCategories
209
- * array(
210
- * cat_id_1,
211
- * cat_id_2
212
- * )
213
- * @return array
214
- * array(
215
- * cat_id_1,
216
- * cat_id_2
217
- * )
218
- */
219
- private function addCategoryChildren($iCategoryId, $aCurrentCategories = array()) {
220
- /* @var $oCurrentCategory Mage_Catalog_Model_Category */
221
- $oCurrentCategory = Mage::getModel('catalog/category');
222
- $oCurrentCategory = $oCurrentCategory->load($iCategoryId);
223
- return array_merge($aCurrentCategories, $oCurrentCategory->getAllChildren(true));
224
- }
225
  }
1
  <?php
2
+
3
  /**
4
+ * Sitewards_B2BProfessional_Helper_Category
5
+ * - Helper containing the checks for
6
+ * - if extension is activated by category
7
+ * - checking if a category is active from a given product
 
 
 
 
 
 
 
8
  *
9
  * @category Sitewards
10
  * @package Sitewards_B2BProfessional
11
+ * @copyright Copyright (c) 2014 Sitewards GmbH (http://www.sitewards.com/)
12
  */
13
+ class Sitewards_B2BProfessional_Helper_Category extends Sitewards_B2BProfessional_Helper_Core
14
+ {
15
+ /**
16
+ * Path for the config for extension active by category
17
+ */
18
+ const CONFIG_EXTENSION_ACTIVE_BY_CATEGORY = 'b2bprofessional/activatebycategorysettings/activebycategory';
19
+
20
+ /**
21
+ * Path for the config for activated categories
22
+ */
23
+ const CONFIG_EXTENSION_ACTIVATED_CATEGORIES = 'b2bprofessional/activatebycategorysettings/activecategories';
24
+
25
+ /**
26
+ * Variable for if the extension is active by category
27
+ *
28
+ * @var bool
29
+ */
30
+ protected $bExtensionActiveByCategory;
31
+
32
+ /**
33
+ * Check to see if the website is set-up to require a user login to view pages
34
+ *
35
+ * @return bool
36
+ */
37
+ public function isExtensionActivatedByCategory()
38
+ {
39
+ return $this->getStoreFlag(self::CONFIG_EXTENSION_ACTIVE_BY_CATEGORY, 'bExtensionActiveByCategory');
40
+ }
41
+
42
+ /**
43
+ * For a product get all the parent and children product ids when they are set
44
+ *
45
+ * @param Mage_Catalog_Model_Product $oProduct
46
+ * @return int[]
47
+ */
48
+ protected function getChildrenAndParentIds(Mage_Catalog_Model_Product $oProduct)
49
+ {
50
+ $oProductType = $oProduct->getTypeInstance();
51
+ $aLinkedProductIds = $oProductType->getParentIdsByChild($oProduct->getId());
52
+ $aChildProductIdsByGroups = $oProductType->getChildrenIds($oProduct->getId());
53
+ foreach ($aChildProductIdsByGroups as $aChildProductIds) {
54
+ $aLinkedProductIds = array_unique(array_merge($aLinkedProductIds, $aChildProductIds));
55
+ }
56
+ return $aLinkedProductIds;
57
+ }
58
+
59
+ /**
60
+ * Validate that the category of a give product is activated in the module
61
+ *
62
+ * @param Mage_Catalog_Model_Product $oProduct
63
+ * @return bool
64
+ */
65
+ public function isCategoryActiveByProduct(Mage_Catalog_Model_Product $oProduct)
66
+ {
67
+ $aCurrentCategories = $oProduct->getCategoryIds();
68
+
69
+ $aLinkedProductIds = array();
70
+ if ($oProduct->isSuper()) {
71
+ $aLinkedProductIds = $this->getChildrenAndParentIds($oProduct);
72
+ }
73
+
74
+ if (!empty($aLinkedProductIds)) {
75
+ $aCurrentCategories = $this->getAllCategoryIds($aLinkedProductIds, $aCurrentCategories);
76
+ }
77
+
78
+ if (!is_array($aCurrentCategories)) {
79
+ $aCurrentCategories = array(
80
+ $aCurrentCategories
81
+ );
82
+ }
83
+ return $this->hasActiveCategory($aCurrentCategories);
84
+ }
85
+
86
+ /**
87
+ * Check that at least one of the given category ids is active
88
+ *
89
+ * @param int[] $aCategoryIds
90
+ * @return bool
91
+ */
92
+ public function hasActiveCategory($aCategoryIds)
93
+ {
94
+ $aActiveCategoryIds = $this->getActiveCategories();
95
+ foreach ($aCategoryIds as $iCategoryId) {
96
+ if (in_array($iCategoryId, $aActiveCategoryIds)) {
97
+ return true;
98
+ }
99
+ }
100
+ return false;
101
+ }
102
+
103
+ /**
104
+ * Get all category ids activated via the system config
105
+ * - Include the children category ids
106
+ *
107
+ * @return int[]
108
+ */
109
+ protected function getActiveCategories()
110
+ {
111
+ $aCurrentActiveCategories = $this->getExtensionActivatedCategoryIds();
112
+
113
+ /**
114
+ * Loop through each activated category ids and add children category ids
115
+ */
116
+ $aSubActiveCategories = $this->addCategoryChildren($aCurrentActiveCategories);
117
+ return array_unique(array_merge($aCurrentActiveCategories, $aSubActiveCategories));
118
+ }
119
+
120
+ /**
121
+ * Get an array of category ids activated via the admin config section
122
+ *
123
+ * @return int[]
124
+ */
125
+ protected function getExtensionActivatedCategoryIds()
126
+ {
127
+ /*
128
+ * Category Ids are saved in the config in format
129
+ * - "category1,category2"
130
+ */
131
+ $sActivatedCategoryIds = Mage::getStoreConfig(self::CONFIG_EXTENSION_ACTIVATED_CATEGORIES);
132
+ return explode(',', $sActivatedCategoryIds);
133
+ }
134
+
135
+ /**
136
+ * From given category id load all child ids into an array
137
+ *
138
+ * @param int[] $aCategoryIds
139
+ * @return int[]
140
+ */
141
+ protected function addCategoryChildren($aCategoryIds)
142
+ {
143
+ $oCategoryResource = Mage::getResourceModel('catalog/category');
144
+ $oAdapter = $oCategoryResource->getReadConnection();
145
+
146
+ $oSelect = $oAdapter->select();
147
+ $oSelect->from(array('m' => $oCategoryResource->getEntityTable()), 'entity_id');
148
+
149
+ foreach ($aCategoryIds as $iCategoryId) {
150
+ $oSelect->orWhere($oAdapter->quoteIdentifier('path') . ' LIKE ?', '%/' . $iCategoryId . '/%');
151
+ }
152
+ return $oAdapter->fetchCol($oSelect);
153
+ }
154
+
155
+ /**
156
+ * From an array of all product ids get all unique entries in the product category table
157
+ *
158
+ * @param int[] $aProductIds
159
+ * @param int[] $aCurrentCategories
160
+ * @return int[]
161
+ */
162
+ protected function getAllCategoryIds($aProductIds, $aCurrentCategories)
163
+ {
164
+ $oProductResource = Mage::getResourceModel('catalog/product');
165
+ $oAdapter = $oProductResource->getReadConnection();
166
+
167
+ $oSelect = $oAdapter->select();
168
+ $oSelect->from($oProductResource->getTable('catalog/category_product'), 'category_id');
169
+ $oSelect->where('product_id IN (?)', $aProductIds);
170
+
171
+ return array_unique(array_merge($aCurrentCategories, $oAdapter->fetchCol($oSelect)));
172
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  }
app/code/community/Sitewards/B2BProfessional/Helper/Core.php CHANGED
@@ -1,35 +1,26 @@
1
  <?php
 
2
  /**
3
- * Class Sitewards_B2BProfessional_Helper_Core
4
- * - define the reusable sections of the config file
5
  *
6
  * @category Sitewards
7
  * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
  */
10
- class Sitewards_B2BProfessional_Helper_Core extends Mage_Core_Helper_Abstract {
11
- /**
12
- * The root node of the b2b professional configuration
13
- */
14
- const CONFIG_B2B_PROFESSIONAL_NODE = 'b2bprofessional';
15
-
16
- /**
17
- * The general settings node of the b2b professional configuration
18
- */
19
- const CONFIG_GENERAL_SETTINGS_NODE = 'generalsettings';
20
-
21
- /**
22
- * The language settings node of the b2b professional configuration
23
- */
24
- const CONFIG_LANGUAGE_SETTINGS_NODE = 'languagesettings';
25
-
26
- /**
27
- * The category settings node of the b2b professional configuration
28
- */
29
- const CONFIG_CATEGORY_SETTINGS_NODE = 'activatebycategorysettings';
30
-
31
- /**
32
- * The customer settings node of the b2b professional configuration
33
- */
34
- const CONFIG_CUSTOMER_SETTINGS_NODE = 'activatebycustomersettings';
35
  }
1
  <?php
2
+
3
  /**
4
+ * Sitewards_B2BProfessional_Helper_Core
 
5
  *
6
  * @category Sitewards
7
  * @package Sitewards_B2BProfessional
8
+ * @copyright Copyright (c) 2014 Sitewards GmbH (http://www.sitewards.com/)
9
  */
10
+ class Sitewards_B2BProfessional_Helper_Core extends Mage_Core_Helper_Abstract
11
+ {
12
+ /**
13
+ * Get a store flag value and set to against the object
14
+ *
15
+ * @param string $sStoreFlagPath
16
+ * @param string $sStoreFlagAttribute
17
+ * @return bool
18
+ */
19
+ public function getStoreFlag($sStoreFlagPath, $sStoreFlagAttribute)
20
+ {
21
+ if ($this->$sStoreFlagAttribute === null) {
22
+ $this->$sStoreFlagAttribute = Mage::getStoreConfigFlag($sStoreFlagPath);
23
+ }
24
+ return $this->$sStoreFlagAttribute;
25
+ }
 
 
 
 
 
 
 
 
 
26
  }
app/code/community/Sitewards/B2BProfessional/Helper/Customer.php CHANGED
@@ -1,175 +1,196 @@
1
  <?php
 
2
  /**
3
- * Class Sitewards_B2BProfessional_Helper_Customer
4
- * - function to check if extension is activated by customer
5
- * - function to check if extension requires login
6
- * - function to check if customer is active
7
- * - function to check if customer is allowed in the current store
8
- * - function to check if customers are activated globally
9
- * - function to check if customer is active for store
10
- * - function to check if customer was created via the admin section
11
- * - function to get the extension's activated customer groups
12
  *
13
  * @category Sitewards
14
  * @package Sitewards_B2BProfessional
15
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
16
  */
17
- class Sitewards_B2BProfessional_Helper_Customer extends Mage_Core_Helper_Abstract {
18
- /**
19
- * Check to see if the extension is activated by customer
20
- *
21
- * @return bool
22
- */
23
- public function isExtensionActivatedByCustomer() {
24
- return Mage::getStoreConfigFlag(Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/' . Sitewards_B2BProfessional_Helper_Core::CONFIG_CUSTOMER_SETTINGS_NODE . '/activebycustomer');
25
- }
26
-
27
- /**
28
- * Check to see if the website is set-up to require a user login to view pages
29
- *
30
- * @return boolean
31
- */
32
- public function isLoginRequired() {
33
- return Mage::getStoreConfigFlag(Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/requirelogin/requirelogin');
34
- }
35
-
36
- /**
37
- * Check that the current customer's group id is in the list of active group ids
38
- *
39
- * @return boolean
40
- */
41
- public function isCustomerActive() {
42
- /* @var $oCustomerSession Mage_Customer_Model_Session */
43
- $oCustomerSession = Mage::getModel('customer/session');
44
- $iCurrentCustomerGroupId = $oCustomerSession->getCustomerGroupId();
45
- $aActiveCustomerGroupIds = $this->getActivatedCustomerGroupIds();
46
-
47
- if (in_array($iCurrentCustomerGroupId, $aActiveCustomerGroupIds)) {
48
- return true;
49
- }
50
- }
51
-
52
- /**
53
- * Check to see if the user is allowed on the current store
54
- * - Check if the customer is logged in,
55
- * - Check if the extension is set to have global customer activation,
56
- * - Check if the user is active for the current store
57
- *
58
- * @return bool
59
- */
60
- public function isCustomerAllowedInStore() {
61
- /* @var $oCustomerSession Mage_Customer_Model_Session */
62
- $oCustomerSession = Mage::getSingleton('customer/session');
63
- if ($oCustomerSession->isLoggedIn()) {
64
- /*
65
- * If customer activation is global
66
- * - then any customer can access any store
67
- */
68
- if ($this->isCustomerActivationGlobal()) {
69
- return true;
70
- }
71
-
72
- /* @var $oCustomer Mage_Customer_Model_Customer */
73
- $oCustomer = $oCustomerSession->getCustomer();
74
- if($this->isCustomerActiveForStore($oCustomer)) {
75
- return true;
76
- }
77
- }
78
- }
79
-
80
- /**
81
- * Check to see if the extension has the "global customer activation"
82
- *
83
- * @return bool
84
- */
85
- private function isCustomerActivationGlobal() {
86
- return Mage::getStoreConfigFlag(Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/' . Sitewards_B2BProfessional_Helper_Core::CONFIG_GENERAL_SETTINGS_NODE . '/activecustomers');
87
- }
88
-
89
- /**
90
- * Check to see if the user is active for current store
91
- * NOTE: users created via the admin section cannot be attached to a front end store and so have global activation
92
- *
93
- * @param $oCustomer Mage_Customer_Model_Customer
94
- * @return bool
95
- */
96
- private function isCustomerActiveForStore($oCustomer) {
97
- /*
98
- * Check to see if the user was created via the admin section
99
- * - Note: users created via the admin section cannot be attached to a front end store
100
- */
101
- if ($this->isCustomerAdminCreation($oCustomer)) {
102
- return true;
103
- }
104
-
105
- /*
106
- * Get user's store and current store for comparison
107
- */
108
- $iUserStoreId = $oCustomer->getStoreId();
109
- $iCurrentStoreId = Mage::app()->getStore()->getId();
110
-
111
- /*
112
- * Return true if:
113
- * - the user's store id matches the current store id
114
- */
115
- if ($iUserStoreId == $iCurrentStoreId) {
116
- return true;
117
- }
118
- }
119
-
120
- /**
121
- * Check to see if the user has been created via the admin section
122
- *
123
- * @param $oCustomer Mage_Customer_Model_Customer
124
- * @return bool
125
- */
126
- private function isCustomerAdminCreation($oCustomer) {
127
- if($oCustomer->getCreatedIn() == 'Admin') {
128
- return true;
129
- }
130
- }
131
-
132
- /**
133
- * Get an array of all the activated customer group ids
134
- * - always include the 'NOT LOGGED IN' group
135
- *
136
- * @return array
137
- */
138
- private function getActivatedCustomerGroupIds() {
139
- /*
140
- * Customer group ids are saved in the config in format
141
- * - "group1,group2"
142
- */
143
- $sActivatedCustomerGroups = Mage::getStoreConfig(Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/' . Sitewards_B2BProfessional_Helper_Core::CONFIG_CUSTOMER_SETTINGS_NODE . '/activecustomers');
144
- $aActivatedCustomerGroupIds = explode(',', $sActivatedCustomerGroups);
145
-
146
- /*
147
- * Always add the guest user group id when activated by customer group
148
- * Note: the the group code for the guest user can not be changed via the admin section
149
- */
150
- /* @var $oCustomerGroup Mage_Customer_Model_Group */
151
- $oCustomerGroup = Mage::getModel('customer/group');
152
- $iGuestGroupId = $oCustomerGroup->load('NOT LOGGED IN', 'customer_group_code')->getId();
153
- $aActivatedCustomerGroupIds[] = $iGuestGroupId;
154
-
155
- return $aActivatedCustomerGroupIds;
156
- }
157
-
158
- /**
159
- * checks if user is allowed to view products
160
- *
161
- * @return bool
162
- */
163
- public function isUserAllowed()
164
- {
165
- /* @var $oHelper Sitewards_B2BProfessional_Helper_Data */
166
- $oHelper = Mage::helper('b2bprofessional');
167
- return (
168
- $oHelper->isExtensionActive() == true
169
- && (
170
- $this->isLoginRequired() == false
171
- || Mage::getSingleton('customer/session')->isLoggedIn()
172
- )
173
- );
174
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  }
1
  <?php
2
+
3
  /**
4
+ * Sitewards_B2BProfessional_Helper_Customer
5
+ * - Helper containing the checks for
6
+ * - customer is active
7
+ * - if login is required
 
 
 
 
 
8
  *
9
  * @category Sitewards
10
  * @package Sitewards_B2BProfessional
11
+ * @copyright Copyright (c) 2014 Sitewards GmbH (http://www.sitewards.com/)
12
  */
13
+ class Sitewards_B2BProfessional_Helper_Customer extends Sitewards_B2BProfessional_Helper_Core
14
+ {
15
+ /**
16
+ * Path for the config for extension requires login
17
+ */
18
+ const CONFIG_EXTENSION_REQUIRES_LOGIN = 'b2bprofessional/requirelogin/requirelogin';
19
+
20
+ /**
21
+ * Path for the config for extension is active by customer group
22
+ */
23
+ const CONFIG_EXTENSION_ACTIVE_BY_CUSTOMER_GROUP = 'b2bprofessional/activatebycustomersettings/activebycustomer';
24
+
25
+ /**
26
+ * Path for the config for customer groups that are activated
27
+ */
28
+ const CONFIG_EXTENSION_ACTIVE_CUSTOMER_GROUPS = 'b2bprofessional/activatebycustomersettings/activecustomers';
29
+
30
+ /**
31
+ * Path for the config for customer groups that are activated
32
+ */
33
+ const CONFIG_EXTENSION_ACTIVE_CUSTOMER_GLOBALLY = 'b2bprofessional/generalsettings/activecustomers';
34
+
35
+ /**
36
+ * Flag if the extension is set to require login
37
+ *
38
+ * @var bool
39
+ */
40
+ protected $bLoginRequired;
41
+
42
+ /**
43
+ * Flag if the extension is active by customer group
44
+ *
45
+ * @var bool
46
+ */
47
+ protected $bExtensionActiveByCustomerGroup;
48
+
49
+ /**
50
+ * Array of activated customer group ids
51
+ *
52
+ * @var int[]
53
+ */
54
+ protected $aActivatedCustomerGroupIds = array();
55
+
56
+ /**
57
+ * Check to see if the customer is logged in
58
+ * - Is the session logged in,
59
+ * - Are customers activated globally,
60
+ * - Is this one customer active for the current store,
61
+ *
62
+ * @return bool
63
+ */
64
+ public function isCustomerLoggedIn()
65
+ {
66
+ if (Mage::helper('customer')->isLoggedIn() === true) {
67
+ /*
68
+ * If customer activation is global
69
+ * - then any customer can access any store
70
+ */
71
+ if ($this->isCustomerActivationGlobal()) {
72
+ return true;
73
+ }
74
+
75
+ /* @var $oCustomerSession Mage_Customer_Model_Session */
76
+ $oCustomerSession = Mage::getSingleton('customer/session');
77
+ /* @var $oCustomer Mage_Customer_Model_Customer */
78
+ $oCustomer = $oCustomerSession->getCustomer();
79
+ if($this->isCustomerActiveForStore($oCustomer)) {
80
+ return true;
81
+ }
82
+ }
83
+ return false;
84
+ }
85
+
86
+ /**
87
+ * Check if the extension has customers activated globally
88
+ *
89
+ * @return bool
90
+ */
91
+ private function isCustomerActivationGlobal()
92
+ {
93
+ return Mage::getStoreConfigFlag(self::CONFIG_EXTENSION_ACTIVE_CUSTOMER_GLOBALLY);
94
+ }
95
+
96
+ /**
97
+ * Check if a given customer is allowed for the current store
98
+ * - NOTE: users created via the admin section cannot be attached to a front end store and so are globally active
99
+ *
100
+ * @param Mage_Customer_Model_Customer $oCustomer
101
+ * @return bool
102
+ */
103
+ private function isCustomerActiveForStore(Mage_Customer_Model_Customer $oCustomer)
104
+ {
105
+ /*
106
+ * Check to see if the user was created via the admin section
107
+ * - Note: users created via the admin section cannot be attached to a front end store
108
+ */
109
+ if ($this->isCustomerAdminCreation($oCustomer)) {
110
+ return true;
111
+ }
112
+
113
+ /*
114
+ * Get user's store and current store for comparison
115
+ */
116
+ $iUserStoreId = $oCustomer->getStoreId();
117
+ $iCurrentStoreId = Mage::app()->getStore()->getId();
118
+
119
+ /*
120
+ * Return true if:
121
+ * - the user's store id matches the current store id
122
+ */
123
+ return $iUserStoreId === $iCurrentStoreId;
124
+ }
125
+
126
+ /**
127
+ * Check to see if the user has been created via the admin section
128
+ *
129
+ * @param Mage_Customer_Model_Customer $oCustomer
130
+ * @return bool
131
+ */
132
+ private function isCustomerAdminCreation(Mage_Customer_Model_Customer $oCustomer)
133
+ {
134
+ return $oCustomer->getStoreId() === Mage_Core_Model_App::ADMIN_STORE_ID;
135
+ }
136
+
137
+ /**
138
+ * Check to see if the customer's group is active
139
+ * - If they are not logged in then we do not need to check any further
140
+ *
141
+ * @return bool
142
+ */
143
+ public function isCustomerGroupActive()
144
+ {
145
+ /* @var $oCustomerSession Mage_Customer_Model_Session */
146
+ $oCustomerSession = Mage::getModel('customer/session');
147
+ $iCurrentCustomerGroupId = $oCustomerSession->getCustomerGroupId();
148
+ $aActiveCustomerGroupIds = $this->getActivatedCustomerGroupIds();
149
+
150
+ return in_array($iCurrentCustomerGroupId, $aActiveCustomerGroupIds);
151
+ }
152
+
153
+ /**
154
+ * Check to see if the website is set-up to require a user login to view pages
155
+ *
156
+ * @return bool
157
+ */
158
+ public function isLoginRequired()
159
+ {
160
+ return $this->getStoreFlag(self::CONFIG_EXTENSION_REQUIRES_LOGIN, 'bLoginRequired');
161
+ }
162
+
163
+ /**
164
+ * Check to see if the extension is activated by customer group
165
+ *
166
+ * @return bool
167
+ */
168
+ public function isExtensionActivatedByCustomerGroup()
169
+ {
170
+ return $this->getStoreFlag(self::CONFIG_EXTENSION_ACTIVE_BY_CUSTOMER_GROUP, 'bExtensionActiveByCustomerGroup');
171
+ }
172
+
173
+ /**
174
+ * Get an array of all the activated customer group ids
175
+ * - always include the 'NOT LOGGED IN' group
176
+ *
177
+ * @return int[]
178
+ */
179
+ private function getActivatedCustomerGroupIds()
180
+ {
181
+ if (empty($this->aActivatedCustomerGroupIds)) {
182
+ /*
183
+ * Customer group ids are saved in the config in format
184
+ * - "group1,group2"
185
+ */
186
+ $sActivatedCustomerGroups = Mage::getStoreConfig(self::CONFIG_EXTENSION_ACTIVE_CUSTOMER_GROUPS);
187
+ $this->aActivatedCustomerGroupIds = explode(',', $sActivatedCustomerGroups);
188
+
189
+ /*
190
+ * Always add the guest user group id when activated by customer group
191
+ */
192
+ $this->aActivatedCustomerGroupIds[] = Mage_Customer_Model_Group::NOT_LOGGED_IN_ID;
193
+ }
194
+ return $this->aActivatedCustomerGroupIds;
195
+ }
196
  }
app/code/community/Sitewards/B2BProfessional/Helper/Data.php CHANGED
@@ -1,189 +1,208 @@
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
- * - Check that the current cart is valid,
12
  *
13
  * @category Sitewards
14
  * @package Sitewards_B2BProfessional
15
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
16
  */
17
- class Sitewards_B2BProfessional_Helper_Data extends Mage_Core_Helper_Abstract {
18
- /**
19
- * Object for the sitewards b2bprofessional category helper
20
- *
21
- * @var Sitewards_B2BProfessional_Helper_Category
22
- */
23
- protected $oB2BCategoryHelper;
24
-
25
- /**
26
- * Object for the sitewards b2bprofessional customer helper
27
- *
28
- * @var Sitewards_B2BProfessional_Helper_Customer
29
- */
30
- protected $oB2BCustomerHelper;
31
-
32
- protected $_isActive;
33
- protected $_isExtensionActive;
34
-
35
- /**
36
- * Create instances of the sitewards b2bprofessional category and customer helpers
37
- */
38
- protected function _prepareHelpers() {
39
- /** @var $this->oB2BCategoryHelper Sitewards_B2BProfessional_Helper_Category */
40
- $this->oB2BCategoryHelper = Mage::helper('b2bprofessional/category');
41
- /** @var $this->oB2BCustomerHelper Sitewards_B2BProfessional_Helper_Customer */
42
- $this->oB2BCustomerHelper = Mage::helper('b2bprofessional/customer');
43
- }
44
-
45
- /**
46
- * Check to see if the extension is active
47
- * Returns the extension's general setting "active"
48
- *
49
- * @return bool
50
- */
51
- public function isExtensionActive() {
52
- if (empty($this->_isExtensionActive)) {
53
- $this->_isExtensionActive = Mage::getStoreConfigFlag(Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/' . Sitewards_B2BProfessional_Helper_Core::CONFIG_GENERAL_SETTINGS_NODE . '/active');
54
- }
55
- return $this->_isExtensionActive;
56
- }
57
-
58
- /**
59
- * Check that the price can be displayed for the given product id
60
- * - Check that the extension is active
61
- * - Check that the customer is allowed in the store
62
- * - When the extension is activated by customer group and category
63
- * - Check that:
64
- * - The category is active by product
65
- * - AND The customer is active
66
- * - When the extension is activated by customer group
67
- * - Check that:
68
- * - The customer is active
69
- * - When the extension is activated by category
70
- * - Check that:
71
- * - The category is active by product
72
- * - AND the user is not logged in
73
- * - Else
74
- * - Check if the user is not logged in
75
- *
76
- * @param int $iProductId
77
- * @return bool
78
- */
79
- public function isProductActive($iProductId) {
80
- $bIsLoggedIn = false;
81
- // global extension activation
82
- if ($this->isExtensionActive()) {
83
- $this->_prepareHelpers();
84
-
85
- // check user logged in and has store access
86
- if ($this->oB2BCustomerHelper->isCustomerAllowedInStore()) {
87
- $bIsLoggedIn = true;
88
- }
89
-
90
- $bCheckUser = $this->oB2BCustomerHelper->isExtensionActivatedByCustomer();
91
- $bCheckCategory = $this->oB2BCategoryHelper->isExtensionActivatedByCategory();
92
-
93
- if($bCheckUser == true && $bCheckCategory == true) {
94
- $bIsActive = $this->oB2BCategoryHelper->isCategoryActiveByProduct($iProductId) && $this->oB2BCustomerHelper->isCustomerActive();
95
- } elseif($bCheckUser == true) {
96
- $bIsActive = $this->oB2BCustomerHelper->isCustomerActive();
97
- } elseif ($bCheckCategory == true) {
98
- $bIsActive = $this->oB2BCategoryHelper->isCategoryActiveByProduct($iProductId) && !$bIsLoggedIn;
99
- } else {
100
- $bIsActive = !$bIsLoggedIn;
101
- }
102
- } else {
103
- $bIsActive = false;
104
- }
105
- return $bIsActive;
106
- }
107
-
108
- /**
109
- * Check that the price can be displayed when no product id is given
110
- * - Check that the extension is active
111
- * - Check that the customer is allowed in the store
112
- * - When the extension is activated by customer group and category
113
- * - Check that:
114
- * - The category is active
115
- * - AND The customer is active
116
- * - When the extension is activated by customer group
117
- * - Check that:
118
- * - The customer is active
119
- * - When the extension is activated by category
120
- * - Check that:
121
- * - The category is active
122
- * - AND the user is not logged in
123
- * - Else
124
- * - Check if the user not is logged in
125
- *
126
- * @return bool
127
- */
128
- public function isActive() {
129
- if (empty($this->_isActive)) {
130
- $bIsLoggedIn = false;
131
- // global extension activation
132
- if ($this->isExtensionActive()) {
133
- $this->_prepareHelpers();
134
-
135
- // check user logged in and has store access
136
- if ($this->oB2BCustomerHelper->isCustomerAllowedInStore()) {
137
- $bIsLoggedIn = true;
138
- }
139
-
140
- $bCheckUser = $this->oB2BCustomerHelper->isExtensionActivatedByCustomer();
141
- $bCheckCategory = $this->oB2BCategoryHelper->isExtensionActivatedByCategory();
142
-
143
- if($bCheckUser == true && $bCheckCategory == true) {
144
- $bIsActive = $this->oB2BCategoryHelper->isCategoryActive() && $this->oB2BCustomerHelper->isCustomerActive();
145
- } elseif($bCheckUser == true) {
146
- $bIsActive = $this->oB2BCustomerHelper->isCustomerActive();
147
- } elseif ($bCheckCategory == true) {
148
- $bIsActive = $this->oB2BCategoryHelper->isCategoryActive() && !$bIsLoggedIn;
149
- } else {
150
- $bIsActive = !$bIsLoggedIn;
151
- }
152
- } else {
153
- $bIsActive = false;
154
- }
155
- $this->_isActive = $bIsActive;
156
- }
157
- return $this->_isActive;
158
- }
159
-
160
- /**
161
- * Validate that the current quote in the checkout session is valid for the user
162
- * - Check each item in the quote against the function checkActive
163
- *
164
- * @return bool
165
- */
166
- public function hasValidCart() {
167
- $bValidCart = true;
168
- /* @var $oQuote Mage_Sales_Model_Quote */
169
- $oQuote = Mage::getSingleton('checkout/session')->getQuote();
170
- foreach($oQuote->getAllItems() as $oItem) {
171
- /* @var $oItem Mage_Sales_Model_Quote_Item */
172
- $iProductId = $oItem->getProductId();
173
- /*
174
- * For each item check if it is active for the current user
175
- */
176
- if ($this->isProductActive($iProductId)) {
177
- $bValidCart = false;
178
- }
179
- }
180
- return $bValidCart;
181
- }
182
-
183
- /**
184
- * @return string
185
- */
186
- public function getOrderHistoryUrl() {
187
- return $this->_getUrl('sales/order/history');
188
- }
189
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+
3
  /**
4
  * Sitewards_B2BProfessional_Helper_Data
5
+ * - Helper containing the checks for
6
+ * - extension is active,
7
+ * - product is active,
8
+ * - is the category active,
 
 
 
 
9
  *
10
  * @category Sitewards
11
  * @package Sitewards_B2BProfessional
12
+ * @copyright Copyright (c) 2014 Sitewards GmbH (http://www.sitewards.com/)
13
  */
14
+ class Sitewards_B2BProfessional_Helper_Data extends Sitewards_B2BProfessional_Helper_Core
15
+ {
16
+ /**
17
+ * Path for the config for extension active status
18
+ */
19
+ const CONFIG_EXTENSION_ACTIVE = 'b2bprofessional/generalsettings/active';
20
+
21
+ /**
22
+ * Path for the config for price block class names
23
+ */
24
+ const CONFIG_EXTENSION_PRICE_BLOCKS = 'b2bprofessional/generalsettings/priceblocks';
25
+
26
+ /**
27
+ * Variable for if the extension is active
28
+ *
29
+ * @var bool
30
+ */
31
+ protected $bExtensionActive;
32
+
33
+ /**
34
+ * Variable for if the extension is active by category
35
+ *
36
+ * @var bool
37
+ */
38
+ protected $bExtensionActiveByCategory;
39
+
40
+ /**
41
+ * Variable for if the extension is active by customer group
42
+ *
43
+ * @var bool
44
+ */
45
+ protected $bExtensionActiveByCustomerGroup;
46
+
47
+ /**
48
+ * Variable for the extension's price blocks
49
+ *
50
+ * @var string[]
51
+ */
52
+ protected $aPriceBlockClassNames;
53
+
54
+ /**
55
+ * Check to see if the extension is active
56
+ *
57
+ * @return bool
58
+ */
59
+ public function isExtensionActive()
60
+ {
61
+ return $this->getStoreFlag(self::CONFIG_EXTENSION_ACTIVE, 'bExtensionActive');
62
+ }
63
+
64
+ /**
65
+ * Check to see if the extension is active by category
66
+ *
67
+ * @return bool
68
+ */
69
+ protected function isExtensionActiveByCategory()
70
+ {
71
+ if ($this->bExtensionActiveByCategory === null) {
72
+ $this->bExtensionActiveByCategory = Mage::helper(
73
+ 'sitewards_b2bprofessional/category'
74
+ )->isExtensionActivatedByCategory();
75
+ }
76
+ return $this->bExtensionActiveByCategory;
77
+ }
78
+
79
+ /**
80
+ * Check to see if the extension is active by user group
81
+ *
82
+ * @return bool
83
+ */
84
+ protected function isExtensionActivatedByCustomerGroup()
85
+ {
86
+ if ($this->bExtensionActiveByCustomerGroup === null) {
87
+ $this->bExtensionActiveByCustomerGroup = Mage::helper(
88
+ 'sitewards_b2bprofessional/customer'
89
+ )->isExtensionActivatedByCustomerGroup();
90
+ }
91
+ return $this->bExtensionActiveByCustomerGroup;
92
+ }
93
+
94
+ /**
95
+ * Check to see if the block is a price block
96
+ *
97
+ * @param Mage_Core_Block_Template $oBlock
98
+ * @return bool
99
+ */
100
+ public function isBlockPriceBlock($oBlock)
101
+ {
102
+ $aPriceBlockClassNames = $this->getPriceBlocks();
103
+ return in_array(get_class($oBlock), $aPriceBlockClassNames);
104
+ }
105
+
106
+ /**
107
+ * Check to see if the given product is active
108
+ * - In this case active means product behaves as normal in a magento shop
109
+ *
110
+ * @param Mage_Catalog_Model_Product $oProduct
111
+ * @return bool
112
+ */
113
+ public function isProductActive(Mage_Catalog_Model_Product $oProduct)
114
+ {
115
+ $bIsProductActive = true;
116
+ if ($this->isExtensionActive() === true) {
117
+ $bCheckCategory = $this->isExtensionActiveByCategory();
118
+ $bCheckUser = $this->isExtensionActivatedByCustomerGroup();
119
+ $bIsCustomerLoggedIn = $this->isCustomerLoggedIn();
120
+
121
+ /** @var Sitewards_B2BProfessional_Helper_Category $oCategoryHelper */
122
+ $oCategoryHelper = Mage::helper('sitewards_b2bprofessional/category');
123
+ /** @var Sitewards_B2BProfessional_Helper_Customer $oCustomerHelper */
124
+ $oCustomerHelper = Mage::helper('sitewards_b2bprofessional/customer');
125
+
126
+ $bIsCategoryEnabled = $oCategoryHelper->isCategoryActiveByProduct($oProduct);
127
+ $bIsCustomerGroupEnabled = $oCustomerHelper->isCustomerGroupActive();
128
+
129
+ if ($bCheckCategory && $bCheckUser) {
130
+ $bIsProductActive = !($bIsCategoryEnabled && $bIsCustomerGroupEnabled);
131
+ } elseif ($bCheckUser) {
132
+ $bIsProductActive = !$bIsCustomerGroupEnabled;
133
+ } elseif ($bCheckCategory) {
134
+ if ($bIsCustomerLoggedIn) {
135
+ $bIsProductActive = true;
136
+ } else {
137
+ $bIsProductActive = !$bIsCategoryEnabled;
138
+ }
139
+ } else {
140
+ $bIsProductActive = $bIsCustomerLoggedIn;
141
+ }
142
+ }
143
+
144
+ return $bIsProductActive;
145
+ }
146
+
147
+ /**
148
+ * From an array of category ids check to see if any are enabled via the extension to hide prices
149
+ *
150
+ * @param int[] $aCategoryIds
151
+ * @return bool
152
+ */
153
+ public function hasEnabledCategories($aCategoryIds)
154
+ {
155
+ $bHasCategories = false;
156
+ if ($this->isExtensionActive() === true) {
157
+ $bCheckCategory = $this->isExtensionActiveByCategory();
158
+ $bCheckUser = $this->isExtensionActivatedByCustomerGroup();
159
+ $bIsCustomerLoggedIn = $this->isCustomerLoggedIn();
160
+
161
+ /** @var Sitewards_B2BProfessional_Helper_Category $oCategoryHelper */
162
+ $oCategoryHelper = Mage::helper('sitewards_b2bprofessional/category');
163
+ /** @var Sitewards_B2BProfessional_Helper_Customer $oCustomerHelper */
164
+ $oCustomerHelper = Mage::helper('sitewards_b2bprofessional/customer');
165
+
166
+ $bHasActiveCategories = $oCategoryHelper->hasActiveCategory($aCategoryIds);
167
+ $bIsUserGroupActive = $oCustomerHelper->isCustomerGroupActive();
168
+
169
+ if ($bCheckCategory && $bCheckUser) {
170
+ $bHasCategories = $bHasActiveCategories && $bIsUserGroupActive;
171
+ } elseif ($bCheckUser) {
172
+ $bHasCategories = $bIsUserGroupActive;
173
+ } elseif ($bCheckCategory) {
174
+ if ($bIsCustomerLoggedIn) {
175
+ $bHasCategories = false;
176
+ } else {
177
+ $bHasCategories = $bHasActiveCategories;
178
+ }
179
+ } else {
180
+ $bHasCategories = !$bIsCustomerLoggedIn;
181
+ }
182
+ }
183
+ return $bHasCategories;
184
+ }
185
+
186
+ /**
187
+ * Check if the customer is logged in
188
+ *
189
+ * @return bool
190
+ */
191
+ protected function isCustomerLoggedIn()
192
+ {
193
+ return Mage::helper('sitewards_b2bprofessional/customer')->isCustomerLoggedIn();
194
+ }
195
+
196
+ /**
197
+ * Get the price blocks as defined in the xml
198
+ *
199
+ * @return string[]
200
+ */
201
+ protected function getPriceBlocks()
202
+ {
203
+ if ($this->aPriceBlockClassNames === null) {
204
+ $this->aPriceBlockClassNames = Mage::getStoreConfig(self::CONFIG_EXTENSION_PRICE_BLOCKS);
205
+ }
206
+ return $this->aPriceBlockClassNames;
207
+ }
208
+ }
app/code/community/Sitewards/B2BProfessional/Helper/Messages.php DELETED
@@ -1,72 +0,0 @@
1
- <?php
2
- /**
3
- * Class Sitewards_B2BProfessional_Helper_Messages
4
- * - contains each message type constant
5
- * - checkout = 0
6
- * - price = 1
7
- * - login = 2
8
- * - contains an array with all messages
9
- * - configuration path to override message
10
- * - default message
11
- * - function that takes in message type and returns the valid message
12
- *
13
- * @category Sitewards
14
- * @package Sitewards_B2BProfessional
15
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
16
- */
17
- class Sitewards_B2BProfessional_Helper_Messages extends Mage_Core_Helper_Abstract {
18
- /**
19
- * Array id for the checkout message
20
- */
21
- const MESSAGE_TYPE_CHECKOUT = 0;
22
-
23
- /**
24
- * Array id for the price message
25
- */
26
- const MESSAGE_TYPE_PRICE = 1;
27
-
28
- /**
29
- * Array id for the login message
30
- */
31
- const MESSAGE_TYPE_LOGIN = 2;
32
-
33
- /**
34
- * Array containing
35
- * - all the message config paths
36
- * - the default message for each type
37
- *
38
- * @var array
39
- */
40
- protected $aMessages = array(
41
- self::MESSAGE_TYPE_CHECKOUT => array(
42
- 'config' => 'errortext',
43
- 'default' => 'Your account is not allowed to access this store.'
44
- ),
45
- self::MESSAGE_TYPE_PRICE => array(
46
- 'config' => 'logintext',
47
- 'default' => 'Please login'
48
- ),
49
- self::MESSAGE_TYPE_LOGIN => array(
50
- 'config' => 'requireloginmessage',
51
- 'default' => 'You do not have access to view this store.'
52
- )
53
- );
54
-
55
- /**
56
- * The getMessage function will for a given message type
57
- * - check if the language override flag has been set via the admin config
58
- * - if override is set it will load the message from the admin config
59
- * - else it will load and translate the default message from the $_aMessages array
60
- *
61
- * @param int $iMessageType
62
- * @return string
63
- */
64
- public function getMessage($iMessageType) {
65
- if (Mage::getStoreConfigFlag(Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/' . Sitewards_B2BProfessional_Helper_Core::CONFIG_LANGUAGE_SETTINGS_NODE . '/languageoverride')) {
66
- $sMessage = Mage::getStoreConfig(Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/' . Sitewards_B2BProfessional_Helper_Core::CONFIG_LANGUAGE_SETTINGS_NODE . '/' . $this->aMessages[$iMessageType]['config']);
67
- } else {
68
- $sMessage = $this->__($this->aMessages[$iMessageType]['default']);
69
- }
70
- return $sMessage;
71
- }
72
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Helper/Redirects.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Class Sitewards_B2BProfessional_Helper_Redirects
4
  * - contains each redirect type config path as constant
@@ -6,34 +7,123 @@
6
  *
7
  * @category Sitewards
8
  * @package Sitewards_B2BProfessional
9
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
10
  */
11
- class Sitewards_B2BProfessional_Helper_Redirects extends Mage_Core_Helper_Abstract {
12
- /**
13
- * String containing the configuration path for the login redirect
14
- */
15
- const REDIRECT_TYPE_LOGIN = 'requirelogin/requireloginredirect';
16
-
17
- /**
18
- * String containing the configuration path for the add to cart redirect
19
- */
20
- const REDIRECT_TYPE_ADD_TO_CART = 'generalsettings/addtocartredirect';
21
-
22
- /**
23
- * The getRedirect function will for a given redirect configuration path
24
- * - load the value for the given configuration path
25
- * - return a formatted url based on this value
26
- *
27
- * @param string $sConfigPath
28
- * @return string
29
- */
30
- public static function getRedirect($sConfigPath) {
31
- $sConfigPath = Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/' . $sConfigPath;
32
- $sRedirectPath = '/';
33
- $sConfigVar = Mage::getStoreConfig($sConfigPath);
34
- if (isset($sConfigVar)) {
35
- $sRedirectPath = $sConfigVar;
36
- }
37
- return Mage::getUrl($sRedirectPath);
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
1
  <?php
2
+
3
  /**
4
  * Class Sitewards_B2BProfessional_Helper_Redirects
5
  * - contains each redirect type config path as constant
7
  *
8
  * @category Sitewards
9
  * @package Sitewards_B2BProfessional
10
+ * @copyright Copyright (c) 2014 Sitewards GmbH (http://www.sitewards.com/)
11
  */
12
+ class Sitewards_B2BProfessional_Helper_Redirects extends Sitewards_B2BProfessional_Helper_Core
13
+ {
14
+ /**
15
+ * String containing the configuration path for the login redirect
16
+ */
17
+ const REDIRECT_TYPE_LOGIN = 'b2bprofessional/requirelogin/requireloginredirect';
18
+
19
+ /**
20
+ * The getRedirect function will for a given redirect configuration path
21
+ * - load the value for the given configuration path
22
+ * - return a formatted url based on this value
23
+ *
24
+ * @param string $sConfigPath
25
+ * @return string
26
+ */
27
+ public function getRedirect($sConfigPath)
28
+ {
29
+ $sRedirectPath = '/';
30
+ $sConfigVar = Mage::getStoreConfig($sConfigPath);
31
+ if (isset($sConfigVar)) {
32
+ $sRedirectPath = $sConfigVar;
33
+ }
34
+ return Mage::getUrl($sRedirectPath);
35
+ }
36
+
37
+ /**
38
+ * From a given controller check to see if we need to redirect the user
39
+ * - Cms related for cms pages,
40
+ * - A front action to allow for admin pages,
41
+ * - Customer account to allow for login
42
+ * - Magento API to allow api requests
43
+ *
44
+ * @param Mage_Core_Controller_Front_Action $oControllerAction
45
+ * @return bool
46
+ */
47
+ protected function isRedirectRequired($oControllerAction)
48
+ {
49
+ $bIsCmsController = $this->isCmsController($oControllerAction);
50
+ $bIsFrontController = $this->isFrontController($oControllerAction);
51
+ $bIsApiController = $this->isApiController($oControllerAction);
52
+ $bIsCustomerController = $this->isCustomerController($oControllerAction);
53
+
54
+ return !$bIsCmsController && $bIsFrontController && !$bIsCustomerController && !$bIsApiController;
55
+ }
56
+
57
+ /**
58
+ * Check to see if the controller is a customer controller
59
+ *
60
+ * @param Mage_Core_Controller_Front_Action $oControllerAction
61
+ * @return bool
62
+ */
63
+ protected function isCustomerController($oControllerAction)
64
+ {
65
+ return $oControllerAction instanceof Mage_Customer_AccountController;
66
+ }
67
+
68
+ /**
69
+ * Check to see if the controller is an api controller
70
+ *
71
+ * @param Mage_Core_Controller_Front_Action $oControllerAction
72
+ * @return bool
73
+ */
74
+ protected function isApiController($oControllerAction)
75
+ {
76
+ return $oControllerAction instanceof Mage_Api_Controller_Action;
77
+ }
78
+
79
+ /**
80
+ * Check to see if the controller is a front controller
81
+ *
82
+ * @param Mage_Core_Controller_Front_Action $oControllerAction
83
+ * @return bool
84
+ */
85
+ protected function isFrontController($oControllerAction)
86
+ {
87
+ return $oControllerAction instanceof Mage_Core_Controller_Front_Action;
88
+ }
89
+
90
+ /**
91
+ * Check to see if the controller is a cms controller
92
+ *
93
+ * @param Mage_Core_Controller_Front_Action $oControllerAction
94
+ * @return bool
95
+ */
96
+ protected function isCmsController($oControllerAction)
97
+ {
98
+ return $oControllerAction instanceof Mage_Cms_IndexController
99
+ || $oControllerAction instanceof Mage_Cms_PageController;
100
+ }
101
+
102
+ /**
103
+ * Set-up the redirect to the customer login page
104
+ *
105
+ * @param Mage_Core_Controller_Front_Action $oControllerAction
106
+ */
107
+ public function performRedirect($oControllerAction)
108
+ {
109
+ if ($this->isRedirectRequired($oControllerAction)) {
110
+ /* @var $oResponse Mage_Core_Controller_Response_Http */
111
+ $oResponse = $oControllerAction->getResponse();
112
+ $oResponse->setRedirect(
113
+ $this->getRedirect(
114
+ self::REDIRECT_TYPE_LOGIN
115
+ )
116
+ );
117
+
118
+ /*
119
+ * Add message to the session
120
+ * - Note:
121
+ * We need session_write_close otherwise the messages get lots in redirect
122
+ */
123
+ /* @var $oSession Mage_Core_Model_Session */
124
+ $oSession = Mage::getSingleton('core/session');
125
+ $oSession->addNotice(Mage::helper('sitewards_b2bprofessional')->__('Please login'));
126
+ session_write_close();
127
+ }
128
+ }
129
  }
app/code/community/Sitewards/B2BProfessional/Helper/Replacements.php DELETED
@@ -1,274 +0,0 @@
1
- <?php
2
- /**
3
- * Class Sitewards_B2BProfessional_Helper_Replacements
4
- * - contains the replacement pattern regular expression
5
- * - function to get add to cart replacement string
6
- * - function to check if product needs add to cart button replaced
7
- * - functions to replace given sections
8
- *
9
- * @category Sitewards
10
- * @package Sitewards_B2BProfessional
11
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
12
- */
13
- class Sitewards_B2BProfessional_Helper_Replacements extends Mage_Core_Helper_Abstract {
14
- /**
15
- * Regular expression for replacements
16
- */
17
- const PATTERN_BASE = '@<%1$s [^>]*?%2$s="[^"]*?%3$s[^"]*?"[^>]*?>.*?</%1$s>@siu';
18
-
19
- /**
20
- * Object for the main sitewards b2bprofessional helper
21
- *
22
- * @var Sitewards_B2BProfessional_Helper_Data
23
- */
24
- protected $oB2BHelper;
25
-
26
- /**
27
- * Create an instance of the main sitewards b2bprofessional helper
28
- */
29
- public function __construct() {
30
- $this->oB2BHelper = Mage::helper('b2bprofessional');
31
- }
32
-
33
- /**
34
- * Get the replacement text for the add to cart url
35
- *
36
- * @return string
37
- */
38
- public function getReplaceAddToCartUrl() {
39
- return Mage::getStoreConfig(Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/add_to_cart/value');
40
- }
41
-
42
- /**
43
- * Check if the add to cart button should be replace
44
- * - if so return the new url
45
- * - else return the normal url
46
- *
47
- * @param int $iProductId
48
- * @param string $sNormalAddToCartUrl
49
- * @return string
50
- */
51
- public function replaceAddToCart($iProductId, $sNormalAddToCartUrl) {
52
- if ($this->isAddToCartToBeReplaced($iProductId)) {
53
- return $this->getReplaceAddToCartUrl();
54
- } else {
55
- return $sNormalAddToCartUrl;
56
- }
57
- }
58
-
59
- /**
60
- * Check to see if the add to cart button should be replaced
61
- *
62
- * @param int $iProductId
63
- * @return bool
64
- */
65
- public function isAddToCartToBeReplaced($iProductId) {
66
- return (bool) $this->oB2BHelper->isProductActive($iProductId) && $this->replaceSection('add_to_cart');
67
- }
68
-
69
- /**
70
- * Build two arrays,
71
- * - one for patterns
72
- * - one for replacements,
73
- * Using these two array call to replace the patterns when the cart is invalid
74
- *
75
- * @param array $aSections
76
- * @param string $sHtml
77
- * @return string
78
- */
79
- public function replaceSections($aSections, $sHtml) {
80
- $aPatterns = array();
81
- $aReplacements = array();
82
- /*
83
- * Foreach section to replace
84
- * - add the pattern
85
- * - add the replacement
86
- */
87
- $bReplaceOnInvalidCart = false;
88
- foreach($aSections as $sReplaceSection) {
89
- if($this->replaceSection($sReplaceSection)) {
90
- $aPatterns[] = $this->getPattern($sReplaceSection);
91
- $aReplacements[] = $this->getReplacement($sReplaceSection);
92
- if($this->checkInvalidCart($sReplaceSection)) {
93
- $bReplaceOnInvalidCart = true;
94
- }
95
- }
96
- }
97
- if($bReplaceOnInvalidCart == true) {
98
- return $this->replaceOnInvalidCart($aPatterns, $aReplacements, $sHtml);
99
- } else {
100
- return $this->replaceOnIsActive($aPatterns, $aReplacements, $sHtml);
101
- }
102
- }
103
-
104
- /**
105
- * Build two arrays,
106
- * - one for patterns
107
- * - one for replacements,
108
- * Using these two array call to replace the patterns when the cart is invalid
109
- *
110
- * @param array $aSections
111
- * @param string $sHtml
112
- * @param int $iProductId
113
- * @return string
114
- */
115
- public function replaceSectionsByProductId($aSections, $sHtml, $iProductId) {
116
- $aPatterns = array();
117
- $aReplacements = array();
118
- /*
119
- * Foreach section to replace
120
- * - add the pattern
121
- * - add the replacement
122
- */
123
- foreach($aSections as $sReplaceSection) {
124
- if($this->replaceSection($sReplaceSection)) {
125
- $aPatterns[] = $this->getPattern($sReplaceSection);
126
- $aReplacements[] = $this->getReplacement($sReplaceSection);
127
- }
128
- }
129
- return $this->replaceOnInvalidCartByProductId($aPatterns, $aReplacements, $sHtml, $iProductId);
130
- }
131
-
132
- /**
133
- * Check if a given config section should be replaced
134
- *
135
- * @param string $sConfigSection
136
- * @return bool
137
- */
138
- public function replaceSection($sConfigSection) {
139
- return Mage::getStoreConfigFlag(Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/' . $sConfigSection . '/replace');
140
- }
141
-
142
- /**
143
- * From a given config section
144
- * - Load all the config
145
- * - remove unused sections
146
- * - perform a sprintf on given config items
147
- *
148
- * @param string $sConfigSection
149
- * @return string
150
- */
151
- private function getPattern($sConfigSection) {
152
- // Load config array and unset unused information
153
- $aSectionConfig = Mage::getStoreConfig(Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/' . $sConfigSection);
154
- unset($aSectionConfig['replace']);
155
- unset($aSectionConfig['remove']);
156
-
157
- // Replace the tag, id and value sections of the regular expression
158
- return sprintf(self::PATTERN_BASE, $aSectionConfig['tag'], $aSectionConfig['id'], $aSectionConfig['value']);
159
- }
160
-
161
- /**
162
- * Get replacement text for a given config section
163
- *
164
- * @param string $sConfigSection
165
- * @return string
166
- */
167
- private function getReplacement($sConfigSection) {
168
- // Check for the remove flag
169
- if(!Mage::getStoreConfigFlag(Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/' . $sConfigSection . '/remove')) {
170
- // If the remove flag is not set then get the module's price message
171
- /* @var $oB2BMessagesHelper Sitewards_B2BProfessional_Helper_Messages */
172
- $oB2BMessagesHelper = Mage::helper('b2bprofessional/messages');
173
- return $oB2BMessagesHelper->getMessage($oB2BMessagesHelper::MESSAGE_TYPE_PRICE);
174
- }
175
- }
176
-
177
- /**
178
- * Check if a given config section should check if the cart is valid
179
- *
180
- * @param string $sConfigSection
181
- * @return bool
182
- */
183
- private function checkInvalidCart($sConfigSection) {
184
- return Mage::getStoreConfigFlag(Sitewards_B2BProfessional_Helper_Core::CONFIG_B2B_PROFESSIONAL_NODE . '/' . $sConfigSection . '/check_cart');
185
- }
186
-
187
- /**
188
- * When we have an invalid cart
189
- * - Perform a preg_replace with a given set of patterns and replacements on a string
190
- * - When product id is given check for valid product
191
- * - When no product id is given then check to complete cart
192
- *
193
- * @param array $aPatterns
194
- * @param array $aReplacements
195
- * @param string $sBlockHtml
196
- * @return string
197
- */
198
- private function replaceOnInvalidCart($aPatterns, $aReplacements, $sBlockHtml) {
199
- /*
200
- * If you have no product id provided and an invalid cart
201
- *
202
- * THEN
203
- * Perform the preg_replace
204
- */
205
- if (
206
- !$this->oB2BHelper->hasValidCart()
207
- ) {
208
- $sBlockHtml = $this->getNewBlockHtml($aPatterns, $aReplacements, $sBlockHtml);
209
- }
210
- return $sBlockHtml;
211
- }
212
-
213
- /**
214
- * When we have an invalid user
215
- * - Perform a preg_replace with a given set of patterns and replacements on a string
216
- * - Use only global isActive
217
- *
218
- * @param array $aPatterns
219
- * @param array $aReplacements
220
- * @param string $sBlockHtml
221
- * @return string
222
- */
223
- private function replaceOnIsActive($aPatterns, $aReplacements, $sBlockHtml) {
224
- if (
225
- $this->oB2BHelper->isActive()
226
- ) {
227
- $sBlockHtml = $this->getNewBlockHtml($aPatterns, $aReplacements, $sBlockHtml);
228
- }
229
- return $sBlockHtml;
230
- }
231
-
232
- /**
233
- * When we have an invalid cart
234
- * - Perform a preg_replace with a given set of patterns and replacements on a string
235
- * - When product id is given check for valid product
236
- * - When no product id is given then check to complete cart
237
- *
238
- * @param array $aPatterns
239
- * @param array $aReplacements
240
- * @param string $sBlockHtml
241
- * @param int $iProductId
242
- * @return string
243
- */
244
- private function replaceOnInvalidCartByProductId($aPatterns, $aReplacements, $sBlockHtml, $iProductId) {
245
- /*
246
- * If you have a product id provided and it is invalid
247
- *
248
- * THEN
249
- * Perform the preg_replace
250
- */
251
- if (
252
- $this->oB2BHelper->isProductActive($iProductId)
253
- ) {
254
- $sBlockHtml = $this->getNewBlockHtml($aPatterns, $aReplacements, $sBlockHtml);
255
- }
256
- return $sBlockHtml;
257
- }
258
-
259
- /**
260
- * Perform a preg_replace with the pattern and replacements given
261
- *
262
- * @param array $aPatterns
263
- * @param array $aReplacements
264
- * @param string $sBlockHtml
265
- * @return mixed
266
- */
267
- private function getNewBlockHtml($aPatterns, $aReplacements, $sBlockHtml) {
268
- return preg_replace(
269
- $aPatterns,
270
- $aReplacements,
271
- $sBlockHtml
272
- );
273
- }
274
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Model/Customer.php DELETED
@@ -1,57 +0,0 @@
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) 2013 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 customer 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
- /* @var $oSession Mage_Core_Model_Session */
43
- $oSession = Mage::getSingleton('core/session');
44
- $oSession->addSuccess($oCustomerHelper->__('Please wait for your account to be activated'));
45
- } else {
46
- throw new Exception ($oCustomerHelper->__ ('This account is not activated.'), self::EXCEPTION_CUSTOMER_NOT_ACTIVATED );
47
- }
48
- }
49
-
50
- Mage::dispatchEvent('customer_customer_authenticated', array(
51
- 'model' => $this,
52
- 'password' => $sLoginPassword
53
- ));
54
-
55
- return true;
56
- }
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Model/Observer.php CHANGED
@@ -1,477 +1,271 @@
1
  <?php
 
2
  /**
3
  * Sitewards_B2BProfessional_Model_Observer
4
- * - Observer to catch the following actions
 
 
 
5
  *
6
  * @category Sitewards
7
  * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
  */
10
- class Sitewards_B2BProfessional_Model_Observer {
11
- /**
12
- * The last product Id
13
- *
14
- * @var int
15
- */
16
- protected static $_iLastProductId = 0;
17
-
18
- /**
19
- * blocks which display prices
20
- *
21
- * @var array
22
- */
23
- protected $aPriceBlockClassNames = array(
24
- 'Mage_Catalog_Block_Product_Price' => 1,
25
- 'Mage_Bundle_Block_Catalog_Product_Price' => 1,
26
- );
27
-
28
- /**
29
- * Check if the site requires login to work
30
- * - Add notice,
31
- * - Redirect to the home page,
32
- *
33
- * @param Varien_Event_Observer $oObserver
34
- */
35
- public function onControllerActionPreDispatch(Varien_Event_Observer $oObserver) {
36
- /* @var $oHelper Sitewards_B2BProfessional_Helper_Data */
37
- $oHelper = Mage::helper('b2bprofessional');
38
- if($oHelper->isExtensionActive() == true) {
39
- /* @var $oControllerAction Mage_Core_Controller_Front_Action */
40
- $oControllerAction = $oObserver->getData('controller_action');
41
-
42
- /* @var $oB2BMessagesHelper Sitewards_B2BProfessional_Helper_Messages */
43
- $oB2BMessagesHelper = Mage::helper('b2bprofessional/messages');
44
- /* @var $oB2BCustomerHelper Sitewards_B2BProfessional_Helper_Customer */
45
- $oB2BCustomerHelper = Mage::helper('b2bprofessional/customer');
46
-
47
- /*
48
- * Check to see if the system requires a login
49
- * And there is no logged in user
50
- */
51
- if($oB2BCustomerHelper->isLoginRequired() == true && !Mage::getSingleton('customer/session')->isLoggedIn()) {
52
- /*
53
- * Check to see if the controller is:
54
- * 1) Cms related for cms pages,
55
- * 2) A front action to allow for admin pages,
56
- * 3) Customer account to allow for login
57
- * 4) Magento API to allow api requests
58
- */
59
- if(
60
- !$oControllerAction instanceof Mage_Cms_IndexController
61
- &&
62
- !$oControllerAction instanceof Mage_Cms_PageController
63
- &&
64
- $oControllerAction instanceof Mage_Core_Controller_Front_Action
65
- &&
66
- !$oControllerAction instanceof Mage_Customer_AccountController
67
- &&
68
- !$oControllerAction instanceof Mage_Api_Controller_Action
69
- ){
70
- // Redirect to the homepage
71
- /* @var $oResponse Mage_Core_Controller_Response_Http */
72
- $oResponse = $oControllerAction->getResponse();
73
- $oResponse->setRedirect(Sitewards_B2BProfessional_Helper_Redirects::getRedirect(Sitewards_B2BProfessional_Helper_Redirects::REDIRECT_TYPE_LOGIN));
74
 
75
- /*
76
- * Add message to the session
77
- * - Note:
78
- * We need session_write_close otherwise the messages get lots in redirect
79
- */
80
- /* @var $oSession Mage_Core_Model_Session */
81
- $oSession = Mage::getSingleton('core/session');
82
- $oSession->addNotice($oB2BMessagesHelper->getMessage($oB2BMessagesHelper::MESSAGE_TYPE_LOGIN));
83
- session_write_close();
84
- }
85
- /*
86
- * On Multishipping or Onepage actions
87
- * - validate that the cart is valid
88
- * - if not redirect the user to the account section and display message
89
- */
90
- } elseif(
91
- $oControllerAction instanceof Mage_Checkout_MultishippingController
92
- ||
93
- $oControllerAction instanceof Mage_Checkout_OnepageController
94
- ) {
95
- if (!$oHelper->hasValidCart()) {
96
- // Stop the default action from being dispatched
97
- $oControllerAction->setFlag('', 'no-dispatch', true);
98
- //Set the appropriate error message to the user session
99
- Mage::getSingleton('customer/session')->addError($oB2BMessagesHelper->getMessage($oB2BMessagesHelper::MESSAGE_TYPE_CHECKOUT));
100
- //Redirect to the account login url
101
- Mage::app()->getResponse()->setRedirect(Mage::getUrl('customer/account/login'))->sendHeaders();
102
- }
103
- /*
104
- * On Cart action
105
- * - validate that the cart is valid
106
- * - add message to the checkout session
107
- */
108
- } elseif($oControllerAction instanceof Mage_Checkout_CartController) {
109
- if (!$oHelper->hasValidCart()) {
110
- Mage::getSingleton('checkout/session')->addError($oB2BMessagesHelper->getMessage($oB2BMessagesHelper::MESSAGE_TYPE_CHECKOUT));
111
- }
112
- }
113
- }
114
- }
115
 
116
- /**
117
- * checks if the block represents a price block
118
- *
119
- * @param Mage_Core_Block_Abstract $oBlock
120
- * @return bool
121
- */
122
- protected function isExactlyPriceBlock($oBlock)
123
- {
124
- return ($oBlock && isset($this->aPriceBlockClassNames[get_class($oBlock)]));
125
- }
126
 
127
- /**
128
- * Check for block Mage_Catalog_Block_Product_Price
129
- * - Check the product is active via the Sitewards_B2BProfessional_Helper_Data
130
- * - Replace the text with that on the b2bprofessional
131
- *
132
- * @param Varien_Event_Observer $oObserver
133
- * @return string
134
- */
135
- public function onCoreBlockAbstractToHtmlAfter(Varien_Event_Observer $oObserver) {
136
- $oBlock = $oObserver->getData('block');
137
- $oTransport = $oObserver->getData('transport');
 
138
 
139
- /* @var $oB2BHelper Sitewards_B2BProfessional_Helper_Data */
140
- $oB2BHelper = Mage::helper('b2bprofessional');
141
- /* @var $oB2BMessagesHelper Sitewards_B2BProfessional_Helper_Messages */
142
- $oB2BMessagesHelper = Mage::helper('b2bprofessional/messages');
143
- /* @var $oB2BReplacementsHelper Sitewards_B2BProfessional_Helper_Replacements */
144
- $oB2BReplacementsHelper = Mage::helper('b2bprofessional/replacements');
145
 
146
- /*
147
- * Check to see if we should remove the product price
148
- */
149
- if($this->isExactlyPriceBlock($oBlock)) {
150
- $oProduct = $oBlock->getProduct();
151
- $iCurrentProductId = $oProduct->getId();
 
 
 
 
 
 
152
 
153
- if ($oB2BHelper->isProductActive($iCurrentProductId)) {
154
- // To stop duplicate information being displayed validate that we only do this once per product
155
- if ($iCurrentProductId != self::$_iLastProductId) {
156
- self::$_iLastProductId = $iCurrentProductId;
 
 
 
 
157
 
158
- $oTransport->setHtml($oB2BMessagesHelper->getMessage($oB2BMessagesHelper::MESSAGE_TYPE_PRICE));
159
- } else {
160
- $oTransport->setHtml('');
161
- }
162
- // Set type id to combined to stop tax being displayed via Symmetrics_TweaksGerman_Block_Tax
163
- if (
164
- Mage::helper('core')->isModuleEnabled('Symmetrics_TweaksGerman')
165
- && $oProduct->getTypeId() == 'bundle'
166
- ){
167
- $oProduct->setTypeId('combined');
168
- }
169
- }
170
- /*
171
- * Check to see if we should remove the add to cart button on the product page
172
- */
173
- } elseif(
174
- $oBlock instanceof Mage_Catalog_Block_Product_View
175
- &&
176
- $oBlock->getNameInLayout() == 'product.info.addtocart'
177
- ) {
178
- $iCurrentProductId = $oBlock->getProduct()->getId();
179
- if ($oB2BReplacementsHelper->isAddToCartToBeReplaced($iCurrentProductId)) {
180
- $oTransport->setHtml('');
181
- }
182
- /*
183
- * Check to see if we should remove the add to cart button on the wishlist item
184
- */
185
- } elseif (
186
- $oBlock instanceof Mage_Wishlist_Block_Customer_Wishlist_Item_Column_Cart
187
- ) {
188
- $iCurrentProductId = $oBlock->getItem()->getProduct()->getId();
189
- if ($oB2BReplacementsHelper->isAddToCartToBeReplaced($iCurrentProductId)) {
190
- $oTransport->setHtml($oB2BMessagesHelper->getMessage($oB2BMessagesHelper::MESSAGE_TYPE_PRICE));
191
- }
192
- /*
193
- * Check to see if we should remove totals and actions from the cart
194
- */
195
- } elseif(
196
- $oBlock instanceof Mage_Checkout_Block_Cart_Totals
197
- ||
198
- $oBlock instanceof Mage_Checkout_Block_Onepage_Link
199
- ||
200
- $oBlock instanceof Mage_Checkout_Block_Multishipping_Link
201
- ) {
202
- /*
203
- * If the current cart is not valid
204
- * - remove the block html
205
- */
206
- if (!$oB2BHelper->hasValidCart()) {
207
- $oTransport->setHtml('');
208
- }
209
- /*
210
- * Check to see if we should replace totals and actions from the cart sidebar
211
- */
212
- } elseif (
213
- $oBlock instanceof Mage_Checkout_Block_Cart_Sidebar
214
- ) {
215
- $aSections = array(
216
- 'cart_sidebar_totals',
217
- 'cart_sidebar_actions'
218
- );
219
- $sOriginalHtml = $oB2BReplacementsHelper->replaceSections($aSections, $oTransport->getHtml());
220
- $oTransport->setHtml($sOriginalHtml);
221
- /*
222
- * Check to see if we should replace item price from the cart
223
- */
224
- } elseif (
225
- $oBlock instanceof Mage_Checkout_Block_Cart_Item_Renderer
226
- ) {
227
- $iProductId = $oBlock->getItem()->getProductId();
228
- $aSections = array(
229
- 'cart_item_price'
230
- );
231
- $sOriginalHtml = $oB2BReplacementsHelper->replaceSectionsByProductId($aSections, $oTransport->getHtml(), $iProductId);
232
- $oTransport->setHtml($sOriginalHtml);
233
- /*
234
- * Check to see if we should replace the add to cart button on product blocks
235
- */
236
- } elseif (
237
- $oBlock instanceof Mage_Catalog_Block_Product_Abstract
238
- ||
239
- $oBlock instanceof Mage_Catalog_Block_Product_Compare_Abstract
240
- ) {
241
- $aSections = array(
242
- 'add_to_cart'
243
- );
244
- // Check for the block's product so we can filter on product id
245
- $oCurrentProduct = $oBlock->getProduct();
246
- if(!is_null($oCurrentProduct)) {
247
- $iCurrentProductId = $oBlock->getProduct()->getId();
248
- $sOriginalHtml = $oB2BReplacementsHelper->replaceSectionsByProductId($aSections, $oTransport->getHtml(), $iCurrentProductId);
249
- } else {
250
- $sOriginalHtml = $oB2BReplacementsHelper->replaceSections($aSections, $oTransport->getHtml());
251
- }
252
- $oTransport->setHtml($sOriginalHtml);
253
- }
254
- }
255
 
256
- /**
257
- * On the event core_block_abstract_to_html_before
258
- * - Check extension is active
259
- * - Check for the block type Mage_Catalog_Block_Product_List_Toolbar
260
- * - Remove the price order
261
- * - Check for the block type Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox
262
- * - Check for the block type Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Multi
263
- * - Check for the block type Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Radio
264
- * - Check for the block type Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Select
265
- * - Rewrite bundle options price templates
266
- *
267
- * @param Varien_Event_Observer $oObserver
268
- */
269
- public function onCoreBlockAbstractToHtmlBefore(Varien_Event_Observer $oObserver) {
270
- $oBlock = $oObserver->getData('block');
271
 
272
- if (Mage::helper('b2bprofessional')->isActive()) {
273
- if($oBlock instanceof Mage_Catalog_Block_Product_List_Toolbar) {
274
- $oBlock->removeOrderFromAvailableOrders('price');
275
- }
276
- }
277
- /*
278
- * Used isExtensionActive because isActive returns false
279
- * for bundle product which is not under active category
280
- */
281
- if (Mage::helper('b2bprofessional')->isExtensionActive()) {
282
 
283
- if (version_compare(Mage::getVersion(), '1.8.0.0') >= 0){
284
- if ($oBlock instanceof Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox) {
285
- $oBlock->setTemplate('sitewards/b2bprofessional/catalog/product/view/type/bundle/option-post-180/checkbox.phtml');
286
- } else if ($oBlock instanceof Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Multi) {
287
- $oBlock->setTemplate('sitewards/b2bprofessional/catalog/product/view/type/bundle/option-post-180/multi.phtml');
288
- } else if ($oBlock instanceof Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Radio) {
289
- $oBlock->setTemplate('sitewards/b2bprofessional/catalog/product/view/type/bundle/option-post-180/radio.phtml');
290
- } else if ($oBlock instanceof Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Select) {
291
- $oBlock->setTemplate('sitewards/b2bprofessional/catalog/product/view/type/bundle/option-post-180/select.phtml');
292
- }
293
- } else {
294
- if ($oBlock instanceof Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox) {
295
- $oBlock->setTemplate('sitewards/b2bprofessional/catalog/product/view/type/bundle/option-pre-180/checkbox.phtml');
296
- } else if ($oBlock instanceof Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Multi) {
297
- $oBlock->setTemplate('sitewards/b2bprofessional/catalog/product/view/type/bundle/option-pre-180/multi.phtml');
298
- } else if ($oBlock instanceof Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Radio) {
299
- $oBlock->setTemplate('sitewards/b2bprofessional/catalog/product/view/type/bundle/option-pre-180/radio.phtml');
300
- } else if ($oBlock instanceof Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Select) {
301
- $oBlock->setTemplate('sitewards/b2bprofessional/catalog/product/view/type/bundle/option-pre-180/select.phtml');
302
- }
303
- }
304
- }
305
- }
306
 
307
- /**
308
- * On the event catalog_product_type_configurable_price
309
- * Set the Configurable price of a product to 0 to stop the changed price showing up in the drop down
310
- *
311
- * @param Varien_Event_Observer $oObserver
312
- */
313
- public function onCatalogProductTypeConfigurablePrice(Varien_Event_Observer $oObserver) {
314
- $oProduct = $oObserver->getData('product');
315
- /* @var $oB2BHelper Sitewards_B2BProfessional_Helper_Data */
316
- $oB2BHelper = Mage::helper('b2bprofessional');
317
 
318
- if ($oB2BHelper->isProductActive($oProduct->getId())) {
319
- $oProduct->setConfigurablePrice(0);
320
- }
321
- }
 
 
 
 
 
 
 
 
 
 
322
 
323
- /**
324
- * If we have a Mage_Catalog_Block_Layer_View
325
- * - remove the price attribute
326
- *
327
- * @param Varien_Event_Observer $oObserver
328
- */
329
- public function onCoreLayoutBlockCreateAfter(Varien_Event_Observer $oObserver) {
330
- $oBlock = $oObserver->getData('block');
331
- if($oBlock instanceof Mage_Catalog_Block_Layer_View) {
332
- /* @var $oB2BHelper Sitewards_B2BProfessional_Helper_Data */
333
- $oB2BHelper = Mage::helper('b2bprofessional');
334
 
335
- /*
336
- * Get all possible category filters
337
- * Assign to value b2bprof_category_filters to be used in
338
- * Sitewards_B2BProfessional_Helper_Category->isCategoryActive
339
- */
340
- /* @var $oCategoryFilter Mage_Catalog_Block_Layer_Filter_Category */
341
- $oCategoryFilter = $oBlock->getChild('category_filter');
342
- if($oCategoryFilter instanceof Mage_Catalog_Block_Layer_Filter_Category) {
343
- $oCategories = $oCategoryFilter->getItems();
344
- $aCategoryOptions = array();
345
- foreach($oCategories as $oCategory) {
346
- /* @var $oCategory Mage_Catalog_Model_Layer_Filter_Item */
347
- $iCategoryId = $oCategory->getValue();
348
- $aCategoryOptions[] = $iCategoryId;
349
- }
350
 
351
- if (Mage::registry('b2bprof_category_filters') !== null){
352
- Mage::unregister('b2bprof_category_filters');
353
- }
354
- Mage::register('b2bprof_category_filters', $aCategoryOptions);
355
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
356
 
357
- if($oB2BHelper->isActive()) {
358
- $aFilterableAttributes = $oBlock->getData('_filterable_attributes');
359
- $aNewFilterableAttributes = array();
360
- foreach ($aFilterableAttributes as $oFilterableAttribute) {
361
- if($oFilterableAttribute->getAttributeCode() != 'price') {
362
- $aNewFilterableAttributes[] = $oFilterableAttribute;
363
- }
364
- }
365
- $oBlock->setData('_filterable_attributes', $aNewFilterableAttributes);
366
- }
367
- }
368
- }
369
 
370
- /**
371
- * caused by some magento magic we have to save each quote item individually if we're adding multiple of them in the same request
372
- *
373
- * @param Varien_Event_Observer $oObserver
374
- */
375
- public function onCheckoutCartProductAddAfter(Varien_Event_Observer $oObserver) {
376
- if (
377
- Mage::app()->getRequest()->getModuleName() == 'b2bprofessional'
378
- AND Mage::app()->getRequest()->getControllerName() == 'cart'
379
- AND Mage::app()->getRequest()->getActionName() == 'addmultiple'
380
- ) {
381
- $oObserver->getQuoteItem()->save();
382
- }
383
- }
384
 
385
- /**
386
- * This function is called just before $quote object get stored to database.
387
- * Here, from POST data, we capture our custom field and put it in the quote object
388
- *
389
- * @param Varien_Event_Observer $oObserver
390
- */
391
- public function saveQuoteBefore (Varien_Event_Observer $oObserver) {
392
- $oQuote = $oObserver->getQuote();
393
- $aPost = Mage::app()
394
- ->getFrontController()
395
- ->getRequest()
396
- ->getPost();
397
- if (isset($aPost['b2bprofessional']['delivery_date'])) {
398
- $sVar = $aPost['b2bprofessional']['delivery_date'];
399
- $oQuote->setDeliveryDate($sVar);
400
- }
401
- }
402
 
403
- /**
404
- * This function is called, just after $quote object get saved to database.
405
- * Here, after the quote object gets saved in database
406
- * we save our custom field in the our table created i.e sales_quote_custom
407
- *
408
- * @param Varien_Event_Observer $oObserver
409
- */
410
- public function saveQuoteAfter (Varien_Event_Observer $oObserver) {
411
- $oQuote = $oObserver->getQuote();
412
- if ($oQuote->getDeliveryDate()) {
413
- $sVar = $oQuote->getDeliveryDate();
414
- if (!empty($sVar)) {
415
- $oModel = Mage::getModel('b2bprofessional/quote');
416
- $oModel->deleteByQuote($oQuote->getId(), 'delivery_date');
417
- $oModel->setQuoteId($oQuote->getId());
418
- $oModel->setKey('delivery_date');
419
- $oModel->setValue($sVar);
420
- $oModel->save();
421
- }
422
- }
423
- }
424
 
425
- /**
426
- * When load() function is called on the quote object,
427
- * we read our custom fields value from database and put them back in quote object.
428
- *
429
- * @param Varien_Event_Observer $oObserver
430
- */
431
- public function loadQuoteAfter (Varien_Event_Observer $oObserver) {
432
- $oQuote = $oObserver->getQuote();
433
- $oModel = Mage::getModel('b2bprofessional/quote');
434
- $aData = $oModel->getByQuote($oQuote->getId());
435
- foreach ($aData as $sKey => $sValue) {
436
- $oQuote->setData($sKey, $sValue);
437
- }
438
- }
439
 
440
- /**
441
- * This function is called after order gets saved to database.
442
- * Here we transfer our custom fields from quote table to order table i.e sales_order_custom
443
- *
444
- * @param Varien_Event_Observer $oObserver
445
- */
446
- public function saveOrderAfter (Varien_Event_Observer $oObserver) {
447
- $oOrder = $oObserver->getOrder();
448
- $oQuote = $oObserver->getQuote();
449
- if ($oQuote->getDeliveryDate()) {
450
- $sVar = $oQuote->getDeliveryDate();
451
- if (!empty($sVar)) {
452
- $oModel = Mage::getModel('b2bprofessional/order');
453
- $oModel->deleteByOrder($oOrder->getId(), 'delivery_date');
454
- $oModel->setOrderId($oOrder->getId());
455
- $oModel->setKey('delivery_date');
456
- $oModel->setValue($sVar);
457
- $oOrder->setDeliveryDate($sVar);
458
- $oModel->save();
459
- }
460
- }
461
- }
462
 
463
- /**
464
- * This function is called when $order->load() is done.
465
- * Here we read our custom fields value from database and set it in order object.
466
- *
467
- * @param Varien_Event_Observer $oObserver
468
- */
469
- public function loadOrderAfter (Varien_Event_Observer $oObserver) {
470
- $oOrder = $oObserver->getOrder();
471
- $oModel = Mage::getModel('b2bprofessional/order');
472
- $aData = $oModel->getByOrder($oOrder->getId());
473
- foreach ($aData as $sKey => $sValue) {
474
- $oOrder->setData($sKey, $sValue);
475
- }
476
- }
477
  }
1
  <?php
2
+
3
  /**
4
  * Sitewards_B2BProfessional_Model_Observer
5
+ * - Observer containing the following event methods
6
+ * - catalog_product_is_salable_after - remove add to cart buttons,
7
+ * - catalog_product_type_prepare_full_options - stop product being added to cart via url
8
+ * - core_block_abstract_to_html_after - remove price from product pages
9
  *
10
  * @category Sitewards
11
  * @package Sitewards_B2BProfessional
12
+ * @copyright Copyright (c) 2014 Sitewards GmbH (http://www.sitewards.com/)
13
  */
14
+ class Sitewards_B2BProfessional_Model_Observer
15
+ {
16
+ /**
17
+ * The last product Id
18
+ *
19
+ * @var int
20
+ */
21
+ protected static $iLastProductId = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
+ /**
24
+ * Check to see if a product can be sold to the current logged in user
25
+ * - if the flag of salable is already false then we should do nothing
26
+ *
27
+ * @param Varien_Event_Observer $oObserver
28
+ */
29
+ public function catalogProductIsSalableAfter(Varien_Event_Observer $oObserver)
30
+ {
31
+ /** @var Sitewards_B2BProfessional_Helper_Data $oB2BHelper */
32
+ $oB2BHelper = Mage::helper('sitewards_b2bprofessional');
33
+ if ($oB2BHelper->isExtensionActive() === true) {
34
+ $oProduct = $oObserver->getEvent()->getProduct();
35
+ $oSalable = $oObserver->getEvent()->getSalable();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
+ if ($oSalable->getIsSalable() == true) {
38
+ $oSalable->setIsSalable($oB2BHelper->isProductActive($oProduct));
39
+ }
40
+ }
41
+ }
 
 
 
 
 
42
 
43
+ /**
44
+ * Check to see if the product being added to the cart can be bought
45
+ *
46
+ * @param Varien_Event_Observer $oObserver
47
+ * @throws Mage_Catalog_Exception
48
+ */
49
+ public function catalogProductTypePrepareFullOptions(Varien_Event_Observer $oObserver)
50
+ {
51
+ /** @var Sitewards_B2BProfessional_Helper_Data $oB2BHelper */
52
+ $oB2BHelper = Mage::helper('sitewards_b2bprofessional');
53
+ if ($oB2BHelper->isExtensionActive() === true) {
54
+ $oProduct = $oObserver->getEvent()->getProduct();
55
 
56
+ if ($oB2BHelper->isProductActive($oProduct) === false) {
57
+ throw new Mage_Catalog_Exception($oB2BHelper->__('Your account is not allowed to access this store.'));
58
+ }
59
+ }
60
+ }
 
61
 
62
+ /**
63
+ * Replace the price information with the desired message
64
+ *
65
+ * @param Varien_Event_Observer $oObserver
66
+ */
67
+ public function coreBlockAbstractToHtmlAfter(Varien_Event_Observer $oObserver)
68
+ {
69
+ /** @var Sitewards_B2BProfessional_Helper_Data $oB2BHelper */
70
+ $oB2BHelper = Mage::helper('sitewards_b2bprofessional');
71
+ if ($oB2BHelper->isExtensionActive() === true) {
72
+ $oBlock = $oObserver->getData('block');
73
+ $oTransport = $oObserver->getData('transport');
74
 
75
+ /*
76
+ * Check to see if we should remove the product price
77
+ */
78
+ if ($this->isExactlyPriceBlock($oBlock)) {
79
+ $this->transformPriceBlock($oBlock, $oTransport);
80
+ }
81
+ }
82
+ }
83
 
84
+ /**
85
+ * Check to see if the user will need to be redirected to the login page or another saved via the admin
86
+ *
87
+ * @param Varien_Event_Observer $oObserver
88
+ */
89
+ public function controllerActionPredispatch(Varien_Event_Observer $oObserver)
90
+ {
91
+ /** @var Sitewards_B2BProfessional_Helper_Data $oB2BHelper */
92
+ $oB2BHelper = Mage::helper('sitewards_b2bprofessional');
93
+ if ($oB2BHelper->isExtensionActive() === true) {
94
+ /* @var $oControllerAction Mage_Core_Controller_Front_Action */
95
+ $oControllerAction = $oObserver->getData('controller_action');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
+ /* @var $oB2BCustomerHelper Sitewards_B2BProfessional_Helper_Customer */
98
+ $oB2BCustomerHelper = Mage::helper('sitewards_b2bprofessional/customer');
 
 
 
 
 
 
 
 
 
 
 
 
 
99
 
100
+ /*
101
+ * Check to see if the system requires a login
102
+ * And there is no logged in user
103
+ */
104
+ if ($oB2BCustomerHelper->isLoginRequired() == true && !$oB2BCustomerHelper->isCustomerLoggedIn()) {
105
+ Mage::helper('sitewards_b2bprofessional/redirects')->performRedirect($oControllerAction);
106
+ }
107
+ }
108
+ }
 
109
 
110
+ /**
111
+ * Remove the price option from the order by options
112
+ *
113
+ * @param Varien_Event_Observer $oObserver
114
+ */
115
+ public function coreBlockAbstractToHtmlBefore(Varien_Event_Observer $oObserver)
116
+ {
117
+ /** @var Sitewards_B2BProfessional_Helper_Data $oB2BHelper */
118
+ $oB2BHelper = Mage::helper('sitewards_b2bprofessional');
119
+ if ($oB2BHelper->isExtensionActive() === true) {
120
+ $oBlock = $oObserver->getData('block');
 
 
 
 
 
 
 
 
 
 
 
 
121
 
122
+ if ($oBlock instanceof Mage_Catalog_Block_Product_List_Toolbar) {
123
+ $oBlock->removeOrderFromAvailableOrders('price');
124
+ }
125
+ }
126
+ }
 
 
 
 
 
127
 
128
+ /**
129
+ * If we have a Mage_Catalog_Block_Layer_View
130
+ * - remove the price attribute
131
+ *
132
+ * @param Varien_Event_Observer $oObserver
133
+ */
134
+ public function coreLayoutBlockCreateAfter(Varien_Event_Observer $oObserver)
135
+ {
136
+ /* @var Sitewards_B2BProfessional_Helper_Data $oB2BHelper */
137
+ $oB2BHelper = Mage::helper('sitewards_b2bprofessional');
138
+ if ($oB2BHelper->isExtensionActive()) {
139
+ $oBlock = $oObserver->getData('block');
140
+ if ($oBlock instanceof Mage_Catalog_Block_Layer_View) {
141
+ $aCategoryOptions = $this->getCategoryFilters($oBlock);
142
 
143
+ if ($oB2BHelper->hasEnabledCategories($aCategoryOptions)) {
144
+ $this->removePriceFilter($oBlock);
145
+ }
146
+ }
147
+ }
148
+ }
 
 
 
 
 
149
 
150
+ /**
151
+ * checks if the block represents a price block
152
+ *
153
+ * @param Mage_Core_Block_Abstract $oBlock
154
+ * @return bool
155
+ */
156
+ protected function isExactlyPriceBlock($oBlock)
157
+ {
158
+ return $oBlock
159
+ && Mage::helper('sitewards_b2bprofessional')->isBlockPriceBlock($oBlock);
160
+ }
 
 
 
 
161
 
162
+ /**
163
+ * From a block get all the category filters when set
164
+ *
165
+ * @param Mage_Catalog_Block_Layer_View $oBlock
166
+ * @return int[]
167
+ */
168
+ protected function getCategoryFilters($oBlock)
169
+ {
170
+ /* @var $oCategoryFilter Mage_Catalog_Block_Layer_Filter_Category */
171
+ $oCategoryFilter = $oBlock->getChild('category_filter');
172
+ $aCategoryOptions = array();
173
+ if ($oCategoryFilter instanceof Mage_Catalog_Block_Layer_Filter_Category) {
174
+ $oCategories = $oCategoryFilter->getItems();
175
+ foreach ($oCategories as $oCategory) {
176
+ /* @var $oCategory Mage_Catalog_Model_Layer_Filter_Item */
177
+ $iCategoryId = $oCategory->getValue();
178
+ $aCategoryOptions[] = $iCategoryId;
179
+ }
180
 
181
+ if (empty($aCategoryOptions)) {
182
+ return $this->getDefaultCategoryOptions();
183
+ }
184
+ }
185
+ return $aCategoryOptions;
186
+ }
 
 
 
 
 
 
187
 
188
+ /**
189
+ * Return the default category,
190
+ * - either from the filter,
191
+ * - the current category,
192
+ * - or the root category
193
+ *
194
+ * @return int[]
195
+ */
196
+ protected function getDefaultCategoryOptions()
197
+ {
198
+ $aCategoryOptions = array();
 
 
 
199
 
200
+ /* @var $oCategory Mage_Catalog_Model_Category */
201
+ $oCategory = Mage::registry('current_category_filter');
202
+ if ($oCategory === null) {
203
+ $oCategory = Mage::registry('current_category');
204
+ if ($oCategory === null) {
205
+ $oCategory = Mage::getModel('catalog/category')->load(
206
+ Mage::app()->getStore()->getRootCategoryId()
207
+ );
208
+ }
209
+ }
210
+ $aCategoryOptions[] = $oCategory->getId();
211
+ return $aCategoryOptions;
212
+ }
 
 
 
 
213
 
214
+ /**
215
+ * Remove the price filter options from the filterable attributes
216
+ *
217
+ * @param Mage_Catalog_Block_Layer_View $oBlock
218
+ */
219
+ protected function removePriceFilter($oBlock)
220
+ {
221
+ $aFilterableAttributes = $oBlock->getData('_filterable_attributes');
222
+ $aNewFilterableAttributes = array();
223
+ foreach ($aFilterableAttributes as $oFilterableAttribute) {
224
+ if ($oFilterableAttribute->getAttributeCode() != 'price') {
225
+ $aNewFilterableAttributes[] = $oFilterableAttribute;
226
+ }
227
+ }
228
+ $oBlock->setData('_filterable_attributes', $aNewFilterableAttributes);
229
+ }
 
 
 
 
 
230
 
231
+ /**
232
+ * Set type id to combined to stop tax being displayed via Symmetrics_TweaksGerman_Block_Tax
233
+ *
234
+ * @param Mage_Catalog_Model_Product $oProduct
235
+ */
236
+ protected function setSymmetricsProductType(Mage_Catalog_Model_Product $oProduct)
237
+ {
238
+ if (
239
+ Mage::helper('core')->isModuleEnabled('Symmetrics_TweaksGerman')
240
+ && $oProduct->getTypeId() == 'bundle'
241
+ ) {
242
+ $oProduct->setTypeId('combined');
243
+ }
244
+ }
245
 
246
+ /**
247
+ * For a given product price block check if the product is active
248
+ * - if it is active then set the price html as the default message
249
+ *
250
+ * @param Mage_Catalog_Block_Product_Price $oBlock
251
+ * @param Varien_Object $oTransport
252
+ */
253
+ protected function transformPriceBlock($oBlock, $oTransport)
254
+ {
255
+ /** @var Sitewards_B2BProfessional_Helper_Data $oB2BHelper */
256
+ $oB2BHelper = Mage::helper('sitewards_b2bprofessional');
257
+ $oProduct = $oBlock->getProduct();
258
+ $iCurrentProductId = $oProduct->getId();
 
 
 
 
 
 
 
 
 
259
 
260
+ if ($oB2BHelper->isProductActive($oProduct) === false) {
261
+ // To stop duplicate information being displayed validate that we only do this once per product
262
+ if ($iCurrentProductId !== self::$iLastProductId) {
263
+ self::$iLastProductId = $iCurrentProductId;
264
+ $oTransport->setHtml($oB2BHelper->__('Please login'));
265
+ } else {
266
+ $oTransport->setHtml('');
267
+ }
268
+ $this->setSymmetricsProductType($oProduct);
269
+ }
270
+ }
 
 
 
271
  }
app/code/community/Sitewards/B2BProfessional/Model/Order.php DELETED
@@ -1,39 +0,0 @@
1
- <?php
2
- class Sitewards_B2BProfessional_Model_Order extends Mage_Core_Model_Abstract{
3
- public function _construct() {
4
- parent::_construct();
5
- $this->_init('b2bprofessional/order');
6
- }
7
-
8
- /**
9
- * @param int $iOrderId
10
- * @param string $sKey
11
- */
12
- public function deleteByOrder($iOrderId, $sKey) {
13
- $this->_getResource()->deleteByOrder($iOrderId, $sKey);
14
- }
15
-
16
- /**
17
- * @param int $iOrderId
18
- * @param string $sKey
19
- * @return string
20
- */
21
- public function getByOrder($iOrderId, $sKey = '') {
22
- return $this->_getResource()->getByOrder($iOrderId, $sKey);
23
- }
24
-
25
- /**
26
- * @param int $iOrderId
27
- * @return bool
28
- */
29
- public function canCancel($iOrderId) {
30
- /* @var $oOrder Mage_Sales_Model_Order */
31
- $oOrder = Mage::getModel('sales/order')->load($iOrderId);
32
- if ($oOrder->getCustomerId() == Mage::getSingleton('customer/session')->getCustomerId()) {
33
- $sDeliveryDate = current($this->getByOrder($iOrderId, 'delivery_date'));
34
- return (strtotime($sDeliveryDate) > now());
35
- } else {
36
- return false;
37
- }
38
- }
39
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Model/Quote.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- class Sitewards_B2BProfessional_Model_Quote extends Mage_Core_Model_Abstract {
3
- public function _construct() {
4
- parent::_construct();
5
- $this->_init('b2bprofessional/quote');
6
- }
7
-
8
- /**
9
- * @param int $iQuoteId
10
- * @param string $sKey
11
- */
12
- public function deleteByQuote($iQuoteId, $sKey) {
13
- $this->_getResource()->deleteByQuote($iQuoteId, $sKey);
14
- }
15
-
16
- /**
17
- * @param int $iQuoteId
18
- * @param string $sKey
19
- * @return string
20
- */
21
- public function getByQuote($iQuoteId, $sKey = '') {
22
- return $this->_getResource()->getByQuote($iQuoteId, $sKey);
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Model/Resource/Order.php DELETED
@@ -1,46 +0,0 @@
1
- <?php
2
- class Sitewards_B2BProfessional_Model_Resource_Order extends Mage_Core_Model_Mysql4_Abstract {
3
- public function _construct () {
4
- $this->_init('b2bprofessional/order', 'id');
5
- }
6
-
7
- /**
8
- * @param int $iOrderId
9
- * @param string $sKey
10
- */
11
- public function deleteByOrder ($iOrderId, $sKey) {
12
- $sTable = $this->getMainTable();
13
- $sWhere = $this->_getWriteAdapter()
14
- ->quoteInto('order_id = ? AND ', $iOrderId)
15
- . $this->_getWriteAdapter()
16
- ->quoteInto('`key` = ?', $sKey);
17
- $this->_getWriteAdapter()
18
- ->delete($sTable, $sWhere);
19
- }
20
-
21
- /**
22
- * @param int $iOrderId
23
- * @param string $sKey
24
- * @return array
25
- */
26
- public function getByOrder ($iOrderId, $sKey = '') {
27
- $sTable = $this->getMainTable();
28
- $sWhere = $this->_getReadAdapter()
29
- ->quoteInto('order_id = ?', $iOrderId);
30
- if (!empty($sKey)) {
31
- $sWhere .= $this->_getReadAdapter()
32
- ->quoteInto(' AND `key` = ? ', $sKey);
33
- }
34
- $sSql = $this->_getReadAdapter()
35
- ->select()
36
- ->from($sTable)
37
- ->where($sWhere);
38
- $aRows = $this->_getReadAdapter()
39
- ->fetchAll($sSql);
40
- $aReturn = array();
41
- foreach ($aRows as $row) {
42
- $aReturn[$row['key']] = $row['value'];
43
- }
44
- return $aReturn;
45
- }
46
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Model/Resource/Order/Collection.php DELETED
@@ -1,8 +0,0 @@
1
- <?php
2
-
3
- class Sitewards_B2BProfessional_Model_Resource_Order_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
4
- public function _construct () {
5
- parent::_construct();
6
- $this->_init('b2bprofessional/order');
7
- }
8
- }
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Model/Resource/Quote.php DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
- class Sitewards_B2BProfessional_Model_Resource_Quote extends Mage_Core_Model_Mysql4_Abstract {
3
- public function _construct() {
4
- $this->_init('b2bprofessional/quote', 'id');
5
- }
6
-
7
- /**
8
- * @param int $iQuoteId
9
- * @param string $sKey
10
- */
11
- public function deleteByQuote($iQuoteId, $sKey){
12
- $sTable = $this->getMainTable();
13
- $sWhere = $this->_getWriteAdapter()->quoteInto('quote_id = ? AND ', $iQuoteId)
14
- . $this->_getWriteAdapter()->quoteInto('`key` = ?', $sKey);
15
- $this->_getWriteAdapter()->delete($sTable, $sWhere);
16
- }
17
-
18
- /**
19
- * @param int $iQuoteId
20
- * @param string $sKey
21
- * @return array
22
- */
23
- public function getByQuote($iQuoteId, $sKey = ''){
24
- $sTable = $this->getMainTable();
25
- $sWhere = $this->_getReadAdapter()->quoteInto('quote_id = ?', $iQuoteId);
26
- if (!empty($sKey)){
27
- $sWhere .= $this->_getReadAdapter()->quoteInto(' AND `key` = ? ', $sKey);
28
- }
29
- $sSql = $this->_getReadAdapter()->select()->from($sTable)->where($sWhere);
30
- $aRows = $this->_getReadAdapter()->fetchAll($sSql);
31
- $aReturn = array();
32
- foreach($aRows as $row){
33
- $aReturn[$row['key']] = $row['value'];
34
- }
35
- return $aReturn;
36
- }
37
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Model/Resource/Quote/Collection.php DELETED
@@ -1,8 +0,0 @@
1
- <?php
2
-
3
- class Sitewards_B2BProfessional_Model_Resource_Quote_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
4
- public function _construct () {
5
- parent::_construct();
6
- $this->_init('b2bprofessional/quote');
7
- }
8
- }
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Model/System/Config/Source/Category.php CHANGED
@@ -1,39 +1,42 @@
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) 2013 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
  }
1
  <?php
2
+
3
  /**
4
  * Sitewards_B2BProfessional_Model_System_Config_Source_Category
5
+ * - Create an options array with the current system categories
6
  *
7
  * @category Sitewards
8
  * @package Sitewards_B2BProfessional
9
+ * @copyright Copyright (c) 2014 Sitewards GmbH (http://www.sitewards.com/)
10
  */
11
+ class Sitewards_B2BProfessional_Model_System_Config_Source_Category extends Mage_Adminhtml_Model_System_Config_Source_Category
12
+ {
13
+ /**
14
+ * Populate an options array with the current system categories
15
+ *
16
+ * @param boolean $bAddEmpty
17
+ * @return array
18
+ */
19
+ public function toOptionArray($bAddEmpty = true)
20
+ {
21
+ /* @var $oCategoryCollection Mage_Catalog_Model_Resource_Category_Collection */
22
+ $oCategoryCollection = Mage::getResourceModel('catalog/category_collection');
23
+ $oCategoryCollection->addAttributeToSelect('name')->load();
24
 
25
+ $aCategoryOptions = array();
26
+ if ($bAddEmpty) {
27
+ $aCategoryOptions[] = array(
28
+ 'label' => Mage::helper('adminhtml')->__('-- Please select at least one category --'),
29
+ 'value' => ''
30
+ );
31
+ }
32
+ foreach ($oCategoryCollection as $oCategory) {
33
+ /* @var $oCategory Mage_Catalog_Model_Category */
34
+ $aCategoryOptions[] = array(
35
+ 'label' => $oCategory->getName(),
36
+ 'value' => $oCategory->getId()
37
+ );
38
+ }
39
 
40
+ return $aCategoryOptions;
41
+ }
42
  }
app/code/community/Sitewards/B2BProfessional/Model/System/Config/Source/Identifiers.php DELETED
@@ -1,42 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Model_System_Config_Source_Identifiers
4
- * - Create an options array with the current identifiers allowed in the system config
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_Model_System_Config_Source_Identifiers {
11
- /**
12
- * Options array for the source model
13
- *
14
- * @var array
15
- */
16
- protected $_aOptions;
17
-
18
- /**
19
- * Create an array with all the allowed identifiers
20
- *
21
- * @return array
22
- */
23
- public function toOptionArray() {
24
- if (!$this->_aOptions) {
25
- $this->_aOptions = array(
26
- array(
27
- 'value' => 'id',
28
- 'label' => 'id'
29
- ),
30
- array(
31
- 'value' => 'class',
32
- 'label' => 'class'
33
- ),
34
- array(
35
- 'value' => 'onclick',
36
- 'label' => 'onclick'
37
- ),
38
- );
39
- }
40
- return $this->_aOptions;
41
- }
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Model/System/Config/Source/Page.php CHANGED
@@ -1,32 +1,35 @@
1
  <?php
 
2
  /**
3
  * Sitewards_B2BProfessional_Model_System_Config_Source_Page
4
- * - Create an options array with the current system cms pages and the customer login page
5
  *
6
  * @category Sitewards
7
  * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
  */
10
- class Sitewards_B2BProfessional_Model_System_Config_Source_Page extends Mage_Adminhtml_Model_System_Config_Source_Cms_Page {
11
- /**
12
- * Populate an options array with the current system cms pages and the customer login page
13
- *
14
- * @param boolean $bAddEmpty
15
- * @return array
16
- */
17
- public function toOptionArray() {
18
- if (!$this->_options) {
19
- parent::toOptionArray();
20
- $aNewCmsOption = array(
21
- 'value' => '',
22
- 'label' => Mage::helper('b2bprofessional')->__('-- Please Select --')
23
- );
24
- $aCustomerLogin = array(
25
- 'value' => 'customer/account/login',
26
- 'label' => Mage::helper('b2bprofessional')->__('Customer Login')
27
- );
28
- array_unshift($this->_options, $aNewCmsOption, $aCustomerLogin);
29
- }
30
- return $this->_options;
31
- }
 
 
32
  }
1
  <?php
2
+
3
  /**
4
  * Sitewards_B2BProfessional_Model_System_Config_Source_Page
5
+ * - Create an options array with the current system cms pages and the customer login page
6
  *
7
  * @category Sitewards
8
  * @package Sitewards_B2BProfessional
9
+ * @copyright Copyright (c) 2014 Sitewards GmbH (http://www.sitewards.com/)
10
  */
11
+ class Sitewards_B2BProfessional_Model_System_Config_Source_Page extends Mage_Adminhtml_Model_System_Config_Source_Cms_Page
12
+ {
13
+ /**
14
+ * Populate an options array with the current system cms pages and the customer login page
15
+ *
16
+ * @return array
17
+ */
18
+ public function toOptionArray()
19
+ {
20
+ if (!$this->_options) {
21
+ parent::toOptionArray();
22
+ $aNewCmsOption = array(
23
+ 'value' => '',
24
+ 'label' => Mage::helper('sitewards_b2bprofessional')->__('-- Please Select --')
25
+ );
26
+
27
+ $aCustomerLogin = array(
28
+ 'value' => 'customer/account/login',
29
+ 'label' => Mage::helper('sitewards_b2bprofessional')->__('Customer Login')
30
+ );
31
+ array_unshift($this->_options, $aNewCmsOption, $aCustomerLogin);
32
+ }
33
+ return $this->_options;
34
+ }
35
  }
app/code/community/Sitewards/B2BProfessional/Model/System/Config/Source/Tags.php DELETED
@@ -1,50 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Model_System_Config_Source_Tags
4
- * - Create an options array with the current tags allowed in the system config
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_Model_System_Config_Source_Tags {
11
- /**
12
- * Options array for the source model
13
- *
14
- * @var array
15
- */
16
- protected $_aOptions;
17
-
18
- /**
19
- * Create an array with all the allowed tags
20
- *
21
- * @return array
22
- */
23
- public function toOptionArray() {
24
- if (!$this->_aOptions) {
25
- $this->_aOptions = array(
26
- array(
27
- 'value' => 'a',
28
- 'label' => '<a>'
29
- ),
30
- array(
31
- 'value' => 'div',
32
- 'label' => '<div>'
33
- ),
34
- array(
35
- 'value' => 'p',
36
- 'label' => '<p>'
37
- ),
38
- array(
39
- 'value' => 'span',
40
- 'label' => '<span>'
41
- ),
42
- array(
43
- 'value' => 'button',
44
- 'label' => '<button>'
45
- ),
46
- );
47
- }
48
- return $this->_aOptions;
49
- }
50
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Test/Helper/Data.php CHANGED
@@ -1,24 +1,25 @@
1
  <?php
 
2
  /**
3
  * Test for class Sitewards_B2BProfessional_Helper_Data
4
  *
5
  * @category Sitewards
6
  * @package Sitewards_B2BProfessional
7
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
8
  */
9
  class Sitewards_B2BProfessional_Test_Helper_Data extends EcomDev_PHPUnit_Test_Case
10
  {
11
- /**
12
- * Tests is extension active
13
- *
14
- * @test
15
- * @loadFixture
16
- */
17
- public function testIsExtensionActive()
18
- {
19
- $this->assertTrue(
20
- Mage::helper('b2bprofessional')->isExtensionActive(),
21
- "Extension is not active please check config"
22
- );
23
- }
24
  }
1
  <?php
2
+
3
  /**
4
  * Test for class Sitewards_B2BProfessional_Helper_Data
5
  *
6
  * @category Sitewards
7
  * @package Sitewards_B2BProfessional
8
+ * @copyright Copyright (c) 2014 Sitewards GmbH (http://www.sitewards.com/)
9
  */
10
  class Sitewards_B2BProfessional_Test_Helper_Data extends EcomDev_PHPUnit_Test_Case
11
  {
12
+ /**
13
+ * Tests is extension active
14
+ *
15
+ * @test
16
+ * @loadFixture
17
+ */
18
+ public function testIsExtensionActive()
19
+ {
20
+ $this->assertTrue(
21
+ Mage::helper('sitewards_b2bprofessional')->isExtensionActive(),
22
+ 'Extension is not active please check config'
23
+ );
24
+ }
25
  }
app/code/community/Sitewards/B2BProfessional/controllers/CartController.php DELETED
@@ -1,115 +0,0 @@
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) 2014 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- require_once 'Mage/Checkout/controllers/CartController.php';
11
-
12
- class Sitewards_B2BProfessional_CartController extends Mage_Checkout_CartController
13
- {
14
- /**
15
- * On checkout cart controller preDispatch
16
- * - validate that all products are active for customer/customer group,
17
- * - assign error message,
18
- * - redirect to customer login page,
19
- *
20
- * @return Mage_Core_Controller_Front_Action
21
- */
22
- public function preDispatch()
23
- {
24
- parent::preDispatch();
25
-
26
- /* @var $oB2BHelper Sitewards_B2BProfessional_Helper_Data */
27
- $oB2BHelper = Mage::helper('b2bprofessional');
28
- /*
29
- * Let's check if the extension is active before we do anything funny
30
- */
31
- if ($oB2BHelper->isExtensionActive()) {
32
- /**
33
- * Check customer is logged in
34
- * - If it is activated in the extension
35
- */
36
- if (
37
- Mage::helper('b2bprofessional/customer')->isLoginRequired()
38
- &&
39
- !Mage::getSingleton('customer/session')->isLoggedIn()
40
- ) {
41
- $this->setFlag('', self::FLAG_NO_DISPATCH, true);
42
- }
43
-
44
- $oRequest = $this->getRequest();
45
- $iProductId = $oRequest->get('product');
46
-
47
- // check for grouped products
48
- $bAllowed = true;
49
- $aMultiProducts = $oRequest->getPost('super_group');
50
- if (!empty($aMultiProducts)) {
51
- foreach ($aMultiProducts as $iMultiProductId => $iMultiProductValue) {
52
- if ($iMultiProductValue > 0) {
53
- if ($oB2BHelper->isProductActive($iMultiProductId)) {
54
- $bAllowed = false;
55
- }
56
- }
57
- }
58
- }
59
-
60
- $bHasProduct = !empty($iProductId);
61
- $bIsProductActive = $oB2BHelper->isProductActive($iProductId);
62
- if (
63
- ($bHasProduct && $bIsProductActive)
64
- ||
65
- !$bAllowed
66
- ) {
67
- /* @var $oB2BMessagesHelper Sitewards_B2BProfessional_Helper_Messages */
68
- $oB2BMessagesHelper = Mage::helper('b2bprofessional/messages');
69
-
70
- $this->setFlag('', self::FLAG_NO_DISPATCH, true);
71
- Mage::getSingleton('customer/session')->addError(
72
- $oB2BMessagesHelper->getMessage($oB2BMessagesHelper::MESSAGE_TYPE_CHECKOUT)
73
- );
74
- Mage::app()->getResponse()->setRedirect(
75
- Sitewards_B2BProfessional_Helper_Redirects::getRedirect(
76
- Sitewards_B2BProfessional_Helper_Redirects::REDIRECT_TYPE_ADD_TO_CART
77
- )
78
- )->sendHeaders();
79
- }
80
- }
81
- return $this;
82
- }
83
-
84
- /**
85
- * adds multiple products to cart
86
- */
87
- public function addmultipleAction()
88
- {
89
- $oRequest = $this->getRequest();
90
- $aSkus = $oRequest->getParam('sku');
91
- $aQtys = $oRequest->getParam('qty');
92
- $bSuccess = false;
93
-
94
- $oQuote = $this->_getQuote();
95
- foreach ($aSkus as $iKey => $sSku) {
96
- $oProduct = Mage::getModel('catalog/product');
97
- $oProduct->load($oProduct->getIdBySku($sSku));
98
- if ($oProduct->getId() && !Mage::helper('b2bprofessional')->isProductActive($oProduct->getId())) {
99
- $oRequest->setParam('product', $oProduct->getId());
100
- $iQty = isset($aQtys[$iKey]) ? $aQtys[$iKey] : 1;
101
- $oRequest->setParam('qty', $iQty);
102
- $this->addAction();
103
- $bSuccess = true;
104
- }
105
- }
106
- if ($bSuccess) {
107
- $oQuote->save();
108
- } else {
109
- Mage::getSingleton('customer/session')->addError(
110
- $this->__('Please enter valid product sku.')
111
- );
112
- $this->_redirect('b2bprofessional/order/form');
113
- }
114
- }
115
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/controllers/OrderController.php DELETED
@@ -1,45 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_OrderController
4
- * implements actions for new order form and cancel an order
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_OrderController extends Mage_Core_Controller_Front_Action {
11
-
12
- /**
13
- * Check customer authentication
14
- */
15
- public function preDispatch () {
16
- parent::preDispatch();
17
- $sLoginUrl = Mage::helper('customer')
18
- ->getLoginUrl();
19
-
20
- if (!Mage::getSingleton('customer/session')
21
- ->authenticate($this, $sLoginUrl)
22
- ) {
23
- $this->setFlag('', self::FLAG_NO_DISPATCH, true);
24
- }
25
- }
26
-
27
- public function formAction() {
28
- $this->loadLayout();
29
- $this->_initLayoutMessages('customer/session');
30
- $this->renderLayout();
31
- }
32
-
33
- /**
34
- * cancels an order
35
- */
36
- public function cancelAction() {
37
- $iOrderId = $this->getRequest()->getParam('id');
38
- $oB2BModel = Mage::getModel('b2bprofessional/order');
39
- $oMageModel = Mage::getModel('sales/order')->load($iOrderId);
40
- if ($oB2BModel->canCancel($iOrderId)) {
41
- $oMageModel->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->save();
42
- }
43
- $this->getResponse()->setRedirect(Mage::helper('b2bprofessional')->getOrderHistoryUrl());
44
- }
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/controllers/ProductController.php DELETED
@@ -1,64 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_ProductController
4
- * implements infoAction to validate a product request by sku
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_ProductController extends Mage_Core_Controller_Front_Action
11
- {
12
- /**
13
- * Check customer authentication
14
- */
15
- public function preDispatch()
16
- {
17
- parent::preDispatch();
18
- $sLoginUrl = Mage::helper('customer')
19
- ->getLoginUrl();
20
-
21
- if (!Mage::getSingleton('customer/session')
22
- ->authenticate($this, $sLoginUrl)
23
- ) {
24
- $this->setFlag('', self::FLAG_NO_DISPATCH, true);
25
- }
26
- }
27
-
28
- /**
29
- * gets a sku as input parameter
30
- * sets JSON response with product data if it is allowed to be viewed
31
- */
32
- public function infoAction()
33
- {
34
- $sSku = $this->getRequest()->getParam('sku');
35
- /* @var Mage_Catalog_Model_Product $oProduct */
36
- $oProduct = Mage::getModel('catalog/product')->loadByAttribute('sku', $sSku);
37
- if (Mage::helper('b2bprofessional/customer')->isUserAllowed() and $oProduct) {
38
- if (Mage::helper('b2bprofessional')->isProductActive($oProduct->getId())) {
39
- $sMessage = Mage::helper('b2bprofessional')->__('Your account is not allowed to access this product.');
40
- $sResponse = json_encode(
41
- array(
42
- 'result' => 1,
43
- 'error' => $sMessage,
44
- )
45
- );
46
- } else {
47
- $sResponse = json_encode(
48
- array(
49
- 'result' => 0,
50
- 'sku' => $oProduct->getSku(),
51
- 'name' => $oProduct->getName(),
52
- 'price' => Mage::helper('core')->currency($oProduct->getPrice()),
53
- 'qty' => $oProduct->getStockItem()->getMinSaleQty(),
54
- )
55
- );
56
- }
57
- $this->getResponse()->setHeader('Content-type', 'text/json');
58
- $this->getResponse()->setBody($sResponse);
59
- } else {
60
- $this->getResponse()->setHttpResponseCode(404);
61
- }
62
- }
63
-
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/etc/adminhtml.xml CHANGED
@@ -2,32 +2,32 @@
2
  <!--
3
  /**
4
  * adminhtml.xml
5
- * - create acl for this module
6
  *
7
  * @category Sitewards
8
  * @package Sitewards_B2BProfessional
9
- * @copyright Copyright (c) 2013 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>
2
  <!--
3
  /**
4
  * adminhtml.xml
5
+ * - create acl for this module
6
  *
7
  * @category Sitewards
8
  * @package Sitewards_B2BProfessional
9
+ * @copyright Copyright (c) 2014 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="sitewards_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,309 +1,100 @@
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) 2013 Sitewards GmbH (http://www.sitewards.com/)
16
- */
17
- -->
18
  <config>
19
- <modules>
20
- <Sitewards_B2BProfessional>
21
- <version>2.5.2</version>
22
- </Sitewards_B2BProfessional>
23
- </modules>
24
- <global>
25
- <blocks>
26
- <b2bprofessional>
27
- <class>Sitewards_B2BProfessional_Block</class>
28
- </b2bprofessional>
29
- <catalog>
30
- <rewrite>
31
- <product_list>Sitewards_B2BProfessional_Block_Catalog_Product_List</product_list>
32
- <product_new>Sitewards_B2BProfessional_Block_Catalog_Product_New</product_new>
33
- <product_widget_new>Sitewards_B2BProfessional_Block_Catalog_Product_Widget_New</product_widget_new>
34
- </rewrite>
35
- </catalog>
36
- <checkout>
37
- <rewrite>
38
- <links>Sitewards_B2BProfessional_Block_Checkout_Links</links>
39
- </rewrite>
40
- </checkout>
41
- <reports>
42
- <rewrite>
43
- <product_compared>Sitewards_B2BProfessional_Block_Reports_Product_Compared</product_compared>
44
- <product_viewed>Sitewards_B2BProfessional_Block_Reports_Product_Viewed</product_viewed>
45
- <product_widget_compared>Sitewards_B2BProfessional_Block_Reports_Product_Widget_Compared</product_widget_compared>
46
- <product_widget_viewed>Sitewards_B2BProfessional_Block_Reports_Product_Widget_Viewed</product_widget_viewed>
47
- </rewrite>
48
- </reports>
49
- </blocks>
50
- <helpers>
51
- <b2bprofessional>
52
- <class>Sitewards_B2BProfessional_Helper</class>
53
- </b2bprofessional>
54
- <catalog>
55
- <rewrite>
56
- <product_compare>Sitewards_B2BProfessional_Helper_Catalog_Product_Compare</product_compare>
57
- </rewrite>
58
- </catalog>
59
- </helpers>
60
- <models>
61
- <b2bprofessional>
62
- <class>Sitewards_B2BProfessional_Model</class>
63
- <resourceModel>b2bprofessional_resource</resourceModel>
64
- </b2bprofessional>
65
- <b2bprofessional_resource>
66
- <class>Sitewards_B2BProfessional_Model_Resource</class>
67
- <entities>
68
- <quote>
69
- <table>sales_quote_b2bprofessional</table>
70
- </quote>
71
- <order>
72
- <table>sales_order_b2bprofessional</table>
73
- </order>
74
- </entities>
75
- </b2bprofessional_resource>
76
- </models>
77
- <rewrite>
78
- <sitewards_b2bprofessional_cart>
79
- <from><![CDATA[#^/checkout/cart/#]]></from>
80
- <to>b2bprofessional/cart/</to>
81
- </sitewards_b2bprofessional_cart>
82
- </rewrite>
83
- <resources>
84
- <sitewards_b2bprofessional>
85
- <setup>
86
- <module>Sitewards_B2BProfessional</module>
87
- </setup>
88
- <connection>
89
- <use>core_setup</use>
90
- </connection>
91
- </sitewards_b2bprofessional>
92
- </resources>
93
- </global>
94
- <frontend>
95
- <routers>
96
- <Sitewards_B2BProfessional>
97
- <use>standard</use>
98
- <args>
99
- <module>Sitewards_B2BProfessional</module>
100
- <frontName>b2bprofessional</frontName>
101
- </args>
102
- </Sitewards_B2BProfessional>
103
- </routers>
104
- <translate>
105
- <modules>
106
- <Sitewards_B2BProfessional>
107
- <files>
108
- <default>Sitewards_B2BProfessional.csv</default>
109
- </files>
110
- </Sitewards_B2BProfessional>
111
- </modules>
112
- </translate>
113
- <layout>
114
- <updates>
115
- <b2bprofessional>
116
- <file>sitewards/b2bprofessional.xml</file>
117
- </b2bprofessional>
118
- </updates>
119
- </layout>
120
- <events>
121
- <controller_action_predispatch>
122
- <observers>
123
- <b2bprofessional>
124
- <class>b2bprofessional/observer</class>
125
- <method>onControllerActionPreDispatch</method>
126
- </b2bprofessional>
127
- </observers>
128
- </controller_action_predispatch>
129
- <core_block_abstract_to_html_before>
130
- <observers>
131
- <b2bprofessional>
132
- <class>b2bprofessional/observer</class>
133
- <method>onCoreBlockAbstractToHtmlBefore</method>
134
- </b2bprofessional>
135
- </observers>
136
- </core_block_abstract_to_html_before>
137
- <core_block_abstract_to_html_after>
138
- <observers>
139
- <b2bprofessional>
140
- <class>b2bprofessional/observer</class>
141
- <method>onCoreBlockAbstractToHtmlAfter</method>
142
- </b2bprofessional>
143
- </observers>
144
- </core_block_abstract_to_html_after>
145
- <catalog_product_type_configurable_price>
146
- <observers>
147
- <b2bprofessional>
148
- <class>b2bprofessional/observer</class>
149
- <method>onCatalogProductTypeConfigurablePrice</method>
150
- </b2bprofessional>
151
- </observers>
152
- </catalog_product_type_configurable_price>
153
- <core_layout_block_create_after>
154
- <observers>
155
- <b2bprofessional>
156
- <class>b2bprofessional/observer</class>
157
- <method>onCoreLayoutBlockCreateAfter</method>
158
- </b2bprofessional>
159
- </observers>
160
- </core_layout_block_create_after>
161
- <checkout_cart_product_add_after>
162
- <observers>
163
- <b2bprofessional>
164
- <class>b2bprofessional/observer</class>
165
- <method>onCheckoutCartProductAddAfter</method>
166
- </b2bprofessional>
167
- </observers>
168
- </checkout_cart_product_add_after>
169
- <sales_quote_save_before> <!-- Event Called Before Quote Object is saved -->
170
- <observers>
171
- <save_before>
172
- <type>singleton</type>
173
- <class>Sitewards_B2BProfessional_Model_Observer</class>
174
- <!-- Over Model Class -->
175
- <method>saveQuoteBefore</method>
176
- <!-- name of function -->
177
- </save_before>
178
- </observers>
179
- </sales_quote_save_before>
180
- <sales_quote_save_after> <!-- Event called After Quote Object is saved -->
181
- <observers>
182
- <save_after>
183
- <type>singleton</type>
184
- <class>Sitewards_B2BProfessional_Model_Observer</class>
185
- <!-- Over Model Class -->
186
- <method>saveQuoteAfter</method>
187
- <!-- name of function -->
188
- </save_after>
189
- </observers>
190
- </sales_quote_save_after>
191
- <sales_quote_load_after> <!-- Event called when Quote Object is loaded -->
192
- <observers>
193
- <load_after>
194
- <type>singleton</type>
195
- <class>Sitewards_B2BProfessional_Model_Observer</class>
196
- <!-- Over Model Class -->
197
- <method>loadQuoteAfter</method>
198
- <!-- name of function -->
199
- </load_after>
200
- </observers>
201
- </sales_quote_load_after>
202
- <sales_model_service_quote_submit_after> <!-- Event called after order placed -->
203
- <observers>
204
- <sales_model_service_quote_submit_after>
205
- <type>singleton</type>
206
- <class>Sitewards_B2BProfessional_Model_Observer</class>
207
- <!-- Over Model Class -->
208
- <method>saveOrderAfter</method>
209
- <!-- name of function -->
210
- </sales_model_service_quote_submit_after>
211
- </observers>
212
- </sales_model_service_quote_submit_after>
213
- <sales_order_load_after> <!-- Event called after Order Object is loaded -->
214
- <observers>
215
- <sales_order_load_after>
216
- <type>singleton</type>
217
- <class>Sitewards_B2BProfessional_Model_Observer</class>
218
- <!-- Over Model Class -->
219
- <method>loadOrderAfter</method>
220
- <!-- name of function -->
221
- </sales_order_load_after>
222
- </observers>
223
- </sales_order_load_after>
224
- </events>
225
- </frontend>
226
- <adminhtml>
227
- <translate>
228
- <modules>
229
- <Sitewards_B2BProfessional>
230
- <files>
231
- <default>Sitewards_B2BProfessional.csv</default>
232
- </files>
233
- </Sitewards_B2BProfessional>
234
- </modules>
235
- </translate>
236
- <layout>
237
- <updates>
238
- <b2bprofessional>
239
- <file>sitewards/b2bprofessional.xml</file>
240
- </b2bprofessional>
241
- </updates>
242
- </layout>
243
- </adminhtml>
244
- <phpunit>
245
- <suite>
246
- <modules>
247
- <Sitewards_B2BProfessional/>
248
- </modules>
249
- </suite>
250
- </phpunit>
251
- <default>
252
- <b2bprofessional>
253
- <generalsettings>
254
- <addtocartredirect>customer/account/login</addtocartredirect>
255
- </generalsettings>
256
- <languagesettings>
257
- <logintext>Please login</logintext>
258
- <errortext>Your account is not allowed to access this store.</errortext>
259
- <requireloginmessage>You do not have access to view this store.</requireloginmessage>
260
- </languagesettings>
261
- <requirelogin>
262
- <requirelogin>0</requirelogin>
263
- <requireloginredirect>customer/account/login</requireloginredirect>
264
- </requirelogin>
265
- <!--
266
- Each of the following sections is to do with replacing html when customer has limited access,
267
- They should contain:
268
- replace: flag for if the section will be replaced
269
- tag: which html tag to look for <p> == p
270
- id: the type of identifier for this tag (id, class, href)
271
- value: what to look for in the identifier
272
- remove: if the section is removed or replaced by text
273
- check_cart: flag to check for invalid cart
274
- -->
275
- <cart_sidebar_totals>
276
- <replace>1</replace>
277
- <tag>p</tag>
278
- <id>class</id>
279
- <value>subtotal</value>
280
- <remove />
281
- <check_cart>1</check_cart>
282
- </cart_sidebar_totals>
283
- <cart_sidebar_actions>
284
- <replace>1</replace>
285
- <tag>div</tag>
286
- <id>class</id>
287
- <value>actions</value>
288
- <remove>1</remove>
289
- <check_cart>1</check_cart>
290
- </cart_sidebar_actions>
291
- <cart_item_price>
292
- <replace>1</replace>
293
- <tag>span</tag>
294
- <id>class</id>
295
- <value>price</value>
296
- <remove />
297
- <check_cart>1</check_cart>
298
- </cart_item_price>
299
- <add_to_cart>
300
- <replace>1</replace>
301
- <tag>button</tag>
302
- <id>onclick</id>
303
- <value>remove-add-to-cart</value>
304
- <remove>1</remove>
305
- <check_cart />
306
- </add_to_cart>
307
- </b2bprofessional>
308
- </default>
309
  </config>
1
  <?xml version="1.0"?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  <config>
3
+ <modules>
4
+ <Sitewards_B2BProfessional>
5
+ <version>3.0.0</version>
6
+ </Sitewards_B2BProfessional>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <sitewards_b2bprofessional>
11
+ <class>Sitewards_B2BProfessional_Model</class>
12
+ </sitewards_b2bprofessional>
13
+ </models>
14
+ <helpers>
15
+ <sitewards_b2bprofessional>
16
+ <class>Sitewards_B2BProfessional_Helper</class>
17
+ </sitewards_b2bprofessional>
18
+ </helpers>
19
+ </global>
20
+ <frontend>
21
+ <events>
22
+ <catalog_product_is_salable_after>
23
+ <observers>
24
+ <sitewards_b2bprofessional>
25
+ <type>singleton</type>
26
+ <class>sitewards_b2bprofessional/observer</class>
27
+ <method>catalogProductIsSalableAfter</method>
28
+ </sitewards_b2bprofessional>
29
+ </observers>
30
+ </catalog_product_is_salable_after>
31
+ <catalog_product_type_prepare_full_options>
32
+ <observers>
33
+ <sitewards_b2bprofessional>
34
+ <type>singleton</type>
35
+ <class>sitewards_b2bprofessional/observer</class>
36
+ <method>catalogProductTypePrepareFullOptions</method>
37
+ </sitewards_b2bprofessional>
38
+ </observers>
39
+ </catalog_product_type_prepare_full_options>
40
+ <core_block_abstract_to_html_before>
41
+ <observers>
42
+ <sitewards_b2bprofessional>
43
+ <type>singleton</type>
44
+ <class>sitewards_b2bprofessional/observer</class>
45
+ <method>coreBlockAbstractToHtmlBefore</method>
46
+ </sitewards_b2bprofessional>
47
+ </observers>
48
+ </core_block_abstract_to_html_before>
49
+ <core_block_abstract_to_html_after>
50
+ <observers>
51
+ <sitewards_b2bprofessional>
52
+ <type>singleton</type>
53
+ <class>sitewards_b2bprofessional/observer</class>
54
+ <method>coreBlockAbstractToHtmlAfter</method>
55
+ </sitewards_b2bprofessional>
56
+ </observers>
57
+ </core_block_abstract_to_html_after>
58
+ <core_layout_block_create_after>
59
+ <observers>
60
+ <sitewards_b2bprofessional>
61
+ <type>singleton</type>
62
+ <class>sitewards_b2bprofessional/observer</class>
63
+ <method>coreLayoutBlockCreateAfter</method>
64
+ </sitewards_b2bprofessional>
65
+ </observers>
66
+ </core_layout_block_create_after>
67
+ <controller_action_predispatch>
68
+ <observers>
69
+ <sitewards_b2bprofessional>
70
+ <type>singleton</type>
71
+ <class>sitewards_b2bprofessional/observer</class>
72
+ <method>controllerActionPredispatch</method>
73
+ </sitewards_b2bprofessional>
74
+ </observers>
75
+ </controller_action_predispatch>
76
+ </events>
77
+ </frontend>
78
+ <default>
79
+ <b2bprofessional>
80
+ <generalsettings>
81
+ <active>0</active>
82
+ <priceblocks>
83
+ <catalog>Mage_Catalog_Block_Product_Price</catalog>
84
+ <bundle>Mage_Bundle_Block_Catalog_Product_Price</bundle>
85
+ </priceblocks>
86
+ </generalsettings>
87
+ <requirelogin>
88
+ <requirelogin>0</requirelogin>
89
+ <requireloginredirect>customer/account/login</requireloginredirect>
90
+ </requirelogin>
91
+ </b2bprofessional>
92
+ </default>
93
+ <phpunit>
94
+ <suite>
95
+ <modules>
96
+ <Sitewards_B2BProfessional/>
97
+ </modules>
98
+ </suite>
99
+ </phpunit>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  </config>
app/code/community/Sitewards/B2BProfessional/etc/system.xml CHANGED
@@ -2,431 +2,159 @@
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) 2013 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>2</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
- <addtocartredirect translate="label comment">
59
- <label>On 'Add To Cart' Redirect User To Page</label>
60
- <frontend_type>select</frontend_type>
61
- <source_model>b2bprofessional/system_config_source_page</source_model>
62
- <sort_order>3</sort_order>
63
- <show_in_default>1</show_in_default>
64
- <show_in_website>1</show_in_website>
65
- <show_in_store>1</show_in_store>
66
- <comment><![CDATA[Select which page to redirect a user to when they try to add an invalid product to their cart.]]></comment>
67
- </addtocartredirect>
68
- </fields>
69
- </generalsettings>
70
- <requirelogin>
71
- <label>Require User Login</label>
72
- <frontend_type>text</frontend_type>
73
- <sort_order>2</sort_order>
74
- <show_in_default>1</show_in_default>
75
- <show_in_website>1</show_in_website>
76
- <show_in_store>1</show_in_store>
77
- <fields>
78
- <requirelogin translate="label comment">
79
- <label>Require User Login</label>
80
- <frontend_type>select</frontend_type>
81
- <source_model>adminhtml/system_config_source_yesno</source_model>
82
- <sort_order>3</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[The user is required to login before they can view pages in this shop. <br /> Note: CMS pages are always allowed.]]></comment>
87
- </requirelogin>
88
- <requireloginredirect translate="label comment">
89
- <label>Redirect User To Page</label>
90
- <frontend_type>select</frontend_type>
91
- <source_model>b2bprofessional/system_config_source_page</source_model>
92
- <sort_order>6</sort_order>
93
- <show_in_default>1</show_in_default>
94
- <show_in_website>1</show_in_website>
95
- <show_in_store>1</show_in_store>
96
- <comment><![CDATA[Select which page to redirect a user to.]]></comment>
97
- </requireloginredirect>
98
- </fields>
99
- </requirelogin>
100
- <languagesettings translate="label comment">
101
- <label>Language settings</label>
102
- <frontend_type>text</frontend_type>
103
- <sort_order>3</sort_order>
104
- <show_in_default>1</show_in_default>
105
- <show_in_website>1</show_in_website>
106
- <show_in_store>1</show_in_store>
107
- <fields>
108
- <languageoverride translate="label comment">
109
- <label>Override language file</label>
110
- <frontend_type>select</frontend_type>
111
- <source_model>adminhtml/system_config_source_yesno</source_model>
112
- <sort_order>3</sort_order>
113
- <show_in_default>1</show_in_default>
114
- <show_in_website>1</show_in_website>
115
- <show_in_store>1</show_in_store>
116
- <comment><![CDATA[Override language file text with text specified below]]></comment>
117
- </languageoverride>
118
- <logintext translate="label comment">
119
- <label>Custom text for price</label>
120
- <frontend_type>textarea</frontend_type>
121
- <sort_order>4</sort_order>
122
- <show_in_default>1</show_in_default>
123
- <show_in_website>1</show_in_website>
124
- <show_in_store>1</show_in_store>
125
- <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>
126
- <depends><languageoverride>1</languageoverride></depends>
127
- </logintext>
128
- <errortext translate="label comment">
129
- <label>Custom text for checkout-error</label>
130
- <frontend_type>textarea</frontend_type>
131
- <sort_order>5</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[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>
136
- <depends><languageoverride>1</languageoverride></depends>
137
- </errortext>
138
- <requireloginmessage translate="label comment">
139
- <label>Require User Login - Message</label>
140
- <frontend_type>textarea</frontend_type>
141
- <sort_order>6</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[Text to be displayed when the store requires a user to login to view pages<br />Only visible when language override is active.<br />Otherwise text in language file is used.<br />May contain HTML]]></comment>
146
- <depends><languageoverride>1</languageoverride></depends>
147
- </requireloginmessage>
148
- </fields>
149
- </languagesettings>
150
- <activatebycategorysettings translate="label comment">
151
- <label>Activate by category</label>
152
- <frontend_type>text</frontend_type>
153
- <sort_order>4</sort_order>
154
- <show_in_default>1</show_in_default>
155
- <show_in_website>1</show_in_website>
156
- <show_in_store>1</show_in_store>
157
- <fields>
158
- <activebycategory translate="label comment">
159
- <label>Activate by category</label>
160
- <frontend_type>select</frontend_type>
161
- <source_model>adminhtml/system_config_source_yesno</source_model>
162
- <sort_order>5</sort_order>
163
- <show_in_default>1</show_in_default>
164
- <show_in_website>1</show_in_website>
165
- <show_in_store>1</show_in_store>
166
- <comment><![CDATA[Activate extension only for categories selected below]]></comment>
167
- </activebycategory>
168
- <activecategories translate="label comment">
169
- <label>Active categories</label>
170
- <frontend_type>multiselect</frontend_type>
171
- <source_model>b2bprofessional/system_config_source_category</source_model>
172
- <sort_order>6</sort_order>
173
- <show_in_default>1</show_in_default>
174
- <show_in_website>1</show_in_website>
175
- <show_in_store>1</show_in_store>
176
- <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>
177
- <depends><activebycategory>1</activebycategory></depends>
178
- </activecategories>
179
- </fields>
180
- </activatebycategorysettings>
181
- <activatebycustomersettings translate="label comment">
182
- <label>Activate by customer group</label>
183
- <frontend_type>text</frontend_type>
184
- <sort_order>5</sort_order>
185
- <show_in_default>1</show_in_default>
186
- <show_in_website>1</show_in_website>
187
- <show_in_store>1</show_in_store>
188
- <comment><![CDATA[When activating this extension by customer group the guest user is also included.]]></comment>
189
- <fields>
190
- <activebycustomer translate="label comment">
191
- <label>Activate by customer group</label>
192
- <frontend_type>select</frontend_type>
193
- <source_model>adminhtml/system_config_source_yesno</source_model>
194
- <sort_order>5</sort_order>
195
- <show_in_default>1</show_in_default>
196
- <show_in_website>1</show_in_website>
197
- <show_in_store>1</show_in_store>
198
- <comment><![CDATA[Activate extension only for customer groups selected below]]></comment>
199
- </activebycustomer>
200
- <activecustomers translate="label comment">
201
- <label>Active customer groups</label>
202
- <frontend_type>multiselect</frontend_type>
203
- <source_model>adminhtml/system_config_source_customer_group</source_model>
204
- <sort_order>6</sort_order>
205
- <show_in_default>1</show_in_default>
206
- <show_in_website>1</show_in_website>
207
- <show_in_store>1</show_in_store>
208
- <comment><![CDATA[Select customer groups for which the extension should be active.<br />Hold down Ctrl-key for multiple selection.]]></comment>
209
- <depends><activebycustomer>1</activebycustomer></depends>
210
- </activecustomers>
211
- </fields>
212
- </activatebycustomersettings>
213
- <cart_sidebar_totals translate="label">
214
- <label>Cart Sidebar Totals</label>
215
- <frontend_type>text</frontend_type>
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
- <fields>
221
- <replace translate="label,comment">
222
- <label>Replace the sidebar totals</label>
223
- <frontend_type>select</frontend_type>
224
- <source_model>adminhtml/system_config_source_yesno</source_model>
225
- <sort_order>1</sort_order>
226
- <show_in_default>1</show_in_default>
227
- <show_in_website>1</show_in_website>
228
- <show_in_store>1</show_in_store>
229
- </replace>
230
- <tag translate="label comment">
231
- <label>What tag wraps the sidebar totals?</label>
232
- <frontend_type>select</frontend_type>
233
- <source_model>b2bprofessional/system_config_source_tags</source_model>
234
- <sort_order>2</sort_order>
235
- <show_in_default>1</show_in_default>
236
- <show_in_website>1</show_in_website>
237
- <show_in_store>1</show_in_store>
238
- </tag>
239
- <id translate="label comment">
240
- <label>What identifier does this tag have?</label>
241
- <frontend_type>select</frontend_type>
242
- <source_model>b2bprofessional/system_config_source_identifiers</source_model>
243
- <sort_order>3</sort_order>
244
- <show_in_default>1</show_in_default>
245
- <show_in_website>1</show_in_website>
246
- <show_in_store>1</show_in_store>
247
- </id>
248
- <value translate="label comment">
249
- <label>What value does this identifier have?</label>
250
- <frontend_type>text</frontend_type>
251
- <sort_order>4</sort_order>
252
- <show_in_default>1</show_in_default>
253
- <show_in_website>1</show_in_website>
254
- <show_in_store>1</show_in_store>
255
- </value>
256
- <remove translate="label,comment">
257
- <label>Do you want to remove this section completely?</label>
258
- <frontend_type>select</frontend_type>
259
- <source_model>adminhtml/system_config_source_yesno</source_model>
260
- <sort_order>5</sort_order>
261
- <show_in_default>1</show_in_default>
262
- <show_in_website>1</show_in_website>
263
- <show_in_store>1</show_in_store>
264
- </remove>
265
- </fields>
266
- </cart_sidebar_totals>
267
- <cart_sidebar_actions translate="label">
268
- <label>Cart Sidebar Actions</label>
269
- <frontend_type>text</frontend_type>
270
- <sort_order>7</sort_order>
271
- <show_in_default>1</show_in_default>
272
- <show_in_website>1</show_in_website>
273
- <show_in_store>1</show_in_store>
274
- <fields>
275
- <replace translate="label,comment">
276
- <label>Replace the sidebar actions section</label>
277
- <frontend_type>select</frontend_type>
278
- <source_model>adminhtml/system_config_source_yesno</source_model>
279
- <sort_order>1</sort_order>
280
- <show_in_default>1</show_in_default>
281
- <show_in_website>1</show_in_website>
282
- <show_in_store>1</show_in_store>
283
- </replace>
284
- <tag translate="label comment">
285
- <label>What tag wraps the sidebar actions?</label>
286
- <frontend_type>select</frontend_type>
287
- <source_model>b2bprofessional/system_config_source_tags</source_model>
288
- <sort_order>2</sort_order>
289
- <show_in_default>1</show_in_default>
290
- <show_in_website>1</show_in_website>
291
- <show_in_store>1</show_in_store>
292
- </tag>
293
- <id translate="label comment">
294
- <label>What identifier does this tag have?</label>
295
- <frontend_type>select</frontend_type>
296
- <source_model>b2bprofessional/system_config_source_identifiers</source_model>
297
- <sort_order>3</sort_order>
298
- <show_in_default>1</show_in_default>
299
- <show_in_website>1</show_in_website>
300
- <show_in_store>1</show_in_store>
301
- </id>
302
- <value translate="label comment">
303
- <label>What value does this identifier have?</label>
304
- <frontend_type>text</frontend_type>
305
- <sort_order>4</sort_order>
306
- <show_in_default>1</show_in_default>
307
- <show_in_website>1</show_in_website>
308
- <show_in_store>1</show_in_store>
309
- </value>
310
- <remove translate="label,comment">
311
- <label>Do you want to remove this section completely?</label>
312
- <frontend_type>select</frontend_type>
313
- <source_model>adminhtml/system_config_source_yesno</source_model>
314
- <sort_order>5</sort_order>
315
- <show_in_default>1</show_in_default>
316
- <show_in_website>1</show_in_website>
317
- <show_in_store>1</show_in_store>
318
- </remove>
319
- </fields>
320
- </cart_sidebar_actions>
321
- <cart_item_price translate="label">
322
- <label>Cart Items Price</label>
323
- <frontend_type>text</frontend_type>
324
- <sort_order>8</sort_order>
325
- <show_in_default>1</show_in_default>
326
- <show_in_website>1</show_in_website>
327
- <show_in_store>1</show_in_store>
328
- <fields>
329
- <replace translate="label,comment">
330
- <label>Replace the cart item prices</label>
331
- <frontend_type>select</frontend_type>
332
- <source_model>adminhtml/system_config_source_yesno</source_model>
333
- <sort_order>1</sort_order>
334
- <show_in_default>1</show_in_default>
335
- <show_in_website>1</show_in_website>
336
- <show_in_store>1</show_in_store>
337
- </replace>
338
- <tag translate="label comment">
339
- <label>What tag wraps the cart item prices?</label>
340
- <frontend_type>select</frontend_type>
341
- <source_model>b2bprofessional/system_config_source_tags</source_model>
342
- <sort_order>2</sort_order>
343
- <show_in_default>1</show_in_default>
344
- <show_in_website>1</show_in_website>
345
- <show_in_store>1</show_in_store>
346
- </tag>
347
- <id translate="label comment">
348
- <label>What identifier does this tag have?</label>
349
- <frontend_type>select</frontend_type>
350
- <source_model>b2bprofessional/system_config_source_identifiers</source_model>
351
- <sort_order>3</sort_order>
352
- <show_in_default>1</show_in_default>
353
- <show_in_website>1</show_in_website>
354
- <show_in_store>1</show_in_store>
355
- </id>
356
- <value translate="label comment">
357
- <label>What value does this identifier have?</label>
358
- <frontend_type>text</frontend_type>
359
- <sort_order>4</sort_order>
360
- <show_in_default>1</show_in_default>
361
- <show_in_website>1</show_in_website>
362
- <show_in_store>1</show_in_store>
363
- </value>
364
- <remove translate="label,comment">
365
- <label>Do you want to remove this section completely?</label>
366
- <frontend_type>select</frontend_type>
367
- <source_model>adminhtml/system_config_source_yesno</source_model>
368
- <sort_order>5</sort_order>
369
- <show_in_default>1</show_in_default>
370
- <show_in_website>1</show_in_website>
371
- <show_in_store>1</show_in_store>
372
- </remove>
373
- </fields>
374
- </cart_item_price>
375
- <add_to_cart translate="label">
376
- <label>Add to cart button</label>
377
- <frontend_type>text</frontend_type>
378
- <sort_order>8</sort_order>
379
- <show_in_default>1</show_in_default>
380
- <show_in_website>1</show_in_website>
381
- <show_in_store>1</show_in_store>
382
- <fields>
383
- <replace translate="label,comment">
384
- <label>Replace the add to cart button</label>
385
- <frontend_type>select</frontend_type>
386
- <source_model>adminhtml/system_config_source_yesno</source_model>
387
- <sort_order>1</sort_order>
388
- <show_in_default>1</show_in_default>
389
- <show_in_website>1</show_in_website>
390
- <show_in_store>1</show_in_store>
391
- </replace>
392
- <tag translate="label comment">
393
- <label>What tag wraps the add to cart button?</label>
394
- <frontend_type>select</frontend_type>
395
- <source_model>b2bprofessional/system_config_source_tags</source_model>
396
- <sort_order>2</sort_order>
397
- <show_in_default>1</show_in_default>
398
- <show_in_website>1</show_in_website>
399
- <show_in_store>1</show_in_store>
400
- </tag>
401
- <id translate="label comment">
402
- <label>What identifier does this tag have?</label>
403
- <frontend_type>select</frontend_type>
404
- <source_model>b2bprofessional/system_config_source_identifiers</source_model>
405
- <sort_order>3</sort_order>
406
- <show_in_default>1</show_in_default>
407
- <show_in_website>1</show_in_website>
408
- <show_in_store>1</show_in_store>
409
- </id>
410
- <value translate="label comment">
411
- <label>What value does this identifier have?</label>
412
- <frontend_type>text</frontend_type>
413
- <sort_order>4</sort_order>
414
- <show_in_default>1</show_in_default>
415
- <show_in_website>1</show_in_website>
416
- <show_in_store>1</show_in_store>
417
- </value>
418
- <remove translate="label,comment">
419
- <label>Do you want to remove this section completely?</label>
420
- <frontend_type>select</frontend_type>
421
- <source_model>adminhtml/system_config_source_yesno</source_model>
422
- <sort_order>5</sort_order>
423
- <show_in_default>1</show_in_default>
424
- <show_in_website>1</show_in_website>
425
- <show_in_store>1</show_in_store>
426
- </remove>
427
- </fields>
428
- </add_to_cart>
429
- </groups>
430
- </b2bprofessional>
431
- </sections>
432
  </config>
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) 2014 Sitewards GmbH (http://www.sitewards.com/)
11
  */
12
  -->
13
  <config>
14
+ <tabs>
15
+ <b2bprofessional translate="label" module="sitewards_b2bprofessional">
16
+ <label>B2B Professional</label>
17
+ <sort_order>301</sort_order>
18
+ </b2bprofessional>
19
+ </tabs>
20
+ <sections>
21
+ <b2bprofessional translate="label" module="sitewards_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>2</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
+ <requirelogin>
61
+ <label>Require User Login</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
+ <requirelogin translate="label comment">
69
+ <label>Require User Login</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[The user is required to login before they can view pages in this shop. <br /> Note: CMS pages are always allowed.]]></comment>
77
+ </requirelogin>
78
+ <requireloginredirect translate="label comment">
79
+ <label>Redirect User To Page</label>
80
+ <frontend_type>select</frontend_type>
81
+ <source_model>sitewards_b2bprofessional/system_config_source_page</source_model>
82
+ <sort_order>6</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[Select which page to redirect a user to.]]></comment>
87
+ </requireloginredirect>
88
+ </fields>
89
+ </requirelogin>
90
+ <activatebycategorysettings translate="label comment">
91
+ <label>Activate by category</label>
92
+ <frontend_type>text</frontend_type>
93
+ <sort_order>4</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
+ <activebycategory translate="label comment">
99
+ <label>Activate by category</label>
100
+ <frontend_type>select</frontend_type>
101
+ <source_model>adminhtml/system_config_source_yesno</source_model>
102
+ <sort_order>5</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><![CDATA[Activate extension only for categories selected below]]></comment>
107
+ </activebycategory>
108
+ <activecategories translate="label comment">
109
+ <label>Active categories</label>
110
+ <frontend_type>multiselect</frontend_type>
111
+ <source_model>sitewards_b2bprofessional/system_config_source_category</source_model>
112
+ <sort_order>6</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>1</show_in_website>
115
+ <show_in_store>1</show_in_store>
116
+ <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>
117
+ <depends>
118
+ <activebycategory>1</activebycategory>
119
+ </depends>
120
+ </activecategories>
121
+ </fields>
122
+ </activatebycategorysettings>
123
+ <activatebycustomersettings translate="label comment">
124
+ <label>Activate by customer group</label>
125
+ <frontend_type>text</frontend_type>
126
+ <sort_order>5</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>1</show_in_store>
130
+ <comment><![CDATA[When activating this extension by customer group users in the selected group will not be able to see prices, plus the guest user is also included.]]></comment>
131
+ <fields>
132
+ <activebycustomer translate="label comment">
133
+ <label>Activate by customer group</label>
134
+ <frontend_type>select</frontend_type>
135
+ <source_model>adminhtml/system_config_source_yesno</source_model>
136
+ <sort_order>5</sort_order>
137
+ <show_in_default>1</show_in_default>
138
+ <show_in_website>1</show_in_website>
139
+ <show_in_store>1</show_in_store>
140
+ <comment><![CDATA[Activate extension only for customer groups selected below]]></comment>
141
+ </activebycustomer>
142
+ <activecustomers translate="label comment">
143
+ <label>Active customer groups</label>
144
+ <frontend_type>multiselect</frontend_type>
145
+ <source_model>adminhtml/system_config_source_customer_group</source_model>
146
+ <sort_order>6</sort_order>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
+ <show_in_store>1</show_in_store>
150
+ <comment><![CDATA[Select customer groups for which the extension should be active.<br />Hold down Ctrl-key for multiple selection.]]></comment>
151
+ <depends>
152
+ <activebycustomer>1</activebycustomer>
153
+ </depends>
154
+ </activecustomers>
155
+ </fields>
156
+ </activatebycustomersettings>
157
+ </groups>
158
+ </b2bprofessional>
159
+ </sections>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  </config>
app/code/community/Sitewards/B2BProfessional/sql/sitewards_b2bprofessional/upgrade-2.3.0-2.4.0.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- $oInstaller = $this;
3
- $oInstaller->startSetup();
4
- $oInstaller->run("
5
- CREATE TABLE IF NOT EXISTS {$this->getTable('sales_quote_b2bprofessional')} (
6
- `id` int(11) unsigned NOT NULL auto_increment,
7
- `quote_id` int(11) unsigned NOT NULL,
8
- `key` varchar(255) NOT NULL,
9
- `value` text NOT NULL,
10
- PRIMARY KEY (`id`)
11
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
12
- CREATE TABLE IF NOT EXISTS {$this->getTable('sales_order_b2bprofessional')} (
13
- `id` int(11) unsigned NOT NULL auto_increment,
14
- `order_id` int(11) unsigned NOT NULL,
15
- `key` varchar(255) NOT NULL,
16
- `value` text NOT NULL,
17
- PRIMARY KEY (`id`)
18
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
19
- ");
20
- $oInstaller->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/layout/sitewards/b2bprofessional.xml DELETED
@@ -1,13 +0,0 @@
1
- <?xml version="1.0"?>
2
- <layout version="0.1.0">
3
- <adminhtml_sales_order_view>
4
- <reference name="order_info">
5
- <action method='setTemplate'>
6
- <template>sitewards/b2bprofessional/sales/order/info.phtml</template>
7
- </action>
8
- <block type="adminhtml/sales_order_view_info" name="order_info2"
9
- template="sales/order/view/info.phtml"></block>
10
- <block type="b2bprofessional/adminhtml_order" name="b2bprofessional.order" template='sitewards/b2bprofessional/order.phtml'/>
11
- </reference>
12
- </adminhtml_sales_order_view>
13
- </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/sitewards/b2bprofessional/order.phtml DELETED
@@ -1,22 +0,0 @@
1
- <div class="box-left">
2
- <div class="entry-edit">
3
- <div class="entry-edit-head">
4
- <h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Additional') ?></h4>
5
- </div>
6
- <div class="fieldset">
7
- <table cellspacing="0" class="form-list">
8
- <?php
9
- $aData = $this->getB2BProfessionalVars();
10
- foreach ($aData as $sKey => $sValue) {
11
- ?>
12
- <tr>
13
- <td style="width:10%" class="label"><strong><?php echo Mage::helper('sales')->__($sKey) ?></strong></td>
14
- <td class="value"><?php echo $sValue; ?></td>
15
- </tr>
16
- <?php }
17
- ?>
18
- </table>
19
- </div>
20
- </div>
21
- </div>
22
- <div class="clear"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/sitewards/b2bprofessional/sales/order/info.phtml DELETED
@@ -1,2 +0,0 @@
1
- <?php echo $this->getChildHtml('order_info2'); ?>
2
- <?php echo $this->getChildHtml('b2bprofessional.order'); ?>
 
 
app/design/frontend/base/default/layout/sitewards/b2bprofessional.xml DELETED
@@ -1,77 +0,0 @@
1
- <?xml version="1.0" ?>
2
- <!--
3
- /**
4
- * layout.xml
5
- * - adds link "New Order Form"
6
- * - sets customer_account design for order form
7
- * - integrates module specific javascript on order form
8
- *
9
- * @category Sitewards
10
- * @package Sitewards_B2BProfessional
11
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
12
- */
13
- -->
14
- <layout version="0.1.0">
15
- <customer_account>
16
- <reference name="customer_account_navigation">
17
- <action method="addLink" ifconfig="b2bprofessional/generalsettings/active" translate="label" module="b2bprofessional">
18
- <name>order_form</name>
19
- <path>b2bprofessional/order/form</path>
20
- <label>New Order Form</label>
21
- </action>
22
- </reference>
23
- </customer_account>
24
- <sitewards_b2bprofessional_order_form translate="label" module="b2bprofessional">
25
- <label>New Order Form</label>
26
- <update handle="customer_account"/>
27
- <reference name="my.account.wrapper">
28
- <block type="b2bprofessional/order_form" name="order_form"
29
- template="sitewards/b2bprofessional/order/form.phtml"/>
30
- </reference>
31
- <reference name="head">
32
- <action method="addJs">
33
- <script>sitewards/b2bprofessional.js</script>
34
- </action>
35
- <action method="addCss">
36
- <name>css/sitewards/b2bprofessional.css</name>
37
- </action>
38
- </reference>
39
- </sitewards_b2bprofessional_order_form>
40
- <checkout_onepage_index>
41
- <reference name="checkout.onepage.billing">
42
- <action method="setTemplate">
43
- <value>sitewards/b2bprofessional/checkout/billing/extra.phtml</value>
44
- </action>
45
- </reference>
46
- <reference name="head">
47
- <reference name="head">
48
- <action method="addItem">
49
- <type>js_css</type>
50
- <name>calendar/calendar-system.css</name>
51
- <!--<params/><if/><condition>can_load_calendar_js</condition>-->
52
- </action>
53
- <action method="addItem">
54
- <type>js</type>
55
- <name>calendar/calendar.js</name>
56
- <!--<params/><if/><condition>can_load_calendar_js</condition>-->
57
- </action>
58
- <action method="addItem">
59
- <type>js</type>
60
- <name>calendar/calendar-setup.js</name>
61
- <!--<params/><if/><condition>can_load_calendar_js</condition>-->
62
- </action>
63
- <action method="addItem">
64
- <type>js</type>
65
- <name>sitewards/b2bprofessional.js</name>
66
- <!--<params/><if/><condition>can_load_calendar_js</condition>-->
67
- </action>
68
- </reference>
69
- </reference>
70
- </checkout_onepage_index>
71
- <sales_order_view>
72
- <reference name="my.account.wrapper">
73
- <block type="b2bprofessional/order" name="b2bprofessional.order" template="sitewards/b2bprofessional/order.phtml"
74
- after='sales.order.info'/>
75
- </reference>
76
- </sales_order_view>
77
- </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-post-180/checkbox.phtml DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package base_default
23
- * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
-
27
- ?>
28
-
29
- <?php /* @var $this Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox */ ?>
30
- <?php $_option = $this->getOption() ?>
31
- <?php $_selections = $_option->getSelections() ?>
32
- <dt><label<?php if ($_option->getRequired()) echo ' class="required"' ?>><?php echo $this->escapeHtml($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<em>*</em>' ?></label></dt>
33
- <dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
34
- <div class="input-box">
35
- <?php if (count($_selections) == 1 && $_option->getRequired()): ?>
36
- <?php echo $this->getSelectionQtyTitlePrice($_selections[0]) ?>
37
- <input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>"/>
38
- <?php else:?>
39
- <ul class="options-list">
40
- <?php foreach($_selections as $_selection): ?>
41
- <li><input onclick="bundle.changeSelection(this)" class="change-container-classname checkbox bundle-option-<?php echo $_option->getId() ?> <?php if ($_option->getRequired()) echo 'validate-one-required-by-name' ?>" id="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>" type="checkbox" name="bundle_option[<?php echo $_option->getId() ?>][]"<?php if ($this->_isSelected($_selection)) echo ' checked="checked"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?> value="<?php echo $_selection->getSelectionId() ?>"/>
42
- <span class="label"><label for="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>"><?php if (Mage::helper('b2bprofessional')->isProductActive($_selection->getId())): echo $_selection->getName(); else: echo $this->getSelectionQtyTitlePrice($_selection); endif;?></label></span>
43
- <?php if($_option->getRequired()): ?>
44
- <?php echo $this->setValidationContainer('bundle-option-'.$_option->getId().'-'.$_selection->getSelectionId(), 'bundle-option-'.$_option->getId().'-container') ?>
45
- <?php endif; ?>
46
- </li>
47
- <?php endforeach; ?>
48
- </ul>
49
- <div id="bundle-option-<?php echo $_option->getId() ?>-container"></div>
50
- <?php endif; ?>
51
- </div>
52
- </dd>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-post-180/multi.phtml DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package base_default
23
- * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
-
27
- ?>
28
-
29
- <?php /* @var $this Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Multi */ ?>
30
- <?php $_option = $this->getOption() ?>
31
- <?php $_selections = $_option->getSelections() ?>
32
- <dt><label<?php if ($_option->getRequired()) echo ' class="required"' ?>><?php echo $this->escapeHtml($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<em>*</em>' ?></label></dt>
33
- <dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
34
- <div class="input-box">
35
- <?php if (count($_selections) == 1 && $_option->getRequired()): ?>
36
- <?php echo $this->getSelectionQtyTitlePrice($_selections[0]) ?>
37
- <input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>"/>
38
- <?php else: ?>
39
- <select onchange="bundle.changeSelection(this)" multiple="multiple" size="5" id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>][]" class="bundle-option-<?php echo $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> bundle-option-select multiselect change-container-classname">
40
- <?php if(!$_option->getRequired()): ?>
41
- <option value=""><?php echo $this->__('None') ?></option>
42
- <?php endif; ?>
43
- <?php foreach ($_selections as $_selection): ?>
44
- <option value="<?php echo $_selection->getSelectionId() ?>"<?php if ($this->_isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>><?php if (Mage::helper('b2bprofessional')->isProductActive($_selection->getId())): echo $_selection->getName(); else: echo $this->getSelectionQtyTitlePrice($_selection, false); endif;?></option>
45
- <?php endforeach; ?>
46
- </select>
47
- <?php endif; ?>
48
- </div>
49
- </dd>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-post-180/radio.phtml DELETED
@@ -1,74 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package base_default
23
- * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
-
27
- ?>
28
-
29
- <?php /* @var $this Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Radio */ ?>
30
- <?php $_option = $this->getOption(); ?>
31
- <?php $_selections = $_option->getSelections(); ?>
32
- <?php $_default = $_option->getDefaultSelection(); ?>
33
- <?php list($_defaultQty, $_canChangeQty) = $this->_getDefaultValues(); ?>
34
- <?php $tierPriceHtml = ''; ?>
35
-
36
- <dt>
37
- <label<?php if ($_option->getRequired()) echo ' class="required"' ?>><?php echo $this->escapeHtml($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<em>*</em>' ?></label>
38
- </dt>
39
- <dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
40
- <div class="input-box">
41
- <?php /** @var $_selection Mage_Catalog_Model_Product*/ ?>
42
- <?php if ($this->_showSingle()): ?>
43
- <?php echo $this->getSelectionTitlePrice($_selections[0]); ?>
44
- <?php if ($_selections[0]->getSelectionCanChangeQty()): ?>
45
- <?php $tierPriceHtml = $this->getTierPriceHtml($_selections[0]); ?>
46
- <?php endif; ?>
47
- <input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>" />
48
- <?php else:?>
49
- <ul class="options-list">
50
- <?php if (!$_option->getRequired()): ?>
51
- <li><input type="radio" onclick="bundle.changeSelection(this)" class="radio" id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]"<?php echo ($_default && $_default->isSalable())?'':' checked="checked" ' ?> value=""/>
52
- <span class="label"><label for="bundle-option-<?php echo $_option->getId() ?>"><?php echo $this->__('None') ?></label></span>
53
- </li>
54
- <?php endif; ?>
55
- <?php foreach ($_selections as $_selection): ?>
56
- <?php if ($_selection->getSelectionCanChangeQty() && $this->_isSelected($_selection)): ?>
57
- <?php $tierPriceHtml = $this->getTierPriceHtml($_selection); ?>
58
- <?php endif; ?>
59
- <li><input type="radio" onclick="bundle.changeSelection(this)" class="radio<?php echo $_option->getRequired()?' validate-one-required-by-name':'' ?> change-container-classname" id="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]"<?php if ($this->_isSelected($_selection)) echo ' checked="checked"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>value="<?php echo $_selection->getSelectionId() ?>"/>
60
- <span class="label"><label for="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>"><?php if (Mage::helper('b2bprofessional')->isProductActive($_selection->getId())): echo $_selection->getName(); else: echo $this->getSelectionTitlePrice($_selection); endif;?></label></span>
61
- <?php if ($_option->getRequired()): ?>
62
- <?php echo $this->setValidationContainer('bundle-option-'.$_option->getId().'-'.$_selection->getSelectionId(), 'bundle-option-'.$_option->getId().'-container') ?>
63
- <?php endif; ?>
64
- </li>
65
- <?php endforeach; ?>
66
- </ul>
67
- <div id="bundle-option-<?php echo $_option->getId() ?>-container"></div>
68
- <?php endif; ?>
69
- </div>
70
- <span id="bundle-option-<?php echo $_option->getId() ?>-tier-prices"> <?php echo $tierPriceHtml; ?></span>
71
- <span class="qty-holder">
72
- <label for="bundle-option-<?php echo $_option->getId() ?>-qty-input"><?php echo $this->__('Qty:') ?>&nbsp;</label><input onkeyup="bundle.changeOptionQty(this, event)" onblur="bundle.changeOptionQty(this, event)" <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> id="bundle-option-<?php echo $_option->getId() ?>-qty-input" class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" type="text" name="bundle_option_qty[<?php echo $_option->getId() ?>]" value="<?php echo $_defaultQty ?>"/>
73
- </span>
74
- </dd>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-post-180/select.phtml DELETED
@@ -1,63 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package base_default
23
- * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
- ?>
27
-
28
- <?php /* @var $this Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Select */ ?>
29
- <?php $_option = $this->getOption(); ?>
30
- <?php $_selections = $_option->getSelections(); ?>
31
- <?php $_default = $_option->getDefaultSelection(); ?>
32
- <?php list($_defaultQty, $_canChangeQty) = $this->_getDefaultValues(); ?>
33
- <?php $tierPriceHtml = ''; ?>
34
-
35
- <dt>
36
- <label<?php if ($_option->getRequired()) echo ' class="required"' ?>><?php echo $this->escapeHtml($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<em>*</em>' ?></label>
37
- </dt>
38
- <dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
39
- <div class="input-box">
40
- <?php /** @var $_selection Mage_Catalog_Model_Product*/ ?>
41
- <?php if ($this->_showSingle()): ?>
42
- <?php echo $this->getSelectionTitlePrice($_selections[0]); ?>
43
- <?php if ($_selections[0]->getSelectionCanChangeQty()): ?>
44
- <?php $tierPriceHtml = $this->getTierPriceHtml($_selections[0]); ?>
45
- <?php endif; ?>
46
- <input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>"/>
47
- <?php else:?>
48
- <select onchange="bundle.changeSelection(this)" id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]" class="bundle-option-<?php echo $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> bundle-option-select change-container-classname">
49
- <option value=""><?php echo $this->__('Choose a selection...') ?></option>
50
- <?php foreach ($_selections as $_selection): ?>
51
- <?php if ($_selection->getSelectionCanChangeQty() && $this->_isSelected($_selection)): ?>
52
- <?php $tierPriceHtml = $this->getTierPriceHtml($_selection); ?>
53
- <?php endif; ?>
54
- <option value="<?php echo $_selection->getSelectionId() ?>"<?php if ($this->_isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>><?php if (Mage::helper('b2bprofessional')->isProductActive($_selection->getId())): echo $_selection->getName(); else: echo $this->getSelectionTitlePrice($_selection, false); endif;?></option>
55
- <?php endforeach; ?>
56
- </select>
57
- <?php endif; ?>
58
- </div>
59
- <span id="bundle-option-<?php echo $_option->getId() ?>-tier-prices"> <?php echo $tierPriceHtml; ?></span>
60
- <span class="qty-holder">
61
- <label for="bundle-option-<?php echo $_option->getId() ?>-qty-input"><?php echo $this->__('Qty:') ?>&nbsp;</label><input onkeyup="bundle.changeOptionQty(this, event)" onblur="bundle.changeOptionQty(this, event)" <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> id="bundle-option-<?php echo $_option->getId() ?>-qty-input" class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" type="text" name="bundle_option_qty[<?php echo $_option->getId() ?>]" value="<?php echo $_defaultQty ?>"/>
62
- </span>
63
- </dd>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-pre-180/checkbox.phtml DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
- /**
3
- * Bundle product checkbox option price template
4
- *
5
- * @category Sitewards
6
- * @package Sitewards_B2BProfessional
7
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
8
- */
9
- ?>
10
-
11
- <?php /* @var $this Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox */ ?>
12
- <?php $_option = $this->getOption() ?>
13
- <?php $_selections = $_option->getSelections() ?>
14
- <dt><label<?php if ($_option->getRequired()) echo ' class="required"' ?>><?php echo $this->htmlEscape($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<em>*</em>' ?></label></dt>
15
- <dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
16
- <div class="input-box">
17
- <?php if (count($_selections) == 1 && $_option->getRequired()): ?>
18
- <?php echo $this->getSelectionQtyTitlePrice($_selections[0]) ?>
19
- <input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>"/>
20
- <?php else:?>
21
- <ul class="options-list">
22
- <?php foreach($_selections as $_selection): ?>
23
- <li><input onclick="bundle.changeSelection(this)" class="change-container-classname checkbox bundle-option-<?php echo $_option->getId() ?> <?php if ($_option->getRequired()) echo 'validate-one-required-by-name' ?>" id="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>" type="checkbox" name="bundle_option[<?php echo $_option->getId() ?>][]"<?php if ($this->_isSelected($_selection)) echo ' checked="checked"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?> value="<?php echo $_selection->getSelectionId() ?>"/>
24
- <span class="label"><label for="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>"><?php if (Mage::helper('b2bprofessional')->isProductActive($_selection->getId())): echo $_selection->getName(); else: echo $this->getSelectionQtyTitlePrice($_selection); endif;?></label></span>
25
- <?php if($_option->getRequired()): ?>
26
- <?php echo $this->setValidationContainer('bundle-option-'.$_option->getId().'-'.$_selection->getSelectionId(), 'bundle-option-'.$_option->getId().'-container') ?>
27
- <?php endif; ?>
28
- </li>
29
- <?php endforeach; ?>
30
- </ul>
31
- <div id="bundle-option-<?php echo $_option->getId() ?>-container"></div>
32
- <?php endif; ?>
33
- </div>
34
- </dd>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-pre-180/multi.phtml DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- /**
3
- * Bundle product multiselect option price template
4
- *
5
- * @category Sitewards
6
- * @package Sitewards_B2BProfessional
7
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
8
- */
9
- ?>
10
-
11
- <?php /* @var $this Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Multi */ ?>
12
- <?php $_option = $this->getOption() ?>
13
- <?php $_selections = $_option->getSelections() ?>
14
- <dt><label<?php if ($_option->getRequired()) echo ' class="required"' ?>><?php echo $this->htmlEscape($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<em>*</em>' ?></label></dt>
15
- <dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
16
- <div class="input-box">
17
- <?php if (count($_selections) == 1 && $_option->getRequired()): ?>
18
- <?php echo $this->getSelectionQtyTitlePrice($_selections[0]) ?>
19
- <input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>"/>
20
- <?php else: ?>
21
- <select onchange="bundle.changeSelection(this)" multiple="multiple" size="5" id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>][]" class="bundle-option-<?php echo $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> bundle-option-select multiselect change-container-classname">
22
- <?php if(!$_option->getRequired()): ?>
23
- <option value=""><?php echo $this->__('None') ?></option>
24
- <?php endif; ?>
25
- <?php foreach ($_selections as $_selection): ?>
26
- <option value="<?php echo $_selection->getSelectionId() ?>"<?php if ($this->_isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>><?php if (Mage::helper('b2bprofessional')->isProductActive($_selection->getId())): echo $_selection->getName(); else: echo $this->getSelectionQtyTitlePrice($_selection, false); endif;?></option>
27
- <?php endforeach; ?>
28
- </select>
29
- <?php endif; ?>
30
- </div>
31
- </dd>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-pre-180/radio.phtml DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
- /**
3
- * Bundle product radio option price template
4
- *
5
- * @category Sitewards
6
- * @package Sitewards_B2BProfessional
7
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
8
- */
9
- ?>
10
-
11
- <?php /* @var $this Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Radio */ ?>
12
- <?php $_option = $this->getOption(); ?>
13
- <?php $_selections = $_option->getSelections(); ?>
14
- <?php $_default = $_option->getDefaultSelection(); ?>
15
- <?php list($_defaultQty, $_canChangeQty) = $this->_getDefaultValues(); ?>
16
-
17
- <dt>
18
- <label<?php if ($_option->getRequired()) echo ' class="required"' ?>><?php echo $this->htmlEscape($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<em>*</em>' ?></label>
19
- </dt>
20
- <dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
21
- <div class="input-box">
22
- <?php if ($this->_showSingle()): ?>
23
- <?php echo $this->getSelectionTitlePrice($_selections[0]) ?>
24
- <input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>" />
25
- <?php else:?>
26
- <ul class="options-list">
27
- <?php if (!$_option->getRequired()): ?>
28
- <li><input type="radio" onclick="bundle.changeSelection(this)" class="radio" id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]"<?php echo ($_default && $_default->isSalable())?'':' checked="checked" ' ?> value=""/>
29
- <span class="label"><label for="bundle-option-<?php echo $_option->getId() ?>"><?php echo $this->__('None') ?></label></span>
30
- </li>
31
- <?php endif; ?>
32
- <?php foreach ($_selections as $_selection): ?>
33
- <li><input type="radio" onclick="bundle.changeSelection(this)" class="radio<?php echo $_option->getRequired()?' validate-one-required-by-name':'' ?> change-container-classname" id="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]"<?php if ($this->_isSelected($_selection)) echo ' checked="checked"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>value="<?php echo $_selection->getSelectionId() ?>"/>
34
- <span class="label"><label for="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>"><?php if (Mage::helper('b2bprofessional')->isProductActive($_selection->getId())): echo $_selection->getName(); else: echo $this->getSelectionTitlePrice($_selection); endif;?></label></span>
35
- <?php if ($_option->getRequired()): ?>
36
- <?php echo $this->setValidationContainer('bundle-option-'.$_option->getId().'-'.$_selection->getSelectionId(), 'bundle-option-'.$_option->getId().'-container') ?>
37
- <?php endif; ?>
38
- </li>
39
- <?php endforeach; ?>
40
- </ul>
41
- <div id="bundle-option-<?php echo $_option->getId() ?>-container"></div>
42
- <?php endif; ?>
43
- </div>
44
- <span class="qty-holder">
45
- <label for="bundle-option-<?php echo $_option->getId() ?>-qty-input"><?php echo $this->__('Qty:') ?>&nbsp;</label><input onkeyup="bundle.changeOptionQty(this, event)" onblur="bundle.changeOptionQty(this, event)" <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> id="bundle-option-<?php echo $_option->getId() ?>-qty-input" class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" type="text" name="bundle_option_qty[<?php echo $_option->getId() ?>]" value="<?php echo $_defaultQty ?>"/>
46
- </span>
47
- </dd>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option-pre-180/select.phtml DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
- /**
3
- * Bundle product select option price template
4
- *
5
- * @category Sitewards
6
- * @package Sitewards_B2BProfessional
7
- * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
8
- */
9
- ?>
10
-
11
- <?php /* @var $this Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Select */ ?>
12
- <?php $_option = $this->getOption(); ?>
13
- <?php $_selections = $_option->getSelections(); ?>
14
- <?php $_default = $_option->getDefaultSelection(); ?>
15
- <?php list($_defaultQty, $_canChangeQty) = $this->_getDefaultValues(); ?>
16
-
17
- <dt>
18
- <label<?php if ($_option->getRequired()) echo ' class="required"' ?>><?php echo $this->htmlEscape($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<em>*</em>' ?></label>
19
- </dt>
20
- <dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
21
- <div class="input-box">
22
- <?php if ($this->_showSingle()): ?>
23
- <?php echo $this->getSelectionTitlePrice($_selections[0]) ?>
24
- <input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>"/>
25
- <?php else:?>
26
- <select onchange="bundle.changeSelection(this)" id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]" class="bundle-option-<?php echo $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> bundle-option-select change-container-classname">
27
- <option value=""><?php echo $this->__('Choose a selection...') ?></option>
28
- <?php foreach ($_selections as $_selection): ?>
29
- <option value="<?php echo $_selection->getSelectionId() ?>"<?php if ($this->_isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>><?php if (Mage::helper('b2bprofessional')->isProductActive($_selection->getId())): echo $_selection->getName(); else: echo $this->getSelectionTitlePrice($_selection, false); endif;?></option>
30
- <?php endforeach; ?>
31
- </select>
32
- <?php endif; ?>
33
- </div>
34
- <span class="qty-holder">
35
- <label for="bundle-option-<?php echo $_option->getId() ?>-qty-input"><?php echo $this->__('Qty:') ?>&nbsp;</label><input onkeyup="bundle.changeOptionQty(this, event)" onblur="bundle.changeOptionQty(this, event)" <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> id="bundle-option-<?php echo $_option->getId() ?>-qty-input" class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" type="text" name="bundle_option_qty[<?php echo $_option->getId() ?>]" value="<?php echo $_defaultQty ?>"/>
36
- </span>
37
- </dd>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/sitewards/b2bprofessional/checkout/billing/extra.phtml DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- /**
3
- * @var $this Mage_Checkout_Block_Onepage_Billing
4
- */
5
- $sDeliveryDate =
6
- '<span class="form-list">' .
7
- '<label for="delivery_date">' . $this->__('Order Date:') .
8
- '</label> </span>&nbsp;<input
9
- type="text"
10
- id="delivery_date"
11
- name="b2bprofessional[delivery_date]"
12
- value="' . $this->escapeHtml($this->getQuote()->getDeliveryDate()) . '"
13
- title="' . $this->__('Order Date') . '"
14
- class="input-text validate-date"
15
- id="b2bprofessional:delivery_date" />'.
16
- '<script type="text/javascript">'.
17
- ' document.observe("dom:loaded", (function () {'.
18
- ' var oOrderDatePicker = new OrderDatePicker();'.
19
- ' oOrderDatePicker.initialize();'.
20
- ' }));'.
21
- '</script>'
22
- ;
23
-
24
- $this->setTemplate('persistent/checkout/onepage/billing.phtml');
25
- $sHtml = $this->toHtml();
26
- // replace field in the billing.phtml, so we don't have to rewrite full billing.phtml and this is a bit more upgrade safe
27
- $iPosition = strpos($sHtml, '<div class="buttons-set" id="billing-buttons-container">');
28
- echo substr($sHtml, 0, $iPosition) .
29
- $sDeliveryDate .
30
- substr($sHtml, $iPosition);
31
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/sitewards/b2bprofessional/order.phtml DELETED
@@ -1,21 +0,0 @@
1
- <div class="col-set order-info-box">
2
- <div class="col">
3
- <div class="box">
4
- <div class="box-title">
5
- <h2><?php echo $this->__('Additional') ?></h2>
6
- </div>
7
- <div class="box-content">
8
- <?php
9
- $aData = $this->getB2BProfessionalVars();
10
- foreach ($aData as $sKey => $sValue) {
11
- ?>
12
- <b><?php echo $this->__($sKey); ?></b> : <?php echo $sValue; ?> <br/>
13
- <?php }
14
- if ($this->canCancel()) {
15
- ?>
16
- <div><a href="<?php echo $this->getCancelUrl(); ?>"><?php echo $this->__('Cancel order'); ?></a></div>
17
- <?php } ?>
18
- </div>
19
- </div>
20
- </div>
21
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/sitewards/b2bprofessional/order/form.phtml DELETED
@@ -1,37 +0,0 @@
1
- <?php echo $this
2
- ->getMessagesBlock()
3
- ->getGroupedHtml() ?>
4
- <ul class="messages" style="display: none;"><li class="error-msg"><ul><li></li></ul></li></ul>
5
- <div class="fieldset">
6
- <form method="POST" id="order_form" action="<?php echo $this->getUrl('checkout/cart/addmultiple'); ?>">
7
- <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')
8
- ->getFormKey(); ?>"/>
9
- <table>
10
- <thead>
11
- <tr>
12
- <th><?php echo $this->__('SKU'); ?></th>
13
- <th><?php echo $this->__('Name'); ?></th>
14
- <th><?php echo $this->__('Price'); ?></th>
15
- <th><?php echo $this->__('Quantity'); ?></th>
16
- <th><?php echo $this->__('Action'); ?></th>
17
- </tr>
18
- </thead>
19
- <tbody>
20
- <tr class="product">
21
- <td><input type="text" name="sku[]" class="sku input-text"/></td>
22
- <td class="name"></td>
23
- <td class="price"></td>
24
- <td><input type="text" name="qty[]" class="qty input-text" disabled="disabled"/></td>
25
- <td><a class="remove"><?php echo $this->__('Remove this entry'); ?></a></td>
26
- </tr>
27
- </tbody>
28
- </table>
29
- <input type="submit" value="<?php echo $this->__('Submit Data')?>" title="<?php echo $this->__('Submit Data')?>"/>
30
- </form>
31
- <div class="invisible">
32
- <img class="loading" src="<?php echo $this->getSkinUrl('images/sitewards/loading.gif'); ?>"/>
33
- </div>
34
- </div>
35
- <script type="text/javascript">
36
- Translator.add('The product does not exist.', '<?php echo $this->__('The product does not exist.')?>');
37
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/Sitewards_B2BProfessional.xml CHANGED
@@ -2,28 +2,25 @@
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>
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) 2014 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_Catalog />
21
+ <Mage_Customer />
22
+ <Netzarbeiter_CustomerActivation/>
23
+ </depends>
24
+ </Sitewards_B2BProfessional>
25
+ </modules>
 
 
 
26
  </config>
app/locale/de_DE/Sitewards_B2BProfessional.csv CHANGED
@@ -2,57 +2,18 @@
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"
24
- "You do not have access to view this store.","Sie haben keine Berechtigungen um diese Webshop-Seite zu betrachten."
25
  "Require User Login","Nutzer muss sich einloggen"
26
  "The user is required to login before they can view pages in this shop. <br /> Note: CMS pages are always allowed.","Der Nutzer muss sich einloggen bevor Seiten im Shop aufgerufen werden können. <br /> Hinweis: CMS-Seiten sind immer erlaubt."
27
- "Require User Login - Message","Nutzer muss sich einloggen - Nachricht"
28
- "Text to be displayed when the store requires a user to login to view pages<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 Nutzer sich einloggen muss, um eine bestimmte Seite im Shop zu betrachten.<br /> Wird nur verwendet, wenn die Sprache überschrieben wird.<br/>Ansonsten wird der Text aus der Sparchdatei benutzt.<br/> Dieser Text darf HTML beinhalten."
29
  "Redirect User To Page","Nutzer auf Seite weiterleiten"
30
- "Select which page to redirect a user to.","Wählen Sie die Seite, auf die der Nutzer weitergeleitet werden soll."
31
- "Cart Sidebar Totals","Summen des Sidebar-Warenkorbs"
32
- "Replace the sidebar totals","Summen des Sidebar-Warenkorbs ersetzen"
33
- "What tag wraps the sidebar totals?","Welcher Tag umschließt die Summen des Sidebar-Warenkorbs?"
34
- "What identifier does this tag have?","Welchen Identifier haben die umschließenden Tags?"
35
- "What value does this identifier have?","Welchen Wert haben die Identifier?"
36
- "Do you want to remove this section completely?","Wollen sie diesen Abschnitt komplett entfernen?"
37
- "Cart Sidebar Actions","Aktionen des Sidebar-Warenkobs"
38
- "Replace the sidebar actions section","Aktionen des Sidebar-Warenkobs ersetzen"
39
- "What tag wraps the sidebar actions?","Welcher Tag umschließt die Aktionen des Sidebar-Warenkorbs?"
40
- "Cart Items Price","Preis der Produkte im Warenkorb"
41
- "Replace the cart item prices","Preis der Produkte im Warenkorb ersetzen"
42
- "What tag wraps the cart item prices?","Welcher Tag umschließt die Preise der Produkte im Warenkorb?"
43
- "Add to cart button","In den Warenkorb Button"
44
- "Replace the add to cart button","Warenkorb Button ersetzen"
45
- "What tag wraps the add to cart button?","Welcher Tag umschließt den Warenkorb Button?"
46
- "On \'Add To Cart\' Redirect User To Page","Seite, auf die Nutzer nach dem Hinzufügen eines Produkts zum Warenkorb weitergeleitet werden"
47
- "Select which page to redirect a user to when they try to add an invalid product to their cart.","Wählen Sie eine Seite, zu der ein Nutzer weitergeleitet werden soll, wenn versucht wurde, ein ungültiges Produkt in den Warenkorb zu legen."
48
- "New Order Form","Neuer Bestellzettel"
49
- "Remove this entry","Eintrag entfernen"
50
- "The product does not exist.","Dieses Produkt ist nicht vorhanden."
51
- "SKU","Artikelnummer"
52
- "Name","Name"
53
- "Price","Preis"
54
- "Quantity","Anzahl"
55
- "Action","Aktion"
56
- "Submit Data","Daten Senden"
57
- "Your account is not allowed to access this product.","Ihr Benutzerkonto ist für dieses Produkt nicht freigeschaltet."
58
- "Please enter valid product sku.","Bitte geben Sie eine gültige SKU an."
2
  "Please login","Bitte einloggen"
3
  "General settings","Allgemeine Einstellungen"
4
  "Enable B2B extension","B2B Extension aktivieren"
 
 
 
 
 
5
  "Activate by category","Für Kategorien aktivieren"
6
  "Active categories","Aktive Kategorien"
7
  "Activate by customer group","Für Kundengruppen aktivieren"
8
  "Active customer groups","Aktive Kundengruppen"
9
  "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"""
10
  "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."
 
 
 
11
  "Activate extension only for categories selected below","Extension nur für folgende Kategorien aktivieren"
12
  "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."
13
  "Activate extension only for customer groups selected below","Extension nur für Kunden aus folgenden Kundengruppen aktivieren."
14
  "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."
15
  "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"
 
16
  "Require User Login","Nutzer muss sich einloggen"
17
  "The user is required to login before they can view pages in this shop. <br /> Note: CMS pages are always allowed.","Der Nutzer muss sich einloggen bevor Seiten im Shop aufgerufen werden können. <br /> Hinweis: CMS-Seiten sind immer erlaubt."
 
 
18
  "Redirect User To Page","Nutzer auf Seite weiterleiten"
19
+ "Select which page to redirect a user to.","Wählen Sie die Seite, auf die der Nutzer weitergeleitet werden soll."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/locale/en_US/Sitewards_B2BProfessional.csv CHANGED
@@ -1,5 +1,19 @@
1
  "Your account is not allowed to access this store.","Your account is not allowed to access this store."
2
  "Please login","Please login"
3
- "You do not have access to view this store.","You do not have access to view this store."
4
- "delivery_date","Defined order date"
5
- "Order Date:","Define order date:"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  "Your account is not allowed to access this store.","Your account is not allowed to access this store."
2
  "Please login","Please login"
3
+ "General settings","General settings"
4
+ "Enable B2B extension","Enable B2B extension"
5
+ "Activate by category","Activate by category"
6
+ "Active categories","Active categories"
7
+ "Activate by customer group","Activate by customer group"
8
+ "Active customer groups","Active customer groups"
9
+ "Enable or disable extension. Customer activation behaviour can be configured under <br />""Customer Configuration > Customer activation""","Enable or disable extension. Customer activation behaviour can be configured under <br />""Customer Configuration > Customer activation"""
10
+ "Activate customers for all stores. Otherwise they will only see the prices in the store, they have registered for.","Activate customers for all stores. Otherwise they will only see the prices in the store, they have registered for."
11
+ "Activate extension only for categories selected below","Activate extension only for categories selected below"
12
+ "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.","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."
13
+ "Activate extension only for customer groups selected below","Activate extension only for customer groups selected below"
14
+ "Select customer groups for which the extension should be active.<br />Hold down Ctrl-key for multiple selection.","Select customer groups for which the extension should be active.<br />Hold down Ctrl-key for multiple selection."
15
+ "When activating this extension by customer group the guest user is also included.","When activating this extension by customer group the guest user is also included."
16
+ "Require User Login","Require User Login"
17
+ "The user is required to login before they can view pages in this shop. <br /> Note: CMS pages are always allowed.","The user is required to login before they can view pages in this shop. <br /> Note: CMS pages are always allowed."
18
+ "Redirect User To Page","Redirect User To Page"
19
+ "Select which page to redirect a user to.","Select which page to redirect a user to."
js/sitewards/b2bprofessional.js DELETED
@@ -1,358 +0,0 @@
1
- document.observe(
2
- 'dom:loaded',
3
- /**
4
- * initializes first product
5
- */
6
- function() {
7
- var oProduct = new OrderProduct($$('form#order_form .product')[0]);
8
- }
9
- );
10
-
11
- /**
12
- * presentation of a product row
13
- */
14
- var OrderProduct = Class.create(
15
- {
16
- /**
17
- * prototype element of the .product element
18
- */
19
- _oLine: null,
20
-
21
- /**
22
- * URL of loading image
23
- */
24
- _sLoadingImage: null,
25
-
26
- /**
27
- * initializes observer for sku
28
- *
29
- * @param oLine
30
- */
31
- initialize: function (oLine) {
32
- if (typeof oLine == 'undefined') {
33
- return;
34
- }
35
- this._oLine = oLine;
36
- this.getElement('input.sku').observe(
37
- 'change',
38
- this._onChangeSku.bind(this)
39
- );
40
- this.getElement('.qty').style.display = 'none';
41
- this._sLoadingImage = $$('.sitewards-b2bprofessional-order-form .loading').first().src;
42
-
43
- var that = this;
44
- this.getElement('.remove')
45
- .observe('click', function (oEvent) {
46
- that._onRemove();
47
- oEvent.preventDefault();
48
- return false;
49
- })
50
- .hide()
51
- ;
52
- },
53
-
54
- /**
55
- * displays more information about product, if allowed
56
- *
57
- * @private
58
- */
59
- _onChangeSku: function () {
60
- new Ajax.Request('/b2bprofessional/product/info', {
61
- method: 'get',
62
- parameters: {
63
- 'sku' : this.getElement('input.sku').value
64
- },
65
- requestHeaders: {Accept: 'application/json'},
66
- onSuccess: this._onSuccess.bind(this),
67
- onFailure: this._onFailure.bind(this)
68
- });
69
- this.getElement('.name').update('<img src="'+this._sLoadingImage+'">');
70
- this.getElement('.qty').style.display = 'none';
71
- },
72
-
73
- /**
74
- * returns element of this product element
75
- *
76
- * @param sSelector
77
- * @returns {*}
78
- */
79
- getElement: function (sSelector) {
80
- return this._oLine.down(sSelector);
81
- },
82
-
83
- /**
84
- * duplicates current line
85
- *
86
- * @private
87
- */
88
- _duplicateLine: function () {
89
- var oParent = this._oLine.up();
90
- oParent.insert(this._oLine.outerHTML);
91
- var oProduct = new OrderProduct(oParent.childElements().last());
92
- oProduct._reset();
93
- },
94
-
95
- /**
96
- * displaysinformation about product
97
- *
98
- * @param transport
99
- * @private
100
- */
101
- _onSuccess: function(transport) {
102
- this._clearMessages();
103
- var oResponse = transport.responseText.evalJSON(true);
104
- if (oResponse.result == 0) {
105
- var oQty = this.getElement('input.qty');
106
-
107
- oQty.value = Math.max(1, oResponse.qty);
108
- oQty.disabled = false;
109
- this.getElement('.name').update(oResponse.name);
110
- this.getElement('.price').update(oResponse.price);
111
- if (this._hasEmptyLineInForm() == false) {
112
- this._duplicateLine();
113
- }
114
- this.getElement('.qty').style.display = 'block';
115
- oQty.focus();
116
- oQty.select();
117
-
118
- if (this.getElement('input.sku').value.length > 0) {
119
- this.getElement('.remove').show();
120
- }
121
- } else {
122
- this._reset();
123
- this.getElement('input.sku').value = '';
124
- this._showMessage(oResponse.error);
125
- this.getElement('input.sku').focus();
126
- }
127
- },
128
-
129
- /**
130
- * Show standard magento message
131
- *
132
- * @param sText
133
- * @param sType
134
- * @private
135
- */
136
- _showMessage : function (sText) {
137
- $$('.messages')[0].style.display = 'block';
138
- $$('.messages>li>ul>li')[0].update(sText);
139
- },
140
-
141
- /**
142
- * Remove all messages
143
- *
144
- * @private
145
- */
146
- _clearMessages : function () {
147
- $$('.messages>li>ul>li')[0].update('');
148
- $$('.messages')[0].style.display = 'none';
149
- },
150
-
151
- /**
152
- * Determines if there is an empty line in the form
153
- *
154
- * @return {Boolean} true if there is an empty line
155
- * @private
156
- */
157
- _hasEmptyLineInForm : function () {
158
- var aLines = this._oLine.up('tbody').select('tr');
159
- for (var i=0; i < aLines.length; i++) {
160
- var oInput = $(aLines[i]).select('input').first();
161
- if (oInput.value == '') {
162
- return true;
163
- }
164
- }
165
- return false;
166
- },
167
-
168
- /**
169
- * resets information about product
170
- *
171
- * @private
172
- */
173
- _reset: function () {
174
- this.getElement('input.qty').update('');
175
- this.getElement('input.qty').disabled = 'disabled';
176
- this.getElement('.name').update('');
177
- this.getElement('.price').update('');
178
- },
179
-
180
- /**
181
- * remove last empty row after a failed ajax request, except current row is last row
182
- *
183
- * @private
184
- */
185
- _removeEmptyRows: function () {
186
- var oLastLine = this._oLine.up().childElements().last();
187
- if (oLastLine != this._oLine) {
188
- oLastLine.remove();
189
- }
190
- },
191
-
192
- /**
193
- * removes the line from the form
194
- *
195
- * @private
196
- */
197
- _onRemove: function () {
198
- var oLinesContainer = this._oLine.up();
199
- this._oLine.remove();
200
- // hide "remove line" if only one line is left
201
- if (oLinesContainer.childElements().length <= 1) {
202
- oLinesContainer.down('.remove').hide();
203
- }
204
- },
205
-
206
- /**
207
- * called on ajax request failure
208
- *
209
- * @private
210
- */
211
- _onFailure: function () {
212
- this._reset();
213
- this._removeEmptyRows();
214
- this._showMessage(Translator.translate('The product does not exist.'));
215
- this.getElement('.name').focus();
216
- }
217
- }
218
- );
219
-
220
- /**
221
- * Date picker for the order date
222
- */
223
- var OrderDatePicker = Class.create(
224
- {
225
- /**
226
- * Sets up all events of the input fields and
227
- * the Calender
228
- */
229
- initialize: function () {
230
-
231
- // initialize date picker with correct date format
232
- Calendar.setup({
233
- inputField : 'delivery_date',
234
- ifFormat : '%Y-%m-%d',
235
- align : 'Bl',
236
- button: 'delivery_date',
237
- singleClick : true
238
- });
239
-
240
- // initialize the input
241
- var oDateInput = $('delivery_date');
242
- if (oDateInput.value == '') {
243
- var oToday = new Date(),
244
- sDay = ('0' + oToday.getDate()).slice(-2),
245
- sMonth = ('0' + (oToday.getMonth()+1)).slice(-2),
246
- sYear = oToday.getFullYear()
247
- ;
248
- $('delivery_date').value = sYear + '-' + sMonth + '-' + sDay;
249
- }
250
- // date can only be changed via date picker
251
- oDateInput.on('focus', function () {
252
- oDateInput.blur();
253
- });
254
-
255
- this._initializeLoca();
256
- },
257
-
258
- /**
259
- * initialize the localization of the calendar, if not already initialized
260
- *
261
- * @private
262
- */
263
- _initializeLoca: function () {
264
-
265
- if (this._isUndefined('enUS', window)) {
266
- window.enUS = {
267
- "m": {
268
- "wide": [
269
- "January", "February", "March", "April", "May", "June", "July", "August",
270
- "September", "October", "November", "December"
271
- ],
272
- "abbr": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
273
- }
274
- };
275
- }
276
-
277
- this._initCalendarLocaField('_DN', new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"));
278
- this._initCalendarLocaField('_SDN', new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"));
279
- this._initCalendarLocaField('_FD', 0);
280
- this._initCalendarLocaField('_MN', window.enUS.m.wide);
281
- this._initCalendarLocaField('_SMN', window.enUS.m.abbr);
282
- this._initCalendarLocaField('_TT', {
283
- INFO: "About",
284
- ABOUT: "DHTML Date/Time Selector\n" +
285
- "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" +
286
- "For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
287
- "Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." +
288
- "\n\n" +
289
- "Date selection:\n" +
290
- "- Use the \xab, \xbb buttons to select year\n" +
291
- "- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" +
292
- "- Hold mouse button on any of the above buttons for faster selection.",
293
- ABOUT_TIME: "\n\n" +
294
- "Time selection:\n" +
295
- "- Click on any of the time parts to increase it\n" +
296
- "- or Shift-click to decrease it\n" +
297
- "- or click and drag for faster selection.",
298
- PREV_YEAR : "Prev. year (hold for menu)",
299
- PREV_MONTH: "Prev. month (hold for menu)",
300
- GO_TODAY: "Go Today",
301
- NEXT_MONTH : "Next month (hold for menu)",
302
- NEXT_YEAR: "Next year (hold for menu)",
303
- SEL_DATE: "Select date",
304
- DRAG_TO_MOVE: "Drag to move",
305
- PART_TODAY: "(today)",
306
- DAY_FIRST: "Display %s first",
307
- SELECT_COLUMN: "Select all %ss of this month",
308
- SELECT_ROW: "Select all days of this week",
309
- WEEKEND: "0,6",
310
- CLOSE: "Close",
311
- TODAY: "Today",
312
- TIME_PART: "(Shift-)Click or drag to change value",
313
- DEF_DATE_FORMAT: "%Y-%m-%d",
314
- TT_DATE_FORMAT: "%a, %b %e",
315
- WK: "wk",
316
- TIME: "Time:",
317
- LAM: "am",
318
- AM: "AM",
319
- LPM: "pm",
320
- PM: "PM"
321
- })
322
- ;
323
- this._initCalendarLocaField('_DIR', 'ltr');
324
- this._initCalendarLocaField('_am', 'am');
325
- this._initCalendarLocaField('_pm', 'pm');
326
- },
327
-
328
- /**
329
- * Inits a localization part of the calendar
330
- *
331
- * @param {string} sFieldname name of the part
332
- * @param {mixed} mValue value of the field (array, string or number)
333
- * @private
334
- */
335
- _initCalendarLocaField: function (sFieldname, mValue) {
336
- if (this._isUndefined(sFieldname, Calendar)) {
337
- Calendar[sFieldname] = mValue;
338
- }
339
- },
340
-
341
- /**
342
- * Checks if element is undefined
343
- *
344
- * @param {mixed} mElement object or (string) name of property of oParent object
345
- * @param {object} oParent object to check the property mElement of (not required)
346
- * @return {Boolean} true if the element is undefined
347
- * @private
348
- */
349
- _isUndefined : function (mElement, oParent) {
350
- if (typeof oParent == 'undefined') {
351
- return (typeof mElement == 'undefined');
352
- } else {
353
- return (typeof oParent[mElement] == 'undefined');
354
- }
355
- }
356
- }
357
- );
358
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sitewards_B2BProfessional</name>
4
- <version>2.5.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
7
  <channel>community</channel>
@@ -20,11 +20,11 @@ Features of the B2BProfessional Extension:&#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>Update to work with Magento 1.9</notes>
24
  <authors><author><name>Sitewards Magento Team</name><user>sitewards</user><email>magento@sitewards.com</email></author></authors>
25
- <date>2014-05-15</date>
26
- <time>08:21:02</time>
27
- <contents><target name="magecommunity"><dir name="Sitewards"><dir name="B2BProfessional"><dir name="Block"><dir name="Adminhtml"><file name="Order.php" hash="1079907aaeb1f57c753635899032ff38"/></dir><dir name="Catalog"><dir name="Product"><file name="List.php" hash="4c8e213915c4c7c177b503916921a392"/><file name="New.php" hash="3da0bc1cb1bd562f1a41e2169f6da061"/><dir name="Widget"><file name="New.php" hash="f263ee41756685c78959082ff2a38b5a"/></dir></dir></dir><dir name="Checkout"><file name="Links.php" hash="f88d8e603f98a282b2d6f678f03d974d"/></dir><dir name="Order"><file name="Form.php" hash="9b3a9d07b9a7eb537e898578d0ce0466"/></dir><file name="Order.php" hash="c421edb98f77b39b0abdb68262a018f6"/><dir name="Reports"><dir name="Product"><file name="Compared.php" hash="abe90ddad8722f7f3b41eef2cf9d7411"/><file name="Viewed.php" hash="c89044322ca310b450e7e8b95c17de69"/><dir name="Widget"><file name="Compared.php" hash="427bd3640335044572ccb4a6966d1d31"/><file name="Viewed.php" hash="f943f7cff7e0858c23527bcdf82f4b19"/></dir></dir></dir></dir><dir name="Docs"><file name="Sitewards B2B Professional_Deutsch V4.pdf" hash="69c5aabb9eba3cb4d060206f68bfffa9"/><file name="Sitewards B2B Professional_ENG_V4.pdf" hash="ec57137d81856521207e5014dfad133d"/></dir><dir name="Helper"><dir name="Catalog"><dir name="Product"><file name="Compare.php" hash="29d7ee722666ceeed48ac0e43c937b1d"/></dir></dir><file name="Category.php" hash="c7ac2551cc37516ea44002b08021c27b"/><file name="Core.php" hash="8a9ed86d5aead09fad8a6c372904005d"/><file name="Customer.php" hash="3b8caf476d39a55db5378ff209bf2186"/><file name="Data.php" hash="4b3fc08e209643cc07d5e366998b90a6"/><file name="Messages.php" hash="54ce3aae10919721bb3545988d6aa564"/><file name="Redirects.php" hash="5670879b38bc078e36fb32f739b3a1f5"/><file name="Replacements.php" hash="cb5b3162388618b1d8c512c5b83918a0"/></dir><dir name="Model"><file name="Customer.php" hash="ceb9778dfb4725c8cd087f2595b3ccff"/><file name="Observer.php" hash="668b466c9d871157657d73cbe576a629"/><file name="Order.php" hash="5ba1832297e6f95a7b14787298bd9f2a"/><file name="Quote.php" hash="9401c027ab3b4949f0db15200d591c6d"/><dir name="Resource"><dir name="Order"><file name="Collection.php" hash="32b8e20dce599b6455232af83199e8cf"/></dir><file name="Order.php" hash="82300aaebd70030ce59b48f0bb68a275"/><dir name="Quote"><file name="Collection.php" hash="5f6dc10e88b36d1535432def4c8f11a2"/></dir><file name="Quote.php" hash="8560f55cdbcfe7312f1c1208ddcf9378"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Category.php" hash="e9642d20bb0bc0f542b07ecdf8d021c5"/><file name="Identifiers.php" hash="018e168fb31fffa33b3889612e0336be"/><file name="Page.php" hash="042ef4e679e8e8c7b6a2c696119712b3"/><file name="Tags.php" hash="af72690991f6f91a5aecb5f5fd7f621a"/></dir></dir></dir></dir><dir name="Test"><dir name="Helper"><dir name="Data"><dir name="fixtures"><file name="testIsExtensionActive.yaml" hash="1597dbaa9909bf2cd6cdc41188d79a40"/></dir></dir><file name="Data.php" hash="19407fd03acd55753b08b472f4004c57"/></dir></dir><dir name="controllers"><file name="CartController.php" hash="ed057ef6e574e564bf5b2f3849a4154f"/><file name="OrderController.php" hash="0c8f8fc04d5920bb2d4fb8abbe5e4ea2"/><file name="ProductController.php" hash="b5c0bd7d94857a8262ac730733df198e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1c7cde3689b2da69458c39c3508f7e1a"/><file name="config.xml" hash="142cfcf5e0c7dd538eb60bb845f193ab"/><file name="system.xml" hash="20344173951dcaf070b8882eb97a35eb"/></dir><dir name="sql"><dir name="sitewards_b2bprofessional"><file name="upgrade-2.3.0-2.4.0.php" hash="b203deb87585780983f5a16f19b88b34"/></dir></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="e2f335efa0e6b206580aca1ce2cd595d"/></dir><dir name="en_US"><file name="Sitewards_B2BProfessional.csv" hash="e3e35d922900bad93fee16ecdbb09f69"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="sitewards"><dir name="b2bprofessional"><dir name="catalog"><dir name="product"><dir name="view"><dir name="type"><dir name="bundle"><dir name="option-post-180"><file name="checkbox.phtml" hash="33a5b1b7ccd05030e75828ce7213246a"/><file name="multi.phtml" hash="92de70f9e37a1911cdaa908642c92d89"/><file name="radio.phtml" hash="e20a3344b361fab375cddeeed94e60f9"/><file name="select.phtml" hash="784f8ef8ee7374d83d25c47328529fba"/></dir><dir name="option-pre-180"><file name="checkbox.phtml" hash="43233f86f7e8529e5bc997f448ca250a"/><file name="multi.phtml" hash="43797266868e249b34a228a4ad9797e7"/><file name="radio.phtml" hash="770363afcc009271d58a15f02ae4fdbe"/><file name="select.phtml" hash="47b3b35fe986ab31fdc8e239e8ec9bb1"/></dir></dir></dir></dir></dir></dir><dir name="checkout"><dir name="billing"><file name="extra.phtml" hash="ecc02d2548ca43b2424f88ac4cc3b0e0"/></dir></dir><dir name="order"><file name="form.phtml" hash="07382e7c71e8e0a8c9de39e8b1e255c7"/></dir><file name="order.phtml" hash="9591a8cc45c05df038807157a6f07537"/></dir></dir></dir><dir name="layout"><dir name="sitewards"><file name="b2bprofessional.xml" hash="c85d310d8a2045c854537780f6c8a89d"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="sitewards"><dir name="b2bprofessional"><file name="order.phtml" hash="acd14610cfb5ae3af32d29d4fb97dee9"/><dir name="sales"><dir name="order"><file name="info.phtml" hash="f15665316c8b577c00f3a6d079a00f63"/></dir></dir></dir></dir></dir><dir name="layout"><dir name="sitewards"><file name="b2bprofessional.xml" hash="dd9927dd56d60c6499e591623d4c4ad8"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="sitewards"><file name="loading.gif" hash="1836c963dec1eb6dab0e0a41b8121cd3"/></dir></dir><dir name="css"><dir name="sitewards"><file name="b2bprofessional.css" hash="6d6ce9426f7f397c0488a82188c3bba5"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="sitewards"><file name="b2bprofessional.js" hash="953f75bd31bcd1dcb639d9582cf30292"/></dir></dir></target></contents>
28
  <compatible/>
29
- <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><package><name>Netzarbeiter_CustomerActivation</name><channel>community</channel><min>0.3.0</min><max></max></package></required></dependencies>
30
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sitewards_B2BProfessional</name>
4
+ <version>3.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
7
  <channel>community</channel>
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>Updated the extension to improve code quality and extension speed.</notes>
24
  <authors><author><name>Sitewards Magento Team</name><user>sitewards</user><email>magento@sitewards.com</email></author></authors>
25
+ <date>2014-08-15</date>
26
+ <time>14:14:24</time>
27
+ <contents><target name="magecommunity"><dir name="Sitewards"><dir name="B2BProfessional"><dir name="Docs"><file name="Sitewards B2B Professional_Deutsch V4.pdf" hash="69c5aabb9eba3cb4d060206f68bfffa9"/><file name="Sitewards B2B Professional_ENG_V4.pdf" hash="ec57137d81856521207e5014dfad133d"/></dir><dir name="Helper"><file name="Category.php" hash="72689cd7ea584379faf651d5dab7c351"/><file name="Core.php" hash="42335338c141593bc65b1e7913e4faf1"/><file name="Customer.php" hash="66f0f771c367e84181392f08efd693a4"/><file name="Data.php" hash="986044678c3628e854048d3e41c4e51e"/><file name="Redirects.php" hash="4b6d65cbf94a58b8b8b74eb480075fed"/></dir><dir name="Model"><file name="Observer.php" hash="5b2c913136e1337e6858103185855841"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Category.php" hash="c45ee6c8eaaec42d239705b591c77919"/><file name="Page.php" hash="4527fdfc9bba40aa98dffc6db8fa5d3e"/></dir></dir></dir></dir><dir name="Test"><dir name="Helper"><dir name="Data"><dir name="fixtures"><file name="testIsExtensionActive.yaml" hash="1597dbaa9909bf2cd6cdc41188d79a40"/></dir></dir><file name="Data.php" hash="1c57859446ccbe78bdd3cf14cace8f19"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="4a2fcabe901e2baae0eea97a08f05363"/><file name="config.xml" hash="3208477f6797fd73eaf2baf679fcfad9"/><file name="system.xml" hash="2b37ce38dd2ef8ed6fde97ebe503eac3"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sitewards_B2BProfessional.xml" hash="023a28f2a21cd706dea246807465b99f"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Sitewards_B2BProfessional.csv" hash="6015eda25375bedb1b91182fbf61b2af"/></dir><dir name="en_US"><file name="Sitewards_B2BProfessional.csv" hash="44feec9f9e16dcc49cb2576c3244df4b"/></dir></target></contents>
28
  <compatible/>
29
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><package><name>Netzarbeiter_CustomerActivation</name><channel>community</channel><min>0.3.0</min><max/></package><package><name>Sitewards_DeliveryDate</name><channel>community</channel><min>0.1.0</min><max/></package><package><name>Sitewards_QuickOrders</name><channel>community</channel><min>0.1.0</min><max/></package></required></dependencies>
30
  </package>
skin/frontend/base/default/css/sitewards/b2bprofessional.css DELETED
@@ -1,22 +0,0 @@
1
- .sitewards-b2bprofessional-order-form TABLE TR TD,
2
- .sitewards-b2bprofessional-order-form THEAD TR TH
3
- {
4
- padding-right: 20px;
5
- padding-bottom: 10px;
6
- }
7
-
8
- .sitewards-b2bprofessional-order-form THEAD TR TH {
9
- font-weight: bold;
10
- }
11
-
12
- .sitewards-b2bprofessional-order-form .price {
13
- text-align: right;
14
- }
15
-
16
- .sitewards-b2bprofessional-order-form .invisible {
17
- display: none;
18
- }
19
-
20
- .sitewards-b2bprofessional-order-form A {
21
- cursor: pointer;
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
skin/frontend/base/default/images/sitewards/loading.gif DELETED
Binary file