【问题标题】:CS- cart custom form and ajax responseCS-购物车自定义表单和ajax响应
【发布时间】:2015-05-18 12:57:40
【问题描述】:

实际上我是 cs-cart 的新手,我正在尝试将我的结果集显示到 html/smarty 块中,其中包含我从后端添加的表单代码

Design->Layout 但它只在控制台中显示响应,我在这里粘贴一些代码

块代码(从后端设计->布局添加):

<div class="quick-quote">
<h3>Quick Quote!</h3>
<form class="cm-ajax" action="index.php" method="post" id="quick_quote_form"> 
<div id="quick-quote">
<div class="clearfix">
<label style="width:73px;" >Width:</label>
</div>

<div class="input">
<input type="text" placeholder="enter width" name="d_width" id="d_width" class="required form-control" >
</div>
<div class="clearfix">
<label style="width:73px;" >Height:</label>
</div>
<input type="submit" class="get-quote-btn" value="Get Quote" name="dispatch[get_qoute.get_rates]" /> 
 </div>
 <div class="result"></div>
 <!-- tag -->
 <input type="hidden" name="result_ids" value="result" />
 </form>
 </div>
 Controller code:
   <?php
  use Tygh\Registry;
  if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  if ($mode == 'get_rates') {
  $height= $_POST["d_height"];
  $width=$_POST["d_width"];
  $val = $height+$width;
  Registry::get('view'); 
  Registry::get('ajax')->assign('get_rates', $val);
 } 
 exit;
 }
 ?>
  Result set is coming correctly , Now I don't know how to show response in block div.
 <div class="result"></div>
 <!-- tag -->
 <input type="hidden" name="result_ids" value="result" />
  Thanks in advance. 

【问题讨论】:

    标签: cs-cart


    【解决方案1】:

    不要转到设计 -> 布局,因为它对所有表单和页面都很常见。 转到网站菜单-> 内容然后选择要更改的表单,在那里您可以看到布局选项卡,编辑块完成。

    【讨论】:

      【解决方案2】:

      在表单中设置必须通过 ajax 方法刷新的块

      <input type="hidden" name="result_ids" value="result" />
      

      你在这一行的问题:

       <div class="result"></div>
      

      所有刷新结果必须在ID标签中:

      <div id="result"></div>
      

      【讨论】:

        猜你喜欢
        • 2017-01-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-12-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多