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>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.