Sitewards_B2BProfessional - Version 2.1.2

Version Notes

Remove the price range from search pages when customer is not active.

Download this release

Release Info

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


Code changes from version 2.1.1 to 2.1.2

app/code/community/Sitewards/B2BProfessional/Helper/Data.php CHANGED
@@ -41,6 +41,7 @@ class Sitewards_B2BProfessional_Helper_Data extends Mage_Core_Helper_Abstract {
41
  }
42
  $iUserStoreId = $oCustomer->getStoreId();
43
  $iCurrentStoreId = Mage::app()->getStore()->getId();
 
44
  if ($iUserStoreId == $iCurrentStoreId || $bCreatedViaAdmin == true) {
45
  return true;
46
  }
@@ -71,7 +72,31 @@ class Sitewards_B2BProfessional_Helper_Data extends Mage_Core_Helper_Abstract {
71
  $aCurrentCategories = $oProduct->getCategoryIds();
72
  }
73
  } else {
74
- $aCurrentCategories = array(Mage::getModel('catalog/product')->getCategoryId());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
76
  $aCurrentCategories = array_unique($aCurrentCategories);
77
 
@@ -135,6 +160,7 @@ class Sitewards_B2BProfessional_Helper_Data extends Mage_Core_Helper_Abstract {
135
  */
136
  public function checkLoggedIn() {
137
  $bLoggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
 
138
  if (!$this->checkAllowed()) {
139
  $bLoggedIn = false;
140
  }
41
  }
42
  $iUserStoreId = $oCustomer->getStoreId();
43
  $iCurrentStoreId = Mage::app()->getStore()->getId();
44
+
45
  if ($iUserStoreId == $iCurrentStoreId || $bCreatedViaAdmin == true) {
46
  return true;
47
  }
72
  $aCurrentCategories = $oProduct->getCategoryIds();
73
  }
74
  } else {
75
+ /*
76
+ * Check if there is a filtered category
77
+ * - If not check for a current_category,
78
+ * - If not load the store default category,
79
+ */
80
+ $aB2BProfFilters = Mage::registry('b2bprof_category_filters');
81
+ if(empty($aB2BProfFilters)) {
82
+ /* @var $oCategory Mage_Catalog_Model_Category */
83
+ $oCategory = Mage::registry('current_category_filter');
84
+ if(is_null($oCategory)) {
85
+ $oCategory = Mage::registry('current_category');
86
+ if(is_null($oCategory)) {
87
+ $oCategory = Mage::getModel('catalog/category')->load(Mage::app()->getStore()->getRootCategoryId());
88
+ }
89
+ }
90
+ $aCurrentCategories = $oCategory->getAllChildren(true);
91
+ $aCurrentCategories[] = $oCategory->getId();
92
+ } else {
93
+ $aCurrentCategories = $aB2BProfFilters;
94
+ foreach($aB2BProfFilters as $iCategoryId) {
95
+ $oCategory = Mage::getModel('catalog/category')->load($iCategoryId);
96
+
97
+ $aCurrentCategories = array_merge($aCurrentCategories, $oCategory->getAllChildren(true));
98
+ }
99
+ }
100
  }
101
  $aCurrentCategories = array_unique($aCurrentCategories);
102
 
160
  */
161
  public function checkLoggedIn() {
162
  $bLoggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
163
+
164
  if (!$this->checkAllowed()) {
165
  $bLoggedIn = false;
166
  }
app/code/community/Sitewards/B2BProfessional/Model/Customer.php CHANGED
@@ -18,8 +18,8 @@ class Sitewards_B2BProfessional_Model_Customer extends Mage_Customer_Model_Custo
18
  * - If cusomter is not active,
19
  * - Throw correct exception or add system message,
20
  *
21
- * @param string $sLoginEmail
22
- * @param string $sLoginPassword
23
  * @return true
24
  * @throws Exception
25
  * - Customer is not confirmed and confirmation is required,
18
  * - If cusomter is not active,
19
  * - Throw correct exception or add system message,
20
  *
21
+ * @param string $sLoginEmail
22
+ * @param string $sLoginPassword
23
  * @return true
24
  * @throws Exception
25
  * - Customer is not confirmed and confirmation is required,
app/code/community/Sitewards/B2BProfessional/Model/Observer.php CHANGED
@@ -108,6 +108,26 @@ class Sitewards_B2BProfessional_Model_Observer {
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
@@ -123,4 +143,45 @@ class Sitewards_B2BProfessional_Model_Observer {
123
  $oProduct->setConfigurablePrice(0);
124
  }
125
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
108
  }
109
  }
110
 
