Compare commits
9 Commits
feature/gi
...
6cfee98a6b
| Author | SHA1 | Date | |
|---|---|---|---|
| 6cfee98a6b | |||
| bafa889c59 | |||
| c6c11d5f7f | |||
| 7373657d78 | |||
| d18c735b63 | |||
| cac4e1f925 | |||
| 7f7cc72647 | |||
| 3bbf82f897 | |||
| a388b53cff |
@@ -118,6 +118,66 @@ class Migrate extends Command
|
||||
]
|
||||
);
|
||||
}
|
||||
if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'Netherlands')->exists()) {
|
||||
Capsule::table('countries')->insert([
|
||||
'countryName' => 'Netherlands',
|
||||
'productsUrl' => 'https://nl.ryobitools.eu/api/product-listing/get-products',
|
||||
'cultureCode' => 'nl-NL',
|
||||
'currency' => 'EUR',
|
||||
'locale' => 'nl',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
);
|
||||
}
|
||||
if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'France')->exists()) {
|
||||
Capsule::table('countries')->insert([
|
||||
'countryName' => 'France',
|
||||
'productsUrl' => 'https://fr.ryobitools.eu/api/product-listing/get-products',
|
||||
'cultureCode' => 'fr-FR',
|
||||
'currency' => 'EUR',
|
||||
'locale' => 'fr',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
);
|
||||
}
|
||||
if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'Spain')->exists()) {
|
||||
Capsule::table('countries')->insert([
|
||||
'countryName' => 'Spain',
|
||||
'productsUrl' => 'https://es.ryobitools.eu/api/product-listing/get-products',
|
||||
'cultureCode' => 'es-ES',
|
||||
'currency' => 'EUR',
|
||||
'locale' => 'es',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
);
|
||||
}
|
||||
if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'Poland')->exists()) {
|
||||
$id = Capsule::table('countries')->insertGetId(
|
||||
[
|
||||
'countryName' => 'Poland',
|
||||
'productsUrl' => 'https://pl.ryobitools.eu/api/product-listing/get-products',
|
||||
'cultureCode' => 'pl-PL',
|
||||
'currency' => 'PLN',
|
||||
'locale' => 'pl',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'UK')->exists()) {
|
||||
Capsule::table('countries')->insert([
|
||||
'countryName' => 'UK',
|
||||
'productsUrl' => 'https://uk.ryobitools.eu/api/product-listing/get-products',
|
||||
'cultureCode' => 'en-GB',
|
||||
'currency' => 'GBP',
|
||||
'locale' => 'uk',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if (!Capsule::schema()->hasColumn('products', 'country_id')) {
|
||||
Capsule::schema()->table('products', function (Blueprint $table) use ($id) {
|
||||
|
||||
@@ -20,8 +20,11 @@ final class PromosController extends BaseController
|
||||
|
||||
|
||||
$promos = Product::select($this->database->getConnection()->raw("distinct json_extract(promotions, '$.slug') as slug, json_extract(promotions, '$.tag') as tag"))
|
||||
->addSelect('countries.locale')
|
||||
->whereRaw("json_extract(promotions, '$.tag') is not null")
|
||||
->get();
|
||||
->join('countries', 'products.country_id', '=', 'countries.id')
|
||||
->get()
|
||||
->groupBy('locale');
|
||||
|
||||
return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'promos' . $promo, 'promos' => $promos->toArray()]);
|
||||
}
|
||||
|
||||
@@ -6,9 +6,17 @@
|
||||
{% endif %}
|
||||
|
||||
{% if listType starts with 'promos' %}
|
||||
{% for promo in promos %}
|
||||
<a href="{{ path('app_promos', {'promo': promo.slug}) }}"><span class="badge bg-info">PROMO: {{ promo.tag }}</span></a>
|
||||
{% endfor %}
|
||||
<ul class="list-group list-group-flush">
|
||||
{% for locale, promoByLocale in promos %}
|
||||
<li class="list-group-item">
|
||||
<h5 class="d-inline-block"><span class="badge bg-info">{{ locale | upper }}</span></h5>
|
||||
{% for promo in promoByLocale %}
|
||||
<a href="{{ path('app_promos', {'promo': promo.slug}) }}"><span
|
||||
class="badge bg-info">PROMO: {{ promo.tag }} [{{ promo.locale | upper }}]</span></a>
|
||||
{% endfor %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -38,22 +46,24 @@
|
||||
<td class="align-middle">
|
||||
<a href='{{ path('app_product', {'productId': product.id}) }}'
|
||||
class="text-decoration-none">{{ product.name }}</a>
|
||||
<br>
|
||||
{% if product.stock > 0 %}
|
||||
<span class="badge text-bg-light">stock: {{ product.stock }}</span>
|
||||
{% else %}
|
||||
<span class="badge text-bg-warning">out of stock</span>
|
||||
{% endif %}
|
||||
{% if product.isDiscontinued() %}
|
||||
<span class="badge text-bg-secondary" data-bs-toggle="tooltip"
|
||||
data-bs-title="Last update: {{ product.lastSeen }}">is discontinued</span>
|
||||
<a href="{{ path('app_discontinued') }}"><span class="badge text-bg-secondary" data-bs-toggle="tooltip"
|
||||
data-bs-title="Last update: {{ product.lastSeen }}">is discontinued</span></a>
|
||||
{% endif %}
|
||||
{% if product.isNew() %}
|
||||
<span class="badge text-bg-success">is new</span>
|
||||
<a href="{{ path('app_new') }}"><span class="badge text-bg-success">is new</span></a>
|
||||
{% endif %}
|
||||
<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>
|
||||
{% if product.promotions is not null and product.promotions.hasPromotion %}<a href="{{ path('app_promos', {'promo': product.promotions.slug}) }}"><span class="badge bg-info">PROMO: {{ product.promotions.tag }}</span></a>{% endif %}
|
||||
<span class="badge text-bg-light">{{ product.country.countryName }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<nav aria-label="breadcrumb" style="--bs-breadcrumb-divider: '>';">
|
||||
|
||||
Reference in New Issue
Block a user