Allow Free Shipping to Store Country Only in Virtuemart

This forum is for general questions about extensions for Joomla! version 1.5.x.
Locked
peskyhuman
Joomla! Apprentice
Joomla! Apprentice
Posts: 40
Joined: Wed Apr 28, 2010 8:42 pm
Location: New Zealand
Contact:

Allow Free Shipping to Store Country Only in Virtuemart

Post by peskyhuman » Sat Aug 14, 2010 1:17 am

This is a solution I spent a long time trying to find, so I am posting it here to save others time.

This code allows you to specify one country which will be allowed free shipping in Virtuemart while the others still retain normal shipping options. This works in hand with the free shipping limit specify in the the Virtuemart store configurations.

Credits: This is a tweak of the code pasted by #nickdwhite to the Virtuemart forums almost 4 years ago. Thanks Nick!

1.) Open the class file: administrator/components/com_virtuemart/classes/ps_checkout.php

2.) Find the following line of code:

Code: Select all

if( $vendor_freeshipping > 0 && $vars['order_subtotal_withtax'] > $vendor_freeshipping) {
3.) Replace the above line of code with the following:

Code: Select all

$db = new ps_DB;
		$q = "SELECT country from #__{vm}_user_info WHERE user_info_id = '" . $vars["ship_to_info_id"] . "'";
		$db->query($q);

		if( $vendor_freeshipping > 0 && $vars['order_subtotal_withtax'] >= $vendor_freeshipping && $db->f("country") == "NZL") {
4.) Replace the country code (NZL) with the code of the country you wish to allow free shipping to.

5.) Specify the free shipping limit by clicking on Edit Store in the Virtuemart control panel (you will find it in the Store Information section of the page).

6.) Specify shipping rates for countries you want to ship to but that are not eligible for free shipping (or else they will not be able complete checkout)

Note: You will also need to set shipping rates for any sales under your free shipping limit, within your country.

Hope this helps someone!!! :p
Check out my latest Joomla! website:

http://thegamegate.co.nz

ciriman
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Tue Jun 22, 2010 9:51 am

Re: Allow Free Shipping to Store Country Only in Virtuemart

Post by ciriman » Tue Feb 01, 2011 6:16 pm

your guide is just for me, but trying to enter the portion of code given something does not work. get free shipping for the country that I put in the code, but if I do a test simulating the shipping to a different country (which I would like to be excluded from free shipping) when choosing your method of payment do not see anything ... as missing the chance to ship.

I've set up different payment methods for both the country and can have free shipping, and for foreign countries. so I think everything is ok.

virtuemart calls asking me to choose the shipping method but do not see any list.
I hope for your help

my virtuemart version is: 1.1.4
joomla! 1.5

shaycohen
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Mar 21, 2012 3:00 pm

Re: Allow Free Shipping to Store Country Only in Virtuemart

Post by shaycohen » Wed Mar 21, 2012 3:04 pm

Great post! how do you add more than one country? for example if you wish to have free shipping not only in NZL but also to Canada?

jabberlope
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Thu Jul 12, 2012 7:14 am

Re: Allow Free Shipping to Store Country Only in Virtuemart

Post by jabberlope » Wed Aug 01, 2012 7:23 am

I'm experiencing the same problem as @ciriman. Anyone ever resolve the issue surrounding this? Thanks, Jabberlope...


Locked

Return to “Extensions for Joomla! 1.5”