Archive for February, 2010

Error Message – Could not connect to MySQL database

February 17, 2010

OMG I have just had THE most stressful 3 hours EVER!

Well maybe…

Anyway what has been happening is that I have been getting an error message everytime I try to open up MAMP.

“Error: Could not connect to MySQL Database”

This pops up in Firefox as Mamp opens. So basically I could still work on the website, but this error message came up when I tried to get to the MAMP start page. And I have been having a few problems with the website so I thought that fixing this might solve my problems (I hope so but still to see about this!)

So anyways…

I looked and looked and looked for an answer and found that many people do many different things.

My Solution –

So what I did may not help you as you may have a different problem, BUT…..

What I did in the end was that I went into /Applications/MAMP/bin/Mamp/index.php and I changed line 15, where it says ‘root’ ‘root’ – I changed these to my ‘username’ and then my ‘password’ (The ones that I chose when I first set up MAMP)

I next went into /Applications/MAMP/bin/phpMyAdmin/config.inc.php and changed lines 85 and 86 to my username and password.

Then I saved and closed these files and I quit MAMP and re-started and IT WORKED!!!  I am so so so so sooooo excited!!

Computers are so great sometimes. I think the fact that they often don’t do what I want them to makes it so much more satisfing when they eventually do. I feel like I have really conquered something HUGE!

Ah – so now onto my next problems….

My Problems Setting Up Multisite on MAMP

February 16, 2010

My word – STRESS!

So I have just set up my computer so that I can have another site working with my MAMP application. So that means that I can now work on two sites at home and not have them online.

It was really not very easy to set up but its such a simple thing that it should have been I think.

Apparently MAMP Pro takes away all the problems as it you can have an unlimited number of virtual hosts and its all configured like that ready to go, but you have to pay for this and I wanted to see if I could do it for free first coz I am cheap!

Now the reason I want to be able to have these two sites on my own computer is that I am going to start working on my parents site now. Yay!  So I want to be able to do this offline so that there can be no problems that anyone knows about and then when it is perfect I will upload it to the internet and all will be well.

STEP ONE – Export Database.

So the first thing that I did was I went into the cpanel for their website and I exported the database as a file that I was later to import into MAMP. This was the same thing that I did when taking my other site from MAMP to the internet, just the other way around.

STEP TWO – Make a new file in the etc/hosts folder. (I don’t know what this means by the way!)

Then I read these instructions (from the drupal.org site) and I could not understand what to do coz I didn’t know how to change the file. But maybe if you have more knowledge than me it would be easy.

For me tho my answer was to be found here, at a blog post I read.

The instructions were really scary to follow and involve going into the Terminal Application! At the point where they ask for the password it has some text where it says that you might delete everything just by being in there. OMG

But… I did what it said. I made a new location with a new name. I called it todtaylor coz tats the name of my parents website.

(I am not sure about the .drupal.local bit in the other instructions by the way – although in other ways the two posts seem the same)

STEP THREE – Add database

So at this point I went to http://todtaylor it came up with a page like this

When I clicked on ‘drupal’ it went to the drupal start up page and I added in that database that I had exported earlier.

It was quite hard.  I didn’t know what to put for the password but in the end what I did was I went into the original database in MAMP and I went into priveledges and changed the password and it told me the password had been changed for root@todtaylor so I knew the username was route.

So it all seems fine now but I am still a bit scared. Also the version used for the site was Drupal 5 and on my computer I have Drupal 6 so its all a bit wrong right now.

As they say tho – It will all be alright in the end and if it isn’t alright then it isn’t the end. And this is NOT the end, so its sweet  🙂

Why Can’t I Browse For Images with WSIWIG Editor?

February 10, 2010

I have been having an extremely frustrating problem. The reason it is most frustrating is because it is the second time I am having this problem!  I have already had it, solved it and then forgotten about it and now I am having it again!

