feature/handling-multiple-countries #51
@@ -113,7 +113,7 @@ class ScrapeWebsite extends Command
|
|||||||
$productModel->skuID = $product->skuID;
|
$productModel->skuID = $product->skuID;
|
||||||
$productModel->name = $product->name;
|
$productModel->name = $product->name;
|
||||||
$productModel->availableQuantity = $product->availableQuantity;
|
$productModel->availableQuantity = $product->availableQuantity;
|
||||||
$productModel->categories = $product->categories;
|
$productModel->categories = str_replace(['/', ' '], '', $product->categories);
|
||||||
$productModel->image = $product->image;
|
$productModel->image = $product->image;
|
||||||
$productModel->subTitle = $product->subTitle;
|
$productModel->subTitle = $product->subTitle;
|
||||||
$productModel->variantCode = $product->variantCode;
|
$productModel->variantCode = $product->variantCode;
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ final class NewController extends BaseController
|
|||||||
if($this->cache->getItem('list_new')->isHit()) {
|
if($this->cache->getItem('list_new')->isHit()) {
|
||||||
return $this->render('productList.html.twig', ['listType' => 'new']);
|
return $this->render('productList.html.twig', ['listType' => 'new']);
|
||||||
}
|
}
|
||||||
|
$date = now()->modify('-30 days')->format('Y-m-d');
|
||||||
$products = Product::where('created_at', '>', now()->modify('-30 days')->format('Y-m-d'))
|
$products = Product::where('created_at', '>', $date)
|
||||||
|
->with(['country', 'stock'])
|
||||||
->orderByDesc('starred')
|
->orderByDesc('starred')
|
||||||
->orderByDesc('created_by')
|
->orderByDesc('created_by')
|
||||||
->with(['currentPrice', 'lowestPrice'])
|
|
||||||
->get();
|
->get();
|
||||||
return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'new']);
|
return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'new']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ use function Symfony\Component\Clock\now;
|
|||||||
class Product extends Model
|
class Product extends Model
|
||||||
{
|
{
|
||||||
public $timestamps = true;
|
public $timestamps = true;
|
||||||
public $fillable = ['skuID'];
|
public $fillable = ['skuID', 'country_id'];
|
||||||
|
|
||||||
public function country(): BelongsTo
|
public function country(): BelongsTo
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<td><img src='{{ product.image }}&width=150' class='border rounded p-1' alt='{{ product.name }}'/></td>
|
<td><img src='{{ product.image }}&width=150' class='border rounded p-1' alt='{{ product.name }}'/></td>
|
||||||
<td>
|
<td>
|
||||||
<a href='{{ path('app_product', {'productId': product.id}) }}' class="text-decoration-none">{{ product.name }}</a>
|
<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>
|
||||||
<td>
|
<td>
|
||||||
<nav aria-label="breadcrumb" style="--bs-breadcrumb-divider: '>';">
|
<nav aria-label="breadcrumb" style="--bs-breadcrumb-divider: '>';">
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
{% if product.isNew() %}
|
{% if product.isNew() %}
|
||||||
<span class="badge text-bg-success">is new</span>
|
<span class="badge text-bg-success">is new</span>
|
||||||
{% endif %}
|
{% 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>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
<nav aria-label="breadcrumb" style="--bs-breadcrumb-divider: '>';" >
|
<nav aria-label="breadcrumb" style="--bs-breadcrumb-divider: '>';" >
|
||||||
|
|||||||
Reference in New Issue
Block a user