Социален Облак Лого Социален Облак
Сподели виждането. Сподели успеха.
<% data.products.forEach(function(product) { %>
<%= product.name %> <% if (product.price && product.originalPrice && product.price < product.originalPrice) { %>
ПРОМОЦИЯ
<% } %>

<%= product.name %>

<% if (product.category && product.category.name) { %>

<%= product.category.name %>

<% } %>
<% for (let i = 1; i <= 5; i++) { %> <% if (i <= Math.floor(Math.random() * 2 + 4)) { %> <% } else { %> <% } %> <% } %>
(<%= Math.floor(Math.random() * 50 + 10) %>)
<% if (product.originalPrice && product.price < product.originalPrice) { %>
<%= product.price.toFixed(2) %> <%= product.currency || 'лв' %> <%= product.originalPrice.toFixed(2) %> <%= product.currency || 'лв' %>
<% } else { %> <%= product.price.toFixed(2) %> <%= product.currency || 'лв' %> <% } %>
<% }); %>
<% const currentPage = parseInt(data.page) || 1; const pageSize = parseInt(data.pageSize) || 12; const totalItems = data.count || 0; const totalPages = Math.ceil(totalItems / pageSize); %> <% if (totalPages > 1) { %>
Показани <%= Math.min((currentPage - 1) * pageSize + 1, totalItems) %>-<%= Math.min(currentPage * pageSize, totalItems) %> от <%= totalItems %> продукта
<% const startPage = Math.max(1, currentPage - 2); const endPage = Math.min(totalPages, currentPage + 2); %> <% if (startPage > 1) { %> <% if (startPage > 2) { %> ... <% } %> <% } %> <% for (let i = startPage; i <= endPage; i++) { %> <% } %> <% if (endPage < totalPages) { %> <% if (endPage < totalPages - 1) { %> ... <% } %> <% } %>
<% } %>