define('WP_HOME','http://www.auctionmaid.com/blog'); define('WP_SITEURL','http://www.auctionmaid.com/blog'); Making sense of chaos | Developing Magento
Nov 19 2009

UPS XML Setup on Magento

Pre-Requisite

  1. Get UPS Account – either online or contact your local UPS (as case in UK)
  2. Get UPS Login – http://www.ups.com
  3. Get Developer Key – Look under Support->Technology Support->UPS Online Tools
  4. Get access key – need developer key and Account number for this

And then on Magento

If using SSL omit step 1

  1. In Ups .php add lines just before this – $xmlResponse = curl_exec ($ch);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  2. Switch on UPS shipping method
  3. Add in user_id, access key, pwd
  4. Test

It’s that easy! I found that changing URLs and anything else was not required.


Sep 23 2009

Sage Pay Magento Setup – Multi-Currencies

I needed to setup SagePay Direct for my new magento extension website www.webshopapps.com. This website uses multiple currencies to show the customer the rates in GBP(base), Euro, USD, AUD. Because of the problems with getting authorisation to receive in multiple currencies I decided to go for a single store approach.

Getting SagePay to work was a challenge – here is what I did:

  1. Installed SagePay via Magento Connect
  2. Copied default/default/layout/protxDirect.xml to theme layout folder
  3. Copied default/default/template/checkout/* payment/* and protxdirect/* files (where relevant) to theme template folder
  4. Refreshed cache
  5. In System->Payment Methodds enabled and put in vendorname, verification=Yes, and selected the currencies I wanted to support
  6. In System->Manage Currency Rates I made sure the conversions were in place for currencies (otherwise extension throws a wobbler)
  7. Modified template/checkout/total/b4before_default.html – around line 42 I changed getBaseCurrency call to be getCurrentCurrency()->getCode()

Without the final change the customer was seeing a USD total, but not the converted GBP total that they were actually being charged.


Aug 17 2009

Importing & Exporting Products

Manually adding products in Magento can be very time consuming. Here I’m going to talk about how to add products using a csv file.

I’d suggest you add one product manually first. This will give you an initial configuration.

To export:

  1. Navigate to System->Import/Export->Profiles
  2. Click “Export all Products”
  3. Click Run Profile -> Run Profile in Popup

You will now have an export file in /var/export.

Open this file. You can see it has a list of attributes across the top. These are taken directly from the attributes as defined in Catalog->Attributes.

Note the category_id attribute, this is set to the id of the category the product resides in. To find out the id’s available look either in the Catalog->Category as it is displayed there. If you don’t select the correct category the products will not display on import.

Modify/add rows as appropriate.

To import:

  1. Navigate to System->Import/Export->Profiles
  2. Click “Import all Products”
  3. Click “Upload File”
  4. Select csv file to import
  5. Click “Save and Continue Editing”
  6. Click “Run Profile”
  7. Select file and press “Run Profile in Popup” – this can take some time

Aug 15 2009

Installing Community Extensions via SSH

I’ve never really like the idea of having to do a chmod 777 on all directories to install community extensions from Magento.

So here is how to do via SSH. Obviously this only works if you have SSH access to your website.

  1. Navigate to base magento directory
  2. ./pear mage-setup
  3. ./pear -V
  4. ./pear list-channels
  5. ./pear install connect.magentocommerce.com/community/<extname>

e.g. ./pear install connect.magentocommerce.com/community/Yoast_Blank_Seo_Theme

Finally do a chown -R on your directories to whatever your’s is, otherwise they will have root:root

Superb!


Aug 2 2009

Updating to PHP 5 on VPS Server

You wouldn’t think it would be hard – I have Plesk 9 recently installed. I need PHP5, and it’s not there.

Here are the commands I used to update:

wget -q -O – http://www.atomicorp.com/installers/atomic.sh | sh

yum clean all

yum remove sitebuilder

yum remove sb-publish

rpm -e php-sqlite2

yum update

mv /etc/php.ini.rpmnew /etc/php.ini

service httpd restart

mysqlcheck –check-upgrade –all-databases –auto-repair -uadmin -p<password>

mysql_fix_privilege_tables

cat /usr/share/mysql/mysql_fix_privilege_tables.sql | /usr/bin/mysql –no-defaults –force –user=admin –password=<password> –host=localhost –database=mysql

yum install php-mcrypt

service httpd restart

The stuff in red is only needed if you get problems with PHP 4.4.0 dependencies, and problems when you try to go into Plesk panel and it shows lots of errors!


Jun 30 2009

Upgrading Magento

I hate the Magento Connect upgrade option for Magento. From what I’ve seen in my own experience, and that of those on the forums, it seems an utter mess, and very hit and miss as to what it updates and what it doesnt.

Here is my preferred approach, you really have to think about this from day 1 of your first installation to save yourself pain (something I didn’t do!):

Initial Installation

  1. Setup Tortoise SVN
  2. Take a copy of default theme, change to your theme name and put in svn
  3. Make edits to theme, commit to svn
  4. Any other edits to base installation commit to svn

Upgrade Installation:

  1. Take a copy of the database on live server
  2. Create local database and import data from live server
  3. Create new Magento directory on webserver, put on new Magento package (e.g. 1.3.2.1)
  4. Run installation – use database copy when asked for db details
  5. Re-install all extensions (this is a good thing to do as ensures you have latest versions)
  6. Use SVN files you have saved from previous install and SVN diff capability to re-apply theme /changes (or just gamble and copy the theme across – note this is very very dangerous and requires lots of testing)

I’m not promising this approach will work 100%, but in my experience it’s a better idea than trying to do an upgrade, it failing, then trying to unpick what went on for the next month!


Jun 29 2009

Importing/Exporting Magento Databases

Magento Databases can get pretty big. Here are some commands to help with import/export.

Exporting:

mysqldump -h localhost -u <username> -p <dbname> > <exportname>.sql
Importing:

mysql -h localhost -u <username> -p <dbname> < <importname>.sql
e.g. mysql -h localhost -u karen -p auctionmaid < auctionmaid.sql

Transferring files via from remote shell:

pscp <username>@<remoteip>:<fullpath_to_sql_file>.sql <local_sql_file>.sql
e.g.
pscp root@1.1.1.1:/var/www/vhosts/auctionmaid.co.uk/auctionmaid.sql > auctionmaid.sql


Apr 15 2009

Multiple Tablerates via CSV file – Auctionmaid Matrixrate

I wrote this extension back in Sept/Oct 08 for a web design company that was developing a site in Magento. It went on Magento Connect in Dec08. Since then I’ve had over 1600 downloads, so I guess people must like it!

The beauty of this extension is that you can manage all your shipping and delivery via a csv file.

You can give a customer a choice of shipping options (e.g. do you want it now or next week), which suprisingly isn’t available with the default Magento installation unless you combine shipping methods.

What else? Well, what about filtering by country, or region/state, or city, or postcode, or partial postcode – yep this is all covered.

It has some bells and whistles, like allowing numerical postcode ranges which is great for the Australian market. And allowing postcode pattern matching, which is a must for complex UK requirements (like wanting to charge differently for postcodes that start with PO20).

Want to see a demo: http://www.auctionmaid.com/mag13a

See the documentation.


Mar 12 2009

Adding a custom attribute

Custom attributes are associated with products, and are suitable for a wide range of uses. Here is how to configure:

  1. Goto Catalog->Attributes->Manage Attributes->Add new Attribute
  2. Enter code e.g. volume_weight, and change other relevant fields
  3. Click on Manage Label option – add a label into Admin box e.g. Volume Weight
  4. Save Attribute
  5. Goto Catalog->Attributes->Manage Attributes->Manage Attribute Sets
  6. Click Default
  7. Drag new attribute from unassigned area to where you wish it to display in product
  8. Save Attribute Set

If you now open a product you will see the new attribute present, ready for editing.


Mar 7 2009

Enabling Gift Message

1. Allow Gift Messages under System–>Configuration–>Sales–>Gift Messages.

2. Under System–>Configuration–>Advanced, make sure that the Mage_GiftMessage module says “Enable”. Mine was disabled for some reason.

3. Under each Product allow/deny gift message