I am having problems since the last update of Drupal Commerce to version 2.23
At the top of my products page, there is an area with the parent store. This area is a link to the parent store.
Before the update everything works fine.
Now the link no longer works. I do not understand absolutely nothing, it does not make sense. When I hover over the area it shows a link to the product page, normally that should be a link to the parent store.
When I inspect the page, the href="" tag is empty.
Look in screenshots
I have checked my configuration and my templates, but I really don't see where the problem is.
My old products are working correctly, the problem only appears for new products, created since the update.
Do you have an explanation and a solution ? Thank you
commerce-store--professionnel--product-default.html.twig :
<article{{ attributes.addClass('commerce-store--professionnel--product-default') }}>
<div class="media d-flex align-self-center align-items-center">
<div class="mt-0 mr-3 mb-0 ml-0 rounded overflow-hidden border">
{{ store.field_professionnel_logo }}
</div>
<div class="media-body text-truncate">
Proposé par la <b>{{ store_entity.type.entity.label }}</b>
<div class="mt-0 h3 text-truncate">
{{ store_entity.name.value }}
</div>
<div class="font-weight-bold">
VISITER LA BOUTIQUE
</div>
<a href="{{ store_url }}" title="{{ store_entity.name.value }}" class="stretched-link"></a>
</div>
</div>
</article>
I am using the template above in the template below commerce-product--produit--full.html.twig :
<article{{ attributes.addClass('commerce-product--produit--full') }}>
<div class="row mr-0 mb-3 ml-0 shadow d-flex flex-wrap flag-france">
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4 p-3 bg-primary"></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4 bg-white d-flex align-self-center justify-content-center">
<small class="font-weight-bold text-center">FABRIQUÉ EN FRANCE</small>
</div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4 p-3 bg-danger"></div>
</div>
<div class="card full mb-5 p-0 overflow-hidden shadow rounded bg-white">
<div class="card-header position-relative">
{{ product.stores }}
</div>
<div class="card-body">
<h1 class="p-0 mt-0">{{ product_entity.title.value }}</h1>
<div class="row">
<div class="col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6 mb-3">
{{ product.variation_field_produit_image }}
</div>
<div class="col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6 mb-3">
{% set view = drupal_view_result('produit_labels_produit', 'block_2')|length %}
{% if view > 0 %}
<a href="#" data-toggle="modal" data-toggle="modal" data-target="#modal-label">
{{ drupal_view('produit_labels_produit', 'block_2') }}
</a>
{% endif %}
<div class="bs-field-variation">
<div class="mb-3">
{{ product.variation_sku }}
</div>
<div class="mb-3">
{{ product.variation_field_stock }}
</div>
<div class="h5 rounded bg-light text-center p-2 mb-3">
{{ product.variation_price }}
</div>
{{ product.variations }}
</div>
</div>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 bs-bottom p-0">
{{ product.field_produit_description }}
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 alert alert-warning p-3 mt-3 mb-0" role="alert"><small>Les photos peuvent ne pas représenter fidèlement le produit. Lorsque vous achetez de l’artisanat, chaque produit est unique.</small>
</div>
</div>
<div class="card-footer d-flex flex-wrap justify-content-start pt-0">
<div class="mt-3 mr-3">
{{ product.flag_report_product }}
</div>
<div class="mt-3 mr-3">
{{ product.flag_like_product }}
</div>
<div class="mt-3 mr-3">
{{ drupal_block('shariff_block') }}
</div>
</div>
</div>
{{ drupal_view('produit_legal', 'block_1') }}
<div class="accordion mb-5" id="accordion">
<div class="card border-success rounded overflow-hidden mb-2" id="heading1">
<div class="card-header position-relative bg-success text-white h5 d-flex">
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" class="bi bi-heart-fill mr-2" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 1.314C12.438-3.248 23.534 4.735 8 15-7.534 4.736 3.562-3.248 8 1.314z"/>
</svg> Ils aiment cette page <span class="badge badge-pill badge-light ml-2">{{ product.flag_like_product }}</span>
<a class="collapsed stretched-link text-white ml-auto" data-toggle="collapse" href="#collapse1" aria-expanded="false" aria-controls="collapse1">
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" class="bi bi-plus-circle-fill" viewBox="0 0 16 16">
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.5 4.5a.5.5 0 0 0-1 0v3h-3a.5.5 0 0 0 0 1h3v3a.5.5 0 0 0 1 0v-3h3a.5.5 0 0 0 0-1h-3v-3z"/>
</svg>
</a>
</div>
<div id="collapse1" class="collapse" aria-labelledby="heading1" data-parent="#accordion">
<div class="card-body border-bottom border-success">
L'utilisateur peut montrer ou cacher ce qu'il aime.<br>
Le badge affiche le nombre total de j'aime (même les cachés).<br>
Les résultats affichent uniquement ce que l'utilisateur souhaite montrer.
</div>
<div class="card-body">{{ drupal_view('product_page_like', 'block_1') }}</div>
</div>
</div>
<div class="card border-success rounded overflow-hidden" id="heading2">
<div class="card-header position-relative bg-success text-white h5 d-flex">
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" class="bi bi-hourglass-split mr-2" viewBox="0 0 16 16">
<path d="M2.5 15a.5.5 0 1 1 0-1h1v-1a4.5 4.5 0 0 1 2.557-4.06c.29-.139.443-.377.443-.59v-.7c0-.213-.154-.451-.443-.59A4.5 4.5 0 0 1 3.5 3V2h-1a.5.5 0 0 1 0-1h11a.5.5 0 0 1 0 1h-1v1a4.5 4.5 0 0 1-2.557 4.06c-.29.139-.443.377-.443.59v.7c0 .213.154.451.443.59A4.5 4.5 0 0 1 12.5 13v1h1a.5.5 0 0 1 0 1h-11zm2-13v1c0 .537.12 1.045.337 1.5h6.326c.216-.455.337-.963.337-1.5V2h-7zm3 6.35c0 .701-.478 1.236-1.011 1.492A3.5 3.5 0 0 0 4.5 13s.866-1.299 3-1.48V8.35zm1 0v3.17c2.134.181 3 1.48 3 1.48a3.5 3.5 0 0 0-1.989-3.158C8.978 9.586 8.5 9.052 8.5 8.351z"/>
</svg> Ils exposent ce produit <span class="badge badge-pill badge-light ml-2">{{ drupal_view_result('produit_page_boutique_ephemere', 'block_2')|length }}</span>
<a class="collapsed stretched-link text-white ml-auto" data-toggle="collapse" href="#collapse2" aria-expanded="false" aria-controls="collapse2">
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" class="bi bi-plus-circle-fill" viewBox="0 0 16 16">
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.5 4.5a.5.5 0 0 0-1 0v3h-3a.5.5 0 0 0 0 1h3v3a.5.5 0 0 0 1 0v-3h3a.5.5 0 0 0 0-1h-3v-3z"/>
</svg>
</a>
</div>
<div id="collapse2" class="collapse" aria-labelledby="heading2" data-parent="#accordion">
<div class="card-body">{{ drupal_view('produit_page_boutique_ephemere', 'block_1') }}</div>
</div>
</div>
</div>
<div class="card mb-5 p-3 shadow rounded bg-white">
<div class="h2 mt-0">
{{ product_entity.field_produit_avis.comment_count }} avis
</div>
<em>Prochainement disponible</em>
<div class="font-italic">
{{ product_entity.links }}
</div>
{{ product.field_produit_avis }}
</div>
</article>| Comment | File | Size | Author |
|---|---|---|---|
| Capture d’écran du 2021 01 24 23 16 37.png | 756.39 KB | zenimagine | |
| Capture d’écran du 2021-01-24 23-14-44.png | 211.67 KB | zenimagine |
Comments
Comment #2
zenimagine commentedComment #3
zenimagine commentedComment #4
zenimagine commentedComment #5
jsacksick commentedPlease pay attention to the guidelines before creating an issue:
Comment #6
zenimagine commentedI open requests here because all these problems appeared since the update of Drupal Commerce to version 2.23
I absolutely did not change anything in my configuration.
If I created a question on https://drupal.stackexchange.com it will tell me to open the problem here.
Comment #7
zenimagine commentedComment #8
jsacksick commentedIn this case, you should open a bug report, with reproducible steps on a clean Drupal commerce install, or even better, failing tests.
Without any of that, I probably won't be able to help.
Comment #9
zenimagine commentedI got the store link by replacing:
href="{{ store_url }}"by :
href="/store/{{ store_entity.id }}"but that does not solve the problem.
Comment #10
jsacksick commentedYour template file is named "commerce-store--professionnel--product-default.html.twig" which is not a default theme suggestion provided by Commerce core.
The logic for injecting the "store_url" lives in
template_preprocess_commerce_store(), so you should first check if that logic gets invoked.This code hasn't been touched in 2 years, so i doubt a recent change affected this...
Also... If you search a little, there are thousands of answers available out there... For example, you could do this:
(I personally haven't tried that, but it should in theory work).
Additionally, if none of that works, you should be able to inject yourself the store url via the right preprocess hook.