Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2010
    Location
    Butte, MT
    Posts
    79
    Plugin Contributions
    0

    Default requiring shipping address - and having shipping address form in the shipping page...

    Is there a way to have Zen-Cart show the shipping/delivery address form in the "shipping" page of the checkout, rather than showing the default (billing) address? I'm working with a local florist, and they want to have that form come up in line with each order to insure that customers see it and are not just skipping over the delivery address.

    Zen-cart 1.5.5b
    www [dot] buttefloral [dot] com
    Keith Seyffarth
    Paydirt Design

  2. #2
    Join Date
    Jul 2012
    Posts
    16,751
    Plugin Contributions
    17

    Default Re: requiring shipping address - and having shipping address form in the shipping pag

    So not entirely sure it accomplishes the desired result and I'd have to get back to you on the code portion of it, but would it satisfy the request if upon starting the payment/purchase process if the checkout_shipping_address screen were shown offering the selection or addition of addresses? That when selected would return to the checkout_shipping page and then continue on with the process? Otherwise might suggest any of other modified checkout processes.

    The default ZC code ensures an address is "entered" by defaulting to whatever the customer has as their default address. Yes, it is possible to change that behavior, the question is how to further ensure that something is entered.

    My thoughts were on using one or more observers of the checkout_shipping header: includes/modules/pages/checkout_shipping/header_php.php to first detect the condition when entering the file and then to modify the setting/redirect at the end of the file to redirect to the checkout_shipping_address form when first arriving at the shipping page and otherwise to display the shipping page as normal. Seems to require the minimal amount of modification, but then again the customer could still "blow" through the shipping portion and just select the default address again...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Mar 2010
    Location
    Butte, MT
    Posts
    79
    Plugin Contributions
    0

    Default Re: requiring shipping address - and having shipping address form in the shipping pag

    I think that probably meets the store owner's requirement, if it asks which address (or enter a new one) for delivery, then goes on to choose the shipping method.
    Keith Seyffarth
    Paydirt Design

  4. #4
    Join Date
    Jul 2012
    Posts
    16,751
    Plugin Contributions
    17

    Default Re: requiring shipping address - and having shipping address form in the shipping pag

    So here are my proposed files to accomplish the desired operation.

    This was tested on a ZC 1.5.5 site and is primarily written for ZC 1.5.3+.

    To explain, my thought process and implementation is this:
    When customer arrives at the checkout_shipping page for the first time, there is no session set associated with the 'sendto' address. I take advantage of that information to "recognize" that this is the first time arriving at the checkout_shipping page. Then, I allow the header code to progress so that the "standard" checks are performed in preparation of the checkout_shipping page to be presented or in the case of someone "randomly" trying to go to the checkout_shipping page that they are redirected to the login page. In my opinion at this point it doesn't make sense to go straight to the shipping address area under the current request. So, at the end of the header file, if the beginning identified no sendto address was set, then to redirect to the checkout_shipping_address page. Expectation is that now at the checkout_shipping_address page, selection of the address is made and with the process "continuing" the customer is returned back to the checkout_shipping page and this time the sendto address ought to be set and processing continues as normal with the selected address filled in. If the customer returns to the checkout_shipping page, then whatever value remains in the 'sendto' address is what is used. This value is set upon return to the checkout_shipping page and even in the checkout_shipping_address page (if one is not set which is the condition that will exist at the end of the first load of the checkout_shipping page.

    Anyways, try it out and see if it accomplishes the desired task.

    To do this I propose a single observer file that will observe the checkout_shipping header start and end, with a variable maintained to link the information between the two.

    For ZC 1.5.3. and above create a new file:\
    includes/classes/observers/auto.force_checkout_shipping_address_load.php
    For versions prior to ZC 1.5.3 well first suggest upgrading, second to to invoke the class file through an includes/auto_loaders or similar related file, and 3rd to insert/incorporate the includes/init_includes/init_observers.php file from a more up-to-date version of ZC.

    Code:
    <?php
    
     /**
      * observer class file to force the customer to go to the checkout_shipping_address screen when first stepping through the 
      *  checkout process to try to force entry/selection of the destination address rather than just moving on with the default address.
      * mc12345678.
      */
    
    class zcObserverForceCheckoutShippingAddressLoad extends base {
    
      private $_emptySendTo;
    
      function __construct() {
        $observeThis = array();
        $observeThis[] = 'NOTIFY_HEADER_START_CHECKOUT_SHIPPING';
        $observeThis[] = 'NOTIFY_HEADER_END_CHECKOUT_SHIPPING';
    
        $this->attach($this, $observeThis); // Begin observing the above notifiers.
    
        $this->_emptySendTo = false;
      }
    
      function updateNotifyHeaderStartCheckoutShipping(&$callingClass, $notifier) {
        if (!array_key_exists('sendto', $_SESSION)) { // If the key sendto does not exist, then the address is not set.  Other "related" conditions could be if it is set to false, or if it is set to NULL; however, testing for these conditions depends on the goal and previous operations.
          $this->_emptySendTo = true;
        } else { // The session is set to provide some address in the sendto field and the customer is not to be redirected as defined in updateNotifyHeaderEndCheckoutShipping
          $this->_emptySendTo = false;
        }
      }
    
      function updateNotifyHeaderEndCheckoutShipping(&$callingClass, $notifier) {
        if ($this->_emptySendTo) {
          unset($_SESSION['sendto']); // Clear the session of the send to address (set within the header_php.php file before this point) before sending to the checkout_shipping_address.
          zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL'));
        }
      }
    
      function update(&$callingClass, $notifier) {
        if ($notifier == 'NOTIFY_HEADER_START_CHECKOUT_SHIPPING') {
          $this->updateNotifyHeaderStartCheckoutShipping($callingClass, $notifier);
        }
    
        if ($notifier == 'NOTIFY_HEADER_END_CHECKOUT_SHIPPING') {
          $this->updateNotifyHeaderEndCheckoutShipping($callingClass, $notifier);
        }
      }
    
    }
    Now, understand this though, and I had said it before about the possibility of using an otherwise existing modified checkout process, because this will result in customers having an "extra" screen through which to navigate to complete the purchase. But, it does accomplish the requested task of placing the address selection as a necessary action rather than just something else on the screen.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Mar 2010
    Location
    Butte, MT
    Posts
    79
    Plugin Contributions
    0

    Default Re: requiring shipping address - and having shipping address form in the shipping pag

    Thanks. That looks to be working in 1.5.5b.

    Quote Originally Posted by mc12345678 View Post
    Now, understand this though, and I had said it before about the possibility of using an otherwise existing modified checkout process, because this will result in customers having an "extra" screen through which to navigate to complete the purchase. But, it does accomplish the requested task of placing the address selection as a necessary action rather than just something else on the screen.
    This is specifically what the store owner wanted - stop them and make them pick an address before clicking on to get delivery date, shipping method, etc.
    Keith Seyffarth
    Paydirt Design

  6. #6
    Join Date
    Jul 2012
    Posts
    16,751
    Plugin Contributions
    17

    Default Re: requiring shipping address - and having shipping address form in the shipping pag

    Glad that fit the bill. I felt it important to identify other solutions some of which have been developed to shorten the checkout process rather than add more steps. Unfortunately the "regulars" either speed through whatever maze has been developed or learn to do it right the first time. Hopefully it resolves or at least reduces the frequency of problems. :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v150 Incorrect Tax, Shipping and shipping address getting to PayPal
    By rick2210 in forum PayPal Express Checkout support
    Replies: 9
    Last Post: 21 Jul 2012, 12:19 AM
  2. My store is sending to PayPal the shipping address instead of billing address!
    By mondotex in forum PayPal Express Checkout support
    Replies: 17
    Last Post: 6 Jan 2012, 08:31 PM
  3. Move Address Book entries on Shipping Address page
    By giftmeister in forum Basic Configuration
    Replies: 0
    Last Post: 17 May 2009, 07:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR