You are here

uc-cart-block.html.twig in Ubercart 8.4

{#
/**
 * @file
 * Default theme implementation to display a shopping cart block.
 *
 * Available variables:
 * - items: An associative array of cart item information containing:
 *   - qty: Quantity in cart.
 *   - title: Item title.
 *   - price: Item price.
 *   - desc: (optional) Item description.
 * - item_count: The number of items in the shopping cart.
 * - total: The formatted subtotal of all the products in the shopping cart.
 * - summary_links: A set of links used in the cart summary.
 * - attributes: HTML attributes for the main content element.
 *
 * @see template_preprocess_uc_cart_block()
 *
 * @ingroup themeable
#}
{% if items %}
  <table {{ attributes }}>
  {% for item in items %}
    <tr>
      <td class="cart-block-item-qty">{{ item.qty }} ×</td>
      {% if item.desc %}
        <td class="cart-block-item-title">{{ item.title }}<br />
        <span class="cart-block-item-desc">{{ item.desc }}</span></td>
      {% else %}
        <td class="cart-block-item-title">{{ item.title }}</td>
      {% endif %}
      <td class="cart-block-item-price">{{ item.price }}</td>
    </tr>
  {% endfor %}
  </table>
{% else %}
  <p {{ attributes }}>
    {{ 'There are no products in your shopping cart.'|t }}
  </p>
{% endif %}

<table class="cart-block-summary">
  <tr>
    <td class="cart-block-summary-items">
      {% trans %}
        <span class="num-items">1</span> Item
      {% plural item_count %}
        <span class="num-items">{{ item_count }}</span> Items
      {% endtrans %}
    </td>
    <td class="cart-block-summary-total">
      <strong>{{ 'Total'|t }}:</strong> {{ total }}
    </td>
  </tr>
</table>

{% if items %}
  {{ summary_links }}
{% endif %}

File

uc_cart/templates/uc-cart-block.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display a shopping cart block.
  5. *
  6. * Available variables:
  7. * - items: An associative array of cart item information containing:
  8. * - qty: Quantity in cart.
  9. * - title: Item title.
  10. * - price: Item price.
  11. * - desc: (optional) Item description.
  12. * - item_count: The number of items in the shopping cart.
  13. * - total: The formatted subtotal of all the products in the shopping cart.
  14. * - summary_links: A set of links used in the cart summary.
  15. * - attributes: HTML attributes for the main content element.
  16. *
  17. * @see template_preprocess_uc_cart_block()
  18. *
  19. * @ingroup themeable
  20. #}
  21. {% if items %}
  22. <table {{ attributes }}>
  23. {% for item in items %}
  24. <tr>
  25. <td class="cart-block-item-qty">{{ item.qty }} ×</td>
  26. {% if item.desc %}
  27. <td class="cart-block-item-title">{{ item.title }}<br />
  28. <span class="cart-block-item-desc">{{ item.desc }}</span></td>
  29. {% else %}
  30. <td class="cart-block-item-title">{{ item.title }}</td>
  31. {% endif %}
  32. <td class="cart-block-item-price">{{ item.price }}</td>
  33. </tr>
  34. {% endfor %}
  35. </table>
  36. {% else %}
  37. <p {{ attributes }}>
  38. {{ 'There are no products in your shopping cart.'|t }}
  39. </p>
  40. {% endif %}
  41. <table class="cart-block-summary">
  42. <tr>
  43. <td class="cart-block-summary-items">
  44. {% trans %}
  45. <span class="num-items">1</span> Item
  46. {% plural item_count %}
  47. <span class="num-items">{{ item_count }}</span> Items
  48. {% endtrans %}
  49. </td>
  50. <td class="cart-block-summary-total">
  51. <strong>{{ 'Total'|t }}:</strong> {{ total }}
  52. </td>
  53. </tr>
  54. </table>
  55. {% if items %}
  56. {{ summary_links }}
  57. {% endif %}