Jump to content

how to change the loop to echo the country part and city part in one li?


runeveryday

Recommended Posts

the default html output:

<li class="clearfix">

            <div class="input-box input-firstname input-select-box">

                <label for="billing:firstname">First Name<span class="required">*</span></label>

                <input type="text" value="" id="billing:firstname" name="billing[firstname]" class="required-entry input-text">

            </div>

            <div class="input-box input-lastname input-select-box">

                <label for="billing:lastname">Last Name <span class="required">*</span></label>

                <input type="text" value="" id="billing:lastname" name="billing[lastname]" class="required-entry input-text">

            </div></li>

    <li class="clearfix">

    <div class="input-box input-country">...</div></li>

   

    <li class="clearfix">

            <div class="input-box input-city input-select-box">

                <label for="billing:city">City <span class="required">*</span></label>

                <input type="text" id="billing:city" class="required-entry input-text" title="City" value="" name="billing[city]">

            </div></li>

 

 

 

the php code:

 

 

$billingFields['firstname'] = '

            <div class="input-box input-firstname'.((in_array('firstname', $formErrors)) ? ' input-error' : '').'">

                <label for="billing:firstname">'.$this->__('First Name').'<span class="required">*</span></label>

                <input class="required-entry input-text" type="text" name="billing[firstname]" id="billing:firstname" value="'.$this->getFirstname().'" />

            </div>';

        $billingFields['lastname'] = '

            <div class="input-box input-lastname'.((in_array('lastname', $formErrors)) ? ' input-error' : '').'">

                <label for="billing:lastname">'.$this->__('Last Name').' <span class="required">*</span></label>

                <input class="required-entry input-text" type="text" name="billing[lastname]" id="billing:lastname" value="'.$this->getLastname().'" />

            </div>';

        ?>

    <?php if(!$this->settings['exclude_country_id']):?>

    <?php

    $billingFields['country_id'] = '

        <div class="input-box input-country'.((in_array('country', $formErrors)) ? ' input-error' : '').'">

            <label for="billing:country_id">'.$this->__('Country').' <span class="required">*</span></label>

                '.$this->getCountryHtmlSelect('billing').'

        </div>';

    ?>

    <?php else: ?>

    <?php $billingFields['country_id'] = '

        <input type="hidden" name="billing[country_id]" id="billing:country_id" value="'.$this->settings['default_country'].'" />';

    ?>

    <?php endif; ?>

    <?php if(!$this->settings['exclude_city']):?>

        <?php $billingFields['city'] = '

            <div class="input-box input-city'.((in_array('city', $formErrors)) ? ' input-error' : '').'">

                <label for="billing:city">'.$this->__('City').' <span class="required">*</span></label>

                <input type="text" name="billing[city]" value="'.$this->htmlEscape($this->getCity()).'" title="'.$this->__('City').'" class="required-entry input-text" id="billing:city" />

            </div>';

        ?>

    <?php endif; ?>

   

    <?php $billingFields = $this->getBillingFieldsOrder($billingFields);?>

    <?php foreach($billingFields as $key => $value):?>

        <?php if(!empty($value['has_li'])):?>

            <?php echo implode('',$value['fields']);?>

        <?php else:?>

           

            <li class="clearfix"><?php echo implode('',$value['fields']);?>

        <?php endif;?>

    <?php endforeach;?>

 

 

 

i am sorry . i see the foreach loop. and feel all the code is the same, don't know how to alter it to output the country and city part in the same li like the firstname and lastname.

 

<li class="clearfix">...</li>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.