Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Минимальная этона Opencart 3 условие


Recommended Posts

      <div class="buttons">
        <div class="pull-left"><a href="{{ continue }}" class="btn btn-default cnt">{{ button_shopping }}</a></div>
        <div class="pull-right">
          {% if min_total > 0 and min_total > order_total and not nomincoupon %}
            <span class='min-subtotal-note'>Минимальная сумма заказа: {{ min_total }}&nbsp;руб.</span>
            <a href="{{ checkout }}" class="disabled btn btn-primary">{{ button_checkout }}</a>          
          {% else %}
            <a href="{{ checkout }}" class="btn btn-primary">{{ button_checkout }}</a>          
          {% endif %}
        </div>
      </div>

 

 

Подскажите, как можно добавить к этому скрипу ик же условие - если используется подарочный сертификат не усинавливать минимальную сумму заказа

Link to comment
Share on other sites


Спойлер
{{ header }}
<div id="checkout-cart" class="container">
  <ul class="breadcrumb">
    {% for breadcrumb in breadcrumbs %}
    <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
    {% endfor %}
  </ul>
  {% if attention %}
  <div class="alert alert-info"><i class="fa fa-info-circle"></i> {{ attention }}
    <button type="button" class="close" data-dismiss="alert">&times;</button>
  </div>
  {% endif %}
  {% if success %}
  <div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> {{ success }}
    <button type="button" class="close" data-dismiss="alert">&times;</button>
  </div>
  {% endif %}
  {% if error_warning %}
  <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
    <button type="button" class="close" data-dismiss="alert">&times;</button>
  </div>
  {% endif %}
  <div class="row">{{ column_left }}
    {% if column_left and column_right %}
    {% set class = 'col-sm-6' %}
    {% elseif column_left or column_right %}
    {% set class = 'col-sm-9' %}
    {% else %}
    {% set class = 'col-sm-12' %}
    {% endif %}
    <div id="content" class="{{ class }}">{{ content_top }}
      <h1>Ваша корзина</h1>
      <form action="{{ action }}" method="post" enctype="multipart/form-data" class="cart-form">
        <div class="table-responsive">
          <table class="table table-bordered">
            <thead>
              <tr>
                <td class="text-center">{{ column_image }}</td>
                <td class="text-left">{{ column_name }}</td>
                <td class="text-left">{{ column_model }}</td>
                <td class="text-left">{{ column_quantity }}</td>
                <td class="text-right">{{ column_price }}</td>
                <td class="text-right text-right-price">{{ column_total }}</td>
              </tr>
            </thead>
            <tbody>
            {% for product in products %}
            <tr>
              <td class="text-center">{% if product.thumb %} 
                {% if product.href == '#' %}
                    <img src="{{ product.thumb }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-thumbnail" />
                  {% else %}
                    <a href="{{ product.href }}"><img src="{{ product.thumb }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-thumbnail" /></a>
                  {% endif %}
              {% endif %}</td>			         
              <td class="text-left">
                  {% if product.href == '#' %}
                    {{ product.name }}
                  {% else %}
                    <a href="{{ product.href }}">{{ product.name }}</a> 
                  {% endif %}
			  	{% if not product.stock %} 
					<span class="text-danger">***</span> 
				{% endif %}
                {% if product.option %}
                {% for option in product.option %} <br />
                <small>{{ option.name }}: {{ option.value }}</small> {% endfor %}
                {% endif %}
                {% if product.reward %} <br />
                <small>{{ product.reward }}</small> {% endif %}
                {% if product.recurring %} <br />
                <span class="label label-info">{{ text_recurring_item }}</span> <small>{{ product.recurring }}</small> {% endif %}</td>
              <td data-title="{{ column_model }}" class="text-left" style='white-space: nowrap;'>{{ product.model }}</td>
              <td data-title="{{ column_quantity }}" class="text-left"><div class="cart_input_block input-group btn-block" style="max-width: 200px; display: flex; ">
                  
                  {% if active_gift_ids[ product.product_id ] is defined %}
                    <input disabled type="text" value="{{ product.quantity }}" style="background: none; color: black; margin: 0 auto; font-weight: bold; border: 0;" size="1" class="form-control" />
                  {% else %}
                    <input type="text" name="quantity[{{ product.cart_id }}]" value="{{ product.quantity }}" size="1" class="form-control" />
                  {% endif %}
                  <span class="input-group-btn">

                  {% if active_gift_ids[ product.product_id ] is defined %}
                  {% else %}
                  <button type="submit" data-toggle="tooltip" title="{{ button_update }}" class="btn btn-primary main"><i class="fa fa-refresh"></i></button>
                  {% endif %}

                  {% if active_gift_ids[ product.product_id ] is defined %}
                        {% if active_gift_ids[ product.product_id ] > 0 %}
                          <button type="button" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger" onclick="cart.remove('{{ product.cart_id }}');"><i class="fa fa-times-circle"></i></button>
                        {% endif %}
                  {% else %}
                  <button type="button" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger" onclick="cart.remove('{{ product.cart_id }}');"><i class="fa fa-times-circle"></i></button>
                  {% endif %}
                    
                    {% if active_gift_ids[ product.product_id ] is defined %}
                    {% else %}                

                      {#
                        <button type="button" data-toggle="tooltip" title="{{ button_postpone }}" class="btn btn-info" onclick="wishlist.add('{{ product.product_id }}')"><i class="fa fa-hourglass"></i></button>
                      #}
                   {% endif %}

                  </span></div></td>
              <td data-title="{{ column_price }}" class="text-right unit-price">{{ product.price }}</td>
              <td data-title="{{ column_total }}"  class="text-right total-price">{{ product.total }}</td>
            </tr>
            {% endfor %}
            {% for voucher in vouchers %}
            <tr>
              <td></td>
              <td class="text-left">{{ voucher.description }}</td>
              <td class="text-left"></td>
              <td class="text-left"><div class="input-group btn-block" style="max-width: 200px;">
                  <input type="text" name="" value="1" size="1" disabled="disabled" class="form-control" />
                  <span class="input-group-btn">
                  <button type="button" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger" onclick="voucher.remove('{{ voucher.key }}');"><i class="fa fa-times-circle"></i></button>
                  </span></div></td>
              <td class="text-right">{{ voucher.amount }}</td>
              <td class="text-right">{{ voucher.amount }}</td>
            </tr>
            {% endfor %}
              </tbody>
            
          </table>
        </div>
      </form>

       {% if promo != "" %}
        {{ promo }}
       {% endif %}
       {% if promos_meta|length > 0  %}
          <div class="cart-promos">
            <h2>Действующие акции</h2>
            {% for promo_meta in promos_meta %}
                  <div id="promo{{ product_id }}" class="modal fade" role="dialog"> <div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">Акция &laquo;{{ promo_meta.name }}&raquo;</h4></div><div class="modal-body">{{ promo_meta.description }}</div><div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button></div> </div> </div> </div>
              {% if promo_meta.image %}
                <span class="promo-icon promo-image" data-toggle="modal" href="#promo{{ product_id }}"><img src='{{ promo_meta.image }}'></span>
             {% else %}
                <span class="promo-icon"  data-toggle="modal" href="#promo{{ product_id }}">{{ promo_meta.name }}</span>              
              {% endif %}
            {% endfor %}
          </div>
        {% endif %}


      {% if modules %}
	  <div class="row">
		  <div class="col-sm-12">
		  <h2>{{ text_next }}</h2>
		  <p>{{ text_next_choice }}</p>
		  </div>
		  <div class="panel-group col-sm-8" id="accordion"> {% for module in modules %}
			{{ module }}
			{% endfor %}
		  </div>
		  {% endif %}
          <div class="col-sm-4 sub-total-table">
          <table class="table table-bordered">
            {% for total in totals %}
            <tr>
              <td class="text-right heading-title"><strong>{{ total.title }}:</strong></td>
              <td class="text-right total-amount">{{ total.text }}</td>
            </tr>
            {% endfor %}
          </table>
        </div>
      </div>
      <div class="buttons">
        <div class="pull-left"><a href="{{ continue }}" class="btn btn-default cnt">{{ button_shopping }}</a></div>
        <div class="pull-right">
          {% if min_total > 0 and min_total > order_total and not nomincoupon %}
            <span class='min-subtotal-note'>Минимальная сумма заказа: {{ min_total }}&nbsp;руб.</span>
            <a href="{{ checkout }}" class="disabled btn btn-primary">{{ button_checkout }}</a>          
          {% else %}
            <a href="{{ checkout }}" class="btn btn-primary">{{ button_checkout }}</a>          
          {% endif %}
        </div>
      </div>
      {{ content_bottom }}</div>
    {{ column_right }}</div>
</div>

<script>
  {% if products  %}
    var inCartProducts = {
  {% for product in products %}
      {{ product.product_id }}: {{ product.cart_id }}{% if false == loop.last %},{% endif %}
  {% endfor %}
    };
  {% endif %}
</script>

{{ footer }} 

Полный код cart.twig

 

{{ header }}
<div id="checkout-cart" class="container">
  <ul class="breadcrumb">
    {% for breadcrumb in breadcrumbs %}
    <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
    {% endfor %}
  </ul>
  {% if attention %}
  <div class="alert alert-info"><i class="fa fa-info-circle"></i> {{ attention }}
    <button type="button" class="close" data-dismiss="alert">&times;</button>
  </div>
  {% endif %}
  {% if success %}
  <div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> {{ success }}
    <button type="button" class="close" data-dismiss="alert">&times;</button>
  </div>
  {% endif %}
  {% if error_warning %}
  <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
    <button type="button" class="close" data-dismiss="alert">&times;</button>
  </div>
  {% endif %}
  <div class="row">{{ column_left }}
    {% if column_left and column_right %}
    {% set class = 'col-sm-6' %}
    {% elseif column_left or column_right %}
    {% set class = 'col-sm-9' %}
    {% else %}
    {% set class = 'col-sm-12' %}
    {% endif %}
    <div id="content" class="{{ class }}">{{ content_top }}
      <h1>Ваша корзина</h1>
      <form action="{{ action }}" method="post" enctype="multipart/form-data" class="cart-form">
        <div class="table-responsive">
          <table class="table table-bordered">
            <thead>
              <tr>
                <td class="text-center">{{ column_image }}</td>
                <td class="text-left">{{ column_name }}</td>
                <td class="text-left">{{ column_model }}</td>
                <td class="text-left">{{ column_quantity }}</td>
                <td class="text-right">{{ column_price }}</td>
                <td class="text-right text-right-price">{{ column_total }}</td>
              </tr>
            </thead>
            <tbody>
            {% for product in products %}
            <tr>
              <td class="text-center">{% if product.thumb %} 
                {% if product.href == '#' %}
                    <img src="{{ product.thumb }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-thumbnail" />
                  {% else %}
                    <a href="{{ product.href }}"><img src="{{ product.thumb }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-thumbnail" /></a>
                  {% endif %}
              {% endif %}</td>			         
              <td class="text-left">
                  {% if product.href == '#' %}
                    {{ product.name }}
                  {% else %}
                    <a href="{{ product.href }}">{{ product.name }}</a> 
                  {% endif %}
			  	{% if not product.stock %} 
					<span class="text-danger">***</span> 
				{% endif %}
                {% if product.option %}
                {% for option in product.option %} <br />
                <small>{{ option.name }}: {{ option.value }}</small> {% endfor %}
                {% endif %}
                {% if product.reward %} <br />
                <small>{{ product.reward }}</small> {% endif %}
                {% if product.recurring %} <br />
                <span class="label label-info">{{ text_recurring_item }}</span> <small>{{ product.recurring }}</small> {% endif %}</td>
              <td data-title="{{ column_model }}" class="text-left" style='white-space: nowrap;'>{{ product.model }}</td>
              <td data-title="{{ column_quantity }}" class="text-left"><div class="cart_input_block input-group btn-block" style="max-width: 200px; display: flex; ">
                  
                  {% if active_gift_ids[ product.product_id ] is defined %}
                    <input disabled type="text" value="{{ product.quantity }}" style="background: none; color: black; margin: 0 auto; font-weight: bold; border: 0;" size="1" class="form-control" />
                  {% else %}
                    <input type="text" name="quantity[{{ product.cart_id }}]" value="{{ product.quantity }}" size="1" class="form-control" />
                  {% endif %}
                  <span class="input-group-btn">

                  {% if active_gift_ids[ product.product_id ] is defined %}
                  {% else %}
                  <button type="submit" data-toggle="tooltip" title="{{ button_update }}" class="btn btn-primary main"><i class="fa fa-refresh"></i></button>
                  {% endif %}

                  {% if active_gift_ids[ product.product_id ] is defined %}
                        {% if active_gift_ids[ product.product_id ] > 0 %}
                          <button type="button" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger" onclick="cart.remove('{{ product.cart_id }}');"><i class="fa fa-times-circle"></i></button>
                        {% endif %}
                  {% else %}
                  <button type="button" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger" onclick="cart.remove('{{ product.cart_id }}');"><i class="fa fa-times-circle"></i></button>
                  {% endif %}
                    
                    {% if active_gift_ids[ product.product_id ] is defined %}
                    {% else %}                

                      {#
                        <button type="button" data-toggle="tooltip" title="{{ button_postpone }}" class="btn btn-info" onclick="wishlist.add('{{ product.product_id }}')"><i class="fa fa-hourglass"></i></button>
                      #}
                   {% endif %}

                  </span></div></td>
              <td data-title="{{ column_price }}" class="text-right unit-price">{{ product.price }}</td>
              <td data-title="{{ column_total }}"  class="text-right total-price">{{ product.total }}</td>
            </tr>
            {% endfor %}
            {% for voucher in vouchers %}
            <tr>
              <td></td>
              <td class="text-left">{{ voucher.description }}</td>
              <td class="text-left"></td>
              <td class="text-left"><div class="input-group btn-block" style="max-width: 200px;">
                  <input type="text" name="" value="1" size="1" disabled="disabled" class="form-control" />
                  <span class="input-group-btn">
                  <button type="button" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger" onclick="voucher.remove('{{ voucher.key }}');"><i class="fa fa-times-circle"></i></button>
                  </span></div></td>
              <td class="text-right">{{ voucher.amount }}</td>
              <td class="text-right">{{ voucher.amount }}</td>
            </tr>
            {% endfor %}
              </tbody>
            
          </table>
        </div>
      </form>

       {% if promo != "" %}
        {{ promo }}
       {% endif %}
       {% if promos_meta|length > 0  %}
          <div class="cart-promos">
            <h2>Действующие акции</h2>
            {% for promo_meta in promos_meta %}
                  <div id="promo{{ product_id }}" class="modal fade" role="dialog"> <div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">Акция &laquo;{{ promo_meta.name }}&raquo;</h4></div><div class="modal-body">{{ promo_meta.description }}</div><div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button></div> </div> </div> </div>
              {% if promo_meta.image %}
                <span class="promo-icon promo-image" data-toggle="modal" href="#promo{{ product_id }}"><img src='{{ promo_meta.image }}'></span>
             {% else %}
                <span class="promo-icon"  data-toggle="modal" href="#promo{{ product_id }}">{{ promo_meta.name }}</span>              
              {% endif %}
            {% endfor %}
          </div>
        {% endif %}


      {% if modules %}
	  <div class="row">
		  <div class="col-sm-12">
		  <h2>{{ text_next }}</h2>
		  <p>{{ text_next_choice }}</p>
		  </div>
		  <div class="panel-group col-sm-8" id="accordion"> {% for module in modules %}
			{{ module }}
			{% endfor %}
		  </div>
		  {% endif %}
          <div class="col-sm-4 sub-total-table">
          <table class="table table-bordered">
            {% for total in totals %}
            <tr>
              <td class="text-right heading-title"><strong>{{ total.title }}:</strong></td>
              <td class="text-right total-amount">{{ total.text }}</td>
            </tr>
            {% endfor %}
          </table>
        </div>
      </div>
      <div class="buttons">
        <div class="pull-left"><a href="{{ continue }}" class="btn btn-default cnt">{{ button_shopping }}</a></div>
        <div class="pull-right">
          {% if min_total > 0 and min_total > order_total and not nomincoupon %}
            <span class='min-subtotal-note'>Минимальная сумма заказа: {{ min_total }}&nbsp;руб.</span>
            <a href="{{ checkout }}" class="disabled btn btn-primary">{{ button_checkout }}</a>          
          {% else %}
            <a href="{{ checkout }}" class="btn btn-primary">{{ button_checkout }}</a>          
          {% endif %}
        </div>
      </div>
      {{ content_bottom }}</div>
    {{ column_right }}</div>
</div>

<script>
  {% if products  %}
    var inCartProducts = {
  {% for product in products %}
      {{ product.product_id }}: {{ product.cart_id }}{% if false == loop.last %},{% endif %}
  {% endfor %}
    };
  {% endif %}
</script>

{{ footer }} 

 

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

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.