Author Topic: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores (Now for 1.1.9)  (Read 51104 times)

Das123

  • Beginner
  • *
  • Posts: 21
    • Design Solutions - Creative Consultancy & Studio
------- Edit: 11 July 2011 ------

Hi all, been a while since I've been using VirtueMart but have now needed to upgrade the GST files again. :)

I've changed the files for VirtueMart 1.1.9. Instructions are pretty much the same but the files are different.

I've also changed the SQL update script a little - getting rid of the sample data. It will patch the sample data if you have it installed. If you have already got a version of the GST hack running on your system don't run the sql updater - the database will already be set-up correctly.

If you are updating from a previous version of VirtueMart, do the update for VirtueMart, make sure the sql patches have run if doing this manually, then simply replace the files with the files from this zip.

Hope this helps. :)

I'll change the instructions below where applicable.

-----------------------------------

I supplied some hack files and a short guide for setting version 1.1.2 for Australian stores about 9 months ago (http://forum.virtuemart.net/index.php?topic=44489.msg141852#msg141852) but things have changed a bit in version 1.1.3. At the time I was using Joomla 1.0.xx but now I need the same set-up for Joomla 1.5. So here is the updated version...

Introduction:

This is a hack of existing VirtueMart files to help make them compliant for Australian stores. Note: If you upgrade VirtueMart you will be writing over the top of these hacks and they will no longer work!

There are slight differences to the files in version 1.1.2 and 1.1.3, and people have said that the older version was working OK. But in reality, it is much better to use these to get the full benefit of 1.1.3.

Edit: There were also some changes between 1.1.3 and 1.1.9 but the principles have remained the same.

Another important change is that the Australian Shipping Module has been updated within VirtueMart and there is no reason to use the hacked one supplied in the 1.1.2 version. The shipping module is subsequently missing from this version for that reason.

Two sample SQL files have been included which 'Aussifies' the sample products and sets up some basic Aussie standards in the database. Aussie Product Samples.sql sets up the tax, vendor and sample products, while Vendor and Tax Only.sql only sets up the tax and vendor. It also updates all the products in the database to use the Australian GST settings. I'd recommend installing one of these as a starting point. Use Vendor and Tax Only.sql if you already have products and categories setup in your database - but please do a back-up first!

Edit: Only including a single SQL file for the 1.1.9 version (update.sql). This clears out the tax_rate table and places Australian GST in ID 1; changes all products in the database to have GST applied to them; and adds the field in the vendor table for the ABN number.

Overview:

First of all, we need to cater for ABNs as legally this should be on any tax invoice. Other samples have created ABN entries in the language files, but I would prefer this to be in the database with the rest of the vendor information.
Similarly, I want to simply select 'Australian GST' from the admin panel rather than just patch templates and code here and there all the time (the patching still needs to be done, but the selection in the admin panel feels better).
Finally, tax and shipping should be simple.

Initially I'll go through the minimum steps you need to take to get the job done. Before we start, if you don't know how to FTP files or how to run SQL commands in your database, turn back now. This will be too difficult for you. Otherwise, read on. :)

The patches are still based on the 1.1.2 version so if you are looking for the specific hacks to upgrade the files yourself, please look in that thread. Note that there are now some extra language files that need updating.

I've tested it and it works for me, but I can't make any promises. Back everything up before you start - just in case. Last time many people helped out by posting what was working and what wasn't working. Please lets keep that community spirit going again. Makes everyones life easier.  ;D

So, into the fray!

10 Steps to Australian Compliance

1. Install VirtueMart on your website.

2. Download the zip file attached to this post.

3. Extract and replace the corresponding files in the VirtueMart component backend (path in zip file is from Joomla root directory).

4. If a fresh install of VirtueMart, import the attached SQL patch into the database. This creates an Australian tax reference and adds GST to the vendor. Don't follow this step if you already have a GST patched version and simply wish to upgrade VirtueMart to 1.1.9

5. Log in to the VirtueMart Admin.

6. In Store -> Edit Store
  a. Fill in the details for the vendor. Make sure default currencies etc are correct. Make sure country is correct (for tax defaults).
  b. Put ABN in address format:
{storename}
ABN: {abn}
etc etc

  c. Fill in other details as you like.
  The sample data in the zip has much of this already setup.

7. In Admin -> Configuration
  Under Price Configuration tick Show "(including XX% tax)" when applicable?
  b. Under Tax Configuration select Tax Mode: Australian GST mode
  c. Select other settings as you like.

