cart.phtml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?php
  2. /**
  3. * @version 7.6
  4. */
  5. /** @var \Listings\Form\Cart $form */
  6. $sale = $form->getSale();
  7. $seller = $form->getSeller();
  8. $salesListings = $form->getSalesListings();
  9. $shippingDetails = $form->getShippingDetails();
  10. if (count($salesListings)) {
  11. ?>
  12. <form action="" method="post">
  13. <?php echo $form->hiddenElements; ?>
  14. <div class="table-responsive">
  15. <table class="table table-striped table-hover table-cart">
  16. <thead>
  17. <tr>
  18. <th class="size-mini"></th>
  19. <th><?php echo $this->_('Item Description'); ?></th>
  20. <th class="size-mini"><?php echo $this->_('Quantity'); ?></th>
  21. <th class="size-mini"><?php echo $this->_('Price'); ?></th>
  22. <th class="size-mini"><?php echo $this->_('Subtotal'); ?></th>
  23. <th class="size-tiny"></th>
  24. </tr>
  25. </thead>
  26. <tbody>
  27. <?php
  28. /** @var \Ppb\Db\Table\Row\SaleListing $saleListing */
  29. foreach ($salesListings as $saleListing) {
  30. /** @var \Ppb\Db\Table\Row\Listing $listing */
  31. $listing = $saleListing->findParentRow('\Ppb\Db\Table\Listings');
  32. $link = $this->url($listing->link());
  33. $quantities[] = $saleListing['quantity'];
  34. $listingIds[] = $listing['id'];
  35. ?>
  36. <tr>
  37. <td>
  38. <a href="<?php echo $link; ?>" target="_blank">
  39. <?php echo $this->thumbnail($listing->getMainImage(), 68, true,
  40. array('alt' => $listing['name'])); ?>
  41. </a>
  42. </td>
  43. <td>
  44. <div>
  45. <a href="<?php echo $link; ?>" target="_blank">
  46. <?php echo $listing['name']; ?>
  47. </a>
  48. </div>
  49. <?php if (!empty($saleListing['product_attributes'])) { ?>
  50. <div>
  51. <small><?php echo $this->productAttributes($saleListing->getData('product_attributes'))->display(); ?></small>
  52. </div>
  53. <?php } ?>
  54. </td>
  55. <td>
  56. <?php echo $form->getElement('quantity')
  57. ->setData($saleListing['quantity'])
  58. ->setBrackets('[' . $saleListing['id'] . ']')
  59. ->render(); ?>
  60. </td>
  61. <td>
  62. <?php echo $this->amount($saleListing['price'], $sale['currency']); ?>
  63. </td>
  64. <td>
  65. <?php echo
  66. $this->amount(($saleListing['quantity'] * $saleListing['price']),
  67. $sale['currency']); ?>
  68. </td>
  69. <td>
  70. <a class="confirm-box"
  71. href="<?php echo
  72. $this->url(array('action' => 'delete', 'item_id' => $saleListing['id']),
  73. null, true); ?>"
  74. title="<?php echo $this->_('Remove Product from Cart'); ?>"
  75. data-message="<?php echo $this->_('Are you sure you want to remove this product from the shopping cart?'); ?>">
  76. <i class="fa fa-times"></i>
  77. </a>
  78. </td>
  79. </tr>
  80. <?php } ?>
  81. <tr>
  82. <td colspan="3">
  83. <a class="btn btn-default" href="<?php echo $this->url($seller->storeLink()); ?>">
  84. <?php echo $this->_('Continue Shopping'); ?>
  85. </a>
  86. <?php if ($this->settings['pending_sales_listings_expire_hours']) { ?>
  87. <small>
  88. <?php echo sprintf($this->_('*Stock is reserved for %s minute(s).'),
  89. $this->settings['pending_sales_listings_expire_hours']); ?>
  90. </small>
  91. <?php } ?>
  92. </td>
  93. <td colspan="3" class="text-right">
  94. <?php echo $form->getElement(\Listings\Form\Cart::BTN_UPDATE_CART)->render(); ?>
  95. </td>
  96. </tr>
  97. </tbody>
  98. </table>
  99. </div>
  100. <div>
  101. <div class="col-sm-6">
  102. <?php if ($this->settings['enable_shipping']) { ?>
  103. <div class="shopping-cart-totals">
  104. <h4 class="headline">
  105. <span><?php echo $this->_('Calculate Shipping'); ?></span>
  106. </h4>
  107. <?php if ($seller->getShipping()->getShippableLocations()) { ?>
  108. <?php echo $this->partial('partials/shipping-calculator.phtml', array(
  109. 'enableSelection' => 1,
  110. 'quantity' => $quantities,
  111. 'listingId' => $listingIds,
  112. 'locationId' => $form->getData('locationId'),
  113. 'postCode' => $form->getData('postCode'),
  114. 'user' => $seller)); ?>
  115. <?php
  116. }
  117. else {
  118. ?>
  119. <div class="alert alert-info"><?php echo $this->_('No shipping available.'); ?></div>
  120. <?php } ?>
  121. </div>
  122. <?php } ?>
  123. </div>
  124. <div class="col-sm-5 col-sm-offset-1 shopping-cart-totals">
  125. <h4 class="headline">
  126. <span><?php echo $this->_('Cart Summary'); ?></span>
  127. </h4>
  128. <dl class="dl-horizontal">
  129. <dt><?php echo $this->_('Subtotal'); ?></dt>
  130. <dd><?php echo $this->amount($sale->calculateTotal(true, false), $sale['currency']); ?></dd>
  131. <?php if ($this->settings['enable_shipping']) { ?>
  132. <dt><?php echo $this->_('Postage'); ?></dt>
  133. <?php if (!empty($shippingDetails['method'])) { ?>
  134. <dd>
  135. <?php echo $this->amount($shippingDetails['price'], $shippingDetails['currency']); ?>
  136. <br>
  137. <?php echo $this->_($shippingDetails['method']); ?>
  138. </dd>
  139. <?php
  140. }
  141. else {
  142. ?>
  143. <dd><?php echo $this->_('Get Quote'); ?></dd>
  144. <?php } ?>
  145. <?php
  146. $insuranceAmount = $form->getElement('insurance_amount')->getValue();
  147. if ($insuranceAmount > 0) {
  148. ?>
  149. <dt><?php echo $this->_('Insurance'); ?></dt>
  150. <dd class="reset-label">
  151. <?php echo $form->getElement('apply_insurance')->render(); ?>
  152. <?php echo $this->amount($insuranceAmount, $sale['currency']); ?>
  153. </dd>
  154. <?php } ?>
  155. <?php } ?>
  156. <?php if (($taxAmount = $sale->getTaxAmount(true)) > 0) { ?>
  157. <dt><?php echo $this->_('Tax'); ?></dt>
  158. <dd><?php echo $this->amount($taxAmount, $sale['currency']); ?></dd>
  159. <?php } ?>
  160. <dt><?php echo $this->_('Total'); ?></dt>
  161. <dd class="total"><?php echo $this->amount($sale->calculateTotal(false, false), $sale['currency']); ?></dd>
  162. </dl>
  163. <div class="text-right">
  164. <?php echo $form->getElement(\Listings\Form\Cart::BTN_CHECKOUT)->render(); ?>
  165. </div>
  166. </div>
  167. </div>
  168. <div class="clearfix"></div>
  169. </form>
  170. <?php
  171. }
  172. else {
  173. ?>
  174. <p class="text-center">
  175. <?php echo $this->_('The shopping cart is empty.'); ?>
  176. </p>
  177. <?php } ?>