product.html.twig 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. {% extends "base.html.twig" %}
  2. {% block title %}{{ product.title }} - {{ site_title }}{% endblock %}
  3. {% block extra_css %}
  4. <style>
  5. /* --- PRODUCT PAGE (DARK THEME) --- */
  6. .back-link { color: var(--text-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; margin-bottom: 20px; font-weight: 600; font-size: 14px; transition: 0.2s; text-transform: uppercase; letter-spacing: 0.5px; }
  7. .back-link:hover { color: var(--primary); transform: translateX(-5px); }
  8. .product-container { display: flex; flex-wrap: wrap; gap: 40px; background: var(--panel-bg); padding: 35px; border-radius: var(--border-radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border-color); margin-top: 10px; }
  9. .product-image-wrap { flex: 1; min-width: 320px; }
  10. .product-image-wrap img { width: 100%; border-radius: 8px; border: 1px solid var(--border-color); object-fit: cover; box-shadow: var(--shadow-sm); }
  11. .no-image-box { width: 100%; height: 400px; background: #0f172a; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--text-muted); font-weight: 800; text-transform: uppercase; letter-spacing: 1px; border: 1px dashed var(--border-color); }
  12. .product-details { flex: 1.5; min-width: 320px; display: flex; flex-direction: column; }
  13. .product-details h1 { margin-top: 0; color: var(--text-main); font-size: 2.2em; font-weight: 900; line-height: 1.2; letter-spacing: -0.5px; }
  14. .product-meta { color: var(--text-muted); margin-bottom: 25px; font-size: 14px; padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.05); display: flex; flex-wrap: wrap; gap: 15px; }
  15. .product-meta span { display: flex; align-items: center; gap: 5px; }
  16. .product-meta strong { color: var(--text-main); font-weight: 700; }
  17. .product-price { font-size: 3em; color: var(--accent-green); font-weight: 900; margin: 10px 0 25px; text-shadow: 0 2px 10px rgba(16, 185, 129, 0.2); }
  18. /* ADD TO CART FORM */
  19. .add-to-cart-form { background: rgba(0,0,0,0.15); padding: 25px; border-radius: 8px; border: 1px solid var(--border-color); margin-bottom: 30px; }
  20. .quantity-wrap { display: flex; gap: 15px; align-items: center; margin-bottom: 20px; }
  21. .quantity-wrap label { font-weight: 700; color: var(--text-muted); text-transform: uppercase; font-size: 13px; letter-spacing: 0.5px; }
  22. .quantity-input { width: 80px; padding: 12px; border: 1px solid var(--border-color); border-radius: 6px; background: #0f172a; color: var(--text-main); font-size: 16px; font-weight: bold; text-align: center; outline: none; transition: 0.2s; }
  23. .quantity-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2); }
  24. .buy-btn { display: block; width: 100%; text-align: center; background: var(--primary); color: white; padding: 16px; border-radius: 6px; border: none; font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); cursor: pointer; box-sizing: border-box; }
  25. .buy-btn:hover { background: var(--primary-hover); box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4); transform: translateY(-2px); }
  26. /* ATTRIBUTES TABLE */
  27. .attributes-table { width: 100%; border-collapse: collapse; margin-top: 20px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-color); }
  28. .attributes-table th, .attributes-table td { padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.03); text-align: left; }
  29. .attributes-table tr:last-child th, .attributes-table tr:last-child td { border-bottom: none; }
  30. .attributes-table th { width: 35%; background: rgba(0,0,0,0.3); color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }
  31. .attributes-table td { background: rgba(0,0,0,0.1); color: var(--text-main); font-size: 15px; }
  32. /* DESCRIPTION */
  33. .description-box { margin-top: 35px; white-space: pre-wrap; line-height: 1.7; color: #cbd5e1; background: rgba(0,0,0,0.2); padding: 25px; border-radius: 8px; border: 1px solid var(--border-color); font-size: 15px; }
  34. .description-box h3 { margin-top: 0; margin-bottom: 15px; font-size: 16px; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
  35. @media (max-width: 768px) {
  36. .product-container { padding: 20px; gap: 25px; }
  37. .product-details h1 { font-size: 1.8em; }
  38. .product-price { font-size: 2.2em; }
  39. .attributes-table th { width: 45%; font-size: 12px; padding: 12px; }
  40. .attributes-table td { padding: 12px; font-size: 14px; }
  41. }
  42. </style>
  43. {% endblock %}
  44. {% block content %}
  45. <a href="index.php" class="back-link">
  46. &larr; {% if current_lang == 'en' %}Back to catalog{% else %}Πίσω στον κατάλογο{% endif %}
  47. </a>
  48. <div class="product-container">
  49. <!-- Φωτογραφία -->
  50. <div class="product-image-wrap">
  51. {% if product.image_path %}
  52. <img src="{{ product.image_path }}" alt="{{ product.title }}">
  53. {% else %}
  54. <div class="no-image-box">
  55. {% if current_lang == 'en' %}No Image{% else %}Χωρίς Φωτογραφία{% endif %}
  56. </div>
  57. {% endif %}
  58. </div>
  59. <!-- Λεπτομέρειες -->
  60. <div class="product-details">
  61. <h1 style="margin-bottom: 10px;">{{ product.title }}</h1>
  62. {% if product.sku %}
  63. <div style="font-size: 14px; color: var(--text-muted); margin-bottom: 20px; display: flex; align-items: center; gap: 8px;">
  64. <span style="background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); padding: 4px 10px; border-radius: 6px;">
  65. SKU: <strong style="color: var(--text-main); letter-spacing: 0.5px;">{{ product.sku }}</strong>
  66. </span>
  67. </div>
  68. {% endif %}
  69. <div class="product-meta">
  70. <span>{% if current_lang == 'en' %}Category:{% else %}Κατηγορία:{% endif %} <strong>{{ product.cat_name }}</strong></span>
  71. <span style="color: var(--border-color);">|</span>
  72. <span>{% if current_lang == 'en' %}Seller:{% else %}Πωλητής:{% endif %} <strong>{{ product.seller_name }}</strong></span>
  73. <span style="color: var(--border-color);">|</span>
  74. <span>{% if current_lang == 'en' %}Listed:{% else %}Αναρτήθηκε:{% endif %} <strong>{{ product.created_at|date("d/m/Y") }}</strong></span>
  75. </div>
  76. <div class="product-price">{{ product.price|number_format(2, ',', '.') }} €</div>
  77. <form action="cart.php?action=add" method="POST" class="add-to-cart-form">
  78. <input type="hidden" name="product_id" value="{{ product.id }}">
  79. <div class="quantity-wrap">
  80. <label for="quantity">{% if current_lang == 'en' %}Quantity:{% else %}Ποσότητα:{% endif %}</label>
  81. <input type="number" id="quantity" name="quantity" class="quantity-input" value="1" min="1" max="{{ product.quantity }}">
  82. </div>
  83. <button type="submit" class="buy-btn">
  84. {% if current_lang == 'en' %}Add to Cart{% else %}Προσθήκη στο Καλάθι{% endif %}
  85. </button>
  86. </form>
  87. <!-- Δυναμικά Χαρακτηριστικά -->
  88. {% if attributes|length > 0 %}
  89. <table class="attributes-table">
  90. <tbody>
  91. {% for attr in attributes %}
  92. <tr>
  93. <th>{{ attr.name }}</th>
  94. <td><strong>{{ attr.value }}</strong> {{ attr.unit }}</td>
  95. </tr>
  96. {% endfor %}
  97. </tbody>
  98. </table>
  99. {% endif %}
  100. <!-- Περιγραφή -->
  101. {% if product.description %}
  102. <div class="description-box">
  103. <h3>{% if current_lang == 'en' %}Equipment Description{% else %}Περιγραφή Εξοπλισμού{% endif %}</h3>
  104. {{ product.description }}
  105. </div>
  106. {% endif %}
  107. </div>
  108. </div>
  109. {% endblock %}