Jump to content
Sheedy

Не работает кнопка "В корзину" на странице товара

Recommended Posts

Posted (edited)

Добрый вечер! 
Версия ocStore 2.1.0.2.1
Шаблон свой, делал верстку, потом натяжку по примеру дефолтного шаблона. 
Такая проблема, не работает кнопка "В корзину" на странице товара, при нажатие выдает "Загрузка..." и больше ничего... 
Ссылка на сайт: https://snabzhenec.zp.ua/zapchasti_k_traktoram/zapchasti_yumz/kpp_i_zadnij_most_umz/differencial_40_2403010.html

        <div class="section-buy">
           <div class="add-to-cart">
              <div class="coint-product">
                 <input type="text" name="quantity" value="<?php echo $minimum; ?>" size="2" id="input-quantity" class="quantity-num" />
                 <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
                 <div class="arrow-coint">
                    <i id="up-product" class="fas fa-sort-up"></i>
                    <i id="down-product" class="fas fa-sort-down"></i>
                 </div>
              </div>
              <button type="button" id="button-cart" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-primary btn-lg btn-block"><?php echo $button_cart; ?></button>            
           </div>
            <?php if ($minimum > 1) { ?>
            <div class="alert alert-info"><i class="fa fa-info-circle"></i> <?php echo $text_minimum; ?></div>
            <?php } ?>            
            <div class="fast-add-to-cart">
            <button type="button" data-toggle="tooltip" class="comparisons btn-default" title="<?php echo $button_compare; ?>" onclick="compare.add('<?php echo $product_id; ?>');"><i class="fas fa-exchange-alt"></i></button>
            </div>
        </div>
<script type="text/javascript"><!--
   $('#button-cart').on('click', function() {
     $.ajax({
       url: 'index.php?route=checkout/cart/add',
       type: 'post',
       data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),
       dataType: 'json',
       beforeSend: function() {
         $('#button-cart').button('loading');
       },
       complete: function() {
         $('#button-cart').button('reset');
       },
       success: function(json) {
         $('.alert, .text-danger').remove();
         $('.add-to-cart').removeClass('has-error');
   
         if (json['error']) {
           if (json['error']['option']) {
             for (i in json['error']['option']) {
               var element = $('#input-option' + i.replace('_', '-'));
   
               if (element.parent().hasClass('input-group')) {
                 element.parent().after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
               } else {
                 element.after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
               }
             }
           }
   
           if (json['error']['recurring']) {
             $('select[name=\'recurring_id\']').after('<div class="text-danger">' + json['error']['recurring'] + '</div>');
           }
   
           // Highlight any found errors
           $('.text-danger').parent().addClass('has-error');
         }
   
         if (json['success']) {
           $('#content').after('<div class="alert alert-success">' + json['success'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');
   
           $('#cart > div').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
   
           $('html, body').animate({ scrollTop: 0 }, 'slow');
   
           $('#cart > ul').load('index.php?route=common/cart/info ul li');
         }
       },
           error: function(xhr, ajaxOptions, thrownError) {
               alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
           }
     });
   });
   //-->
</script>


 

Edited by Sheedy

Share this post


Link to post
Share on other sites

Оберните страницу в тег <div id="product">

  • +1 1

Share this post


Link to post
Share on other sites
Posted (edited)
12 минут назад, Jozzeff сказал:

Оберните страницу в тег <div id="product">

всё заработало, спасибо большое!

Edited by Sheedy

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.


  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.