This is the reason I started to write this blog – because there has to be somewhere for me to store my solutions so that I may refer back to them next time I need them. There is ALWAYS a next time! Especially with a memory like mine.

So my problem is that when I am using the WSISIG editor inside some content, like the blog or a page, I cannot get the ‘insert image’ to show a browse button.  I shall demonstrate with screenshots…

See here is what I get…

…and this is what I want.

Now the solution – as I have just re-remembered, is very simple and is explained here on this blog.

Basically it all centers around the module called IMCE Bridge, which I have installed on my website but was not installed for my parents site.

So what you have to do is make sure that you have downloaded and installed the IMCE Bridge module in the usual way (that is to put it in the modules folder where all the other modules are) and then go to admin/build/modules and tick IMCE Wsiwig API Bridge module so that it is turned on. The next thing to do is to go to admin/users/permissions and make sure that users are able to attach images (if you are allowing others apart from yourself to write a blog for example) Now go to admin/settings/wsiwig and edit the full html input format. Go into buttons and plugins and make sure that both image and IMCE are ticked.  Now you should have a browse button in the image attach.  Yay.

I am now working on my parents site and have just managed to get MAMP to work for two websites so will do a blog post about that soon.

Ubercart NZ Bank Transfer at Checkout

February 5, 2010

Here in New Zealand paying by bank transfer is totally normal. Its what we do. I dunno what its like over the rest of the world but here almost anything can be paid for with bank transfer and its great coz it means you don’t have to have a credit card to buy online.

I wanted to have this on my website but it wasn’t in the modules that come with Ubercart so I had to go looking for it.

Once I again I found my answer in the Ubercart forums. That place is great!

I downloaded another module from drupal.org called Bank Transfer Ubercart Payment. There is a ‘Read Me’ which explains what to do to get it to work. It looks a bit confusing but if you read it slowly line by line and don’t move to the next line till you have done what the previous line asks then it shouldn’t be too bad.

All it does is add the option to pay by bank transfer and then adds an action where an invoice will be sent out with bank details on it.

When you see the money come into your bank account you can then go into Store Administration and into Orders and look at the order. You will see that the order is still awaiting payment coz no one has recorded a payment. What I do next is to manually record that the payment has been received and then deal with the order in the normal way.  Well.. I would if I had needed to yet but no one has used it  😦

Anyways its pretty cool.

Drupal & Ubercart Flat Rate Shipping – Problems and Solutions

February 4, 2010

22 Jan 2011 – just adding a couple of corrrections to this post

One of the biggest problems I have had with Ubercart has been to get a flat rate shipping cost that is added automatically to every order and that does not change whether 1 or 2 items are ordered.

(hmmmm, note to self – should I have it set so it increases after 2 items, so that the postage is higher for 3 or more items? – one for another day!)

What I wanted was a $6 postage charge to be added at the checkout. No shipping calculations and no problems if anyone forgets to click the button coz after all, if the postage is always a flat rate of $6 then there is no need to click the ‘calculate postage’ button.

My answer was very simple in the end but it took me ages to find it.

Here are the steps to go through –

Add your flat rate
Add a flat rate shipping method here admin/store/settings/quotes/methods/flatrate. I gave mine the title of New Zealand (this is what I see) and then the line item label of NZ flat rate (this is what people see at the checkout and means that later I should be able to add a rate for other countries too – but one thing at a time!)

I gave mine a base price and default shipping rate of $6. (By the way I went to the post shop first and checked how much it would be to send a t-shirt within New Zealand and there is a pre-paid envelope that would actually take 2 t-shirts and its the same price no matter what the weight is.  Thats why I want a flat rate.)

Correction – only give a value to the base price and NOT default shipping rate if you want the flat rate to be one price for every order, no matter how many items. The base price is the shipping rate and the default shipping rate is an extra which is added on for each additional item. This can be overriden in the product settings as shown below. But if you do it correctly here then there is no need!

