Nested XML Menus using addLink() in Magento

Natively Magento doesn’t have a direct method to nest menu items using the page/template_links->addLink() function, but we had some menus that will never change and are best set in the layout XML rather than in the database/CMS. There is a feature to addLinkBlock() – but this relies on the block outputting the wrapping <li> – but as we intended to nest addLink(), this wouldn’t quite work. So we put together a tiny extension to offer this functionality, The files You’ll need to create the following files and directories first, ./app/code/community/Sonassi/TemplateLinks ./app/code/community/Sonassi/TemplateLinks/etc ./app/code/community/Sonassi/TemplateLinks/Block/Page/Template ./app/etc/modules/Sonassi_TemplateLinks.xml ./app/code/community/Sonassi/TemplateLinks/etc/config.xml ./app/code/community/Sonassi/TemplateLinks/Block/Page/Template/Links.php ./app/design/frontend/x/x/template/page/template/links_nested.phtml Add this to ./app/etc/modules/Sonassi_TemplateLinks.xml <?xml version=”1.0″?> <!– /* * @category Module * @package Sonassi_TemplateLinks * @copyright Copyright (c) 2012 Sonassi */ –> <config> <modules> <Sonassi_TemplateLinks> <active>true</active> <codePool>community</codePool> </Sonassi_TemplateLinks> </modules> </config> Add this to ./app/code/community/Sonassi/TemplateLinks/etc/config.xml <?xml version="1.0"?> <!– /* * @category Module * @package Sonassi_TemplateLinks * @copyright Copyright (c) 2012 Sonassi */ –> <config> <modules> … Continue reading

Giving support access to Magento (for EE support) … with a regex

As part of an EE upgrade, we’ve just hit a reproducable core bug with 1.11; as we have to focus on the other fixes, we’re letting Magento’s EE SLA’ed support take care of the core bugs. But, in order to do that, they need access to the machine. The Magento support IPs As we’re restricting Nginx to maintenance mode – we need to open access for their IP ranges. Magento have around 600 IP addresses that they need to you open up, which the majority of is within large subnet blocks; however, Nginx doesn’t support subnets for the type of matching we use for maintenance mode. So first I tried just putting all 600 IPs in, subnet to individual IP conversion was courtesy of TechZoom. if ($remote_addr ~ (|||||||6…. But Nginx didn’t like this … Testing … Continue reading

Maintenance page with Nginx with specific permitted access

At the moment, we’re in a fairly complicated upgrade of a Magento live store and during the upgrade window, it is necessary to put up a holding page. A simple maintenance.flag file isn’t going to cut it for this process, so cutting off users at the web server is more suitable. For this particular customer, they have a complex 3 server cluster running a single site with over 240,000 unique visitors per day, so Nginx was a more appropriate choice. Going into maintenance Putting up a maintenance page with a 503 header is required, but in addition to this, to make sure payment gateway IPNs can function correctly, we need to permit access to some URLs (where we do not know the source IP address), eg. PayPal or Ogone. Also, we’ll need to add our own IP address to the allow list. In the Nginx vhost configuration file: server { … Continue reading

Fully Automated Magento Install Script

As we’re a popular Magento hosting and Magento development company, we find ourselves installing Magento quite a lot throughout the day. A few years ago we wrote an installation script, but rudely forgot to share it with the community. You can find it here (full) OR (shortened) The features • Using the script is really easy • Support for CE/EE • Supports installation with/without sample data • Chooses the correct sample data for the version of Magento you are using • Automatically re-indexes after installation • Automatically completes the full installer (with en_GB defaults) • Automatically creates an admin account • Supports CE 1.3/1.4/1.5/1.6 EE 1.10/1.11 Using the installer for Community Edition   First log into your SSH account and execute, wget -O   Then execute the script, it takes a minimum of 5 arguments and 2 optional arguments. Required arguments 1. DB Host 2. DB … Continue reading

Magento Checklist for Design Elements

We are starting a new Magento Enterprise project today and whilst populating some of the base items in the Basecamp project, I thought it might be of use to the community to list the basic minimum items we add to our templating/skinning check-list for a Magento website. Ignoring any project specific pages/customisations, the following list is the minimum pages we must skin/satisfy for a Magento project. It is also the list of designs that we ask clients/agencies to supply if they are supplying their own design for us to skin/build. So in no particular order … Magento design check-list Main Template Main template (header) Main template (top navigation) Main template (footer) Main template (footer navigation) Main template (favicon) Main template (1 col) Main template (2 col right) Main template (2 col left) Main template (3 col) Main template (notifications success/error/info) Sidebar Elements Sidebar – Poll (vote overview) Sidebar – Poll … Continue reading