Category Archives: Open Source

Bits & bobs about open source software

Joomla Day UK

I’ll be speaking at this year’s Joomla Day UK conference on 4th October on the tricky subject of pricing. The title of my talk is “You’re too cheap & not nearly nasty enough”, which gives you some idea of what I think about the subject.

Tickets for the event are still available and there’s a great line up of talented speakers. Hopefully we’ll see some of you there.

Magento Search Not Working

Today I came across a really annoying issue with respect to Magento’s search functionality. In essence, regardless of the term the user was entering, Magento returned the same 10 products, & occasionally a correct match!

Looking in the search logs of a search extension I installed, I could see that loads of results were being returned but not being displayed in the actual front end results. Could it be a stale index, or a problem with the cache?

Well, after countless command line reindexing, clearing the cache, checking the search settings in Config (Like & FullText), checking that products were visible, etc, I checked on the display values in the categories. There I discovered that the store’s root category’s “Is Anchor” was set to yes, and there were 14 products assigned to the root category. Amongst these 14 products were the usual suspects appearing in the rogue search results!

In the spirit of trying anything, I set “Is Anchor” to No and removed the products. Bang – the search results started working as expected. I’m not sure why but by this time I was past caring tbh! However, it looks like these settings were restricting the products that could be displayed on the front end. Does anyone know the reason?

Update

I had this occur on another site I’m working on – empty search results. This time the culprit was that none of the products that had been imported via a third party system had been assigned to a website/store.

Magento product images not showing

Today I noticed that some product images on a client’s site were not displaying. This was puzzling because I had recently migrated the site to a new server and had spent quite sometime testing the site.

To cut a long story short, the cause of the problem was two fold. Firstly, the missing images were huge.  Resizing one of them solved the problem for that particular product. This led me to the cause of the second problem – the php memory limit on the new sever was 64M. Increasing the memory limit to 258M resulted in all the large images displaying properly.

Ideally I would resize all the large images but that will have to wait for another day. 

So, make sure to check your php memory size if you encounter a similar situation of your Magento product images not being displayed.

Magento – Sales Emails

One of the (many) things that often gets overlooked when a company puts a Magento website live are the Sales emails. These are the emails that get sent to customers after they have ordered – the New Order email, etc. You can tell if these have been overlooked by studying the opening hours – if it says, “Monday – Friday, 8am – 5pm PST” , then it’s probably using the stock template that comes with Magento (presumably PST refers to Pacific Standard Time, which is pretty meaningless to a European customer).

Sales Email templates
8 Magento Sales Email templates

Within Magento there are 8 email templates that you should modify before going live. This is because these all contain the standard PST opening hours. These templates are New Order, New Invoice, New Shipment, New Credit Memo. I usually rename them with the store name (“Quirk” in this example) so that its easier to manage in a multi store setup. This means you can add different templates for different stores or websites.

Magento Sales Emails template selection
Sales Emails template selection

Changing the default email templates is pretty simple. Within Magento backend, navigate to  System/Transactional Emails.  Click “Add New Template” and then from the Template dropdown, select one of the 8 templates you should modify (see above). For example, the first template I modify is the New Order template. By default I just change the opening hours and then wait until the client has done some test orders before broaching the subject of deciding what content and style would best suit their shop.

Assigning the Magento Sales Email templates
Assigning the Magento Sales Email templates

When you’ve modified the templates, you then have to assign them. Go to Configuration/Sales Emails and then select the appropriate email for each section. For example, here I’ve set the New Order emails to be the “Quirk New Order” for a registered customer and the “Quirk New Order for Guest” for guest checkout customers.

Setting the transactional email templates is not difficult or particularly time consuming. However, it’s an important part of presenting a professional and consistent image to your customers. Paying particular attention to the details here will pay dividends later on.

Magento Multi-Website Checklist

One of Magento’s great features is the multi-site & multi-store capabilities. If you’re new to Magento, this means that you can run more than one website from the same Magento installation. Having just added yet another website to a client’s Magento installation, I thought I’d jot the steps down as an aide-mémoire. So below I’m going to outline a checklist of the actions required to set up a mutli-website store in Magento.

For the purposes of the this example, assume I already have a Mage website eddiemay.me.uk and want to add another website eddie-may.com. Also assume that I’m selling to the same country with the same Tax & shipping rules, payment gateway, etc. Also assume that I’m going to be using the same template but use a different skin to make it look different.

