Форум: Форум PHPФорум ApacheФорум Регулярные ВыраженияФорум MySQLHTML+CSS+JavaScriptФорум FlashРазное
Новые темы: 0000000
MySQL на примерах. Авторы: Кузнецов М.В., Симдянов И.В. PHP. Практика создания Web-сайтов (второе издание). Авторы: Кузнецов М.В., Симдянов И.В. Объектно-ориентированное программирование на PHP. Авторы: Кузнецов М.В., Симдянов И.В. Социальная инженерия и социальные хакеры. Авторы: Кузнецов М.В., Симдянов И.В. Программирование. Ступени успешной карьеры. Авторы: Кузнецов М.В., Симдянов И.В.
ВСЕ НАШИ КНИГИ
Консультационный центр SoftTime

Форум PHP

Выбрать другой форум

 

Здравствуйте, Посетитель!

вид форума:
Линейный форум Структурный форум

тема: Кнопка RESET в форме и сокрытие поля при самовывозе
 
 автор: kipes   (04.02.2016 в 16:16)   письмо автору
37.4 Кб
 
 

Если выбирается файл с реквизитами то все поля ниже скрываются (обвел красной рамкой), проблема в том - как вшить в имеющийся код кнопку для очищения выбранного файла из подзагрузки. Отметил как №1


Как скрыть поле, если пользователь выбрал "самовывоз"? №2

<div class="frame-inside page-cart pageCart">
    <div class="container">
        <div class="js-empty empty {if count($items) == 0}d_b{/if}">
            <div class="f-s_0 title-cart without-crumbs">
                <div class="frame-title">
                    <h1 class="title">{lang('Оформление заказа','fluid')}</h1>
                </div>
            </div>
            <div class="msg layout-highlight layout-highlight-msg">
                <div class="info">
                    <span class="icon_info"></span>
                    <span class="text-el">{lang('Корзина пуста','fluid')}</span>
                </div>
            </div>
        </div>
        {if count($items) !== 0}
        <div class="js-no-empty no-empty">
            <form enctype="multipart/form-data" method="post" action="{$BASE_URL}shop/order/make_order" class="clearfix">
                <div class="left-cart">
                    <div class="f-s_0 title-cart without-crumbs clearfix">
                        <div class="frame-title f_l">
                            <h1 class="title">{lang('Оформление заказа','fluid')}</h1>
                        </div>
                        <!--{if !$is_logged_in}
                        <span class="old-buyer f_r">
                            <span class="s-t">{lang('Если вы зарегистрированы', 'fluid')} — </span>
                            <button type="button" data-trigger="#loginButton">
                                <span class="d_l text-el">{lang('авторизуйтесь','fluid')}</span>
                            </button>
                        </span>
                        {/if}-->
                    </div>
                    <div class="horizontal-form order-form big-title">
                        <div class="inside-padd">
                            {if $errors}
                            <div class="groups-form">
                                <div class="msg">
                                    <div class="error">
                                        <span class="icon_error"></span>
                                        <span class="text-el">{echo $errors}</span>
                                    </div>
                                </div>
                            </div>
                            {/if}


<div class="groups-form">
    <div class="controls">
        <label class="choice_buyer">Выберите тип покупателя:</label>  
                <label>
                     <input type="radio" name="billing_type_person" value="fiz-lico" checked>
                        Физическое лицо (частный покупатель)
                </label>                              
                <label>
                    <input type="radio" name="billing_type_person" value="yur-lico">
                        Юридическое лицо
                </label>
    </div>
                                <label>
                                    <span class="title">
                                        <span class="p_r">
                                            {lang('Ваше Имя: ','fluid')}
                                            {if $isRequired['userInfo[fullName]']}
                                            <span class="must">*</span>
                                            {/if}
                                        </span>
                                    </span>
                                    <span class="frame-form-field">
                                        <input class="makeup" required type="text" value="" autocomplete="off" name="userInfo[fullName]"> <!--value="{$profile.name}"-->
                                    </span>
                                </label>
                                <label>
                                    <span class="title">
                                        <span class="p_r">
                                            {lang('Ваша Фамилия: ','fluid')}
                                            <span class="must">*</span>
                                        </span>
                                    </span>
                                    <span class="frame-form-field">
                                        <input class="makeup" required type="text" value="" autocomplete="off" name="userInfo[surname]">
                                    </span>
                                 </label>


