Permalink
Browse files

[~TASK] Removed shipping link for virtual and downloadable products

[~TASK] Removed percentage number for bundle products
  • Loading branch information...
1 parent ba589f0 commit 78bbfbc4b565b32eaa77c7f39e0fdec7711b8c39 @therouv therouv committed Mar 12, 2012
@@ -51,6 +51,7 @@ public function _toHtml()
->setTemplate('germansetup/price_info.phtml')
->setFormattedTaxRate($this->getFormattedTaxRate())
->setIsIncludingTax($this->isIncludingTax())
+ ->setIsShowShippingLink($this->isShowShippingLink())
->toHtml();
return $html;
@@ -76,7 +77,9 @@ public function getTaxRate()
*/
public function getFormattedTaxRate()
{
- if ($this->getTaxRate() === null) {
+ if ($this->getTaxRate() === null
+ || $this->getProduct()->getTypeId() == 'bundle'
+ ) {
return '';
}
@@ -98,6 +101,22 @@ public function isIncludingTax()
return $this->getData('is_including_tax');
}
+ /**
+ * Returns whether the shipping link needs to be shown
+ * on the frontend or not.
+ *
+ * @return bool
+ */
+ public function isShowShippingLink()
+ {
+ $productTypeId = $this->getProduct()->getTypeId();
+ $ignoreTypeIds = array('virtual', 'downloadable');
+ if (in_array($productTypeId, $ignoreTypeIds)) {
+ return false;
+ }
+ return true;
+ }
+
/**
* Gets tax percents for current product
*
@@ -51,6 +51,7 @@ public function _toHtml()
->setTemplate('germansetup/price_info.phtml')
->setFormattedTaxRate($this->getFormattedTaxRate())
->setIsIncludingTax($this->isIncludingTax())
+ ->setIsShowShippingLink($this->isShowShippingLink())
->toHtml();
return $html;
@@ -76,7 +77,9 @@ public function getTaxRate()
*/
public function getFormattedTaxRate()
{
- if ($this->getTaxRate() === null) {
+ if ($this->getTaxRate() === null
+ || $this->getProduct()->getTypeId() == 'bundle'
+ ) {
return '';
}
@@ -98,6 +101,22 @@ public function isIncludingTax()
return $this->getData('is_including_tax');
}
+ /**
+ * Returns whether the shipping link needs to be shown
+ * on the frontend or not.
+ *
+ * @return bool
+ */
+ public function isShowShippingLink()
+ {
+ $productTypeId = $this->getProduct()->getTypeId();
+ $ignoreTypeIds = array('virtual', 'downloadable');
+ if (in_array($productTypeId, $ignoreTypeIds)) {
+ return false;
+ }
+ return true;
+ }
+
/**
* Gets tax percents for current product
*
@@ -1,5 +1,5 @@
<?php $shippingCostUrl = Mage::helper('germansetup')->getShippingCostUrl() ?>
-<?php if (!empty($shippingCostUrl)): ?>
+<?php if (!empty($shippingCostUrl) && $this->getIsShowShippingLink()): ?>
<?php if ($this->getIsIncludingTax() == Mage_Tax_Model_Config::DISPLAY_TYPE_EXCLUDING_TAX): ?>
<?php echo $this->__('Excl. %s Tax, plus <a href="%s">Shipping Cost</a>', $this->getFormattedTaxRate(), $shippingCostUrl) ?>
<?php elseif ($this->getIsIncludingTax() == Mage_Tax_Model_Config::DISPLAY_TYPE_INCLUDING_TAX): ?>

0 comments on commit 78bbfbc

Please sign in to comment.