NB: This example is for Magento Community Edition 1.7.0.2 – earlier editions had different ways of routing requests using .htaccess or index.php.

  1. Buy a multi-domain SSL certificate. Make sure that new domain is associated with this certificate.
  2. Point your new domain name at your server.
  3. Log into Magento and do a backup – peace of mind, etc.
  4. Set up a new root category & then add any sub categories as required. This root category is going to be ‘home’ of the new website.
  5. Go to System/Manage Stores. Next, hit the Create Website button & fill in the necessary information – keep a note of the value you put in the “code” field. In my example I’m going to use “may” as the code value.
  6. Repeat the steps for Create Store & Create Store View. When you create a store you set the root category to be the one you’ve just created in step 4 above.
  7. Go to CMS/Pages and create a new home page & associate it with the new Website.
  8. Now go to System/Configuration and change the ‘Current Configuration Scope’ to your new website. You’ll notice that the values are a copy of the default website. You’re now going to have to go through a number of tabs and change the required values. Here I’ll refer only to the essential changes.
  9. Under System/Configuration/Web change the Secure & Unsecure urls to your new domain name – in this case eddie-may.com. Also under Default Pages set the CMS Home Page to the page you created in step 7. Under the Session Cookie Management tab, add your new domain as the Cookie Domain like so -> .eddie-may.com
  10. In the Design tab you now have a choice of determining how the website will look. Here I’m going to assume that you’ll use the same template but use CSS to change the style of the site.
  11. So, upload a new skin under the /skin/frontend/default. Lets assume the new skin is called eddiemay, that means you’ll have a folder like so /skin/frontend/default/eddiemay
  12. If that’s the case, the design settings will be Package = default; Skin (Images/CSS) = eddiemay; Layout & Default will be the same values as your first website.
  13. Still under the Design tab, change the HTML Head, Header, Footer, etc as required. From an SEO perspective, make sure that the Default Title & Description are unique.
  14. Now go to Store Emails – you’ll need to change email addresses to reflect the new domain name. Make sure that these email accounts actually exist before going live.
  15. Under Contacts change the main contact email as required.
  16. Under Sales/Invoice & Packing Slip Design – change the default logos to your new logo.
  17. Under Sales/Sales Emails – you may have to change the email templates if you’ve heavily customised your default email templates (you may have hardcoded your store name, for example).
  18. That’s more or less it for the System/Configuration settings.
  19. Now go to CMS section. Here you may have to create new CMS pages & Static Blocks, or at least associate existing ones with the new website. At a minimum you’ll need to associate the Contact, About, Privacy, Terms, Shipping pages with the new website.
  20. The next thing you’ll need to do is add the new website to your .htaccess file. You need to add the new domain like so:
  21. ## multidomain
    SetEnvIf Host www\.eddiemay\.me.uk MAGE_RUN_CODE=base
    SetEnvIf Host www\.eddiemay\.me.uk MAGE_RUN_TYPE=website
    SetEnvIf Host ^eddiemay\.me.uk MAGE_RUN_CODE=base
    SetEnvIf Host ^eddiemay\.me.uk MAGE_RUN_TYPE=website
    SetEnvIf Host www\.eddie-may\.com MAGE_RUN_CODE=may
    SetEnvIf Host www\.eddie-may\.com MAGE_RUN_TYPE=website
    SetEnvIf Host ^eddie-may\.com MAGE_RUN_CODE=may
    SetEnvIf Host ^eddie-may\.com MAGE_RUN_TYPE=website
  22. You’ll notice that I’ve used the code “may” – this was the value I entered in the new Website code field in step 5 above.
  23. Upload the new .htaccess file.
  24. Now test your new website – chances are that you’ll get an error. Downloading the error report will give a cryptic “SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘database-name.catalog_category_flat_store_3′” doesn’t exist – or something similar. If this happens, log into your Magento administration UI, go to System/Index Management & you’ll probably see that several indexes need re-indexing. Once complete, your website should now work as expected.
  25. If all is good, its now time to add some products. You could copy products over from the original website but personally I’d create them from scratch or upload new ones. This is because you can then optimise their descriptions, etc., to avoid duplicate content penalties, etc.

Well, I think that covers all the bases. This will probably take you about 2 hours to complete, depending on the amount of customising of Email template, Static Blocks, etc. The CSS customisations are another thing altogether.

If I’ve left anything out, please let me know. Either way, I hope you find it useful.

Empty Magento Sales Report

I was recently onsite helping a Magento client do some things on her store. During the course of our conversation, she asked about exporting her sales records. She was stuck because the sales report was empty. The reason for this was because her sales statistics needed refreshing.

Magento Sales Report ScreenWhen you go to the sales reports at the top is a warning that you should refresh the last day’s statistics. Doing this is ok if you’ve kept on top of this particular task. If you’ve never updated your statistics before, then this won’t work – your sales stats will be empty or incomplete.

If this is the situation you find yourself in, then you should refresh the life time statistics. This can be done by going to the Refresh Statistics tab under Reports menu item.

Magento Reports menuThis will load the Statistics tab. Select the Orders row, select the ‘Refresh Lifetime Statistics’ option and then submit. A dialog box will warn you that your site could become unresponsive – this is a danger if you’ve never refreshed these statistics before. For this reason, I suggest you only ever do one row at a time.

Magento Refresh Stats UIOnce you have completed this task, go back to the Sales Report and run the orders report again. This time the stats should be reporting correctly.

PS

If your sales reports are out of date (have not been refreshed) then this points to a problem with  your Magento cron job. A cron job is a scheduled task that runs at a determined interval. Refreshing the sales and other reports is one of the things the Magento cron job does. Setting up the cron job is really important and is a topic I’ll address in the future.