<?php if (!empty($shipping_methods)) { ?>
    <?php foreach ($shipping_methods as $code => $sm) { ?>
        <?php $title = !empty($sm['title']) ? $sm['title'] : ''; ?>
        <?php $image = $images[$code]['image']; ?>

        <div class="shipping_method <?= $code; ?>">
            <strong class="title"><?= !empty($image) ? '<img class="shipping_method_image" src="'.$image.'">' : ''; ?><?= $title; ?></strong>
            <?php if(!empty($sm['quote'])) { ?>
                <?php foreach ($sm['quote'] as $key => $quote) { ?>
                    <?php $final_code = !empty($quote['code']) ? $quote['code'] : $code; ?>
                    <?php $title_quote = !empty($quote['title']) ? $quote['title'] : ''; ?>
                    <?php $price_format = !empty($quote['text']) ? $quote['text'] : ''; ?>
                    <?php $desc = !empty($quote['desc']) ? $quote['desc'] : ''; ?>
                    
                    <?php $checked = $quote['checked']; ?>
                    <div class="radio-input radio">
                        <label for="<?= $final_code; ?>">
                            <input name="shipping_method" onchange="set_shipping_method($(this));" value="<?= $final_code; ?>" id="<?= $final_code; ?>" <?= $checked ? 'checked="checked"' : '';?> type="radio"> 
                            <span class="text"><?= $title_quote; ?></span><span class="price"><?= $price_format; ?></span>
                            <?= !empty($desc) ? '<span class="desc">'.$desc.'</span>' : '' ?>
                        </label>
                    </div>
                <?php } ?>
            <?php } elseif(array_key_exists('error', $sm) && !empty($sm['error'])) { ?>
                <div class="poc_alert poc_alert-warning"><?= $sm['error'] ?></div>
            <?php } ?>
        </div>
    <?php } ?>
    <?php if(!empty($method_chossed)) { ?>
        <script type="text/javascript">
            _complete_step('shipping');
        </script>
    <?php } ?>
<?php } else { ?>

    <div class="poc_alert poc_alert-warning"><?= $poc_icon_error; ?> <?= $error_no_shipping; ?></div>
    
    <script type="text/javascript">
        _uncomplete_step('shipping');
    </script>
<?php } ?>