added samples to search result card

This commit is contained in:
Bachir Soussi Chiadmi 2021-01-25 17:39:44 +01:00
parent e07c6b5260
commit 1ca9937fd4
6 changed files with 32 additions and 4 deletions

View File

@ -70,6 +70,7 @@ type SearchResult {
images: [Image]
visuels: [Image]
reference: String
samples: [Sample]
}
type Product {

View File

@ -342,6 +342,12 @@ class MaterioSchemaExtension extends SdlSchemaExtensionPluginBase {
->map('path', $builder->fromValue('field_reference.value'))
);
$registry->addFieldResolver('SearchResult', 'samples',
$builder->produce('property_path')
->map('type', $builder->fromValue('entity:node'))
->map('value', $builder->fromParent())
->map('path', $builder->fromValue('field_samples'))
);
}
// ___ _

File diff suppressed because one or more lines are too long

View File

@ -16,5 +16,12 @@ fragment SearchResultFields on SearchResult {
alt
style_cardmedium_url
style_hd_url
}
samples{
showroom{
name
id
}
location
}
}

View File

@ -27,6 +27,20 @@
</ul>
</div>
</section>
<section class="tool samples" v-if="item.samples && item.samples.length">
<span class="btn mdi mdi-beaker-outline"/>
<div class="tool-content">
<span class="label">{{ $t("materio.Samples") }}</span>
<ul>
<li
v-for="sample in item.samples"
:key="sample.showroom.id"
>
<span class="showroom">{{ sample.showroom.name }}</span>: {{ sample.location }}
</li>
</ul>
</div>
</section>
</nav>
<section class="images" v-switcher>
<figure

View File

@ -36,7 +36,7 @@
</ul>
</div>
</section>
<section class="tool samples">
<section class="tool samples" v-if="item.samples && item.samples.length">
<span class="btn mdi mdi-beaker-outline"/>
<div class="tool-content">
<span class="label">{{ $t("materio.Samples") }}</span>