Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
 All Forums
 Technical
 Tips and Tricks - HALL OF FAME
 Pre select your home country (Version 3.6.1)
Author « Topic »  

jaapg@promanent.com
Advanced Member

Netherlands
376 Posts

Posted - 10/02/2013 :  04:57:00  
The new cart page that was introduced in version 3.6.1 (ASP) forces customers to first select their country and after this loads the states of this country (when available) and then shows the fields to enter the customer details and address. Most customers however will be from the country your shop is based in, so it would be logical to pre-select the home country and also immediatedly show the customer detail fields.

If you use the shipping estimator you will notice that this will show the home country pre-selected. The shipping estimator is shown in the cart where you see all products placed in your cart.

The cart page also checks Session("country") to see if the homecountry is known. However this value is empty when the cart pages needs to display the customer details section.

So using this knowledge you can insert one line of code in your cart.asp page just before the inccart.asp is included.

<% if SESSION("country")="" then SESSION("country")=origCountry '// Force home country %>
<!--#include file="vsadmin/inc/inccart.asp"-->


This addition will make sure the home country is pre-selected in the customer detail section and even forces the states of your home country to be loaded when available.

Note: When you pull down the country selector in the customer detail section you will see that the top value will read something like "Please select ...". The new cart behaviour means that when you select this line (= deselect your country) the address fields will be hidden again. This is the default behaviour of the new cart. I will write a new post with a tip how to switch this off.

Greetings,

Jaap

jaapg@promanent.com
Promanent b.v.
www.promanent.com | www.vaarwinkel.nl

Edited by - jaapg@promanent.com on 12/05/2018 06:08:24

eferg
Advanced Member

USA
171 Posts

Pre-sales questions only
(More Details...)

Posted - 11/22/2013 :  00:16:39  
Jaap -

Thank you for the tip. 94% of my customers are in the US, so I also want my country to be pre-selected in ver 6.3.1. I also want all the billing fields to show when the page loads (the fields are going to show soon enough anyway).

I don't use the shipping estimator, so my solution to both issues above was to add this session code (with the country hard-coded) before the include line in cart.asp:

<% if SESSION("country")="" then SESSION("country")="United States of America" '// Force default country %>
<!--#include file="vsadmin/inc/inccart.asp"-->

Of course if the customer is non-US, selecting a different country will show the correct related states, postal code, etc.

Ed

Edited by - eferg on 11/22/2013 00:23:56

qimacros
Advanced Member

USA
182 Posts

Pre-sales questions only
(More Details...)

Posted - 12/15/2013 :  13:06:09  
I had the same problem, only in PHP
<?php
session_start();
if (!isset($_SESSION['country'])) { $_SESSION['country']='USA'; }
?>

Jay Arthur, The KnowWare Man, works with companies that want to solve problems of delay, defects and deviation.

atlend
Advanced Member

USA
322 Posts

Posted - 07/06/2018 :  06:27:48  
does this still work? Tried it without any result.

jaapg@promanent.com
Advanced Member

Netherlands
376 Posts

Posted - 07/06/2018 :  07:02:01  
Is a rather old post.
When I open the cart our home country is shown correctly in the shipping estimator. I am not sure that is because of my addition or maybe the cart code was changed later on.

Greetings,

Jaap

jaapg@promanent.com
Promanent b.v.
www.promanent.com | www.vaarwinkel.nl

dbdave
ECT Moderator

USA
10405 Posts

Posted - 07/06/2018 :  07:14:52  
Yes, it works, but you make sure you have vsadmin there as he has his changed

quote:
<% if SESSION("country")="" then SESSION("country")=origCountry '// Force home country %>
<!--#include file="dbadmin/inc/inccart.asp"-->


You should never really do that in my opinion.
Having a secret admin is good for logging in to administer your store, but your include lines should still point to the vsadmin that should still be in place.

What Ed wrote works for me
<% if SESSION("country")="" then SESSION("country")="United States of America" '// Force default country %>
<!--#include file="vsadmin/inc/inccart.asp"-->

I use it for this - https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=110167

Edited by - dbdave on 07/06/2018 07:18:43

John Nolan
Advanced Member

Canada
409 Posts

Posted - 12/05/2018 :  04:35:56  
Is the PHP version of this still the same?, i.e.:
<?php
session_start();
if (!isset($_SESSION['country'])) { $_SESSION['country']='USA'; }
?>

Is this okay in current version?

quadrant
Ecommerce Template Guru

United Kingdom
1110 Posts

Pre-sales questions only
(More Details...)

Posted - 12/05/2018 :  05:09:59  
Hi John,

We use it in 6.9.4 PHP and it still works fine although we only have
if (!isset($_SESSION['country'])) { $_SESSION['country']='United Kingdom'; }
just before the /vsadmin/inc/inccart.php include as our session_start(); line is right at the top of the page and I cannot see a reason to have that twice on the same page.

If you have
<?php
session_cache_limiter('none');
session_start();
ob_start(); ?>
at the top of cart.php then just do this:

<?php
if (!isset($_SESSION['country'])) { $_SESSION['country']='USA'; }
include "vsadmin/inc/inccart.php";
?>

Then when you are on the address section of checkout you should see your country selected.

Regards,
David

John Nolan
Advanced Member

Canada
409 Posts

Posted - 12/05/2018 :  07:13:10  
Hmm...
I have:
<?php
session_cache_limiter('none');
session_start();
ob_start();
?>

at the top of my page, and later I have:
<?php include "vsadmin/db_conn_open.php" ?>
<?php include "vsadmin/inc/languagefile.php" ?>
<?php include "vsadmin/includes.php" ?>
<?php include "vsadmin/inc/incfunctions.php" ?>
<?php include "vsadmin/inc/inccart.php" ?>

I amended that to read:
<?php include "vsadmin/db_conn_open.php" ?>
<?php include "vsadmin/inc/languagefile.php" ?>
<?php include "vsadmin/includes.php" ?>
<?php include "vsadmin/inc/incfunctions.php" ?>
<?php if (!isset($_SESSION['country'])) { $_SESSION['country']='Canada'; }
include "vsadmin/inc/inccart.php";?>
but it didn't seem to have any effect.

I'm working in serene ignorance of PHP, so any pointers are appreciated!

  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000