How to add an image to a page in Drupal 7 Last updated:12 June 2012

About three years ago I tried messing about with Drupal to investigate its possibilities. After several hours trying to add an image to a page I gave up.

Today I tried again, using Drupal 7 this time. Here’s what I did…

  • Loaded Drupal
  • Created a new “Basic Page” and added some words….fine so far
  • No way of adding image…checked Modules, nothing likely
  • Went to Add Module, found WYSIWYG editor.
  • Downloaded module to PC, uploaded and enabled module
  • Went back to Add Content, no editor visible….
  • Googled…
  • Went into WYSIWYG Configuration, enabled various buttons including Image
  • Back into Add Content, Image Button, Hurrah!!! No upload capability…
  • Searched modules, found likely looking Media module
  • Downloaded module to PC, uploaded and tried to enable module, couldn’t, it needs another module called cTools
  • Downloaded cTools, uploaded and enabled it
  • Enabled Media modules
  • Back into Add Content, absolutely no joy whatsoever
  • Uninstalled Media and cTools module
  • Googled…
  • Downloaded IMCE and IMCE WYSIWYG modules, uploaded and enabled
  • Back into Add Content, still no luck
  • Back into WYSIWYG configuration, enabled IMCE button
  • Back into Add Content, new button available, it works….
  • Laughed hysterically for several minutes
Drupal screenshot with an image

Ta daaaa…

This whole process took marginally less than an hour. How can it possibly be this difficult? I consider myself pretty technically savvy, and it takes me this long? Cannot imagine letting a client loose on this.

So, for anyone who may have stumbled across this, here’s what I should have done:

Hope this helps someone…

Corollary about a week later: Tried to log on again for some further experimentation and repeatedly got “Access Denied” to the login page (as in, didn’t even get as far as viewing the login fields). Spent about half an hour reading posts from others on the same problem, with no success, then just deleted the entire installation. I’ll stick with WordPress…

Creating a mobile version of an Opencart shop – 8 Last updated:15 March 2012

So, the mobile pages are now live! You can see the live site here. Please bear in mind this is a live site, please don’t enter customer data unless you actually want to buy something!

I’ve put together a summary of the changes made to the theme, plus the files here.

Creating a mobile version of an Opencart shop – 7 Last updated:9 March 2012

With a bit of help from some friends, I’ve now had the site tested on a couple of real mobile devices, with pretty positive feedback. The exception however was the button styling. The image below shows the button on the main (non-mobile) site, then the button on the mobile site, and finally the button as displayed on an iPod:

Opencart buttons - that displayed on an iPod shows an oval button on top of a square button

My first thought was that somehow, the image from the main site was being superimposed on the coloured background from the mobile site. But it wasn’t anywhere in the css. Very puzzling. I finally twigged that it isn’t the main site background image, it’s the default input button used by Mobile Safari unless explicitly removed. Applying this css got rid of it:

input{-webkit-appearance:none;}

Needless to say, this problem didn’t show up in any emulator I used….

Next step I think will be to launch this and invite comments from users. Should be interesting.

Creating a mobile version of an Opencart shop – 6 Last updated:25 February 2012

I should have said, if anyone’s reading this and would like to have a look at the test site, it’s currently available at:

m.testshop.simonbattersby.com

Note you won’t be able to checkout at the moment as it’s pointed at the Paypal sandbox. At the moment at least I’m more concerned with the usability of the site anyway. If you do view the site then any and all comments are welcome. If you see a problem, do let me know – it would be helpful to know the model of phone with which you viewed it. Thanks!

Creating a mobile version of an Opencart shop – 5 Last updated:16 March 2012

Nearly finished this stage now I think. I’ve now worked through all the pages (I think…) and updated them. This morning I realised that although the site works mostly OK without javascript, without it the zones (counties in the UK) are not populated, so it’s impossible to enter an address. Ugh. Resolving this needs the following adding to /catalog/controller/account/create.php, /catalog/controller/account/address.php, /controller/checkout/address.php and /controller/checkout/guest_step_1.php

$this->load->model('localisation/zone');
		
$this->data['zones'] = $this->model_localisation_zone->getZonesByCountryId($this->data['country_id']);

And the following editing in /catalog/view/theme/[your theme]/template/create.tpl, /catalog/view/theme/[your theme]/template/address.tpl, /catalog/view/theme/[your theme]/template/address.tpl and /catalog/view/theme/[your theme]/template/guest_step_2.tpl:

<select name="zone_id">
   <option value="FALSE"><?php echo $text_select; ?></option>
   <?php foreach ($zones as $zone) { ?>
     <?php if ($zone['zone_id'] == $zone_id) { ?>
     <option value="<?php echo $sone['zone_id']; ?>" selected="selected"><?php echo $zone['name']; ?></option>
     <?php } else { ?>
        <option value="<?php echo $zone['zone_id']; ?>"><?php echo $zone['name']; ?></option>
     <?php } ?>
   <?php } ?>          
</select>

(It would be nice if the code used functions a little more for repeated things like the address form.) This then allows selection of zone even with javascript disabled. There’s still a much more minor problem, which is that if the country is changed, with javascript disabled the zone list is not refreshed. This resolves itself when the form is submitted since the zones are then correctly populated by the posted data, but is less than perfect. We get very few orders from outside the UK anyway, so I’m going to park that one for now. The solution, I think, would be to add a button to let the user manually refresh the page, minus the validation, after changing the country.

Anyway, back to the mobile site specifics. I showed it to the client (to whom, coincidentally, I’m married…) yesterday, and she is happy so far. Hoorah! Next step is to test it with some tame users I think.

Concerns I have at the moment: not sure about scrolling the menu on the home page; I wonder whether clicking through from the category page to the product page is too difficult (although in fact most of our sales come direct from the category page not the product page); think the general text might be a bit small. We’ll see.