8. In Tax -> List Tax Rates
  a. Remove default tax rate that comes with VirtuMart.
  b. Add tax rate -> Australia, No state, .10.
  (This has already been setup in the sample data)

9. In Store -> Shipping Module List
  Configure the AusPost module. Make sure the tax rate is the 10% rate you just made.

10. Put in your categories and products etc.

Job done! Not too difficult once you're past step 4. ;D

[attachment cleanup by admin]

Ric Raftis

  • Beginner
  • *
  • Posts: 21
    • Bushsong Web Design - Bendigo & Beyond
Re: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores
« Reply #1 on: April 21, 2009, 11:49:15 am »
Great job you've done here on providing for the Aussie experience. Extremely timely for me too as I'm just setting up an Aussie site.

Everything has worked well in terms of the installation.  I just need to check that the GST will be based on the purchasers shipping address and not be applied across the board.

I would suggest one addition to your dialogue above.  I had already installed my store and all the details and products. On implementing the SQL file, it wiped the lot.  Fortunately there were only 8 products on the site anyway.  It might pay to add that if you have already set up your store to run the SQL query instead of importing the file so others don't lose a lot more data than I did.. :-)

Once again, many thanks for your contribution.

Cheers,


Ric

Partic

  • Jr. Member
  • **
  • Posts: 53
    • KPS
Re: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores
« Reply #2 on: April 22, 2009, 02:24:23 am »
Great stuff! Will be sharing that with the Melbourne Joomla User Group tonight!

Ric Raftis

  • Beginner
  • *
  • Posts: 21
    • Bushsong Web Design - Bendigo & Beyond
Re: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores
« Reply #3 on: April 22, 2009, 07:30:28 am »
Found a couple of issues.

1. GST wouldn't calculate until I added all the States. It wouldn't do it based purely on Australia, the country.

2. When you use a coupon, it calculates a discount. Great. But when the user registers, it calculates the GST on the original price and not the discounted price after applying the coupon value.

Any thoughts on the second issue?


Cheers,


Ric

Das123

  • Beginner
  • *
  • Posts: 21
    • Design Solutions - Creative Consultancy & Studio
Re: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores
« Reply #4 on: April 24, 2009, 06:47:48 am »
Thanks for the comments. Hope your meeting went well in Melbourne, Patric. :)

Good point Ric! I've changed the instruction wording in this post but I have also added a new SQL file that adds the vendor and tax information without touching the rest of the setup. It does, however update all the products to the new tax rate. (New file uploaded into original post)

I'm not sure why you needed to put in all the states. On my test install it was working without this.

And I also don't know where to fix the coupons, sorry. I believe this has been an issue in the past as well.

HulaQueen

  • Jr. Member
  • **
  • Posts: 316
Re: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores
« Reply #5 on: April 24, 2009, 22:52:51 pm »
Ric,

Go into admin... there is a setting in Admin-Configuration for tax settings. Just check "Subtract payment discount before tax/shipping?".

We're just upgrading our old vm install... this is going to be really useful thank you.

Ric Raftis

  • Beginner
  • *
  • Posts: 21
    • Bushsong Web Design - Bendigo & Beyond
Re: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores
« Reply #6 on: April 26, 2009, 00:52:10 am »
@HulaQueen...

Thanks so much for that tip.  You would think that that switch would be ON by default. I can't think of any reason why it would have to be turned on.

Once again, many thanks for that...

Cheers,

Ric

Ric Raftis

  • Beginner
  • *
  • Posts: 21
    • Bushsong Web Design - Bendigo & Beyond
Re: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores
« Reply #7 on: April 26, 2009, 22:08:27 pm »
Well unfortunately, the switching on of the Tax Calcs after application of the coupon discount didn't work. Tested this several times but to no avail.

This site sells product and membership to Australian and overseas purchasers, so the tax calc is based on shipping address. Perhaps this is the problem.

If you'd like to try it out for yourself, the site is at the following URL.. (It is in development mode at the moment because of this and a couple of other issues, mainly VM ones.. )

http://www.bushsong.com.au/development/xcheque/

Cheers,

Ric

EDIT: I have reported this as a bug as I couldn't find a solution for it. Interestingly enough, the same bug was reported in 1.0 and closed, but doesn't seem to have moved over to 1.1... http://dev.virtuemart.net/cb/project/31

Hope I've reported this correctly. I haven't reported a bug in VM site before...


Aushops

  • Beginner
  • *
  • Posts: 13
