Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Feb 2010
    Posts
    32
    Plugin Contributions
    0

    Default Drop down address book?

    Does anyone know if it possible to make the customer address book a drop down menu?

    When customers check out I need them to select a delivery address from a number of addresses (there could be as many as 20), rather than list them all down the page.

    A drop down box would be ideal.

    Can anyone point me in the right direction? And more importantly, can this be done?

    Many thanks

    Mel

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

    Default Re: Drop down address book?

    Quote Originally Posted by MelodyW View Post
    Does anyone know if it possible to make the customer address book a drop down menu?

    When customers check out I need them to select a delivery address from a number of addresses (there could be as many as 20), rather than list them all down the page.

    A drop down box would be ideal.

    Can anyone point me in the right direction? And more importantly, can this be done?

    Many thanks

    Mel
    Don't have a solution, but potential guidance to one. The code that presents the addresses to the screen would need to be modified to populate the dropdown box, then the drop down would need to be recognized by the next "screen". Would suggest that the first. Option populated in the dropdown be something like please choose an address, and then before going to the next screen, something other than that selection must be selected.

    The only "troubling" part, is how big is the field going to be that will display the address, and the formatting of the address in the dropdown to be legible to the guest.

    Can it be done? Pretty much anything can be,but it is more than likely going to be custom coding to do it.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

    Default Re: Drop down address book?

    Here's the code fragment from my Multiple Ship-To Addresses plugin that builds up the dropdown list input:
    Code:
    $addresses = $db->Execute("SELECT address_book_id FROM " . TABLE_ADDRESS_BOOK . " WHERE customers_id = " . (int)$_SESSION['customer_id']);
    if ($addresses->EOF) {
      zen_redirect(zen_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'));
    }
    $multishipAddresses = array();
    while(!$addresses->EOF) {
      $multishipAddresses[] = array ( 'id' => $addresses->fields['address_book_id'],
                                      'text' => str_replace("\n", ', ', zen_address_label($_SESSION['customer_id'], $addresses->fields['address_book_id']))
                                    );
      $addresses->MoveNext();
    }
    Then, you use the built-in Zen Cart function to display the dropdown:
    Code:
    echo zen_draw_pull_down_menu('address[]', $multishipAddresses);

  4. #4
    Join Date
    Sep 2013
    Location
    Texas
    Posts
    304
    Plugin Contributions
    0

    Default Re: Drop down address book?

    I too have hit a brick wall on formatting the address book.
    What I am attempting to do is format the address book into 2 to 4 columns (i.e. like a grid) so when you have 50 or more entries and you want to pick a different "ship to" you don't have to scroll down forever.

    I like my idea better than a drop box because with the drop box you still have to scroll through the entire address list to get to the last entry.

    Any help with the code to create multiple columns when displaying the address book or at least a point in the right direction would he greatly appreciated.

    Thanks in advance.

  5. #5
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Drop down address book?

    Quote Originally Posted by linuxguy2 View Post
    I too have hit a brick wall on formatting the address book.
    What I am attempting to do is format the address book into 2 to 4 columns (i.e. like a grid) so when you have 50 or more entries and you want to pick a different "ship to" you don't have to scroll down forever.

    I like my idea better than a drop box because with the drop box you still have to scroll through the entire address list to get to the last entry.

    Any help with the code to create multiple columns when displaying the address book or at least a point in the right direction would he greatly appreciated.

    Thanks in advance.
    Umm... CSS to identify each "grouping", determine if displaying across or down first... determine maximum possible in the width of the current screen, use that to determine the number of columns (some form of minimum width for the column to be known) the remaining "space" would be the rows... Size each column in a percentage of the available screen based on 100%/(number of columns)... Think that pretty much covers it, though there is a bit more detail to go... If information is to be filled down a row, then basically until the max columns have been reached, then may need to calculate out which numbered item should be displayed next (adjacent/to the right) in this method the last column would more than likely always be the one to have fewer items than the row(s) to the left of it. In a row centric population, the last row would be the one to have fewer than previous rows (if any have fewer in it.)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Jun 2012
    Posts
    68
    Plugin Contributions
    2

    Default Re: Drop down address book?

    mc12345678, could you give more details on how to display address entries in 2 columns?
    I started a new thread last week but no reply so far.

    I tried to add code <table width="100%"><tr><td width="50%">, but that changed the whole block, not individual entries.
    Could you kindly help? Thank you.

  7. #7
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Drop down address book?

    Quote Originally Posted by scott_ease View Post
    mc12345678, could you give more details on how to display address entries in 2 columns?
    I started a new thread last week but no reply so far.

    I tried to add code <table width="100%"><tr><td width="50%">, but that changed the whole block, not individual entries.
    Could you kindly help? Thank you.
    So, I don't know your level of programming and while I began looking at the code a little last night after seeng this request, I sort of ran out of time in order to provide specific code advise and thought perhaps could offer some discussion of what is involved.

    The css is certainly a part of the solution, but is not the final answer. In oder to break the "list" intomultiple sections, there needs to be some understood division. Part of this depends on what the contolling mechanism wll be for the list.

    If a column is to be capped at x items, then how many columns will be allowed as compared to how many total items is involved? If the number of columns is capped then what about responsive design? If the screen is shrunk left to right, what then?

    Also want to consider at what point a multi-column offering should be made.. Should two items be displayed side-by-side as a "default" maybe after x items? Or at least such that each column has a minimum of so many?

    Anyways, this all leads down the path of doing some up front "calculations" and then based on the need for multiple columns, the number of items per column (based on the maximum allowed and whether multiple pages will be used) is identified, then the data is output with a column "divider" applied at the end of each column with the remaining data output for the next column with that process repeated until all columns or the maximum number for the page is displayed. Part of the output is to format the column based on the total number of columns in parallel with the output... For example, if total columns is 1, then 100%/1. If 2 columns, then 100%/2. Though that would be more like 100/2 done by php with the % following as text...

    This is a process similar to the column layout of product used in many of the templates (responsive mostly) available in the plugins/download area.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Drop down address book?

    Btw, having looked now at the other thread, the changes described above appear to be necessary in includes/templates/YOUR_TEMPLATE/templates/tpl_modules_checkout_address_book.php

    But, it would also be a good idea to identify if the same "functionality" should occur when that is used in other calls... Basically would want to search for where that file is called and see/identify if it would be acceptable to have the same multi-column functionality occur/exist. If so then can "blindly" apply the changes. If not, then need to detect if the current page is the one(s) where that should apply...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Jun 2012
    Posts
    68
    Plugin Contributions
    2

    Default Re: Drop down address book?

    I managed to put address entries into a table by adding code to 'tpl_modules_checkout_address_book.php'
    <table width="100%"><tr><td width="50%">......
    </td> <td width="50%">
    <?php
    $addresses->MoveNext();
    }
    ?> </td></tr></table>

    But all 5 entries are squeezed in the same row.
    How to move 3rd&4th entries to the second row and 5th entry to the third row?
    Thank you.
    Last edited by scott_ease; 8 Oct 2015 at 02:34 PM.

  10. #10
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Drop down address book?

    I managed to put address entries into a table by adding code to 'tpl_modules_checkout_address_book.php'
    Code:
    <table width="100%"><?php $tablecounter++;
    if (($tablecounter % 2) == 1) {
    ?><tr>
    <?php } 
    ?><td width="50%">......
    </td><?php 
    if (($tablecounter % 2) == 0) {
    ?></tr>
    <?php } 
            $addresses->MoveNext(); 
          } 
    ?>  </td></tr></table>
    But all 5 entries are squeezed in the same row.
    How to move 3rd&4th entries in the second row and 5th entry in the third row?
    Thank you.

    I changed the above code, but didn't provide "highlights". Please review for applicability.

    Also, before the loop that starts the while, set $tablecounter = 0;
    Last edited by mc12345678; 8 Oct 2015 at 02:54 PM. Reason: Use modulus instead of divide by and compare to integer version.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v150 Email Address Exporter not show in my tools drop down menu
    By maperr55 in forum All Other Contributions/Addons
    Replies: 10
    Last Post: 1 May 2013, 03:01 PM
  2. Delivery Address from Drop Down List at Checkout
    By OrganicMan in forum General Questions
    Replies: 4
    Last Post: 25 Jul 2008, 10:02 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