There are two supported ways to install the module, either via Composer or manually.
To install the AddresssFinder module for Magento 1, run:
composer require addressfinder/module-magento1
composer config extra.magento-root-dir "MAGENTO INSTALLATION DIRECTORY"
composer require magento-hackathon/magento-composer-installer:*
composer run-script post-install-cmd -vvv -- --redeploy
The magento-hackathon/magento-composer-installer creates symlinks between the vendor files created by composer, and your magento install. For this to work, you must tell composer where you have installed Magento.
Tip: Don't forget to enable symlinks in your Magento installation to enable Composer installation to work. This isn't specific to AddressFinder, but a common "gotcha". Read more.
Firstly, download the latest ZIP, then merge the following files/directories into your existing project:
app/code/community/AddressFinder
app/design/frontend/base/default/layout/addressfinder.xml
app/design/frontend/base/default/template/addressfinder
app/etc/modules/AddressFinder_AddressFinder.xml
js/addressfinder
After installation, it's important to clear any caches.
Follow the user guide on the AddressFinder website:
The following templates are exposed:
app/design/frontend/base/default/template/addressfinder/checkout/onepage/billing.phtml
- sets up AddressFinder on the billing step of the checkout.app/design/frontend/base/default/template/addressfinder/checkout/onepage/shipping.phtml
- sets up AddressFinder on the shpping step of hte checkout.app/design/frontend/base/default/template/addressfinder/customer/address/form.phtml
- sets up AddressFinder on the customer address management page.
Further, a number of JavaScript events are fired. We've identified the important events:
addressfinder:magento:loaded
- when AddressFinder has loaded, used by frontend templates to initialiseaddressfinder:magento:initialising
addressfinder:magento:initialised
addressfinder:magento:enabling
- when AddressFinder is being enabled as the country is changed (one widget per country)addressfinder:magento:enabled
addressfinder:magento:disabling
- when AddressFinder is being disabled as the country is changed (one widget per country)addressfinder:magento:disabled
addressfinder:magento:refreshing
addressfinder:magento:refreshed
addressfinder:magento:provider:registering
- when a provider is being registered (AU or NZ)addressfinder:magento:widget:registering
- when a widget is being registered for a provider (AU or NZ)addressfinder:magento:result:select
- when a result is selectedaddressfinder:magento:value
- when a value is being set on for the given metadata key, e.g.city
toSydney
.addressfinder:magento:transform
To attach functionality to these, simply add observers as per the Prototype 1.7 documentatio:
document.observe('addressfinder:magento:result:select', function (event) {
// The payload of the event is located in event.memo
// console.log(event.memo.fullAddress);
// console.log(event.memo.metaData);
});
To test this plugin, clone the docker-magento1 repo: https://github.com/abletech/docker-magento1. Follow the steps in this project to create your Magento store and test your changes to the AddressFinder plugin.
To begin development, you will need a copy of Magento installed using Composer. Create the following composer.json
file in a working directory:
{
"repositories": {
"firegento": {
"type": "composer",
"url": "https://packages.firegento.com"
}
},
"require": {
"magento-hackathon/magento-composer-installer": "^3.1",
"aydin-hassan/magento-core-composer-installer": "^1.5",
"firegento/magento": "v1.9.3.10"
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"magento-root-dir": "./public"
}
}
After you have created this file, simply run composer install
to setup your Magento 1.9 environment. Of course, you can substitute any version of Magento into the file you've created, we're just using the latest.
From here, clone the repository to a location (such as inside your newly created Magento project):
git clone https://github.com/AbleTech/addressfinder-magento-1.git
You may now use a feature of Composer to pull in the locally cloned repository as a Composer dependency. Simply update your composer.json
file
{
"repositories": {
"firegento": {
"type": "composer",
"url": "https://packages.firegento.com"
},
"addressfinder": {
"type": "path",
"url": "./module-magento1"
}
},
"require": {
"magento-hackathon/magento-composer-installer": "^3.1",
"aydin-hassan/magento-core-composer-installer": "^1.5",
"firegento/magento": "v1.9.3.10",
"addressfinder/module-magento1": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"magento-root-dir": "./public"
}
}
You can now make changes in the module and they will reflect in your Magento store.
In order to compile assets, simply run (from within the repository):
npm install
npm run dev
There's also the following tasks which may be of use:
# Minitfy assets
npm run production
# Watch and automatically recompile