Минимальная сумма заказ

#
Re: Минимальная сумма заказ
Добрый день! Ну вот у меня шаблон корзины:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:exsl="http://exslt.org/common"
   extension-element-prefixes="exsl">

   <xsl:output method="xml"
      doctype-public="XSLT-compat"
      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
      omit-xml-declaration="yes"
      encoding="UTF-8"
   indent="yes"/>

   <xslecimal-format name="my" decimal-separator="," grouping-separator=" "/>

   <xsl:template match="/shop">




      <h4 class="h2">Оформление заказа</h4>

      <xsl:choose>
         <xsl:when test="count(shop_cart) = 0">
            <p>Для оформления заказа нужно сначала добавить товары.</p>
         </xsl:when>
         <xsl:otherwise>
            <div id="makeCheckOut">
               <form action="/" class="validate" method="post">
                  <div class="row">
                     <div class="col-sm-8">
                        <div class="padTable">
                           <table class="table table-responsive">
                              <xsl:call-template name="tableHeader"/>
                              <xsl:choose>
                                 <xsl:when test="count(shop_purchase_discount) &gt; 0">
                                    <tbody>
                                       <xsl:apply-templates select="shop_cart[postpone = 0]"/>
                                       <xsl:apply-templates select="shop_purchase_discount"/>
                                    </tbody>
                                    <tfoot>
                                       <tr>
                                          <th></th>
                                          <th class="text-right">Итого:</th>
                                          <th></th>
                                          <th class="text-right">
                                             <xsl:value-of select="format-number(total_amount, '### ##0', 'my'"/><xsl:text> </xsl:text><span class="rub">Р</span>
                                          </th>
                                          <th></th>
                                       </tr>
                                    </tfoot>
                                 </xsl:when>
                                 <xsl:otherwise>
                                    <tbody>
                                       <xsl:apply-templates select="shop_cart[postpone = 0]"/>
                                    </tbody>
                                    <xsl:call-template name="tableFooter">
                                       <xsl:with-param name="nodes" select="shop_cart[postpone = 0]"/>
                                    </xsl:call-template>
                                 </xsl:otherwise>
                              </xsl:choose>
                           </table>
                        </div>
                        <div class="row">
                           <div class="col-sm-6">
                              <div class="form-group">
                                 <xsl:choose>
                                    <xsl:when test="//coupon_value_from != ''">
                                       <input type="text" class="form-control input-sm" name="coupon_text" placeholder="Промо-код" value="{//coupon_value_from}"/>
                                    </xsl:when>
                                    <xsl:otherwise>
                                       <input type="text" class="form-control input-sm" name="coupon_text" placeholder="Промо-код" value="{coupon_text}"/>
                                    </xsl:otherwise>
                                 </xsl:choose>



                              </div>
                           </div>
                           
                           <div class="col-sm-2 text-right">
                              <input type="button" name="recount" class="btn btn-sm footerBtn" onclick="return $.recountCart('/', '#makeCheckOutFull', ''" value="Пересчитать"/>
                           </div>
                        </div>
                     </div>
                     <div class="col-sm-4">
                        <div class="checkOut stickyeah" data-stickyeah-offset="96" data-stickyeah-push="sub" data-stickyeah-class="open">
                           <div class="cnt">
                              <div>Общая стоимость</div>
                              <div class="total">
                                 <strong><xsl:value-of select="format-number(total_amount, '### ##0', 'my'"/><xsl:text> </xsl:text><span class="rub">Р</span></strong>
                              </div>
                              
                              

<p>Минимальная сумма заказа, 499 рублей.</p>

                              <div class="checkOutBtn">

                                 <div class="control-group form-group">
                                    <label class="control-label">Телефон</label>
                                    <div class="controls">
                                       <div class="input-group input-group-sm">
                                          <span class="input-group-addon">+7</span>
                                          <input type="text" size="30" class="form-control" placeholder="9124785527" name="phone" required="required"  data-bv-message="Обязательно укажите телефон" data-bv-between="true" data-bv-between-inclusive="true" data-bv-between-message=" " data-bv-between-min="1000000000" data-bv-between-max="9999999999" maxlength="10" pattern="^[0-9]+$" aria-invalid="false" />
                                       </div>
                                       <div class="help-block"></div>
                                    </div>
                                 </div>

                                 <div class="control-group form-group">
                                    <label class="control-label">Адрес доставки:</label>
                                    <div class="controls">
                                       <textarea name="address" placeholder="Адрес доставки" class="form-control input-sm" rows="4" required="required" data-bv-message="Обязательно укажите адрес доставки"></textarea>
                                       <div class="help-block"></div>
                                    </div>
                                 </div>