<!--TELEPHONE-->
<label>
<span class="title">
    <span class="p_r">
                    {lang('Телефон','fluid')} :
             {if $isRequired['userInfo[phone]']}
                     <span class="must">*</span>
             {/if}
    </span>
</span>
       <span class="frame-form-field">
                    <input type="text" name="userInfo[phone]" id="phone_order" value="{$profile.phone}" class="">
       </span>
</label>
<!--END TELEPHONE-->

<!--E-MAIL-->
<label>
<span class="title">
    <span class="p_r">
                    {lang('E-mail:','fluid')}
            {if $isRequired['userInfo[email]']}
    <span class="must">*</span>
    </span>
</span>

{/if}

    <span class="frame-form-field">
                <input class="makeup" required type="text" autocomplete="off" value="" name="userInfo[email]">
    <!--value="{$profile.email}"-->
    </span>
</label>
<!--END E-MAIL-->

<!----------------------------------------
-----------------------------------------
------------------------------------------
--------------------------------------
--------------------------------  -->





</div><!--end class=groups-form-->


<!-- ------------------------BLOCK Fields юридическое лицо--------------------------------------------- -->

<div class="groups-form">

<!--BUTTON UPLOAD-->       
<div class="ulico" style="display:none;margin-top: 12px;"><!-- класс - ulico   влияет на переключение RADIO -->
        <label class="upload_file_label" for="userfile">
            <span class="title">Загрузите файл с реквизитами или заполните поля ниже:</span>
            <span class="frame-form-field">
                <input type="file" name="userfile" value="" id="userfile" style="cursor:pointer">
            </span>
        </label>
<!--END BUTTON-->

<!--"Компания"-->
{echo ShopCore::app()->CustomFieldsHelper->setRequiredHtml('<span class="must"></span>')->setPatternMain('pattern_custom_field')->getOneCustomFieldsByName('company','order')->asHtml()}
<!--"ИНН"-->
{echo ShopCore::app()->CustomFieldsHelper->setRequiredHtml('<span class="must"></span>')->setPatternMain('pattern_custom_field')->getOneCustomFieldsByName('innpole','order')->asHtml()}
<!--"КПП"-->
{echo ShopCore::app()->CustomFieldsHelper->setRequiredHtml('<span class="must"></span>')->setPatternMain('pattern_custom_field')->getOneCustomFieldsByName('kpppole','order')->asHtml()}
<!--"Юридический адрес"-->
{echo ShopCore::app()->CustomFieldsHelper->setRequiredHtml('<span class="must"></span>')->setPatternMain('pattern_custom_field')->getOneCustomFieldsByName('adressur','order')->asHtml()}
<!--"Физический адрес"-->
{echo ShopCore::app()->CustomFieldsHelper->setRequiredHtml('<span class="must"></span>')->setPatternMain('pattern_custom_field')->getOneCustomFieldsByName('adressfiz','order')->asHtml()}

</div>
</div>
<!-- ------------------------end NEW BLOCK Fields юридическое лицо------------------------------------- -->



<!-- ------------------------NEW BLOCK Fields получатель--------------------------------------------- -
<div class="frame_recipient_caption">

<div class="groups-form">
<div class="order_recipient_caption"><strong>Получатель:</strong></div>

{echo ShopCore::app()->CustomFieldsHelper->setRequiredHtml('<span class="must"></span>')->setPatternMain('pattern_custom_field')->getOneCustomFieldsByName('namepol','order')->asHtml()}

