Sitewards_B2BProfessional - Version 2.1.1

Version Notes

Fix compatibility issues with Simple Configurable Product and other extension.

Download this release

Release Info

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


Code changes from version 2.1.0 to 2.1.1

app/code/community/Sitewards/B2BProfessional/Block/Price.php DELETED
@@ -1,46 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Block_Price
4
- * - Check that the current product is active and display custom text
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_Block_Price extends Mage_Catalog_Block_Product_Price {
11
- /**
12
- * The last product Id
13
- *
14
- * @var int
15
- */
16
- protected static $_iLastProductId = 0;
17
-
18
- /**
19
- * Check that the current product is active
20
- * - Override the text with the module text
21
- *
22
- * @return string
23
- */
24
- protected function _toHtml() {
25
- $sPriceHtml = parent::_toHtml();
26
- $iCurrentProductId = $this->getProduct()->getId();
27
- /* @var $oB2BHelper Sitewards_B2BProfessional_Helper_Data */
28
- $oB2BHelper = Mage::helper('b2bprofessional');
29
-
30
- if ($oB2BHelper->checkActive($iCurrentProductId)) {
31
- if ($iCurrentProductId == self::$_iLastProductId) {
32
- return '';
33
- }
34
- self::$_iLastProductId = $iCurrentProductId;
35
-
36
- // text displayed instead of price
37
- if (Mage::getStoreConfig('b2bprofessional/languagesettings/languageoverride') == 1) {
38
- $sReplacementText = Mage::getStoreConfig('b2bprofessional/languagesettings/logintext');
39
- } else {
40
- $sReplacementText = $this->__('Please login');
41
- }
42
- return $sReplacementText;
43
- }
44
- return $sPriceHtml;
45
- }
46
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Product/View/Options/Type/Select.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- class Sitewards_B2BProfessional_Block_Product_View_Options_Type_Select extends Mage_Catalog_Block_Product_View_Options_Type_Select {
3
- /**
4
- * Return formated price
5
- *
6
- * @param array $value
7
- * @return string
8
- */
9
- protected function _formatPrice($value, $flag=true) {
10
- if (!Mage::helper('b2bprofessional')->checkActive($this->getProduct()->getId())) {
11
- return parent::_formatPrice($value, $flag);
12
- } else {
13
- return $this->__('Please login');
14
- }
15
- }
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Block/Product/View/Type/Configurable.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
- /**
3
- * Sitewards_B2BProfessional_Block_Configurable
4
- * - Check that the current product is active and override the price
5
- *
6
- * @category Sitewards
7
- * @package Sitewards_B2BProfessional
8
- * @copyright Copyright (c) 2012 Sitewards GmbH (http://www.sitewards.com/)
9
- */
10
- class Sitewards_B2BProfessional_Block_Product_View_Type_Configurable extends Mage_Catalog_Block_Product_View_Type_Configurable {
11
- /**
12
- * Check that the product is active
13
- * - If it is not active the override the price
14
- *
15
- * @param float $fProductPrice
16
- * @param boolean $bIsPercent
17
- * @return boolean
18
- */
19
- protected function _preparePrice($fProductPrice, $bIsPercent = false) {
20
- if (Mage::helper('b2bprofessional')->checkActive()) {
21
- return false;
22
- }
23
- return parent::_preparePrice($fProductPrice, $bIsPercent);
24
- }
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Sitewards/B2BProfessional/Model/Observer.php CHANGED
@@ -8,6 +8,13 @@
8
  * @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
9
  */
10
  class Sitewards_B2BProfessional_Model_Observer {
 
 
 
 
 
 
 
11
  /**
12
  * Check if the site requires login to work
13
  * - Add notice,
@@ -59,4 +66,61 @@ class Sitewards_B2BProfessional_Model_Observer {
59
  }
60
  }
61
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
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
  * Check if the site requires login to work
20
  * - Add notice,
66
  }
67
  }
68
  }
69
+
70
+ /**
71
+ * Check for block Mage_Catalog_Block_Product_Price
72
+ * - Check the product is active via the Sitewards_B2BProfessional_Helper_Data
73
+ * - Replace the text with that on the b2bprofessional
74
+ *
75
+ * @param Varien_Event_Observer $oObserver
76
+ * @return string
77
+ */
78
+ public function onCoreBlockAbstractToHtmlAfter(Varien_Event_Observer $oObserver) {
79
+ $oBlock = $oObserver->getData('block');
80
+ $oTransport = $oObserver->getData('transport');
81
+
82
+ if($oBlock instanceof Mage_Catalog_Block_Product_Price) {
83
+ $oProduct = $oBlock->getProduct();
84
+ $iCurrentProductId = $oProduct->getId();
85
+
86
+ /* @var $oB2BHelper Sitewards_B2BProfessional_Helper_Data */
87
+ $oB2BHelper = Mage::helper('b2bprofessional');
88
+
89
+ if ($oB2BHelper->checkActive($iCurrentProductId)) {
90
+ // To stop duplicate information being displayed validate that we only do this once per product
91
+ if ($iCurrentProductId != self::$_iLastProductId) {
92
+ self::$_iLastProductId = $iCurrentProductId;
93
+
94
+ // text displayed instead of price
95
+ if (Mage::getStoreConfig('b2bprofessional/languagesettings/languageoverride') == 1) {
96
+ $sReplacementText = Mage::getStoreConfig('b2bprofessional/languagesettings/logintext');
97
+ } else {
98
+ $sReplacementText = $oB2BHelper->__('Please login');
99
+ }
100
+
101
+ $oTransport->setHtml($sReplacementText);
102
+ } else {
103
+ $oTransport->setHtml('');
104
+ }
105
+ // Set can show price to false to stop tax being displayed via Symmetrics_TweaksGerman_Block_Tax
106
+ $oProduct->setCanShowPrice(false);
107
+ }
108
+ }
109
+ }
110
+
111
+ /**
112
+ * On the event catalog_product_type_configurable_price
113
+ * Set the COnfigurable price of a product to 0 to stop the changed price showing up in the drop down
114
+ *
115
+ * @param Varien_Event_Observer $oObserver
116
+ */
117
+ public function onCatalogProductTypeConfigurablePrice(Varien_Event_Observer $oObserver) {
118
+ $oProduct = $oObserver->getData('product');
119
+ /* @var $oB2BHelper Sitewards_B2BProfessional_Helper_Data */
120
+ $oB2BHelper = Mage::helper('b2bprofessional');
121
+
122
+ if ($oB2BHelper->checkActive($oProduct->getId())) {
123
+ $oProduct->setConfigurablePrice(0);
124
+ }
125
+ }
126
  }
app/code/community/Sitewards/B2BProfessional/etc/config.xml CHANGED
@@ -18,7 +18,7 @@
18
  <config>
19
  <modules>
20
  <Sitewards_B2BProfessional>
21
- <version>2.1.0</version>
22
  </Sitewards_B2BProfessional>
23
  </modules>
24
  <global>
@@ -32,13 +32,6 @@
32
  <catalog_product_view_type_bundle_option_select>Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Select</catalog_product_view_type_bundle_option_select>
33
  </rewrite>
34
  </bundle>
35
- <catalog>
36
- <rewrite>
37
- <product_price>Sitewards_B2BProfessional_Block_Price</product_price>
38
- <product_view_type_configurable>Sitewards_B2BProfessional_Block_Product_View_Type_Configurable</product_view_type_configurable>
39
- <product_view_options_type_select>Sitewards_B2BProfessional_Block_Product_View_Options_Type_Select</product_view_options_type_select>
40
- </rewrite>
41
- </catalog>
42
  <b2bprofessional>
43
  <class>Sitewards_B2BProfessional_Block</class>
44
  </b2bprofessional>
@@ -52,6 +45,22 @@
52
  </b2bprofessional>
53
  </observers>
54
  </controller_action_predispatch>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  </events>
56
  <helpers>
57
  <b2bprofessional>
18
  <config>
19
  <modules>
20
  <Sitewards_B2BProfessional>
21
+ <version>2.1.1</version>
22
  </Sitewards_B2BProfessional>
23
  </modules>
24
  <global>
32
  <catalog_product_view_type_bundle_option_select>Sitewards_B2BProfessional_Block_Bundle_Catalog_Product_View_Type_Bundle_Option_Select</catalog_product_view_type_bundle_option_select>
33
  </rewrite>
34
  </bundle>
 
 
 
 
 
 
 
35
  <b2bprofessional>
36
  <class>Sitewards_B2BProfessional_Block</class>
37
  </b2bprofessional>
45
  </b2bprofessional>
46
  </observers>
47
  </controller_action_predispatch>
48
+ <core_block_abstract_to_html_after>
49
+ <observers>
50
+ <b2bprofessional>
51
+ <class>b2bprofessional/observer</class>
52
+ <method>onCoreBlockAbstractToHtmlAfter</method>
53
+ </b2bprofessional>
54
+ </observers>
55
+ </core_block_abstract_to_html_after>
56
+ <catalog_product_type_configurable_price>
57
+ <observers>
58
+ <b2bprofessional>
59
+ <class>b2bprofessional/observer</class>
60
+ <method>onCatalogProductTypeConfigurablePrice</method>
61
+ </b2bprofessional>
62
+ </observers>
63
+ </catalog_product_type_configurable_price>
64
  </events>
65
  <helpers>
66
  <b2bprofessional>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sitewards_B2BProfessional</name>
4
- <version>2.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
7
  <channel>community</channel>
@@ -20,13 +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>Create an option that will stop users who are not logged in accessing pages.&#xD;
24
- &#xD;
25
- Create an option that will redirect user to a specified CMS page or the customer login/register page when not logged in.</notes>
26
  <authors><author><name>Sitewards Magento Team</name><user>sitewards</user><email>magento@sitewards.com</email></author></authors>
27
- <date>2013-03-19</date>
28
- <time>08:38:35</time>
29
- <contents><target name="magecommunity"><dir name="Sitewards"><dir name="B2BProfessional"><dir name="Block"><dir name="Bundle"><dir name="Catalog"><file name="Price.php" hash="29947f4d2db1edb62d31ab2bb26d5612"/><dir name="Product"><dir name="View"><dir name="Type"><dir name="Bundle"><dir name="Option"><file name="Checkbox.php" hash="97e3e7ce97a873c0bf438dcbb9d63538"/><file name="Multi.php" hash="aade197dae894c11df15ded6b90c5fa6"/><file name="Radio.php" hash="6bae85356183c20b8f7327018f4939fe"/><file name="Select.php" hash="b90a778084796edf552d6c87e888404f"/></dir></dir></dir></dir></dir></dir></dir><file name="Price.php" hash="9014ce96fcaf47192692cde42c2e477c"/><dir name="Product"><dir name="View"><dir name="Options"><dir name="Type"><file name="Select.php" hash="01e9eb71f9c35a00fc39e375e2335301"/></dir></dir><dir name="Type"><file name="Configurable.php" hash="03aca82552c1cba03b1b243762bd95ad"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="fb54bbbba61ef5e564bfcad9a03c6a67"/></dir><dir name="Model"><file name="Customer.php" hash="965cddbd586db90e693e7cef0bfba762"/><file name="Observer.php" hash="f821f35c2b96a327ffc532879e49434d"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Category.php" hash="115526ef80ee1f799e0c68f81a45fc9f"/><file name="Page.php" hash="042ef4e679e8e8c7b6a2c696119712b3"/></dir></dir></dir></dir><dir name="controllers"><file name="CartController.php" hash="6dfb9530a9361dd2636ce5229369de3c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="4532de80b3439c3047ea70776b8420a5"/><file name="config.xml" hash="651acb76508eff0bf7b61127f5cd12c0"/><file name="system.xml" hash="61633ee9a60e9dd3158df36616804e5f"/></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="26108c182a96d9f4eb1df05f379105f7"/></dir><dir name="en_US"><file name="Sitewards_B2BProfessional.csv" hash="5b6a370b2c2790ff1cb3954b8180ff81"/></dir></target></contents>
30
  <compatible/>
31
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Netzarbeiter_CustomerActivation</name><channel>community</channel><min>0.3.0</min><max>0.4.1</max></package></required></dependencies>
32
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sitewards_B2BProfessional</name>
4
+ <version>2.1.1</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>Fix compatibility issues with Simple Configurable Product and other extension.</notes>
 
 
24
  <authors><author><name>Sitewards Magento Team</name><user>sitewards</user><email>magento@sitewards.com</email></author></authors>
25
+ <date>2013-03-20</date>
26
+ <time>08:59:48</time>
27
+ <contents><target name="magecommunity"><dir name="Sitewards"><dir name="B2BProfessional"><dir name="Block"><dir name="Bundle"><dir name="Catalog"><file name="Price.php" hash="29947f4d2db1edb62d31ab2bb26d5612"/><dir name="Product"><dir name="View"><dir name="Type"><dir name="Bundle"><dir name="Option"><file name="Checkbox.php" hash="97e3e7ce97a873c0bf438dcbb9d63538"/><file name="Multi.php" hash="aade197dae894c11df15ded6b90c5fa6"/><file name="Radio.php" hash="6bae85356183c20b8f7327018f4939fe"/><file name="Select.php" hash="b90a778084796edf552d6c87e888404f"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="fb54bbbba61ef5e564bfcad9a03c6a67"/></dir><dir name="Model"><file name="Customer.php" hash="965cddbd586db90e693e7cef0bfba762"/><file name="Observer.php" hash="2b827f5994c1f039af6aaa159eddc2db"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Category.php" hash="115526ef80ee1f799e0c68f81a45fc9f"/><file name="Page.php" hash="042ef4e679e8e8c7b6a2c696119712b3"/></dir></dir></dir></dir><dir name="controllers"><file name="CartController.php" hash="6dfb9530a9361dd2636ce5229369de3c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="4532de80b3439c3047ea70776b8420a5"/><file name="config.xml" hash="96b94503af0182a916359ff46c4f6b31"/><file name="system.xml" hash="61633ee9a60e9dd3158df36616804e5f"/></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="26108c182a96d9f4eb1df05f379105f7"/></dir><dir name="en_US"><file name="Sitewards_B2BProfessional.csv" hash="5b6a370b2c2790ff1cb3954b8180ff81"/></dir></target></contents>
28
  <compatible/>
29
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Netzarbeiter_CustomerActivation</name><channel>community</channel><min>0.3.0</min><max>0.4.1</max></package></required></dependencies>
30
  </package>