<!--<xsl:if test="total_sum_without_discount &lt; 499">
    <p><h2>Заказ не может быть обработан, так как сумма вашего заказа менее 499р. </h2></p>
</xsl:if>

<xsl:if test="total_sum_without_discount &gt; 499">

</xsl:if>-->




                                 <br/>
                                 <input type="submit" name="checkout" class="btn btn-sm footerBtn" onclick="return $.checkOut('/', '#makeCheckOutFull'" value="Оформить заказ"/>
                                 
                                 
                              
                                 
                                 
                                 
                              
                                 <!--<button type="submit" class="btn btn-sm footerBtn" onclick="return $.checkOut('/', '#makeCheckOutFull'">
                                    <strong>Оформить заказ</strong>
                                 </button>-->
                                 
                                 
                                 
                              </div>


                           </div>








                        </div>
                     </div>
                  </div>
               </form>
            </div>

         </xsl:otherwise>
      </xsl:choose>




   </xsl:template>

   <xsl:template name="tableHeader">
      <thead>
         <tr>
            <th class="col-sm-6">Название</th>
            <th class="text-right">Цена</th>
            <th class="col-sm-1">Кол-во</th>
            <th class="text-right">Сумма</th>
            <th></th>
         </tr>
      </thead>
   </xsl:template>


   <xsl:template name="tableFooter">
      <xsl:param name="nodes"/>
      <xsl:variable name="subTotals">
         <xsl:for-each select="$nodes">
            <sum><xsl:value-of select="shop_item/price * quantity"/></sum>
         </xsl:for-each>
      </xsl:variable>
      <tfoot>
         <tr>
            <th></th>
            <th class="text-right">Итого:</th>
            <th></th>
            <th class="text-right nobr">

               <xsl:choose>
                  <xsl:when test="sum(exsl:node-set($subTotals)/sum) = 0">
                     <strong>Бесплатно</strong>
                  </xsl:when>
                  <xsl:otherwise>
                     <strong><xsl:value-of select="format-number(sum(exsl:node-set($subTotals)/sum), '### ##0', 'my'"/><xsl:text> </xsl:text><span class="rub">Р</span></strong>
                  </xsl:otherwise>
               </xsl:choose>


            </th>
            <th></th>
         </tr>
      </tfoot>
   </xsl:template>

   <xsl:template name="resultPrice">
      <xsl:param name="nodes"/>
      <xsl:variable name="subTotals">
         <xsl:for-each select="$nodes">
            <sum><xsl:value-of select="shop_item/price * quantity"/></sum>
         </xsl:for-each>
      </xsl:variable>
      <xsl:value-of select="sum(exsl:node-set($subTotals)/sum)"/>
   </xsl:template>

   <xsl:template match="shop_purchase_discount">
      <tr>
         <td class="col-sm-6">
            <strong><xsl:value-of disable-output-escaping="yes" select="name"/></strong>
         </td>
         <td class="text-right"></td>
         <td class="col-sm-1"></td>
         <td class="text-right nobr">
            <strong><xsl:value-of disable-output-escaping="yes" select="format-number(discount_amount * -1, '### ##0', 'my'"/>&#160;<span class="rub">Р</span></strong>
         </td>
         <td class="text-center"></td>
      </tr>
   </xsl:template>


   <xsl:template match="shop_cart">

      <xsl:variable name="gId" select="shop_item/shop_group_id"/>


      <tr>
         <td class="col-sm-6">

            <xsl:value-of disable-output-escaping="yes" select="shop_item/name"/>

            <xsl:if test="shop_item/marking != ''">
               <div class="small text-muted">
                  <xsl:value-of disable-output-escaping="yes" select="shop_item/marking"/>
               </div>
            </xsl:if>
         </td>
         <td class="text-right">
            <xsl:choose>
               <xsl:when test="shop_item/price = 0">
                  Бесплатно
               </xsl:when>
               <xsl:otherwise>
                  <xsl:value-of disable-output-escaping="yes" select="format-number(shop_item/price, '### ##0', 'my'"/>&#160;<span class="rub">Р</span>
               </xsl:otherwise>
            </xsl:choose>
         </td>
         <td class="col-sm-1">
            <div class="form-group">
               <input type="text" size="3" class="form-control input-sm valI" name="quantity_{shop_item/@id}" id="quantity_{shop_item/@id}" value="{format-number(quantity, '### ##0', 'my'}"/>
            </div>
         </td>
         <td class="text-right nobr">
            <xsl:variable name="summ" select="shop_item/price * quantity"/>
            <xsl:choose>
               <xsl:when test="$summ = 0">
                  <strong>Бесплатно</strong>
               </xsl:when>
               <xsl:otherwise>
                  <strong><xsl:value-of disable-output-escaping="yes" select="format-number($summ, '### ##0', 'my'"/>&#160;<span class="rub">Р</span></strong>
               </xsl:otherwise>
            </xsl:choose>
         </td>
         <td class="text-center">
            <a href="?delete={shop_item/@id}" class="del" onclick="return $.removeFromCart('/', {shop_item/@id}, '#makeCheckOutFull', ''" title="Удалить товар из корзины"><i class="fa fa-close"></i></a>
         </td>
      </tr>
   </xsl:template>

