basket.phtml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <?php
  2. /** @var \Dotdigitalgroup\Email\Block\Basket $block */
  3. // @codingStandardsIgnoreFile
  4. ?>
  5. <?php $items = $block->getBasketItems(); ?>
  6. <?php if ($items) : ?>
  7. <?php $dynamicStyle = $block->getDynamicStyle();?>
  8. <style>
  9. .product-name {
  10. color: <?= $block->escapeHtml($dynamicStyle['nameColor']); ?>;
  11. font-size: <?= $block->escapeHtml($dynamicStyle['fontSize']); ?>;
  12. <?php if (in_array('bold', $dynamicStyle['nameStyle'])) : ?>
  13. font-weight: bold;
  14. <?php endif; ?>
  15. <?php if (in_array('italic', $dynamicStyle['nameStyle'])) : ?>
  16. font-style: italic;
  17. <?php endif; ?>
  18. <?php if (in_array('underline', $dynamicStyle['nameStyle'])) : ?>
  19. text-decoration: underline;
  20. <?php endif; ?>
  21. padding: 1px;
  22. border-bottom: 1px solid #cbd3d4;
  23. border-right: 1px solid #cbd3d4;
  24. }
  25. .product-price {
  26. color: <?= $block->escapeHtml($dynamicStyle['priceColor']); ?>;
  27. font-size: <?= $block->escapeHtml($dynamicStyle['priceFontSize']); ?>;
  28. padding: 5px;
  29. border-bottom: 1px solid #cbd3d4;
  30. <?php if (in_array('bold', $dynamicStyle['priceStyle'])) : ?>
  31. font-weight: bold;
  32. <?php endif; ?>
  33. <?php if (in_array('italic', $dynamicStyle['priceStyle'])) : ?>
  34. font-style: italic;
  35. <?php endif; ?>
  36. <?php if (in_array('underline', $dynamicStyle['priceStyle'])) : ?>
  37. text-decoration: underline;
  38. <?php endif; ?>
  39. }
  40. .product-url {
  41. color: <?= $block->escapeHtml($dynamicStyle['urlColor']); ?>;
  42. font-size: <?= $block->escapeHtml($dynamicStyle['urlFontSize']); ?>
  43. <?php if (in_array('bold', $dynamicStyle['linkStyle'])) : ?>
  44. font-weight: bold;
  45. <?php endif; ?>
  46. <?php if (in_array('italic', $dynamicStyle['linkStyle'])) : ?>
  47. font-style: italic;
  48. <?php endif; ?>
  49. <?php if (in_array('underline', $dynamicStyle['linkStyle'])) : ?>
  50. text-decoration: underline;
  51. <?php endif; ?>
  52. }
  53. .other-text {
  54. color: <?= $block->escapeHtml($dynamicStyle['otherColor']); ?>;
  55. font-size: <?= $block->escapeHtml($dynamicStyle['otherFontSize']); ?>;
  56. <?php if (in_array('bold', $dynamicStyle['otherStyle'])) : ?>
  57. font-weight: bold;
  58. <?php endif; ?>
  59. <?php if (in_array('italic', $dynamicStyle['otherStyle'])) : ?>
  60. font-style: italic;
  61. <?php endif; ?>
  62. <?php if (in_array('underline', $dynamicStyle['otherStyle'])) : ?>
  63. text-decoration: underline;
  64. <?php endif; ?>
  65. }
  66. .product-table {
  67. font-family: <?= $block->escapeHtml($dynamicStyle['docFont']); ?>;
  68. background-color: <?= $block->escapeHtml($dynamicStyle['docBackgroundColor']); ?>;
  69. width: 100% !important;
  70. float:left;
  71. border: 1px solid #cbd3d4;
  72. border-collapse: collapse;
  73. padding: 5px;
  74. }
  75. .product-table img {
  76. display: block;
  77. margin-left: auto;
  78. margin-right: auto
  79. }
  80. .product-table td {
  81. width: 25%;
  82. padding-bottom: 10px;
  83. text-align: center;
  84. }
  85. tr.noborder td {
  86. border: none !important;
  87. }
  88. .pt-th-style-one {
  89. padding: 5px;
  90. border-bottom: 1px solid #cbd3d4;
  91. border-right: 1px solid #cbd3d4;
  92. }
  93. .pt-th-style-two {
  94. padding: 5px;
  95. border-bottom: 1px solid #cbd3d4;
  96. }
  97. .product-table .quantity {
  98. padding: 1px;
  99. border-bottom: 1px solid #cbd3d4;
  100. border-right: 1px solid #cbd3d4;
  101. }
  102. .product-table .product-image {
  103. padding: 5px;
  104. border-bottom: 1px solid #cbd3d4;
  105. border-right: 1px solid #cbd3d4;
  106. }
  107. .hidemob {
  108. border: none !important;
  109. }
  110. .other-text-padding {
  111. padding: 5px;
  112. }
  113. .cart-link {
  114. text-align: center;
  115. }
  116. <?= $block->escapeHtml($dynamicStyle['dynamicStyling']); ?>
  117. /** Responsive **/
  118. @media (max-width: 760px) {
  119. /* Force table to not be like tables anymore */
  120. .product-table table, .product-table thead, .product-table tbody,
  121. .product-table th, .product-table td, .product-table tr {
  122. display: block;
  123. }
  124. .product-table td {
  125. width: 200px !important;
  126. }
  127. .product-table {
  128. width: auto !important;
  129. margin: 0 auto;
  130. float: none !important;
  131. }
  132. .product-table tr {
  133. border: none;
  134. border-bottom: 1px solid #eee;
  135. margin-bottom: 10px !important;
  136. }
  137. .product-table td {
  138. border: none !important;
  139. position: relative;
  140. }
  141. .quantity:before {
  142. content: 'Quantity:';
  143. }
  144. .product-table td:before {
  145. position: relative;
  146. }
  147. .product-table tr th {
  148. display: none !important;
  149. border: none !important;
  150. }
  151. .hidemob {
  152. display: none !important;
  153. }
  154. }
  155. </style>
  156. <table class="product-table">
  157. <tr>
  158. <th class="other-text pt-th-style-one">
  159. <?= $block->escapeHtml(__("Image")); ?>
  160. </th>
  161. <th class="other-text pt-th-style-one">
  162. <?= $block->escapeHtml(__("Description")); ?>
  163. </th>
  164. <th class="other-text pt-th-style-one">
  165. <?= $block->escapeHtml(__("Quantity")); ?>
  166. </th>
  167. <th class="other-text pt-th-style-two">
  168. <?= $block->escapeHtml(__('Total')); ?>
  169. </th>
  170. </tr>
  171. <?php $grandTotal = 0; ?>
  172. <?php foreach ($items as $item) : ?>
  173. <?php $grandTotal = $item['grandTotal']; ?>
  174. <tr>
  175. <td class="product-image">
  176. <?= $block->getImage(
  177. $item['product'],
  178. 'product_small_image'
  179. )->toHtml();
  180. ?>
  181. </td>
  182. <td class="product-name">
  183. <a class="product-url" href="<?= $block->escapeHtml($item['productUrl']); ?>">
  184. <?= $block->escapeHtml($item['product']->getName())
  185. . '</a></br>'
  186. ?></td>
  187. <td class="product-price quantity">
  188. <?= (int) $item['qty']; ?>
  189. </td>
  190. <td class="product-price">
  191. <?= $block->escapeHtml($item['total']); ?>
  192. </td>
  193. </tr>
  194. <?php endforeach; ?>
  195. <tr class="hidemob">
  196. <td class="hidemob"></td>
  197. <td class="hidemob"></td>
  198. <td class="hidemob"></td>
  199. <td class="other-text other-text-padding">
  200. <?= $block->escapeHtml(__('Total: ') . $grandTotal); ?>
  201. </td>
  202. </tr>
  203. </table>
  204. <?php if ($block->canShowUrl()) : ?>
  205. <p class="cart-link">
  206. <a href="<?= $block->escapeUrl($block->getUrlForLink()); ?>" class="product-url">
  207. <strong>
  208. <?php
  209. $link = ($block->takeMeToCartTextForUrl()) ?
  210. $block->takeMeToCartTextForUrl() : __('Take Me To My Basket');
  211. echo $block->escapeHtml($link); ?>
  212. </strong>
  213. </a>
  214. </p>
  215. <?php endif; ?>
  216. <?php endif; ?>