Skip to content

Commit 06db362

Browse files
committed
refactored observer
1 parent 34c92fb commit 06db362

File tree

1 file changed

+12
-8
lines changed
  • app/code/community/CustomGento/ConfigurableTierPrices/Model

1 file changed

+12
-8
lines changed

app/code/community/CustomGento/ConfigurableTierPrices/Model/Observer.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public function catalogProductGetFinalPrice(Varien_Event_Observer $observer)
2323
{
2424
$product = $observer->getProduct();
2525

26-
if (!$this->_helper->isExtensionEnabled() ||
27-
$this->_helper->isProductInDisabledCategory($product) ||
28-
$this->_helper->isExtensionDisabledForProduct($product)
26+
if (!$this->_helper->isExtensionEnabled()
27+
|| $this->_helper->isProductInDisabledCategory($product)
28+
|| $this->_helper->isExtensionDisabledForProduct($product)
2929
) {
3030
return $this;
3131
}
@@ -81,12 +81,16 @@ protected function _calculateTierPrice($product)
8181
*/
8282
protected function _calculateTotalQuantity($product)
8383
{
84-
return array_reduce($this->_getAllVisibleItems(), function ($total, $item) use ($product) {
85-
if ($item->getProductId() == $product->getId()) {
86-
$total += $item->getQty();
84+
return array_reduce(
85+
$this->_getAllVisibleItems(),
86+
function ($total, $item) use ($product) {
87+
if ($item->getProductId() == $product->getId()) {
88+
$total += $item->getQty();
89+
}
90+
91+
return $total;
8792
}
88-
return $total;
89-
});
93+
);
9094
}
9195

9296
/**

0 commit comments

Comments
 (0)