Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Patch for "Webguys / Customer Navigation" (add "My Applications" for Magento 1.7)
<?php
class Webguys_CustomerNavigation_Block_Account_Navigation extends Mage_Customer_Block_Account_Navigation {
public function getLinks(){
$pre_links = $this->_links;
$tmp_links = array();
$this->_links = array();
$startcnt = 100000;
/*
* remove not(!) magento customer account links
*/
foreach ($pre_links as $_link) {
$tmpName = $this->_getFormattedName( $_link->getName() );
if( is_null( Mage::getStoreConfig( 'customernavigation/settings/show_' . $tmpName ) ) ){
$tmp_links[($startcnt++)] = $_link;
}
}
/*
* add allowed account links
*/
foreach ($pre_links as $_link) {
$tmpName = $this->_getFormattedName( $_link->getName() );
if( Mage::getStoreConfig( 'customernavigation/settings/show_' . $tmpName ) ) {
$tmp_links[ Mage::getStoreConfig( 'customernavigation/reorder/position_' . $tmpName ) ] = $_link;
}
}
/*
* resort and add the link
*/
ksort( $tmp_links );
foreach ($tmp_links as $key=>$_link) {
$tmpName = $this->_getFormattedName( $_link->getName() );
$this->addLink($tmpName, $_link->getPath(), $_link->getLabel());
}
return $this->_links;
}
protected function _getFormattedName( $name )
{
return strtolower( str_replace(' ', '_', $name) );
}
}
<?xml version="1.0"?>
<config>
<sections>
<customernavigation translate="label title" module="customernavigation">
<title>Frontend Customer Navigation</title>
<label>Frontend Customer Navigation</label>
<tab>general</tab>
<frontend_type>text</frontend_type>
<sort_order>1000</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<groups>
<settings translate="label">
<label>Change Status</label>
<frontend_type>text</frontend_type>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<fields>
<show_account translate="label">
<label>My Account</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</show_account>
<show_account_edit translate="label">
<label>Account Information</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>20</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</show_account_edit>
<show_address_book translate="label">
<label>Address Book</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>30</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</show_address_book>
<show_orders translate="label">
<label>Orders</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>40</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</show_orders>
<show_billing_agreements translate="label">
<label>Billing Agreements</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>50</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</show_billing_agreements>
<show_recurring_profiles translate="label">
<label>Recurring Profiles</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>60</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</show_recurring_profiles>
<show_reviews translate="label">
<label>Reviews</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>70</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</show_reviews>
<show_tags translate="label">
<label>Tags</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>80</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</show_tags>
<show_wishlist translate="label">
<label>Wishlist</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>90</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</show_wishlist>
<show_downloadable_products translate="label">
<label>Downloadable Products</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>100</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</show_downloadable_products>
<show_newsletter translate="label">
<label>Newsletter</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>110</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</show_newsletter>
<show_oauth_customer_tokens translate="label">
<label>My Applications</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>120</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</show_oauth_customer_tokens>
</fields>
</settings>
<reorder translate="label, comment">
<label>Reorder Items</label>
<comment>Bestimmen Sie die Position der Links durch Vergabe von Positionierungs-Nr. von 1 - 1000</comment>
<frontend_type>text</frontend_type>
<sort_order>120</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<fields>
<position_account translate="label comment">
<label>My Account</label>
<comment>Make sure this value is unique</comment>
<frontend_type>text</frontend_type>
<sort_order>15</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</position_account>
<position_account_edit translate="label comment">
<label>Account Information</label>
<comment>Make sure this value is unique</comment>
<frontend_type>text</frontend_type>
<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>
</position_account_edit>
<position_address_book translate="label comment">
<label>Address Book</label>
<comment>Make sure this value is unique</comment>
<frontend_type>text</frontend_type>
<sort_order>35</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</position_address_book>
<position_orders translate="label comment">
<label>Orders</label>
<comment>Make sure this value is unique</comment>
<frontend_type>text</frontend_type>
<sort_order>45</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</position_orders>
<position_billing_agreements translate="label comment">
<label>Billing Agreements</label>
<comment>Make sure this value is unique</comment>
<frontend_type>text</frontend_type>
<sort_order>55</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</position_billing_agreements>
<position_recurring_profiles translate="label comment">
<label>Recurring Profiles</label>
<comment>Make sure this value is unique</comment>
<frontend_type>text</frontend_type>
<sort_order>65</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</position_recurring_profiles>
<position_reviews translate="label comment">
<label>Reviews</label>
<comment>Make sure this value is unique</comment>
<frontend_type>text</frontend_type>
<sort_order>75</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</position_reviews>
<position_tags translate="label comment">
<label>Tags</label>
<comment>Make sure this value is unique</comment>
<frontend_type>text</frontend_type>
<sort_order>85</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</position_tags>
<position_wishlist translate="label comment">
<label>Wishlist</label>
<comment>Make sure this value is unique</comment>
<frontend_type>text</frontend_type>
<sort_order>95</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</position_wishlist>
<position_downloadable_products translate="label comment">
<label>Downloadable Products</label>
<comment>Make sure this value is unique</comment>
<frontend_type>text</frontend_type>
<sort_order>105</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</position_downloadable_products>
<position_newsletter translate="label comment">
<label>Newsletter</label>
<comment>Make sure this value is unique</comment>
<frontend_type>text</frontend_type>
<sort_order>115</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</position_newsletter>
</fields>
</reorder>
</groups>
</customernavigation>
</sections>
</config>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.