</xsl:stylesheet>


Вставил тот код и ушла только кнопка Оформить заказ. Больше ничего не происходит. Я пока закомментировал Ваш код. Путь до файла такой:
Домой - XSL - шаблоны - hmpDelivery - shop.

Еще есть такой файл на пути: Домой-XSL-шаблоны-Интернетмагазин- МагазинКорзина:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet SYSTEM "lang://57">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl">
   <xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="utf-8" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>
   
   <xslecimal-format name="my" decimal-separator="," grouping-separator=" "/>
   
   <!-- Шаблон для корзины -->
   <xsl:template match="/shop">
      <xsl:choose>
         <xsl:when test="count(shop_cart) = 0">
            <h1>&labelEmptyCart;</h1>
            <p>&labelChooseProduct;</p>
         </xsl:when>
         <xsl:otherwise>
            <h1>&labelTitle;</h1>
            <p>&labelOrder;</p>
            
            <form action="{/shop/url}cart/" method="post">
               <xsl:variable name="available_bonuses">
                  <xsl:choose>
                     <xsl:when test="apply_bonuses/node()">
                        <xsl:value-of select="apply_bonuses" />
                     </xsl:when>
                     <xsl:otherwise>
                        <xsl:value-of select="available_bonuses" />
                     </xsl:otherwise>
                  </xsl:choose>
               </xsl:variable>
               
               <!-- Если есть товары -->
               <xsl:if test="count(shop_cart[postpone = 0]) > 0">
                  <table class="shop_cart">
                     <xsl:call-template name="tableHeader"/>
                     <xsl:apply-templates select="shop_cart[postpone = 0]"/>
                     <xsl:call-template name="tableFooter">
                        <xsl:with-param name="nodes" select="shop_cart[postpone = 0]"/>
                     </xsl:call-template>
                     
                     <!-- Скидки -->
                     <xsl:if test="count(shop_purchase_discount) or shop_discountcard/node() or apply_bonuses/node()">
                        <xsl:apply-templates select="shop_purchase_discount"/>
                        <xsl:apply-templates select="shop_discountcard"/>
                        
                        <xsl:if test="siteuser_id > 0 and apply_bonuses/node()">
                           <tr>
                              <td>
                                 Бонусы
                              </td>
                              <td></td>
                              <td></td>
                              <td>
                                 <!-- Amount -->
                                 <xsl:value-of select="format-number($available_bonuses * -1, '### ##0,00', 'my'"/><xsl:text> </xsl:text><xsl:value-of select="/shop/shop_currency/sign" disable-output-escaping="yes"/>
                              </td>
                              <xsl:if test="count(/shop/shop_warehouse)">
                                 <td></td>
                              </xsl:if>
                              <td></td>
                              <td></td>
                           </tr>
                        </xsl:if>
                        
                        <tr class="total">
                           <td>&labelTotal;</td>
                           <td></td>
                           <td></td>
                           <td>
                              <xsl:value-of select="format-number(total_amount, '### ##0,00', 'my'"/><xsl:text> </xsl:text><xsl:value-of disable-output-escaping="yes" select="/shop/shop_currency/sign"/>
                           </td>
                           <td></td>
                           <xsl:if test="count(/shop/shop_warehouse)">
                              <td></td>
                           </xsl:if>
                           <td></td>
                           <td></td>
                        </tr>
                     </xsl:if>
                  </table>
               </xsl:if>
               
               <div class="coupon-bonus">
                  <!-- Купон -->
                  <div class="shop_coupon">
                     &labelCoupon; <input name="coupon_text" type="text" value="{coupon_text}"/>
                  </div>
                  
                  <xsl:if test="siteuser_id > 0">
                     <div class="shop_bonuses">
                        <input type="checkbox" name="apply_bonuses" onchange="$.showCartBonuses(this);">
                           <xsl:if test="apply_bonuses/node()">
                              <xsl:attribute name="checked">checked</xsl:attribute>
                           </xsl:if>
                           Применить бонусы
                        </input>
                        <input type="text" name="bonuses" value="{$available_bonuses}">
                           <xsl:if test="not(apply_bonuses/node())">
                              <xsl:attribute name="class">hidden</xsl:attribute>
                           </xsl:if>
                        </input>
                     </div>
                  </xsl:if>
               </div>
               
               <!-- Если есть отложенные товары -->
               <xsl:if test="count(shop_cart[postpone = 1]) > 0">
                  <div class="transparent">
                     <h2>&labelPostponeItems;</h2>
                     <table class="shop_cart">
                        <xsl:call-template name="tableHeader"/>
                        <xsl:apply-templates select="shop_cart[postpone = 1]"/>
                        <xsl:call-template name="tableFooter">
                           <xsl:with-param name="nodes" select="shop_cart[postpone = 1]"/>
                        </xsl:call-template>
                     </table>
                  </div>
               </xsl:if>
               
               <!-- Кнопки -->
               <input name="recount" value="&labelRecount;" type="submit" class="button" />
               
               <!-- Пользователь авторизован или модуль пользователей сайта отсутствует -->
               <!-- Чтобы дать возможность заказывать неавторизованным пользователям, удалите в условии 'and (siteuser_id > 0 or siteuser_exists = 0)' -->
               <xsl:if test="count(shop_cart[postpone = 0]) and (siteuser_id > 0 or siteuser_exists = 0)">
                  <input name="step" value="1" type="hidden" />
                  <input value="&labelCheckout;" type="submit" class="button"/>
               </xsl:if>
            </form>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>
   
   <!-- Заголовок таблицы -->
   <xsl:template name="tableHeader">
      <tr>
         <th>&labelItem;</th>
         <th width="70">&labelQuantity;</th>
         <th width="110">&labelUnitPrice;</th>
         <th width="150">&labelAmount;</th>
         <xsl:if test="count(/shop/shop_warehouse)">
            <th width="100">&labelWarehouse;</th>
         </xsl:if>
         <th>&labelPostpone;</th>
         <th>&labelActions;</th>
      </tr>
   </xsl:template>
   
   <!-- Итоговая строка таблицы -->
   <xsl:template name="tableFooter">
      <xsl:param name="nodes"/>
      
      <tr class="total">
         <td>&labelTotal2;</td>
         <td><xsl:value-of select="sum($nodes/quantity)"/></td>
      <td><xsl:text> </xsl:text></td>
         <td>
            <xsl:variable name="subTotals">
               <xsl:for-each select="$nodes">
                  <sum><xsl:value-of select="shop_item/price * quantity"/></sum>
               </xsl:for-each>
            </xsl:variable>
            
            <xsl:value-of select="format-number(sum(exsl:node-set($subTotals)/sum), '### ##0,00', 'my'"/><xsl:text> </xsl:text><xsl:value-of disable-output-escaping="yes" select="/shop/shop_currency/sign"/>
         </td>
         <xsl:if test="count(/shop/shop_warehouse)">
         <td><xsl:text> </xsl:text></td>
         </xsl:if>
      <td><xsl:text> </xsl:text></td>
      <td><xsl:text> </xsl:text></td>
      </tr>
   </xsl:template>
   
   <!-- Шаблон для товара в корзине -->
   <xsl:template match="shop_cart">
      <tr>
         <td>
            <a href="{shop_item/url}">
               <xsl:value-of select="shop_item/name"/>
            </a>
            
            <!-- Комплекты -->
            <xsl:if test="shop_item/type = 3">
               <xsl:for-each select="shop_item/set/shop_item">
                  <div>
                  <span><xsl:text> — </xsl:text></span>
                     <a href="{url}">
                        <xsl:value-of select="name"/>
                     </a>
                  </div>
               </xsl:for-each>
            </xsl:if>
         </td>
         <td>
            <input type="text" size="3" name="quantity_{shop_item/@id}" id="quantity_{shop_item/@id}" value="{quantity}"/>
         </td>
         <td>
            <!-- Цена -->
            <xsl:value-of select="format-number(shop_item/price, '### ##0,00', 'my'"/><xsl:text> </xsl:text><xsl:value-of select="shop_item/currency" disable-output-escaping="yes"/>
         </td>
         <td>
            <!-- Amount -->
            <xsl:value-of disable-output-escaping="yes" select="format-number(shop_item/price * quantity, '### ##0,00', 'my'"/><xsl:text> </xsl:text><xsl:value-of disable-output-escaping="yes" select="shop_item/currency"/>
         </td>
         <xsl:if test="count(/shop/shop_warehouse)">
            <td>
               <xsl:choose>
                  <xsl:when test="sum(shop_item/shop_warehouse_item/count) > 0">
                     <select name="warehouse_{shop_item/@id}">
                        <xsl:apply-templates select="shop_item/shop_warehouse_item"/>
                     </select>
                  </xsl:when>
                  <xsl:otherwise>—</xsl:otherwise>
               </xsl:choose>
            </td>
         </xsl:if>
         <td align="center">
            <!-- Postpone -->
            <input type="checkbox" name="postpone_{shop_item/@id}">
               <xsl:if test="postpone = 1">
                  <xsl:attribute name="checked">checked</xsl:attribute>
               </xsl:if>
            </input>
         </td>
      <td align="center"><a href="?delete={shop_item/@id}" onclick="return confirm('&labelDeleteAlert;'" title="&labelDelete2;" alt="&labelDelete2;">&labelDelete;</a></td>
      </tr>
   </xsl:template>
   
   <xsl:template match="shop_purchase_discount">
      <tr>
         <td>
            <xsl:value-of select="name"/>
         </td>
         <td></td>
         <td></td>
         <td>
            <!-- Amount -->
            <xsl:value-of select="format-number(discount_amount * -1, '### ##0,00', 'my'"/><xsl:text> </xsl:text><xsl:value-of select="/shop/shop_currency/sign" disable-output-escaping="yes"/>
         </td>
         <xsl:if test="count(/shop/shop_warehouse)">
            <td></td>
         </xsl:if>
         <td></td>
         <td></td>
      </tr>
   </xsl:template>
   
   <xsl:template match="shop_discountcard">
      <tr>
         <td>
            Дисконтная карта <xsl:value-of select="number"/>
         </td>
         <td></td>
         <td></td>
         <td>
            <!-- Amount -->
            <xsl:value-of select="format-number(discount_amount * -1, '### ##0,00', 'my'"/><xsl:text> </xsl:text><xsl:value-of select="/shop/shop_currency/sign" disable-output-escaping="yes"/>
         </td>
         <xsl:if test="count(/shop/shop_warehouse)">
            <td></td>
         </xsl:if>
         <td></td>
         <td></td>
      </tr>
   </xsl:template>
   
   <!-- Warehouse option -->
   <xsl:template match="shop_warehouse_item">
      <xsl:if test="count != 0">
         <xsl:variable name="shop_warehouse_id" select="shop_warehouse_id" />
         <option value="{$shop_warehouse_id}">
            <xsl:if test="../../shop_warehouse_id = $shop_warehouse_id">
               <xsl:attribute name="selected">selected</xsl:attribute>
            </xsl:if>
            <xsl:value-of select="/shop/shop_warehouse[@id=$shop_warehouse_id]/name"/> (<xsl:value-of select="count - reserved"/>
         </option>
      </xsl:if>
   </xsl:template>
   
</xsl:stylesheet>

Я так и не пойму, в каком фале что исправить, или куда правильно добавить. Прошу Вашей помощи.
#
Re: Минимальная сумма заказ
В своем сообщении не указал версию. 7-ка.
Вопрос по реализации этого предложения:
Предлагаю иной вариант, который я у себя реализовал.
Я просто спрятал кнопку "оформить заказ" и вывел сообщение о, том что сумма заказа менее минимальной.
Находим в шаблоне корзины:

<div class="gray_button">
        <div>
             <input name="step_1" value="Оформить заказ" type="submit" style="font-weight: bold"/>
        </div>
</div>


и преобразовываем его до состояния:


<xsl:if test="total_sum_without_discount &lt; 200">
    <p><h2>Заказ не может быть обработан, так как сумма вашего заказа менее 200р. </h2></p>
</xsl:if>

<xsl:if test="total_sum_without_discount &gt; 200">
    <div class="gray_button">
   <div>
   <input name="step_1" value="Оформить заказ" type="submit" style="font-weight: bold"/>
   </div>
    </div>
</xsl:if>

Получается что при сумме заказа без скидки менее 200 рублей выводится надпись "Заказ не может быть обработан, так как сумма вашего заказа менее 200р.", а если сумма заказа больше то выводится кнопка "Оформить заказ".
#
Re: Минимальная сумма заказ
а чем ваш вариант отличается от https://www.hostcms.ru/forums/22/4139/#38025
Email: golden-puma@yandex.ru; Telegram: @GoldenPuma; Сайт: https://goldenpuma.ru
Авторизация