Check all configurations in the store
The next thing to do is to make sure that all the correct permissions are enabled and that the shipping quote module is correctly configured.

I will explain what I did, and in italics is how to get there, ie for me I put http://www.hardluck.co.nz/admin/store/etc…..

admin/store/settings/cart – make sure shipping quote is enabled in ‘cart panes’ in edit

admin/store/settings/checkout – make sure calculate shipping costs is enabled in ‘checkout panes’ in edit

admin/store/settings/orders – make sure that shipping quote is ticked in ‘order panes’ in edit

admin/store/settings/cart/quotes/edit – tick the box for ‘prevent the customer from completing an order if the shipping quote is not selected’

admin/store/products – go into each product and scroll down to shipping settings, in here there is a box to enter the flat shipping rate to over-ride the default. We don’t want to do that BUT it says (in my one anyway) ‘Enter -1 to revert to the default value’

This is not right. When I entered ‘-1’ it just took $1 off every time I calculated shipping!  So in there I now enter ‘$0’ and it works fine.

This is no longer necessary

Get the shipping rate to calculate automatically
There is a wee piece of java script here that some amazing person has written, which when downloaded and saved into sites/all/modules (by uploading it with your FTP client – like Filezilla) will make sure the shipping costs button is pressed automatically. I found it by searching thru the Ubercart forums which is a really good place to look if you are having problems coz there are bound to be other people who have the same ones!

So here is a screenshot of part of my checkout and this was just after I added the address. I didn’t need to do anymore, its just added shipping on itself.

Test it thoroughly and have someone else test it too!
This is like THE MOST important step of all! I had my site offline for maintenance when I did this work to it and I tested it a few times myself offline. I then put it online and got my mum to test it too because if there is something that will go wrong she will find it!  I dunno how she does it but she can get even the simplest things wrong so I get her to check everything knowing that if she can work it then it must be ok.

I just thought tho that while it was online and she was testing then then theoretically someone else could have been on there too. I did have it checked by myself by that point and didn’t expect any visitors but I guess that could be a problem for some people. I wonder what other people do in this situation?  Do they work with their site offline?

The next thing I need to do is get my computer sorted so I can work with more than one offline site.

Image Gallery in Drupal

February 3, 2010

I created an image gallery on my website today – take a look at it here

I used ImageCache, CCK and Views, and Lightbox2.

SINCE WRITING THIS POST I HAVE ACTUALLY FOUND AN EASIER WAY USING THE IMAGE MODULE – I HAVE WRITTEN ABOUT IT HERE.

I was going to just use the ‘Image Gallery’ which appears in the navigation menu, I think that it came with the ‘Image’ module. The reason I didn’t use this is because right at the start I made an image gallery in there without really knowing what I was doing and I couldn’t change the sizes of the images so I wasn’t happy with it. I then began to check on Google for what other people have done to get some ideas and see how I could achieve what I wanted.

I realised that most of the things I read about did not use the ‘Image Galleries’ option. Most people have made their own Gallery using ImageCache to create a thumbnail and main image and then using Views to create the gallery and Lightbox2 to view them as full size images.  Its really cool this way.

I followed the instructions at this blog post here which was real easy.

Well……. I say that now – at the time it was not the easiest thing I have ever done!!  I had to read it and read it again and then try it and realise that I was doing the wrong thing and then read it again.  Phew – its took a few hours!  But it is done now and I am pleased with the results.

Some other tips I would add would be to remove the Image Gallery link from the Navigation menu (if it is there) so that it does not get confusing.

Check User Permissions!

Also I would suggest that you ensure you have checked the user permissions for viewing images. Go to admin/user/permissions and check all Image and ImageCache (and any other image related modules) settings and ensure anonymous and authenticated users can view images, thumbnails and galleries. I did not do this at first and I excitedly told everyone about my image gallery. I felt like a bit of a fool when they told me they couldn’t see it!