Results 1 to 1 of 1

Threaded View

  1. #1
    Join Date
    Feb 2007
    Posts
    513
    Plugin Contributions
    2

    Default Shipping option with custom user input field

    I found a way to add user input field on any shipping option. I thought I would post it for other who may need this.

    Name:  ScreenHunter_324 Jan. 24 18.04.jpg
Views: 201
Size:  28.9 KB


    1. add custom field to shipping options page: follow these instructions https://www.zen-cart.com/showthread....ld-to-Checkout
    Doing this would be enough if your add the field to the end of /includes/templates/template_name/templates/tpl_checkout_shipping_default.php shipping options if you only have one shipping option or the field corresponds to the last shipping option.

    2. If you want to add the field to 'NOT the last option' and you have multiple options, then:
    EDIT /includes/templates/template_name/templates/tpl_checkout_shipping_default.php

    FIND
    PHP Code:
    <?php echo $quotes[$i]['module']; ?>&nbsp;<?php if (isset($quotes[$i]['icon']) && zen_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?>
    <div class="important forward"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); ?></div> 
    <?php }            } else {?>
    <?php            
    }?>
    <?php 
    echo zen_draw_radio_field('shipping'$quotes[$i]['id'] . '_' $quotes[$i]['methods'][$j]['id'], $checked'id="ship-'.$quotes[$i]['id'] . '-' str_replace(' ''-'$quotes[$i]['methods'][$j]['id']) .'"'); ?><label for="ship-<?php echo $quotes[$i]['id'] . '-' str_replace(' ''-'$quotes[$i]['methods'][$j]['id']); ?>" class="checkboxLabel" ><?php echo $quotes[$i]['methods'][$j]['title']; ?></label><!--</div>--><br class="clearBoth" /><?php            $radio_buttons++;          }        }?>
    CHANGE TO

    PHP Code:
    <?php echo $quotes[$i]['module']; ?>&nbsp;<?php if (isset($quotes[$i]['icon']) && zen_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?>
    <?php 
    // ** start modifications by hayden thring www.hthring.com ** //            if ( ($n > 1) || ($n2 > 1) || ( $quotes[$i]['module'] == MODULE_SHIPPING_STOREPICKUP_TEXT_TITLE) ) {                 if( $quotes[$i]['module'] == MODULE_SHIPPING_STOREPICKUP_TEXT_TITLE){ ?>
    (Carrier Name: <?php echo zen_draw_input_field('frequent_code'); ?>)
    <?php }else{ ?>
    <div class="important forward"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); ?></div> 
    <?php }// ** end modifications by hayden thring www.hthring.com ** //            } else {?>
    <?php            
    }?>
    <?php 
    echo zen_draw_radio_field('shipping'$quotes[$i]['id'] . '_' $quotes[$i]['methods'][$j]['id'], $checked'id="ship-'.$quotes[$i]['id'] . '-' str_replace(' ''-'$quotes[$i]['methods'][$j]['id']) .'"'); ?><label for="ship-<?php echo $quotes[$i]['id'] . '-' str_replace(' ''-'$quotes[$i]['methods'][$j]['id']); ?>" class="checkboxLabel" ><?php echo $quotes[$i]['methods'][$j]['title']; ?></label><!--</div>--><br class="clearBoth" /><?php            $radio_buttons++;          }        }?>
    change MODULE_SHIPPING_STOREPICKUP_TEXT_TITLE to the title as defined by the shipping option you would like to add the field on.
    You can find the above code (way to add additional area on at end of any shipping option) on https://www.zen-cart.com/downloads.php?do=file&id=1224 (\Shipping_By_Quote_2.3.zip\Shipping_By_Quote_2.3\includes\templates\spyworld\te mplates\tpl_checkout_shipping_default.php)




    This would not be the best option if anyone has already created a plugin that add field directly to the shipping_way database field, but I don't think anyone has.
    Last edited by vandiermen; 24 Jan 2016 at 08:55 AM.

 

 

Similar Threads

  1. v151 need help lining button with input field please
    By StoreOwner in forum General Questions
    Replies: 1
    Last Post: 2 Jul 2014, 11:04 AM
  2. Personalised Products - User Input Field
    By goldndelicious in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 3 Oct 2009, 09:17 PM
  3. Custom user field
    By FrankDeRosa in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 20 May 2009, 07:18 AM
  4. Input Field Product Option
    By DiZZ in forum General Questions
    Replies: 2
    Last Post: 25 Nov 2007, 05:21 PM

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