feature/handling-multiple-countries #51

Merged
krzysiej merged 2 commits from feature/handling-multiple-countries into master 2026-01-20 10:44:33 +01:00
5 changed files with 7 additions and 7 deletions

View File

@@ -113,7 +113,7 @@ class ScrapeWebsite extends Command
$productModel->skuID = $product->skuID;
$productModel->name = $product->name;
$productModel->availableQuantity = $product->availableQuantity;
$productModel->categories = $product->categories;
$productModel->categories = str_replace(['/', ' '], '', $product->categories);
$productModel->image = $product->image;
$productModel->subTitle = $product->subTitle;
$productModel->variantCode = $product->variantCode;

View File

@@ -16,11 +16,11 @@ final class NewController extends BaseController
if($this->cache->getItem('list_new')->isHit()) {
return $this->render('productList.html.twig', ['listType' => 'new']);
}
$products = Product::where('created_at', '>', now()->modify('-30 days')->format('Y-m-d'))
$date = now()->modify('-30 days')->format('Y-m-d');
$products = Product::where('created_at', '>', $date)
->with(['country', 'stock'])
->orderByDesc('starred')
->orderByDesc('created_by')
->with(['currentPrice', 'lowestPrice'])
->get();
return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'new']);
}

View File

@@ -31,7 +31,7 @@ use function Symfony\Component\Clock\now;
class Product extends Model
{
public $timestamps = true;
public $fillable = ['skuID'];
public $fillable = ['skuID', 'country_id'];
public function country(): BelongsTo
{

View File

@@ -10,7 +10,7 @@
<td><img src='{{ product.image }}&width=150' class='border rounded p-1' alt='{{ product.name }}'/></td>
<td>
<a href='{{ path('app_product', {'productId': product.id}) }}' class="text-decoration-none">{{ product.name }}</a>
<span class="badge text-bg-light">{{ product.subTitle }}</span>
<span class="badge text-bg-light"><a href="{{ path('app_search', {'search': product.subTitle}) }}" class="link-underline link-underline-opacity-0 link-dark">{{ product.subTitle }}</a></span>
</td>
<td>
<nav aria-label="breadcrumb" style="--bs-breadcrumb-divider: '>';">

View File

@@ -34,7 +34,7 @@
{% if product.isNew() %}
<span class="badge text-bg-success">is new</span>
{% endif %}
<span class="badge text-bg-light">{{ product.subTitle }}</span>
<span class="badge text-bg-light"><a href="{{ path('app_search', {'search': product.subTitle}) }}" class="link-underline link-underline-opacity-0 link-dark">{{ product.subTitle }}</a></span>
</td>
<td class="align-middle">
<nav aria-label="breadcrumb" style="--bs-breadcrumb-divider: '>';" >