checkout.phtml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php
  2. /**
  3. * @version 7.6
  4. */
  5. /** @var \Listings\Form\Checkout $form */
  6. $sale = $form->getSale();
  7. $seller = $form->getSeller();
  8. $salesListings = $form->getSalesListings();
  9. $shippingDetails = $form->getShippingDetails();
  10. ?>
  11. <form action="<?php echo $form->getAction(); ?>" method="<?php echo $form->getMethod(); ?>"
  12. class="form-horizontal form-checkout">
  13. <?php echo $form->hiddenElements; ?>
  14. <div class="col-sm-7">
  15. <?php
  16. /** @var \Cube\Form\Element $element */
  17. foreach ($form->getElements() as $element) {
  18. if (!$element->isHidden() && $element->getName() != 'apply_insurance') {
  19. echo $this->partial('partials/form-element.phtml', array('element' => $element));
  20. }
  21. } ?>
  22. </div>
  23. <div class="col-sm-5">
  24. <?php if ($this->settings['enable_shipping']) { ?>
  25. <div class="row shopping-cart-totals">
  26. <h4 class="headline">
  27. <span><?php echo $this->_('Shipping Method'); ?></span>
  28. </h4>
  29. <div id="shipping-options">
  30. <?php echo $this->_('Loading ..'); ?>
  31. </div>
  32. </div>
  33. <?php } ?>
  34. <div class="row shopping-cart-totals">
  35. <h4 class="headline">
  36. <span><?php echo $this->_('Your Order'); ?></span>
  37. <small class="pull-right">
  38. [ <a
  39. href="<?php echo $this->url(array('action' => 'index', 'id' => $sale['id'])); ?>"><?php echo $this->_('Edit'); ?></a>
  40. ]
  41. </small>
  42. </h4>
  43. <table class="table table-condensed">
  44. <thead>
  45. <tr>
  46. <th><?php echo $this->_('Item'); ?></th>
  47. <th class="size-mini"><?php echo $this->_('Qty'); ?></th>
  48. <th class="size-mini"><?php echo $this->_('Subtotal'); ?></th>
  49. </tr>
  50. </thead>
  51. <tbody>
  52. <?php
  53. /** @var \Ppb\Db\Table\Row\SaleListing $saleListing */
  54. foreach ($salesListings as $saleListing) {
  55. /** @var \Ppb\Db\Table\Row\Listing $listing */
  56. $listing = $saleListing->findParentRow('\Ppb\Db\Table\Listings');
  57. $calculatedPrice = $saleListing->price(true);
  58. ?>
  59. <tr>
  60. <td>
  61. <div>
  62. <?php echo $listing['name']; ?>
  63. </div>
  64. <?php if (!empty($saleListing['product_attributes'])) { ?>
  65. <div>
  66. <small><?php echo $this->productAttributes($saleListing->getData('product_attributes'))->display(); ?></small>
  67. </div>
  68. <?php } ?>
  69. </td>
  70. <td>
  71. <?php echo $saleListing['quantity']; ?>
  72. </td>
  73. <td>
  74. <div>
  75. <?php echo $this->amount(($saleListing['quantity'] * $calculatedPrice),
  76. $listing['currency']); ?>
  77. </div>
  78. <?php if ($calculatedPrice < $saleListing->getData('price')) { ?>
  79. <div class="discount">
  80. <?php echo $this->_('Discount:'); ?>
  81. <?php echo $this->amount(($saleListing['quantity'] * ($saleListing->getData('price') - $calculatedPrice)),
  82. $listing['currency']); ?>
  83. </div>
  84. <?php } ?>
  85. </td>
  86. </tr>
  87. <?php } ?>
  88. </tbody>
  89. </table>
  90. <?php
  91. $voucherCode = (($voucher = $sale->getVoucher()) !== null) ? $voucher['code'] : null;
  92. echo $this->partial('partials/voucher-code.phtml', array(
  93. 'userId' => $seller['id'],
  94. 'voucherCode' => $voucherCode
  95. )); ?>
  96. <dl class="dl-horizontal">
  97. <dt><?php echo $this->_('Subtotal'); ?></dt>
  98. <dd><?php echo $this->amount($sale->calculateTotal(true), $sale['currency']); ?></dd>
  99. <?php if ($this->settings['enable_shipping']) { ?>
  100. <dt><?php echo $this->_('Postage'); ?></dt>
  101. <?php if (!empty($shippingDetails['method']) && $form->getElement('postage_id')->getValue() !== null) { ?>
  102. <dd>
  103. <?php echo $this->amount($shippingDetails['price'], $shippingDetails['currency']); ?><br>
  104. <?php echo $shippingDetails['method']; ?>
  105. </dd>
  106. <?php
  107. }
  108. else {
  109. ?>
  110. <dd><?php echo $this->_('Get Quote'); ?></dd>
  111. <?php } ?>
  112. <?php
  113. $insuranceAmount = $form->getElement('insurance_amount')->getValue();
  114. if ($insuranceAmount > 0) {
  115. ?>
  116. <dt><?php echo $this->_('Insurance'); ?></dt>
  117. <dd class="reset-label">
  118. <?php echo $form->getElement('apply_insurance')->render(); ?>
  119. <?php echo $this->amount($insuranceAmount, $sale['currency']); ?>
  120. </dd>
  121. <?php } ?>
  122. <?php } ?>
  123. <?php if (($taxAmount = $sale->getTaxAmount(true)) > 0) { ?>
  124. <dt><?php echo $this->_('Tax'); ?></dt>
  125. <dd><?php echo $this->amount($taxAmount, $sale['currency']); ?></dd>
  126. <?php } ?>
  127. <dt><?php echo $this->_('Total'); ?></dt>
  128. <dd class="total"><?php echo $this->amount($sale->calculateTotal(), $sale['currency']); ?></dd>
  129. </dl>
  130. <div class="text-right">
  131. <?php echo $this->formElement('submit', \Listings\Form\Checkout::BTN_PLACE_ORDER,
  132. $this->_('Place Order'))
  133. ->setAttributes(array(
  134. 'class' => 'btn btn-primary btn-lg btn-block'
  135. ))
  136. ->render(); ?>
  137. </div>
  138. </div>
  139. </div>
  140. </form>