{echo ShopCore::app()->CustomFieldsHelper->setRequiredHtml('<span class="must"></span>')->setPatternMain('pattern_custom_field')->getOneCustomFieldsByName('fampol','order')->asHtml()}

{echo ShopCore::app()->CustomFieldsHelper->setRequiredHtml('<span class="must"></span>')->setPatternMain('pattern_custom_field')->getOneCustomFieldsByName('telpol','order')->asHtml()}

{echo ShopCore::app()->CustomFieldsHelper->setRequiredHtml('<span class="must"></span>')->setPatternMain('pattern_custom_field')->getOneCustomFieldsByName('adresspol','order')->asHtml()}
</div>
</div>
<!-- ------------------------end NEW BLOCK Fields получатель------------------------------------------ -->

                    <div class="groups-form">
                    {if count($deliveryMethods) > 0}
                    <!-- Start. Delivery methods block -->
                    <div class="frame-label" id="frameDelivery">
                        <span class="title">{lang('Способ доставки:','fluid')}</span>
                        <div class="frame-form-field check-variant-delivery">
                            
                            {/* <div class="lineForm">
                            <select id="method_deliv" name="deliveryMethodId">
                                <option value="">{lang('--Выбирете способ доставки--', 'fluid')}</option>
                                {foreach $deliveryMethods as $deliveryMethod}
                                <option
                                name="met_del"
                                value="{echo $deliveryMethod->getId()}">
                                {echo $deliveryMethod->getName()}
                            </option>
                            {/foreach}
                        </select>
                    </div>*/}



                    <div class="frame-radio">
                        {foreach $deliveryMethods as $deliveryMethod}
                        <div class="frame-label">
                            <span class="niceRadio b_n">
                                <input type="radio"
                                name="deliveryMethodId"
                                value="{echo $deliveryMethod->getId()}"
                                />
                            </span>



                            <div class="name-count">
                                <span class="text-el">{echo $deliveryMethod->getName()}</span>
                                {if $deliveryMethod->getDescription() && trim($deliveryMethod->getDescription()) != ""}
                                <span class="icon_ask" data-rel="tooltip" data-title="{echo $deliveryMethod->getDescription()}"></span>
                                {/if}
                            </div>



                            <a target="_blank" href="http://mirklimata-rostov.ru/dostavka-split-sistem" style="margin-left:20px;font-size:11px;color:#0090D8">
                            <span class="help-block">
                                {if $deliveryMethod->getDeliverySumSpecified()}
                                {echo $deliveryMethod->getDeliverySumSpecifiedMessage()}
                                {else:}
 <div>{lang('Бесплатно при заказе от','fluid')}: {echo \Currency\Currency::create()->getCurrencyToFormat(\Currency\Currency::create()->getMainCurrency()->getId(), number_format($deliveryMethod->getFreeFrom(),$pricePrecision,'.',''),'span', 'curr', '');}</div> 
                                {/if}
                            </span>
                            </a>

                        </div>
                        {/foreach}
                    </div>
                </div>
                <!-- End. Delivery methods block -->
            </div>
            {/if}

<!-- Получатель заказа     Start. Delivery  address block and comment-->
                    <div class="label_margin_top">
                       <label>
                        <span class="title">
                            <span class="p_r">
                                {lang('Получатель заказа:', 'fluid')}<!--<span class="must">*</span>-->
                                {if $isRequired['userInfo[deliverTo]']}
                                <span class="must">*</span>
                                {/if}
                            </span>
                        </span>
                        <span class="frame-form-field">
                        <!--<input autocomplete="off" name="userInfo[deliverTo]" type="text" value="{$profile.address}"/>
                        -->
                        <textarea class="makeup" placeholder="Имя, Фамилия, Адрес" autocomplete="off" name="userInfo[deliverTo]" type="text"></textarea>
                        </span>
                    </label>
                    </div>
