Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 General help me questions
 Limit ship to options
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

gledav
VP-CART New User

Australia
66 Posts

Posted - October 04 2009 :  18:37:22  Show Profile  Visit gledav's Homepage  Reply with Quote
Hi.

Is there any way to limit the number of countries available to ship to? I want customers from all countries to be able to order products but they can only be delivered to Australia, NZ, Japan and a few others.

Thanks.

Glenn

www.wineseek.com.au
www.creativemusic.com.au
www.mygiftbasket.com.au

gledav
VP-CART New User

Australia
66 Posts

Posted - October 07 2009 :  01:20:04  Show Profile  Visit gledav's Homepage  Reply with Quote
Perhaps I wasn't very clear.. In shopcustomer.asp I would like approx 20 countries to appear in the drop down Country list in the Customer Information section. However in the Shipping Information section I only want about 6 particular countries to appear as these will be the only countires we can ship to. This doesn't seem possible to achieve via admin so does anyone know how I can do it otherwise?

Hope someone can help. Thanks

Glenn

www.wineseek.com.au
www.creativemusic.com.au
www.mygiftbasket.com.au
Go to Top of Page

carfin
VP-CART Expert

United Kingdom
948 Posts

Posted - October 07 2009 :  06:44:21  Show Profile  Reply with Quote
Hi Glenn,

The customer details form uses the same countries drop down list as the shipping form so you would have to create a new sub routine in shopcountries.asp to display a limited number of countries in the shipping form. An easier way is to choose your 20 countries for the customer form by hiding all those you don't want displayed (in shopcountries table) and then from these 20 countries use the countrydisplayorder field to select your ship to countries numbered 1 to 6. These will now show up first on the dropdown list, so you can have a notice on the shipping form to say that you only ship to the first section of countries on the list.
If you really want to stop a customer from choosing a country that you don't ship to, I can help out with code required.

Regards,

Carrol
www.deanston-electrical.co.uk
Go to Top of Page

gledav
VP-CART New User

Australia
66 Posts

Posted - October 07 2009 :  20:57:48  Show Profile  Visit gledav's Homepage  Reply with Quote
Hi Carrol,

Thanks for your advice. I think it probably needs to be made idiot proof, and speaking of idiots, I wouldn't know where to begin with a sub routine. I would be grateful for any help with this.

Thanks,

Glenn

Glenn

www.wineseek.com.au
www.creativemusic.com.au
www.mygiftbasket.com.au
Go to Top of Page

carfin
VP-CART Expert

United Kingdom
948 Posts

Posted - October 08 2009 :  04:29:47  Show Profile  Reply with Quote
Hi Glenn,

Ok, here's the code that I've tried out on our test site and seems to work fine. I am not an expert, as the user name may suggest (I just help out a lot) so please test this out thoroughly before putting it live on any of your sites. Save a copy of shopcountries.asp and shopcustomerform.asp before making any changes.
In your database table shopcountries, choose which countries you want in your limited ship to list and in the field countrydisplayorder, number them from 1 to however many (best to number them to display in alphabetical order)

Open the file shopcountries.asp in a text or html editor
Just before the last closing tag %> add the following code:
'***** CUSTOM - Used on shipping form to display limited countries as entered in countrydisplayorder field in shopcountries table
Sub ShopCountriesShip(formname, fieldname,other)
dim sql, rs, countryname, countryabbrev, selected
dim dbc, i, selecteddone, count
response.write "<select class=""txtfielddropdown"" name=""" & formname & """ size=""1"">" & vbcrlf
countryabbrev=""
countryname=getlang("langcommonselect")
If fieldname="" then
selected=" selected=""selected"""
selecteddone=true
else
selecteddone=false
end if
response.write "<option value=""" & countryabbrev & """ " & selected & ">" & countryname & "</option>" & vbcrlf
if UCASE(other) = "YES" then
if lcase(fieldname) = "other" then
selected = " selected=""selected"""
end if
response.write "<option value=""other"" " & selected & ">Other</option>" & vbcrlf
selected = ""
end if
selected=""
count=0
shopopendatabase dbc
sql="Select * from shopcountries where (countryhide=0 OR countryhide IS NULL) and countrydisplayorder is not null"
sql=sql & " order by countrydisplayorder"
set rs=dbc.execute(sql)
do while not rs.eof
countryname=rs("countryname")
countryabbrev=rs("country")
selected=""
if selecteddone=false then
if fieldname=countryabbrev then
selected=" selected=""selected"""
selecteddone=true
end if
end if
response.write "<option value=""" & countryabbrev & """" & selected & ">" & countryname & "</option>" & vbcrlf
selected=""
count=count+1
rs.movenext
loop
closerecordset rs
response.write "</select>"
shopclosedatabase dbc
end sub


Save the file.

You now need to make the call to this new sub in the shipping form.
Open shopcustomerform.asp
Locate sub ShopShippingForm (about line 145)
Find the line ShopCountries "shipcountry", strshipcountry, "no"
Change it to ShopCountriesShip "shipcountry", strshipcountry, "no"
Save the file

This should now display the limited list in the shipping form.

Regards,

Carrol
www.deanston-electrical.co.uk
Go to Top of Page

gledav
VP-CART New User

Australia
66 Posts

Posted - October 08 2009 :  17:39:28  Show Profile  Visit gledav's Homepage  Reply with Quote
Thanks Carrol. You are, as usual, an angel. I'll give it a go and let you know.

Kind regards,
Glenn.

Glenn

www.wineseek.com.au
www.creativemusic.com.au
www.mygiftbasket.com.au
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00