Skip to content

Commit

Permalink
RWD: New header layout (#102)
Browse files Browse the repository at this point in the history
fballiano authored Jan 30, 2025
1 parent 0d1bec9 commit dfc4d85
Showing 14 changed files with 1,525 additions and 1,873 deletions.
2 changes: 1 addition & 1 deletion app/code/core/Mage/Customer/Block/Account/Dashboard.php
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ public function getReviewsUrl()
*/
public function getWishlistUrl()
{
return Mage::getUrl('customer/wishlist/index', ['_secure' => true]);
return Mage::helper('customer')->getWishlistUrl();
}

/**
5 changes: 5 additions & 0 deletions app/code/core/Mage/Customer/Helper/Data.php
Original file line number Diff line number Diff line change
@@ -311,6 +311,11 @@ public function getRegisterPostUrl()
return $this->_getUrl('customer/account/createpost');
}

public function getWishlistUrl(): string
{
return Mage::getUrl('wishlist', ['_secure' => true]);
}

/**
* Retrieve customer account edit form url
*
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
* @package Mage_Sales
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
* @copyright Copyright (c) 2019-2024 The OpenMage Contributors (https://openmage.org)
* @copyright Copyright (c) 2024 Maho (https://mahocommerce.com)
* @copyright Copyright (c) 2024-2025 Maho (https://mahocommerce.com)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
* @package base_default
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
* @copyright Copyright (c) 2021-2024 The OpenMage Contributors (https://openmage.org)
* @copyright Copyright (c) 2024 Maho (https://mahocommerce.com)
* @copyright Copyright (c) 2024-2025 Maho (https://mahocommerce.com)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

@@ -18,17 +18,15 @@
</div>
<div class="block-content">
<ul>
<?php $_links = $this->getLinks(); ?>
<?php $_index = 1; ?>
<?php $_count = count($_links); ?>
<?php foreach ($_links as $_link): ?>
<?php $_last = ($_index++ >= $_count); ?>
<?php if ($this->isActive($_link)): ?>
<li class="current<?= ($_last ? ' last' : '') ?>"><strong><?= $_link->getLabel() ?></strong></li>
<?php else: ?>
<li<?= ($_last ? ' class="last"' : '') ?>><a href="<?= $_link->getUrl() ?>"><?= $_link->getLabel() ?></a></li>
<?php endif ?>
<?php $links = $this->getLinks(); ?>
<?php foreach ($links as $link): ?>
<li <?= $this->isActive($link) ? 'class="current"' : '' ?>>
<a href="<?= $link->getUrl() ?>"><?= $link->getLabel() ?></a>
</li>
<?php endforeach ?>
<li>
<a href="<?= Mage::helper('customer')->getLogoutUrl() ?>"><?= $this->__('Logout') ?></a>
</li>
</ul>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -21,8 +21,6 @@
<?php endif ?>
<p class="rating-links">
<a href="#product-tab-reviews" onclick="document.querySelector(this.getAttribute('href')).click()"><?= $this->__('%d Review(s)', $this->getReviewsCount()) ?></a>
<span class="separator">|</span>
<a href="<?= $this->getReviewsUrl() ?>#review-form"><?= $this->__('Add Your Review') ?></a>
</p>
</div>
<?php elseif ($this->getDisplayIfEmpty()): ?>
Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@

<?php $_items = $this->getReviewsCollection()->getItems() ?>
<div class="box-collateral box-reviews" id="customer-reviews">
<a href="<?= $this->getReviewsUrl() ?>#review-form"><?= $this->__('Add Your Review') ?></a>

<?php if (count($_items)):?>
<dl>
<?php foreach ($_items as $_review):?>
13 changes: 13 additions & 0 deletions app/design/frontend/rwd/default/layout/checkout.xml
Original file line number Diff line number Diff line change
@@ -66,6 +66,9 @@ Default layout, loads most of the pages
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="head">
<action method="addItem"><type>skin_css</type><name>css/checkout.css</name></action>
</reference>
<reference name="content">
<block type="checkout/cart" name="checkout.cart">
<action method="setCartTemplate"><value>checkout/cart.phtml</value></action>
@@ -134,6 +137,9 @@ will be rendered on all checkout pages
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="head">
<action method="addItem"><type>skin_css</type><name>css/checkout.css</name></action>
</reference>
<reference name="content">
<block type="checkout/multishipping_state" name="checkout_state" template="checkout/multishipping/state.phtml"/>
</reference>
@@ -336,6 +342,7 @@ One page checkout main layout
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
<reference name="head">
<action method="addItem"><type>skin_css</type><name>css/checkout.css</name></action>
<action method="addJs"><script>varien/accordion.js</script></action>
<action method="addJs"><script>varien/opcheckout.js</script></action>
</reference>
@@ -518,6 +525,9 @@ One page checkout order review block
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="head">
<action method="addItem"><type>skin_css</type><name>css/checkout.css</name></action>
</reference>
<reference name="content">
<block type="checkout/onepage_success" name="checkout.success" template="checkout/success.phtml"/>
</reference>
@@ -527,6 +537,9 @@ One page checkout order review block
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
<reference name="head">
<action method="addItem"><type>skin_css</type><name>css/checkout.css</name></action>
</reference>
<reference name="content">
<block type="checkout/onepage_failure" name="checkout.failure" template="checkout/onepage/failure.phtml"/>
</reference>
Original file line number Diff line number Diff line change
@@ -6,32 +6,20 @@
* @package rwd_default
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
* @copyright Copyright (c) 2021-2024 The OpenMage Contributors (https://openmage.org)
* @copyright Copyright (c) 2024 Maho (https://mahocommerce.com)
* @copyright Copyright (c) 2024-2025 Maho (https://mahocommerce.com)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* Shoping cart sidebar
*
* @see Mage_Checkout_Block_Cart_Sidebar
* @var Mage_Checkout_Block_Cart_Sidebar $this
*/

?>

<?php
$_cartQty = $this->getSummaryCount();
if(empty($_cartQty)) {
$_cartQty = 0;
}
/** @var Mage_Checkout_Block_Cart_Sidebar $this */
?>

<a href="<?= $this->helper('checkout/cart')->getCartUrl() ?>" data-target-element="#header-cart" class="skip-link skip-cart <?php if($_cartQty <= 0): ?> no-count<?php endif ?>" title="<?= $this->__('Cart') ?>">
<?php $qty = $this->getSummaryCount() ?: 0 ?>
<a href="<?= $this->helper('checkout/cart')->getCartUrl() ?>" data-target-element="#header-cart" class="skip-link skip-cart" title="<?= $this->__('Cart') ?>">
<span class="icon"></span>
<span class="label"><?= $this->__('Cart') ?></span>
<span class="count"><?= $_cartQty ?></span>
<span class="count count-<?= $qty ?>"><?= $qty ?></span>
</a>

<div id="header-cart" class="block block-cart skip-content">
<div id="header-cart" class="block-cart skip-content">
<?= $this->getChildHtml('minicart_content') ?>
</div>

This file was deleted.

16 changes: 5 additions & 11 deletions app/design/frontend/rwd/default/template/directory/currency.phtml
Original file line number Diff line number Diff line change
@@ -6,25 +6,19 @@
* @package rwd_default
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
* @copyright Copyright (c) 2021-2024 The OpenMage Contributors (https://openmage.org)
* @copyright Copyright (c) 2024 Maho (https://mahocommerce.com)
* @copyright Copyright (c) 2024-2025 Maho (https://mahocommerce.com)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Directory_Block_Currency $this */
?>
<?php
/**
* Currency switcher
*
* @see Mage_Directory_Block_Currency
* @var Mage_Directory_Block_Currency $this
*/
?>
<?php if($this->getCurrencyCount()>1): ?>
<?php if ($this->getCurrencyCount() > 1): ?>
<div class="currency-switcher">
<label for="select-currency"><?= $this->__('Your Currency:') ?></label>
<select id="select-currency" name="currency" title="<?= Mage::helper('core')->quoteEscape($this->__('Your Currency')) ?>" onchange="setLocation(this.value)">
<?php foreach ($this->getCurrencies() as $_code => $_name): ?>
<option value="<?= $this->getSwitchCurrencyUrl($_code) ?>"<?php if($_code==$this->getCurrentCurrencyCode()): ?> selected="selected"<?php endif ?>>
<?= $_name ?> - <?= $_code ?>
<?= Mage::app()->getLocale()->currency($_code)->getSymbol() ?>
</option>
<?php endforeach ?>
</select>
69 changes: 26 additions & 43 deletions app/design/frontend/rwd/default/template/page/html/header.phtml
Original file line number Diff line number Diff line change
@@ -12,63 +12,46 @@

/** @var Mage_Page_Block_Html_Header $this */
?>
<header id="header" class="page-header">
<div class="page-header-container skip-links">
<div>
<a href="#header-nav" class="skip-link skip-nav">
<span class="icon"></span>
<span class="label"><?= $this->__('Menu') ?></span>
</a>

<div class="header-language-background">
<div class="header-language-container">
<div class="store-language-container">
<?= $this->getChildHtml('store_language') ?>
<a class="logo" href="<?= $this->getUrl('') ?>" title="<?= $this->__('Go to Home Page') ?>">
<img src="<?= $this->getLogoSrc() ?>" alt="<?= $this->getLogoAlt() ?>" width="<?= $this->getLogoWidth() ?>" height="<?= $this->getLogoHeight() ?>" />
</a>
</div>

<?= $this->getChildHtml('currency_switcher') ?>

<p class="welcome-msg"><?= $this->getChildHtml('welcome') ?> <?= $this->getAdditionalHtml() ?></p>
</div>
</div>

<header id="header" class="page-header">
<div class="page-header-container">
<a class="logo" href="<?= $this->getUrl('') ?>" title="<?= $this->__('Go to Home Page') ?>">
<img src="<?= $this->getLogoSrc() ?>" alt="<?= $this->getLogoAlt() ?>" width="<?= $this->getLogoWidth() ?>" height="<?= $this->getLogoHeight() ?>" />
</a>
<?= $this->getChildHtml('topSearch') ?>

<?php // In order for the language switcher to display next to logo on smaller viewports, it will be moved here.
// See app.js for details ?>
<div class="store-language-container"></div>
<div>
<?= $this->getChildHtml('store_language') ?>
<?= $this->getChildHtml('currency_switcher') ?>

<div class="skip-links">
<a href="#header-nav" class="skip-link skip-nav">
<a href="<?= $this->helper('customer')->getAccountUrl() ?>" class="skip-link skip-account" title="<?= $this->__('Account') ?>">
<span class="icon"></span>
<span class="label"><?= $this->__('Menu') ?></span>
<span class="label"><?= $this->__('Account') ?></span>
</a>

<a href="#header-search" class="skip-link skip-search" title="<?= $this->__('Search') ?>">
<?php if ($this->isModuleOutputEnabled('Mage_Wishlist') && Mage::getStoreConfig('wishlist/general/active')): ?>
<a href="<?= $this->helper('customer')->getWishlistUrl() ?>" class="skip-link skip-wishlist" title="<?= $this->__('Wishlist') ?>">
<span class="icon"></span>
<span class="label"><?= $this->__('Search') ?></span>
<span class="label"><?= $this->__('Wishlist') ?></span>
</a>
<?php endif ?>

<div class="account-cart-wrapper">
<a href="<?= $this->helper('customer')->getAccountUrl() ?>" data-target-element="#header-account" class="skip-link skip-account" title="<?= $this->__('Account') ?>">
<span class="icon"></span>
<span class="label"><?= $this->__('Account') ?></span>
</a>

<div class="header-minicart">
<?= $this->getChildHtml('minicart_head') ?>
</div>
<div class="header-minicart">
<?= $this->getChildHtml('minicart_head') ?>
</div>
</div>
</div>

<div id="header-nav" class="skip-content">
<?= $this->getChildHtml('topMenu') ?>
</div>

<div id="header-search" class="skip-content">
<?= $this->getChildHtml('topSearch') ?>
</div>

<div id="header-account" class="skip-content">
<?= $this->getChildHtml('topLinks') ?>
</div>
<div id="minicart-container-mobile" class="header-minicart"></div>
<div id="header-nav" class="skip-content">
<?= $this->getChildHtml('topMenu') ?>
</div>
</header>

Loading

0 comments on commit dfc4d85

Please sign in to comment.