<!-- Получатель заказа     End. Delivery  address block and comment-->
        </div>



        <div class="groups-form">
            {if count($deliveryMethods) > 0}
            <!-- Start. Payment methods block-->
            <div class="frame-payment p_r f-s_0" style="margin-bottom: 0;">
                <div id="framePaymentMethod">
                    <div class="frame-label">
                        <span class="title">{lang('Способ оплаты:','fluid')}</span>
                        <div class="frame-form-field">
                            <div class="help-block pseudo-cusel">{lang('Выберите способ доставки:', 'fluid')}</div>
                        </div>
                    </div>
                </div>
                <div class="preloader d_n_"></div>
            </div>
            <!-- End. Payment methods block-->
            {/if}


            <div class="frame-label">
                <div class="frame-form-field">
                    <button type="button" class="m-b_5" data-drop=".hidden-comment" data-place="inherit" data-overlay-opacity="0"><span class="d_l_1">{lang('Добавить комментарий к заказу', 'fluid')}</span></button>
                    <div class="hidden-comment drop">
                        <textarea class="makeup" name="userInfo[commentText]" ></textarea>
                    </div>
                </div>
            </div>


            <div class="frame-label">
                <span class="title">&nbsp;</span>
                <span class="frame-form-field">
                    <div class="btn-buy">
                        <button type="submit" id="submitOrder">
                            <span class="text-el">{lang('Оформить заказ','fluid')}</span>
                        </button>
                    </div>
                </span>
            </div>
        </div>
    </div>
</div>
</div>











<div class="right-cart">
    <div class="frame-bask frame-bask-order">
        <div class="title-default">
            <div class="frame-title d_b clearfix">
                <div class="title f_l">{lang('Мой заказ', 'fluid')}</div>
                <div class="f_r">
                    <button type="button" class="d_l_1 editCart">{lang('Редактировать', 'fluid')}</button>
                </div>
            </div>
        </div>

        <div id="orderDetails" class="p_r">
            {include_tpl('cart_order')}
        </div>
    </div>
</div>
{form_csrf()}
</form>
</div>
{/if}
</div>
</div>





<script type="text/javascript" src='{$THEME}js/maskedinput.js'></script><!--Отвечает за маску-телефона +7 (---) -- -- -->
<script type='text/javascript' src='{$THEME}js/cusel-min-2.5.js'></script>



<!------------------------------------ КОД ProFirst -------------------------------------------------------------- -->


{literal}

<script type="text/javascript">
$('input[type=radio][name=billing_type_person]').change(function() {
    if (this.value == 'fiz-lico') {
        $('.frame_recipient_caption').show();
        $("#custom_field_155").prop('required',true);
    }
    else if (this.value == 'yur-lico') {
        $('.frame_recipient_caption').hide();
        $("#custom_field_155").prop('required',false);
    }
});
</script>

<script type="text/javascript">

