Skip to content

Commit 1c41bbc

Browse files
authored
INT-285: Add Recently viewed component
Add Recently viewed component
1 parent 397e1e3 commit 1c41bbc

11 files changed

Lines changed: 113 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
# Changelog
2+
## Unreleased
3+
### Add
4+
- Add Recently viewed component
5+
6+
### Change
7+
- Upgrade Web Components version to v5.2.1
8+
- Remove deprecation for fputcsv()
9+
210
## [v7.2.2] - 2026.04.17
311
### Fix
412
- Fix ImageUrl for products without image

docs/assets/feature-settings.png

10.2 KB
Loading

src/Config/Communication.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public function getFactFinderFeatures(): array
8383
'useSimilarProducts' => (bool) $this->config('useSimilarProducts'),
8484
'usePushedProductsCampaigns' => (bool) $this->config('usePushedProductsCampaigns'),
8585
'usePopularSearches' => (bool) $this->config('usePopularSearches'),
86+
'useRecentlyViewed' => (bool) $this->config('useRecentlyViewed'),
8687
];
8788
}
8889
}

src/Export/Stream/ConsoleOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function addEntity(array $entity): void
2323
{
2424
$this->fileResource = $this->fileResource ?? new File('php://output', 'w');
2525
ob_start();
26-
$this->fileResource->fputcsv($entity, $this->delimiter);
26+
$this->fileResource->fputcsv($entity, $this->delimiter, '"', '\\');
2727
$this->output->writeln(rtrim(ob_get_clean()));
2828
}
2929
}

src/Export/Stream/CsvFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ public function __construct($fileResource, string $delimiter = ';')
2323

2424
public function addEntity(array $entity): void
2525
{
26-
fputcsv($this->fileResource, $entity, $this->delimiter);
26+
fputcsv($this->fileResource, $entity, $this->delimiter, '"', '\\');
2727
}
2828
}

src/Resources/config/config.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@
166166
<label>Popular searches</label>
167167
<defaultValue>true</defaultValue>
168168
</input-field>
169+
170+
<input-field type="bool">
171+
<name>useRecentlyViewed</name>
172+
<label>Recently Viewed Products</label>
173+
<defaultValue>false</defaultValue>
174+
</input-field>
169175
</card>
170176

171177
<card>

src/Resources/public/ff-web-components/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Resources/public/ff-web-components/default-styles.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,13 @@ ff-similar-products {
274274
}
275275

276276

277+
/* ---- ff-recently-viewed ---- */
278+
279+
ff-recently-viewed {
280+
display: block;
281+
}
282+
283+
277284
/* ---- ff-onfocus-suggest ---- */
278285

279286
ff-onfocus-suggest {
@@ -727,6 +734,13 @@ ff-slider .ffw-slider-button-right {
727734
transform: translate(0, -50%);
728735
}
729736

737+
/* Hidden visibility is important to take nested elements out of the tabindex chain when group is collapsed.
738+
`display:none` cannot be used because it breaks the recalculation of the slider's position. */
739+
ff-asn-group .ffw-wrapper:not([opened]),
740+
ff-asn-group-slider .ffw-wrapper:not([opened]) {
741+
visibility: hidden;
742+
}
743+
730744
ff-asn-remove-all-filters {
731745
display: inline-block;
732746
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{% block component_factfinder_recently_viewed %}
2+
<ff-recently-viewed wait-for-update>
3+
<h3>Recently viewed:</h3>
4+
5+
<ff-record-list subscribe="false" class="row grid-row grid-view">
6+
<template data-role="record">
7+
<ff-record class="cms-listing-col col-sm-6 col-lg-4 col-xl-3">
8+
<div class="card product-box box-standard">
9+
<div class="card-body">
10+
<div class="product-image-wrapper">
11+
<a class="product-image-link is-standard" title="{{ '{{Name}}' }}"
12+
data-redirect="{{ '{{Deeplink}}' }}" data-anchor="{{ '{{Deeplink}}' }}"
13+
data-redirect-target="_self">
14+
<img class="product-image is-standard" data-image="{{ '{{ImageUrl}}' }}"
15+
alt="{{ '{{Name}}' }}" title="{{ '{{Name}}' }}"/>
16+
</a>
17+
</div>
18+
<div class="product-info">
19+
<a class="product-name stretched-link" title="{{ '{{Name}}' }}" data-redirect-target="_self"
20+
data-redirect="{{ '{{Deeplink}}' }}" data-anchor="{{ '{{Deeplink}}' }}">
21+
{{ '{{Name}}' }}
22+
</a>
23+
<div class="product-description">{{ '{{Description}}' }}</div>
24+
<div class="product-price-info">
25+
<p class="product-price">{{ '{{ $ Price}}' }} *</p>
26+
</div>
27+
<div class="product-action">
28+
<div class="d-grid">
29+
<a class="btn btn-light btn-detail" title="{{ '{{Name}}' }}" data-redirect-target="_self"
30+
data-redirect="{{ '{{Deeplink}}' }}" data-anchor="{{ '{{Deeplink}}' }}">
31+
{{ 'listing.boxProductDetails'|trans|sw_sanitize }}
32+
</a>
33+
</div>
34+
</div>
35+
</div>
36+
</div>
37+
</div>
38+
</ff-record>
39+
</template>
40+
</ff-record-list>
41+
</ff-recently-viewed>
42+
{% endblock %}

src/Resources/views/storefront/element/cms-element-product-description-reviews.html.twig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
} %}
3838
{% endif %}
3939

40+
{% if page.extensions.factfinder.features.useRecentlyViewed %}
41+
{% sw_include '@Parent/storefront/components/factfinder/recently_viewed.html.twig' %}
42+
{% endif %}
43+
4044
</div>
4145
{% endif %}
4246
{% endblock %}

0 commit comments

Comments
 (0)