Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Commit

Permalink
[+TASK] Add delivery time display to product view, category view and …
Browse files Browse the repository at this point in the history
…search result pages (closes #133)
  • Loading branch information
avstudnitz committed Feb 26, 2013
1 parent 35ffb4a commit 0e9bc5d
Show file tree
Hide file tree
Showing 7 changed files with 493 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public function _toHtml()
->toHtml();
$htmlObject->setHtml($htmlTemplate);

$this->_addDeliveryTimeHtml($htmlObject);

Mage::dispatchEvent('germansetup_after_product_price',
array(
'html_obj' => $htmlObject,
Expand All @@ -81,6 +83,27 @@ public function _toHtml()
return $html;
}

/**
* Add delivery time on category pages only
*
* @param $htmlObject
*/
protected function _addDeliveryTimeHtml($htmlObject)
{
if (!Mage::getStoreConfigFlag('catalog/price/display_delivery_time_on_categories')) {
return;
}

$pathInfo = Mage::app()->getRequest()->getPathInfo();
if (strpos($pathInfo, 'catalog/category/view') !== false
|| strpos($pathInfo, 'catalogsearch/result') !== false) {
if ($this->getProduct()->getDeliveryTime()) {
$html = '<p class="delivery-time">' . $this->__('Delivery Time') . ': ' . $this->getProduct()->getDeliveryTime() . '</p>';
$htmlObject->setSuffix($html);
}
}
}

/**
* Read tax rate from current product.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,21 @@ class FireGento_GermanSetup_Block_Checkout_Information extends Mage_Core_Block_T
*/
public function getCheckoutAdditionalInformation()
{
if (!Mage::getStoreConfigFlag(self::XML_PATH_CHECKOUT_DISPLAY_ADDITIONAL_INFORMATION)) {
return false;
$additional = '';

if (Mage::getStoreConfigFlag(self::XML_PATH_CHECKOUT_DISPLAY_ADDITIONAL_INFORMATION)) {
$additional = trim(Mage::getStoreConfig(self::XML_PATH_CHECKOUT_ADDITIONAL_INFORMATION));
}

$additional = Mage::getStoreConfig(self::XML_PATH_CHECKOUT_ADDITIONAL_INFORMATION);
$additional = trim($additional);
// Dispatch Event in order to allow adding more additional information texts
$additionalObject = new Varien_Object(array('text' => $additional));
Mage::dispatchEvent('checkout_additional_information', array('additional' => $additionalObject));
$additional = $additionalObject->getText();

if ($additional) {
return $additional;
if (!$additional) {
return false;
}

return false;
return $additional;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@
<catalog>
<price>
<display_block_below_price>1</display_block_below_price>
<display_delivery_time_on_categories>1</display_delivery_time_on_categories>
<cms_page_shipping>lieferung</cms_page_shipping>
</price>
</catalog>
Expand Down
9 changes: 9 additions & 0 deletions src/app/code/community/FireGento/GermanSetup/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</display_block_below_price>
<display_delivery_time_on_categories translate="label,comment" module="germansetup">
<label>Display Delivery time on Category Pages</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>25</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</display_delivery_time_on_categories>
<cms_page_shipping translate="label" module="germansetup">
<label>CMS Page for Shipping Info</label>
<frontend_type>select</frontend_type>
Expand Down
Loading

0 comments on commit 0e9bc5d

Please sign in to comment.