Announcement

Collapse
No announcement yet.

Getting rid of checkout page 0 - Hmmm

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Getting rid of checkout page 0 - Hmmm

    AFAIK actinic say that you can remove page 0 from the checkout if you only have one country, and use simple shipping and tax.

    That's OK as far as it goes but the big problem for me is that I have multiple shipping classes defined by weight so that doesn't work for me and many others.

    There's no real reason why we need page 0 though, so I've taken a quick look (in V6 admitedly) and notice the following:

    1. It's very easy to bypass page 0. In orderscript.pl we have the following code

    # Find out where we are
    #
    $::g_nCurrentSequenceNumber = $::g_InputHash{'SEQUENCE'}; # determine the sequence number of the calling page
    if (!defined $::g_nCurrentSequenceNumber) # if we are at the beginning
    {
    $::g_nCurrentSequenceNumber = 0; # $::STARTSEQUENCE;
    }
    Where I have already commented out ::STARTSEQUENCE and set it to 0 instead. This forces the checkout to go straight to page 1 at the start.

    2. This on it's own isn't enough because it checks for the Delivery country code to be set in the session file and bounces you back to page 0 with an error message.

    All it takes though (for UK) shipping is to set the country code in the session file to
    <DELIVERY_COUNTRY_CODE>UK</DELIVERY_COUNTRY_CODE>
    instead of
    <DELIVERY_COUNTRY_CODE/>
    I haven't worked out yet how to this automatically so if someone else can figure it out then it looks like we have a simple way of doing this. Everything else seems to work and while the 'ship to separate delivery address' bit is set to 'No', pressing the change button takes you to page 0 as usual if the customer want to change it.

    I'll continue to look and see if I can figure out the second part of this. Anyone else know?

    Mike

    PS. As I've said, I'm doing this on V6 so it may be a little different on V8.
    -----------------------------------------

    First Tackle - Fly Fishing and Game Angling

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

    #2
    Originally posted by olderscot
    PS. As I've said, I'm doing this on V6 so it may be a little different on V8.
    If you crack it on 6, it should be fine AKAIK as 6, 7, 8 & 9 are all the same. Perhaps you could crack page 3 at the same time as that is only selecting payment method. Woot for 2 page checkout process. Fingers crossed there is a Perl programmer lingering around. I'm still happy to bet £100 it can't be done though .

    Comment


      #3
      So. Looking at the code it seems the sensible place to set the delivery country code is in the cart script. i.e. all we need to do is get the cart to write the delivery country code to the session file when writing the other cart info.

      This has to be possible as the cart does this when using 'get location early'. I just haven't quite figured out how to do it.

      It looks to me as if the cart will do this if we set the delivery country code in the LocationInfo array.

      I haven't given up yet.

      Mike
      -----------------------------------------

      First Tackle - Fly Fishing and Game Angling

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

      Comment


        #4
        OK. Everything seems to be working now.

        To preset the country code, open ShoppingCart.pl, look for %::g_LocationInfo = %$pLocationInfo; (there's only one instance)
        and then add the additional lines as shown below, save and update your site.:

        Code:
        %::g_LocationInfo = %$pLocationInfo;
        $::g_LocationInfo{DELIVERY_REGION_CODE}="UndefinedRegion";
        $::g_LocationInfo{DELIVERY_COUNTRY_CODE}="UK";
        $::g_LocationInfo{INVOICE_COUNTRY_CODE}="UK";
        $::g_LocationInfo{INVOICE_REGION_CODE}="UndefinedRegion";
        And that's it. Combine it with the presetting of the current sequence number variable shown in the first post and actinic will now jump straight to the second page of checkout and bypass page 0. Work fine for shipping by weight.

        One note for anyone thinking of using this. As actinic now has the delivery country code it shows the default shipping charge in the cart as it always does once it knows your location.

        Mike

        PS. Still in V6. Not tested in V8 yet.
        -----------------------------------------

        First Tackle - Fly Fishing and Game Angling

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

        Comment


          #5
          Mike,

          Have you still got problems with v9? If so please summarise your problems here and I will try to take a look as time permits.
          Zoltan
          Actinic Software
          www.actinic.co.uk

          Comment


            #6
            Hi Zoltan,

            I am having trouble getting this to work in V8 and V9. The country and region codes are being written to the global location variable but are no longer being written to the session file.

            The principle of this still works fine as manually presetting the locations in the session file works without any problems.

            As I see it there are two ways of getting around this:

            1. Preset the country codes in the global variable somewhere else in the scripts.

            2. Force an update of the session file after presetting the locations.

            At the moment I'm now looking to see if I can trigger an update of the session file after writing to the global variable. This looks safe to do as it's just after the session file content has been read. I think I'm getting close, it's just a case of working out the correct instruction.

            Mike
            -----------------------------------------

            First Tackle - Fly Fishing and Game Angling

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

            Comment


              #7
              OK. I've simplified it right down. Rather than use the cart to preset the country codes I've done it in orderscript.pl. The challenge was to set the code so that it only happens the once and doesn't overwrite any country changes the customer sets but I can do that by putting it in the same place as the code that sets which page the checkout starts on.

              So here it is. All you have to do is make a change in one place. Open orderscript.pl and look for:

              Code:
              # Find out where we are
              	#
              	$::g_nCurrentSequenceNumber = $::g_InputHash{'SEQUENCE'}; # determine the sequence number of the calling page
              	if (!defined $::g_nCurrentSequenceNumber) 		# if we are at the beginning
              		{
              		$::g_nCurrentSequenceNumber =  $::STARTSEQUENCE;
              		
              		}
              and change it so that it now reads:

              Code:
              # Find out where we are
              	#
              	$::g_nCurrentSequenceNumber = $::g_InputHash{'SEQUENCE'}; # determine the sequence number of the calling page
              	if (!defined $::g_nCurrentSequenceNumber) 		# if we are at the beginning
              		{
              		$::g_nCurrentSequenceNumber = 0;
               		$::g_LocationInfo{DELIVERY_REGION_CODE}="UndefinedRegion";
              		$::g_LocationInfo{DELIVERY_COUNTRY_CODE}="UK";
              		$::g_LocationInfo{INVOICE_COUNTRY_CODE}="UK";
              		$::g_LocationInfo{INVOICE_REGION_CODE}="UndefinedRegion";
              		}
              i.e. we've set the sequence number to 0 and preset the country codes. You can of course use any country code you want, not just the UK.

              Then save and publish to web.

              In operation, the cart works exactly as it normally does. The only difference is that when the customer clicks a checkout button or link they're taken straight to checkout page 1 with the country already set. They can still change the country using the 'change' button and it will only reset that country if the customer starts checkout from afresh. i.e. they can go backwards and forwards in the checkout without anything happening but if they go to a product page or the cart and click checkout then the country will be reset to the uk.

              Tested in V6 and V9. Straighforward change so should work in V7 and V8 without any problems.

              Mike
              -----------------------------------------

              First Tackle - Fly Fishing and Game Angling

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

              Comment


                #8
                Works fine on 8.5.2 for me.

                Comment


                  #9
                  I have implemented this too and it works well, thanks very much indeed!
                  Harvey

                  http://www.zigzagadvertising.co.uk

                  Web Design Worcestershire

                  Comment


                    #10
                    Fantastic solution Mike - just implemented it in 9.2 and works great. I had a look at the KB and apparently this is still not possible - Can this be updated/added in the KB, please?
                    Last edited by KB2; 23-Mar-2010, 09:11 AM. Reason: Updating kb links

                    Comment


                      #11
                      Can this be updated/added in the KB, please?
                      I'll take a look at it this afternoon.
                      ********************
                      Tracey
                      SellerDeck

                      Comment


                        #12
                        The article has now been updated.
                        ********************
                        Tracey
                        SellerDeck

                        Comment

                        Working...
                        X