Fix LESS import error and refactor project structure
This commit is contained in:
@@ -33,7 +33,7 @@ use App\Core\View;
|
||||
<main class="catalog-main">
|
||||
<div class="container">
|
||||
<div class="breadcrumbs">
|
||||
<a href="/cite_practica/">Главная</a> • <span class="current-page">Каталог</span>
|
||||
<a href="/">Главная</a> • <span class="current-page">Каталог</span>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($success)): ?>
|
||||
@@ -48,10 +48,10 @@ use App\Core\View;
|
||||
<i class="fas fa-user-shield"></i> Панель управления каталогом
|
||||
</h3>
|
||||
<div>
|
||||
<a href="/cite_practica/admin/products" class="admin-btn"><i class="fas fa-boxes"></i> Управление каталогом</a>
|
||||
<a href="/cite_practica/admin/products/add" class="admin-btn"><i class="fas fa-plus"></i> Добавить товар</a>
|
||||
<a href="/cite_practica/admin/categories" class="admin-btn"><i class="fas fa-tags"></i> Категории</a>
|
||||
<a href="/cite_practica/admin/orders" class="admin-btn"><i class="fas fa-shopping-cart"></i> Заказы</a>
|
||||
<a href="/admin/products" class="admin-btn"><i class="fas fa-boxes"></i> Управление каталогом</a>
|
||||
<a href="/admin/products/add" class="admin-btn"><i class="fas fa-plus"></i> Добавить товар</a>
|
||||
<a href="/admin/categories" class="admin-btn"><i class="fas fa-tags"></i> Категории</a>
|
||||
<a href="/admin/orders" class="admin-btn"><i class="fas fa-shopping-cart"></i> Заказы</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -67,14 +67,14 @@ use App\Core\View;
|
||||
|
||||
<div class="catalog-wrapper">
|
||||
<aside class="catalog-sidebar">
|
||||
<form method="GET" action="/cite_practica/catalog" id="filterForm">
|
||||
<form method="GET" action="/catalog" id="filterForm">
|
||||
<div class="filter-group">
|
||||
<h4 class="filter-title">КАТЕГОРИИ</h4>
|
||||
<ul class="filter-list">
|
||||
<li><a href="/cite_practica/catalog" class="<?= empty($filters['category_id']) ? 'active-category' : '' ?>">Все товары</a></li>
|
||||
<li><a href="/catalog" class="<?= empty($filters['category_id']) ? 'active-category' : '' ?>">Все товары</a></li>
|
||||
<?php foreach ($categories as $category): ?>
|
||||
<li>
|
||||
<a href="/cite_practica/catalog?category=<?= $category['category_id'] ?>"
|
||||
<a href="/catalog?category=<?= $category['category_id'] ?>"
|
||||
class="<?= $filters['category_id'] == $category['category_id'] ? 'active-category' : '' ?>">
|
||||
<?= htmlspecialchars($category['name']) ?>
|
||||
</a>
|
||||
@@ -129,7 +129,7 @@ use App\Core\View;
|
||||
<?php if (!empty($filters['search'])): ?>
|
||||
<p style="color: #666;">
|
||||
Результаты поиска: "<strong><?= htmlspecialchars($filters['search']) ?></strong>"
|
||||
<a href="/cite_practica/catalog" style="margin-left: 10px; color: #617365;">
|
||||
<a href="/catalog" style="margin-left: 10px; color: #617365;">
|
||||
<i class="fas fa-times"></i> Очистить
|
||||
</a>
|
||||
</p>
|
||||
@@ -144,9 +144,19 @@ use App\Core\View;
|
||||
<?php else: ?>
|
||||
<?php foreach ($products as $product): ?>
|
||||
<div class="product-card <?= !$product['is_available'] ? 'unavailable' : '' ?>"
|
||||
onclick="window.location.href='/cite_practica/product/<?= $product['product_id'] ?>'"
|
||||
onclick="window.location.href='/product/<?= $product['product_id'] ?>'"
|
||||
data-product-id="<?= $product['product_id'] ?>">
|
||||
<img src="/cite_practica/<?= htmlspecialchars($product['image_url'] ?? 'img/1.jpg') ?>"
|
||||
<?php
|
||||
$imageUrl = $product['image_url'] ?? '';
|
||||
if (empty($imageUrl)) {
|
||||
$imageUrl = '/assets/images/1.jpg';
|
||||
} elseif (strpos($imageUrl, '/img2/') === 0) {
|
||||
$imageUrl = str_replace('/img2/', '/assets/images/', $imageUrl);
|
||||
} elseif (strpos($imageUrl, 'img2/') === 0) {
|
||||
$imageUrl = str_replace('img2/', '/assets/images/', $imageUrl);
|
||||
}
|
||||
?>
|
||||
<img src="<?= htmlspecialchars($imageUrl) ?>"
|
||||
alt="<?= htmlspecialchars($product['name']) ?>">
|
||||
<div class="product-info">
|
||||
<div class="name"><?= htmlspecialchars($product['name']) ?></div>
|
||||
@@ -174,7 +184,7 @@ $('#priceSlider').on('input', function() {
|
||||
|
||||
function addToCart(productId, productName) {
|
||||
$.ajax({
|
||||
url: '/cite_practica/cart/add',
|
||||
url: '/cart/add',
|
||||
method: 'POST',
|
||||
data: { product_id: productId, quantity: 1 },
|
||||
dataType: 'json',
|
||||
@@ -192,4 +202,3 @@ function addToCart(productId, productName) {
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@ use App\Core\View;
|
||||
|
||||
<main class="container">
|
||||
<div class="breadcrumbs">
|
||||
<a href="/cite_practica/">Главная</a> •
|
||||
<a href="/cite_practica/catalog">Каталог</a> •
|
||||
<a href="/">Главная</a> •
|
||||
<a href="/catalog">Каталог</a> •
|
||||
<?php if ($product['category_name']): ?>
|
||||
<a href="/cite_practica/catalog?category=<?= $product['category_id'] ?>">
|
||||
<a href="/catalog?category=<?= $product['category_id'] ?>">
|
||||
<?= htmlspecialchars($product['category_name']) ?>
|
||||
</a> •
|
||||
<?php endif; ?>
|
||||
@@ -48,7 +48,17 @@ use App\Core\View;
|
||||
<div class="product__section">
|
||||
<div class="product__gallery">
|
||||
<div class="product__main-image">
|
||||
<img src="/cite_practica/<?= htmlspecialchars($product['image_url'] ?? 'img/1.jpg') ?>"
|
||||
<?php
|
||||
$imageUrl = $product['image_url'] ?? '';
|
||||
if (empty($imageUrl)) {
|
||||
$imageUrl = '/assets/images/1.jpg';
|
||||
} elseif (strpos($imageUrl, '/img2/') === 0) {
|
||||
$imageUrl = str_replace('/img2/', '/assets/images/', $imageUrl);
|
||||
} elseif (strpos($imageUrl, 'img2/') === 0) {
|
||||
$imageUrl = str_replace('img2/', '/assets/images/', $imageUrl);
|
||||
}
|
||||
?>
|
||||
<img src="<?= htmlspecialchars($imageUrl) ?>"
|
||||
alt="<?= htmlspecialchars($product['name']) ?>">
|
||||
</div>
|
||||
</div>
|
||||
@@ -134,7 +144,7 @@ use App\Core\View;
|
||||
|
||||
<?php if ($isAdmin): ?>
|
||||
<div style="margin-top: 20px;">
|
||||
<a href="/cite_practica/admin/products/edit/<?= $product['product_id'] ?>" class="btn" style="background: #ffc107; color: #333;">
|
||||
<a href="/admin/products/edit/<?= $product['product_id'] ?>" class="btn" style="background: #ffc107; color: #333;">
|
||||
<i class="fas fa-edit"></i> Редактировать
|
||||
</a>
|
||||
</div>
|
||||
@@ -147,8 +157,18 @@ use App\Core\View;
|
||||
<h2>Похожие товары</h2>
|
||||
<div class="products-grid">
|
||||
<?php foreach ($similarProducts as $similar): ?>
|
||||
<div class="product-card" onclick="window.location.href='/cite_practica/product/<?= $similar['product_id'] ?>'" style="cursor: pointer;">
|
||||
<img src="/cite_practica/<?= htmlspecialchars($similar['image_url'] ?? 'img/1.jpg') ?>"
|
||||
<?php
|
||||
$simImageUrl = $similar['image_url'] ?? '';
|
||||
if (empty($simImageUrl)) {
|
||||
$simImageUrl = '/assets/images/1.jpg';
|
||||
} elseif (strpos($simImageUrl, '/img2/') === 0) {
|
||||
$simImageUrl = str_replace('/img2/', '/assets/images/', $simImageUrl);
|
||||
} elseif (strpos($simImageUrl, 'img2/') === 0) {
|
||||
$simImageUrl = str_replace('img2/', '/assets/images/', $simImageUrl);
|
||||
}
|
||||
?>
|
||||
<div class="product-card" onclick="window.location.href='/product/<?= $similar['product_id'] ?>'" style="cursor: pointer;">
|
||||
<img src="<?= htmlspecialchars($simImageUrl) ?>"
|
||||
alt="<?= htmlspecialchars($similar['name']) ?>">
|
||||
<div class="product-info">
|
||||
<h3 style="font-size: 16px; color: #453227;"><?= htmlspecialchars($similar['name']) ?></h3>
|
||||
@@ -180,7 +200,7 @@ $(document).ready(function() {
|
||||
function addToCart(productId) {
|
||||
const quantity = $('.product__qty-value').val();
|
||||
$.ajax({
|
||||
url: '/cite_practica/cart/add',
|
||||
url: '/cart/add',
|
||||
method: 'POST',
|
||||
data: { product_id: productId, quantity: quantity },
|
||||
dataType: 'json',
|
||||
@@ -198,13 +218,12 @@ function addToCart(productId) {
|
||||
function buyNow(productId) {
|
||||
const quantity = $('.product__qty-value').val();
|
||||
$.ajax({
|
||||
url: '/cite_practica/cart/add',
|
||||
url: '/cart/add',
|
||||
method: 'POST',
|
||||
data: { product_id: productId, quantity: quantity },
|
||||
success: function() {
|
||||
window.location.href = '/cite_practica/cart';
|
||||
window.location.href = '/cart';
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user