Re: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores
« Reply #8 on: April 30, 2009, 16:43:30 pm »
Thanks Das for the excellent GST Hack
One Problem I have is there is no $ sign on the purchase order/Tax invoice as per attachment
Is it possible to tell me where I can fix this

Regards
Tony

[attachment cleanup by admin]

Das123

  • Beginner
  • *
  • Posts: 21
    • Design Solutions - Creative Consultancy & Studio
Re: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores
« Reply #9 on: April 30, 2009, 21:03:15 pm »
So instead of it showing AUD215.00 you would prefer $215.00 (or AU$215.00)?

This occurs in the printed order I think. Most of the rest of the site should show the correct details.

This would require another hack to fix. There are two files that display this format that I can see...

administrator/components/com_virtuemart/html/order.order_print.php and
administrator/components/com_virtuemart/html/order.order_list.php

You'll need to search through the files for a command that looks like this...
Code: [Select]
echo $GLOBALS['CURRENCY_DISPLAY']->getFullValue($db->f("some_number_reference"), '', $db->f('order_currency'))
The override is in the back of the function call.

$GLOBALS['CURRENCY_DISPLAY'] is a class reference that manages the display of the currency.

getFullValue() is a method within that class with three variables:
1. Number to be formatted (required).
2. Decimals (optional)
3. Symbol (optional)

So to show the default symbol, you need to not include the symbol reference. This is done by simply deleting the references in the code. So our sample would end up:

Code: [Select]
echo $GLOBALS['CURRENCY_DISPLAY']->getFullValue($db->f("some_number_reference"))
I suppose you could search globally for

Code: [Select]
, '', $db->f('order_currency')) and delete it in the offending pages.

Aushops

  • Beginner
  • *
  • Posts: 13
Re: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores
« Reply #10 on: May 01, 2009, 03:01:56 am »
Hi Das
If possible just with the $ symbol displayed on the Purchase order/Tax Invoice as it is displayed as per shopping cart checkout (image attached)
I tried what you suggested but it didn't change anything on the printout

Regards
Tony

[attachment cleanup by admin]

HulaQueen

  • Jr. Member
  • **
  • Posts: 316
Re: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores
« Reply #11 on: May 06, 2009, 21:56:30 pm »
Has anyone modified the actual invoice to show the GST included in each item on the invoice. Some of my products have GST and others do not, so I am required to show this on each line.

Here's the GST rules if anyone hasn't seen them:
http://www.ato.gov.au/businesses/content.asp?doc=/content/50913.htm&page=1#P36_2104

I'm working on editing administrator/components/com_virtuemart/html/order.order_printdetails.php right now.

Just thought I'd ask just in case!
 

Das123

  • Beginner
  • *
  • Posts: 21
    • Design Solutions - Creative Consultancy & Studio
Re: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores
« Reply #12 on: May 06, 2009, 23:35:42 pm »
@Aushops:
I'm pretty sure it should change with the above edits. It did in my test. The default is to include the currency abbreviation instead of a dollar sign I think so it is actually a general question rather than an Aussie-specific question so perhaps there is an answer somewhere out there.

@HulaQueen:
My hack assumes that all Aussie products will have GST and so it changes many generic values. Instead of 'Total' it will read 'Total (incl. GST)'. Not ideal, but quick and dirty. To get the cart to recognise the difference and display correctly when you have a mix of products would take quite a deal of work, I think, in a number of different files.

HulaQueen

  • Jr. Member
  • **
  • Posts: 316
Re: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores
« Reply #13 on: May 07, 2009, 00:13:59 am »
It's okay if the cart etc does not display the info... but the final invoice does need to. We had GregDev make us a proper GST compliant invoice a few years ago. I'm just working now trying to make it work in the new version of VM. It's complicated. When I get it done I will post the code in this thread for the GST compliant invoice that shows GST component for each item.

Thanks again for providing this. It's incredible how many areas you touched!

HulaQueen

  • Jr. Member
  • **
  • Posts: 316
Re: Setting up VirtueMart 1.1.3 in Joomla 1.5 for Australian stores
« Reply #14 on: May 07, 2009, 05:04:15 am »
Das123 can I ask you a quick question? Is the GST % hard coded everywhere to assume all products have GST? Or does it still use the setting in the product that says if the product has GST or not?

I only ask because one product I don't have gst on in the product settings is showing GST on the invoice. I jut thought I would check with you before I investigate.

Good news on the invoice - I have it working following one of the ATO invoice templates. I just have some formatting to do then will share it. It looks simple but took me about 4 hours to change!

Cheers!!