<?php
  /**
   * Summary
   *
   * @package Digital Downloads Pro
   * @author wojoscripts.com
   * @copyright 2010
   * @version $Id: summary.php, v2.00 2011-07-10 10:12:05 gewa Exp $
   */
  define("_VALID_PHP", true);
  require_once("init.php");
	  
  $cartrow = $content->getCartContent();
  $totalrow = $content->getCartTotal();
  $discount = $totalrow['total'] - $totalrow['coupon'];
  $gaterow = $content->getGateways(true);
?>
<?php include("header.php");?>
<?php if(!$user->logged_in):?>
<div class="msgAlert"><span>!تـوجـه</span>. لطفـا برای ادامـه وارد حساب کاربری خود شویـد، مقـادیر سبد خرید ذخیـره خواهند شـد</div>
<?php else:?>
  <h1>خلاصـه خـریـد</h1>
  <p class="info">. لطفـا از صحـت درستـی اطلاعـات زیر قبـل از انتخـاب روش پـرداخـت اطمینـان حـاصـل فـرمائیـد</p>
  <?php if(!$cartrow):?>
  <div class="msgInfo"><span>!تـوجـه</span>! با عرض پوزش سبد خرید شما خالی  می باشـد</div>
  <?php else:?>
  <div class="box">
      <table cellpadding="0" cellspacing="0" class="display">
        <thead>
          <tr>
            <th width="20" class="left">#</th>
            <th class="right">نـام محصـول</th>
            <th class="right">قیمـت محصـول</th>
            <th align="center">تـعـداد</th>
            <th align="right">قیمـت کـل</th>
          </tr>
        </thead>
        <tfoot>
          <tr>
            <td colspan="5"><strong>روش پـرداخـت را انتخاب نمائیـد :</strong>
            <?php if($gaterow):?>
            <?php foreach($gaterow as $grow):?>
            <span class="input-out shadow"><a href="javascript:void(0);" class="load-gateway" id="item_<?php echo $grow['id'];?>">
            <img src="<?php echo SITEURL.'/gateways/'.$grow['dir'].'/'.$grow['displayname'].'.png';?>" alt="" class="tooltip" title="<?php echo $grow['displayname'];?>"/></a></span>
            <?php endforeach;?>
            <?php endif;?>
            </td>
          </tr>
        </tfoot>
        <tbody>
          <?php $i = 0;?>
          <?php foreach ($cartrow as $ccrow): ?>
          <?php $i++;;?>
          <tr>
            <th><?php echo $i;?>.</th>
            <td><?php echo $ccrow['title'];?></td>
            <td><?php echo $core->formatMoney($ccrow['price']);?></td>
            <td align="center"><?php echo $ccrow['total'];?></td>
            <td align="right"><?php echo $core->formatMoney($ccrow['total'] * $ccrow['price']);?></td>
          </tr>
          <?php endforeach;?>
          <?php unset($ccrow);?>
          <tr>
            <td colspan="4" align="left" valign="top"><strong>
              <?php if($totalrow['coupon'] !=0):?>
              تخفـیف :<br />
              <?php endif;?>
              جـمـع :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
              </strong></td>
            <td align="right" valign="top"><strong>
              <?php if($totalrow['coupon'] !=0):?>
              - <?php echo $core->formatMoney($totalrow['coupon']);?><br />
              <?php endif;?>
              <?php echo $core->formatMoney($discount);?><br />
              </strong></td>
          </tr>
          <tr>
            <td colspan="4" align="left" valign="top"><strong style="color:#F00">جـمـع کـل :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></td>
            <td align="right" valign="top"><strong style="color:#F00"><?php echo $core->formatMoney($discount);?></strong></td>
          </tr>
        </tbody>
      </table>
      <div id="show-result"></div>
  </div>
<script type="text/javascript">
// <![CDATA[
$(document).ready(function () {
    $("a.load-gateway").live("click", function () {
        var parent = $(this);
        $.ajax({
            type: "POST",
            url: "ajax/controller.php",
            data: 'loadgateway=' + $(this).attr('id').replace('item_', ''),
            success: function (msg) {
                $("#show-result").html(msg);

            }
        });
        return false;
    });
});
// ]]>
</script>
<?php endif;?>
<?php endif;?>
<?php include("footer.php");?>