$("document").ready(function(){
$('#userfile').on('change', function (event, files, label) {
    $('label[for="custom_field_152"]').remove();
    $('label[for="custom_field_151"]').remove();
    $('label[for="custom_field_150"]').remove();
    $('label[for="custom_field_149"]').remove();
    $('label[for="custom_field_148"]').remove();
    
    var file_name = this.value.replace(/\\/g, '/').replace(/.*\//, '');
    var file_url = location.protocol + "//" + location.host + "/uploads/files/" + file_name;
    $('#custom_field_111').val(file_url);
});

$('input[type=radio][name=billing_type_person]').change(function() {
    if (this.value == 'fiz-lico') {
        $('.ulico').hide();
            $("#custom_field_152, #custom_field_151, #custom_field_150, #custom_field_149, #custom_field_148").prop('required',false);
    }
    else if (this.value == 'yur-lico') {
        $('.ulico').show();
        $("#custom_field_152, #custom_field_151, #custom_field_150, #custom_field_149, #custom_field_148").prop('required',true);
    }
});
});


/*---------------------------------- END --- КОД ProFirst ------------------------------------------------------------*/

var Order = {
    initGift: function() {
        $(document).on('beforeGetTpl.Cart', function(e) {
            if (e.obj.template == 'cart_order')
                $(genObj.orderDetails).find(preloader).show();
        });
        $(genObj.giftButton).click(function(e) {
            Shop.Cart.getTpl({
                ignoreWrap: '1',
                template: 'cart_order',
                gift: $(genObj.gift).val(),
                deliveryMethodId: function(){
                    if (selectDeliv)
                        return $(genObj.dM).val()
                    else
                        return $(genObj.dM).filter(':checked').val()
                }
            });
        })
        $(genObj.gift).keydown(function(e) {
            if (e.keyCode == 13) {
                $(genObj.giftButton).trigger('click')
                e.preventDefault();
            }
        })
    },
    initOrder: function() {
        if (selectDeliv) {
            cuselInit($(genObj.frameDelivery), $(genObj.dM));
            $(genObj.dM).on('change.methoddeliv', function() {
                Shop.Cart.getTpl({
                    ignoreWrap: '1',
                    template: 'cart_order',
                    gift: $(genObj.gift).val(),
                    deliveryMethodId: $(this).val()
                });
                Shop.Cart.getPayment($(this).val(), '');
            });
        }
        else {
            $(genObj.frameDelivery).nStRadio({
                wrapper: $(".frame-radio > .frame-label"),
                elCheckWrap: '.niceRadio'
                        ,classRemove: 'b_n' //if not standart
                ,
                after: function(el, start) {
                    if (!start) {
                        var input = $(el).find('input');
                        Shop.Cart.getTpl({
                            ignoreWrap: '1',
                            template: 'cart_order',
                            gift: $(genObj.gift).val(),
                            deliveryMethodId: input.val()
                        });
                        Shop.Cart.getPayment(input.val(), '');
                    }
                }
            });
        }

        if (selectPayment)
            cuselInit($(genObj.framePaymentMethod), $(genObj.pM));

        else
            $(genObj.framePaymentMethod).nStRadio({
                wrapper: $(".frame-radio > .frame-label"),
                elCheckWrap: '.niceRadio'
                        ,classRemove: 'b_n'//if not standart
            });
    }
}
$(document).on('scriptDefer', function() {
    Order.initOrder();
    $(document).on('beforeGetPayment.Cart', function(e) {
        $(genObj.submitOrder).attr('disabled', 'disabled');
        $(genObj.framePaymentMethod).next().show();
    });
    $(document).on('getPayment.Cart', function(e) {
        $(genObj.framePaymentMethod).html(e.datas).next().hide();
        $(genObj.submitOrder).removeAttr('disabled');
        if (selectPayment)
            cuselInit($(genObj.framePaymentMethod), $(genObj.pM));
        else {
            $(genObj.framePaymentMethod).nStRadio({
                wrapper: $(".frame-radio > .frame-label"),
                elCheckWrap: '.niceRadio'
            ,classRemove: 'b_n'//if not standart
            });
        }

        $(document).trigger('hideActivity');
    });
    $(document).on('getTpl.Cart', function(e) {
        if (e.obj.template == 'cart_order') {
            $(genObj.orderDetails).empty().append(e.datas);
            $(genObj.orderDetails).find('[data-drop]').drop();
            
            Order.initGift();
            
            if (totalItemsBask == 0){
                $('.pageCart').find(genObj.blockEmpty).show().end().find(genObj.blockNoEmpty).hide();
            }
        }
    });
});
Order.initGift();Order.initOrder();
</script>

<script>
jQuery(function($){
   $("#phone_order").mask("+7(999) 999-99-99");
   });
</script>

{/literal}

  Ответить  
Rambler's Top100
вверх

Rambler's Top100 Яндекс.Метрика Яндекс цитирования