111
+ /**
112
+ * On the event core_block_abstract_to_html_before
113
+ * - Check for the block type Mage_Catalog_Block_Product_List_Toolbar
114
+ * - Remove the price order when required
115
+ *
116
+ * @param Varien_Event_Observer $oObserver
117
+ */
118
+ public function onCoreBlockAbstractToHtmlBefore(Varien_Event_Observer $oObserver) {
119
+ $oBlock = $oObserver->getData('block');
120
+
121
+ if($oBlock instanceof Mage_Catalog_Block_Product_List_Toolbar) {
122
+ /* @var $oB2BHelper Sitewards_B2BProfessional_Helper_Data */
123
+ $oB2BHelper = Mage::helper('b2bprofessional');
124
+
125
+ if($oB2BHelper->checkActive()) {
126
+ $oBlock->removeOrderFromAvailableOrders('price');
127
+ }
128
+ }
129
+ }
130
+
131
  /**
132
  * On the event catalog_product_type_configurable_price
133
  * Set the COnfigurable price of a product to 0 to stop the changed price showing up in the drop down
143
  $oProduct->setConfigurablePrice(0);
144
  }
145
  }
146
+
147
+ /**
148
+ * If we have a Mage_Catalog_Block_Layer_View
149
+ * - remove the price attribute
150
+ *
151
+ * @param Varien_Event_Observer $oObserver
152
+ */
153
+ public function onCoreLayoutBlockCreateAfter(Varien_Event_Observer $oObserver) {
154
+ $oBlock = $oObserver->getData('block');
155
+ if($oBlock instanceof Mage_Catalog_Block_Layer_View) {
156
+ /* @var $oB2BHelper Sitewards_B2BProfessional_Helper_Data */
157
+ $oB2BHelper = Mage::helper('b2bprofessional');
158
+
159
+ /*
160
+ * Get all possible category filters
161
+ * Assign to value b2bprof_category_filters to be used in
162
+ * Sitewards_B2BProfessional_Helper_Data->checkCategoryIsActive
163
+ */
164
+ /* @var $oCategoryFilter Mage_Catalog_Block_Layer_Filter_Category */
165
+ $oCategoryFilter = $oBlock->getChild('category_filter');
166
+ $oCategories = $oCategoryFilter->getItems();
167
+ $aCategoryOptions = array();
168
+ foreach($oCategories as $oCategory) {
169
+ /* @var $oCategory Mage_Catalog_Model_Layer_Filter_Item */
170
+ $iCategoryId = $oCategory->getValue();
171
+ $aCategoryOptions[] = $iCategoryId;
172
+ }
173
+ Mage::register('b2bprof_category_filters', $aCategoryOptions);
174
+
175
+ if($oB2BHelper->checkActive()) {
176
+ $aFilterableAttributes = $oBlock->getData('_filterable_attributes');
177
+ $aNewFilterableAttributes = array();
178
+ foreach ($aFilterableAttributes as $oFilterableAttribute) {
179
+ if($oFilterableAttribute->getAttributeCode() != 'price') {
180
+ $aNewFilterableAttributes[] = $oFilterableAttribute;
181
+ }
182
+ }
183
+ $oBlock->setData('_filterable_attributes', $aNewFilterableAttributes);
184
+ }
185
+ }
186
+ }
187
  }
app/code/community/Sitewards/B2BProfessional/etc/config.xml CHANGED
@@ -18,7 +18,7 @@
18
  <config>
19
  <modules>
20
  <Sitewards_B2BProfessional>
21
- <version>2.1.1</version>
22
  </Sitewards_B2BProfessional>
23
  </modules>
24
  <global>
@@ -45,6 +45,14 @@
45
  </b2bprofessional>
46
  </observers>
47
  </controller_action_predispatch>
 
 
 
 
 
 
 
 
48
  <core_block_abstract_to_html_after>
49
  <observers>
50
  <b2bprofessional>
@@ -61,6 +69,14 @@
61
  </b2bprofessional>
62
  </observers>
63
  </catalog_product_type_configurable_price>
 
 
 
 
 
 
 
 
64
  </events>
65
  <helpers>
66
  <b2bprofessional>
@@ -89,13 +105,6 @@
89
  </args>
90
  </Sitewards_B2BProfessional>
91
  </routers>
92
- <layout>
93
- <updates>
94
- <b2bprofessional>
95
- <file>B2BProfessional.xml</file>
96
- </b2bprofessional>
97
- </updates>
98
- </layout>
99
  <translate>
100
  <modules>
101
  <Sitewards_B2BProfessional>
18
  <config>
19
  <modules>
20
  <Sitewards_B2BProfessional>
21
+ <version>2.1.2</version>
22
  </Sitewards_B2BProfessional>
23
  </modules>
24
  <global>
45
  </b2bprofessional>
46
  </observers>
47
  </controller_action_predispatch>
48
+ <core_block_abstract_to_html_before>
49
+ <observers>
50
+ <b2bprofessional>
51
+ <class>b2bprofessional/observer</class>
52
+ <method>onCoreBlockAbstractToHtmlBefore</method>
53
+ </b2bprofessional>
54
+ </observers>
55
+ </core_block_abstract_to_html_before>
56
  <core_block_abstract_to_html_after>
57
  <observers>
58
  <b2bprofessional>
69
  </b2bprofessional>
70
  </observers>
71
  </catalog_product_type_configurable_price>
72
+ <core_layout_block_create_after>
73
+ <observers>
74
+ <b2bprofessional>
75
+ <class>b2bprofessional/observer</class>
76
+ <method>onCoreLayoutBlockCreateAfter</method>
77
+ </b2bprofessional>
78
+ </observers>
79
+ </core_layout_block_create_after>
80
  </events>
81
  <helpers>
82
  <b2bprofessional>
105
  </args>
106
  </Sitewards_B2BProfessional>
107
  </routers>
 
 
 
 
 
 
 
108
  <translate>
109
  <modules>
110
  <Sitewards_B2BProfessional>
package.xml CHANGED
@@ -1,7 +1,7 @@
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,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>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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sitewards_B2BProfessional</name>
4
+ <version>2.1.2</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>Remove the price range from search pages when customer is not active.</notes>
24
  <authors><author><name>Sitewards Magento Team</name><user>sitewards</user><email>magento@sitewards.com</email></author></authors>
25
+ <date>2013-03-22</date>
26
+ <time>09:35:42</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="248dd96fca4157eb7af8a25ff6f08478"/></dir><dir name="Model"><file name="Customer.php" hash="5b78023593622c28dc6ee1b02d89aa26"/><file name="Observer.php" hash="cb547c37164c243a179458ebd48b118a"/><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="13fe487a043b4559cb3da1d912862f2d"/><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>