0

在opencart的优惠券列表中,它会检查是否有优惠券然后显示出来,然后您可以点击“发送”正式发送优惠券。出于某种原因,这个过程似乎只有在我<a>在这个发送选项之后直接删除链接标签时才有效。我不知道为什么。这是清单...

           <?php foreach ($vouchers as $voucher) { ?>
        <tr>
          <td style="text-align: center;"><?php if ($voucher['selected']) { ?>
            <input type="checkbox" name="selected[]" value="<?php echo $voucher['voucher_id']; ?>" checked="checked" />
            <?php } else { ?>
            <input type="checkbox" name="selected[]" value="<?php echo $voucher['voucher_id']; ?>" />
            <?php } ?></td>
          <td class="left"><?php echo $voucher['code']; ?></td>
          <td class="left"><?php echo $voucher['from']; ?></td>
          <td class="left"><?php echo $voucher['to']; ?></td>
          <td class="right"><?php echo $voucher['amount']; ?></td>
          <td class="left"><?php echo $voucher['theme']; ?></td>
          <td class="left"><?php echo $voucher['status']; ?></td>
          <td class="left"><?php echo $voucher['date_added']; ?></td>
          <td class="right">[ <a onclick="sendVoucher('<?php echo $voucher['voucher_id']; ?>');"><?php echo $text_send; ?></a> ]
            <?php foreach ($voucher['action'] as $action) { ?>
            [ <a href="<?php echo $action['href']; ?>"><?php echo $action['text']; ?></a> ]
            <?php } ?></td>
        </tr>
        <?php } ?>

在上面的代码中,当我删除第二个时<a href="<?php echo $action['href']; ?>"><?php echo $action['text']; ?></a>onclick它应该可以正常工作,当我不删除它时,而不是发送凭证,它只是将我带到该凭证的编辑区域。

继承人的sendVoucher功能,但我什至不确定该功能是否与问题有关。

<script type="text/javascript"><!--
 function sendVoucher(voucher_id) {
$.ajax({
    url: 'index.php?route=sale/voucher/send&token=<?php echo $token;       ?>&voucher_id=' + voucher_id,
    type: 'post',
    dataType: 'json',
    beforeSend: function() {
        $('.success, .warning').remove();
        $('.box').before('<div class="attention"><img src="view/image       /loading.gif" alt="" /> <?php echo $text_wait; ?></div>');
    },
    complete: function() {
        $('.attention').remove();
    },
    success: function(json) {
        if (json['error']) {
            $('.box').before('<div class="warning">' + json['error'] + '</div>');
        }

        if (json['success']) {
            $('.box').before('<div class="success">' + json['success'] + '</div>');
        }       
    }
});
    return false;
  }
  //--></script> 

编辑:为了更清楚,继承人一行的输出 html...

                      <tr>
          <td style="text-align: center;">                <input type="checkbox" name="selected[]" value="4" />
            </td>
          <td class="left">34123123</td>
          <td class="left">adrian</td>
          <td class="left">Adrian</td>
          <td class="right">€20.00</td>
          <td class="left">Birthday</td>
          <td class="left">Enabled</td>
          <td class="left">07/02/2013</td>
          <td class="right">[ <a onclick="sendVoucher('4');"  >Send</a> ]
                            [ <a href="http://mysite.com/admin/index.php?route=sale/voucher/update&amp;token=c9b6332af21513c0a3af8e4265fa62a1&amp;voucher_id=4">Edit</a> ] 
            </td>
        </tr>
4

0 回答 0