fredericlessard17
Forum Replies Created
-
Hello,
Thank you for your reply.
I did some additional testing on my side and I noticed something interesting. When I open the vendor profile page and click “Leave a review”, the popup works perfectly and the star rating and form appear normally.
However, when I am on a listing page and click “Leave a review”, the modal window opens but the review form does not load. I only see the title “Leave a review for this vendor” and the cancel button, but the form area is empty.
I also checked the browser console and there are no JavaScript errors related to the form loading. My custom script is able to detect both the listing ID and the vendor ID correctly, so the vendor context seems to exist on the page.
Because of this, I suspect that when the modal is triggered from the listing page, the vendor context might not be correctly passed to the review form.
Do you know if there is a specific hook or template adjustment required so the review form can load correctly when triggered from a listing page?
there is the code when in inspect both side, 1st is the side from hivepress listing page, and the other one is the inspect from que profil page when i click on leave a review<div id="hp_vendor_review_modal" class="hp-modal fancybox-content" style="display: inline-block;">
<div class="hp-modal__content">
<h3 class="hp-modal__title">Laisser un avis sur ce vendeur</h3>
<div id="hp_vendor_review_modal_inner"><div class="shortcode-site-reviews-form"><div class="glsr glsr-default" id="glsr_awtngxga" data-from="shortcode" data-shortcode="site_reviews_form" data-assigned_posts="1226" data-hide="title,name,email,terms"><div class="glsr-form-wrap">
<form class="glsr-form glsr-review-form" method="post" enctype="multipart/form-data">
<input type="hidden" name="site-reviews[_action]" value="submit-review">
<input type="hidden" name="site-reviews[_nonce]" value="3b4d2073ef">
<input type="hidden" name="site-reviews[_post_id]" value="">
<input type="hidden" name="site-reviews[_referer]" value="https://entrevoisins.ca/annonce/annonce-local/sacs-de-vetements-a-donner/">
<input type="hidden" name="site-reviews[assigned_posts]" value="1226">
<input type="hidden" name="site-reviews[assigned_terms]" value="">
<input type="hidden" name="site-reviews[assigned_users]" value="">
<input type="hidden" name="site-reviews[excluded]" value="title, name, email, terms">
<input type="hidden" name="site-reviews[form_id]" value="glsr_awtngxga">
<input type="hidden" name="site-reviews[form_signature]" value="MPWKwWlBoql-HG1lUfOxK4qJvGb3JhJCb0YbJh1x_ewVeG72kZzIFGWO5euR_YuNE9QhVD3EC642o0oywtpuirs67foy44DKdW6R8NEOlde4HwAFNg_VmMg94f027sMRwUo3eSMsRVlmHikna3dq2k5vojCAnjE0hWIkOPukrKVK8uqGFg2a5BzCVnOOBZMYpPiYIu5iRi3YSNKMLAq83jUi743y93hXzahsZmAxW7YRlAwbyZZYvj_tbEPRUfc7ZJvpxYIufFxtIy_JhN9lD0PDJilR5lmv8geW8w446BwlJx0kiD0NPJn3ZiJptD9xVHCgHun5p5z29T6DGMFbW2gNn2Dp4KbGG_eKhGZolyp2x5eMsW9V8OADTjht-zsYHmbw8ahWGzP0_o9gDo263VLnmT0Hp15C1tfNNYtD_gF98eRQtNBwxwZ6lgWtVeH9HJA-w03-9Rr2ZmdztvFOxhoYIJJQDVQSWYRfktLTrFt_4HlWGbdHpm4Yo_E6oqp2i0uhGZTzbwjlg09iRRsTc5OdUgB0tC_gavc8D0DQ0GDOUxapEN7RGn5B6clPfGmK">
<input type="hidden" name="site-reviews[terms_exist]" value="0">
<div class="glsr-field" style="display:none;"><label for="site-reviews-061e40b6-glsr_awtngxga">Avis</label><input type="text" class="glsr-input glsr-input-text" id="site-reviews-061e40b6-glsr_awtngxga" name="site-reviews[061e40b6]" value=""></div>
<div class="glsr-field glsr-field-rating glsr-required" data-field="rating" data-type="rating">
<label class="glsr-label" for="glsr_awtngxga-rating">
<span>Votre évaluation globale</span>
</label>
<select class="browser-default disable-select glsr-select no-wrap no_wrap" id="glsr_awtngxga-rating" name="site-reviews[rating]" required=""><option value="">Sélectionnez une note</option><option value="5">5 Étoiles</option><option value="4">4 Étoiles</option><option value="3">3 Étoiles</option><option value="2">2 Étoiles</option><option value="1">1 Étoile</option></select>
<div class="glsr-field-error"></div>
</div>
<div class="glsr-field glsr-field-textarea glsr-required" data-field="content" data-type="textarea">
<label class="glsr-label" for="glsr_awtngxga-content">
<span>Avis</span>
</label>
<textarea class="glsr-textarea" id="glsr_awtngxga-content" name="site-reviews[content]" required="" placeholder="Dites aux gens votre avis" rows="5"></textarea>
<div class="glsr-field-error"></div>
</div>
<div class="glsr-form-message">
</div>
<div data-field="submit-button">
<div class="wp-block-buttons is-layout-flex">
<div class="wp-block-button">
<button type="submit" class="glsr-button wp-block-button__link wp-element-button" aria-busy="false" data-loading="Submitting, please wait...">Soumettre l'avis</button>
</div>
</div>
</div>
</form>
</div></div></div></div>
<div style="margin-top:12px;">
<button class="hp-modal__close button">Fermer</button>
</div>
</div>
<button type="button" data-fancybox-close="" class="fancybox-button fancybox-close-small" title="Close"><svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 24 24"><path d="M13 12l5-5-1-1-5 5-5-5-1 1 5 5-5 5 1 1 5-5 5 5 1-1z"></path></svg></button></div><div id="hp_vendor_review_modal" class="hp-modal fancybox-content" style="display: inline-block;">
<div class="hp-modal__content">
<h3 class="hp-modal__title">Laisser un avis sur ce vendeur</h3>
<div id="hp_vendor_review_modal_inner"><div class="shortcode-site-reviews-form"><div class="glsr glsr-default" id="glsr_ulwey7za" data-from="shortcode" data-shortcode="site_reviews_form" data-assigned_posts="1226" data-hide="title,name,email,terms"><div class="glsr-form-wrap">
<form class="glsr-form glsr-review-form" method="post" enctype="multipart/form-data">
<input type="hidden" name="site-reviews[_action]" value="submit-review">
<input type="hidden" name="site-reviews[_nonce]" value="3b4d2073ef">
<input type="hidden" name="site-reviews[_post_id]" value="">
<input type="hidden" name="site-reviews[_referer]" value="https://entrevoisins.ca/vendor/cynthia/">
<input type="hidden" name="site-reviews[assigned_posts]" value="1226">
<input type="hidden" name="site-reviews[assigned_terms]" value="">
<input type="hidden" name="site-reviews[assigned_users]" value="">
<input type="hidden" name="site-reviews[excluded]" value="title, name, email, terms">
<input type="hidden" name="site-reviews[form_id]" value="glsr_ulwey7za">
<input type="hidden" name="site-reviews[form_signature]" value="_M-7xIFFDKPZYgFCHdjsHOesgn7hCAQjlHEy5ZiA1666AzkyP22zxD2sw3Ue8GgJ_VFKoDQvosutkWKwsoHFVkDr7DtEYrG_oPZALyhtda3uQX1g7QG6AHeSbkKsSdex6KYHjRW73CKYYCFtuLDJtzn7N6z7uOnyRGTeO8m6X43oVdhNzPFmfCaWBkFhN29DY8U9mHD8TAp4FCsHHVWNtc2xs2K4F1CC9pO88fiHunTPL5tYXBeVQn6jfC7MIKSfF4CoclOHrBMBBi6bQ6E6M2DWYVQSRCQ0IROS_wGfbkmGAM7akW5ZNK0tM4OUEa_AgMx44L2m_c_aw2V96ubE8Gm4eJcyFsHLuN_oTrZ3ANr4QZMHC4JDQyy1Lfg-1ZZaG-H_HSleXYLqcEdMSQ5rRZcfGDPb7FnpJ40URgXdspY7I0H17em_qROCUL1_E4AQeENE3Bib7WqsyeoUQwfNdL8K2lz9sZ7HtT74uBRhgaQm5FWJauZE6am0N-ns-6ajM2H62ZtguX7cn9SZWto">
<input type="hidden" name="site-reviews[terms_exist]" value="0">
<div class="glsr-field" style="display:none;"><label for="site-reviews-9aae98ad-glsr_ulwey7za">Avis</label><input type="text" class="glsr-input glsr-input-text" id="site-reviews-9aae98ad-glsr_ulwey7za" name="site-reviews[9aae98ad]" value=""></div>
<div class="glsr-field glsr-field-rating glsr-required" data-field="rating" data-type="rating">
<label class="glsr-label" for="glsr_ulwey7za-rating">
<span>Votre évaluation globale</span>
</label>
<select class="browser-default disable-select glsr-select no-wrap no_wrap" id="glsr_ulwey7za-rating" name="site-reviews[rating]" required=""><option value="">Sélectionnez une note</option><option value="5">5 Étoiles</option><option value="4">4 Étoiles</option><option value="3">3 Étoiles</option><option value="2">2 Étoiles</option><option value="1">1 Étoile</option></select>
<div class="glsr-field-error"></div>
</div>
<div class="glsr-field glsr-field-textarea glsr-required" data-field="content" data-type="textarea"><template shadowrootmode="closed"><lt-mirror contenteditable="false" style="display: none;"><template shadowrootmode="closed"><lt-highlighter contenteditable="false" style="display: none;"><lt-div spellcheck="false" class="lt-highlighter__wrapper" style="transform: none !important; transform-origin: 150px 68.8849px !important; zoom: 1 !important; width: 298.153px !important; height: 135.937px !important; margin-top: 25.3977px !important; margin-left: 0.909091px !important;"><lt-div class="lt-highlighter__scroll-element" style="top: 0px !important; left: 0px !important; width: 298px !important; height: 136px !important;"></lt-div></lt-div></lt-highlighter><slot style="color-scheme: inherit; forced-color-adjust: inherit; mask: inherit; math-depth: inherit; position: inherit; position-anchor: inherit; text-size-adjust: inherit; appearance: inherit; color: inherit; font: inherit; font-palette: inherit; font-synthesis: inherit; position-area: inherit; text-orientation: inherit; text-rendering: inherit; text-spacing-trim: inherit; -webkit-font-smoothing: inherit; -webkit-locale: inherit; -webkit-text-orientation: inherit; -webkit-writing-mode: inherit; writing-mode: inherit; zoom: inherit; accent-color: inherit; place-content: inherit; place-items: inherit; place-self: inherit; alignment-baseline: inherit; anchor-name: inherit; anchor-scope: inherit; animation-composition: inherit; animation: inherit; app-region: inherit; aspect-ratio: inherit; backdrop-filter: inherit; backface-visibility: inherit; background: inherit; background-blend-mode: inherit; baseline-shift: inherit; baseline-source: inherit; block-size: inherit; border-block: inherit; border: inherit; border-radius: inherit; border-collapse: inherit; border-end-end-radius: inherit; border-end-start-radius: inherit; border-inline: inherit; border-start-end-radius: inherit; border-start-start-radius: inherit; inset: inherit; box-decoration-break: inherit; box-shadow: inherit; box-sizing: inherit; break-after: inherit; break-before: inherit; break-inside: inherit; buffered-rendering: inherit; caption-side: inherit; caret-animation: inherit; caret-color: inherit; caret-shape: inherit; clear: inherit; clip: inherit; clip-path: inherit; clip-rule: inherit; color-interpolation: inherit; color-interpolation-filters: inherit; color-rendering: inherit; columns: inherit; column-fill: inherit; gap: inherit; column-rule: inherit; column-span: inherit; contain: inherit; contain-intrinsic-block-size: inherit; contain-intrinsic-size: inherit; contain-intrinsic-inline-size: inherit; container: inherit; content: inherit; content-visibility: inherit; corner-shape: inherit; corner-block-end-shape: inherit; corner-block-start-shape: inherit; counter-increment: inherit; counter-reset: inherit; counter-set: inherit; cursor: inherit; cx: inherit; cy: inherit; d: inherit; display: contents; dominant-baseline: inherit; dynamic-range-limit: inherit; empty-cells: inherit; field-sizing: inherit; fill: inherit; fill-opacity: inherit; fill-rule: inherit; filter: inherit; flex: inherit; flex-flow: inherit; float: inherit; flood-color: inherit; flood-opacity: inherit; grid: inherit; grid-area: inherit; height: inherit; hyphenate-character: inherit; hyphenate-limit-chars: inherit; hyphens: inherit; image-orientation: inherit; image-rendering: inherit; initial-letter: inherit; inline-size: inherit; inset-block: inherit; inset-inline: inherit; interactivity: inherit; interest-delay: inherit; interpolate-size: inherit; isolation: inherit; letter-spacing: inherit; lighting-color: inherit; line-break: inherit; list-style: inherit; margin-block: inherit; margin: inherit; margin-inline: inherit; marker: inherit; mask-type: inherit; math-shift: inherit; math-style: inherit; max-block-size: inherit; max-height: inherit; max-inline-size: inherit; max-width: inherit; min-block-size: inherit; min-height: inherit; min-inline-size: inherit; min-width: inherit; mix-blend-mode: inherit; object-fit: inherit; object-position: inherit; object-view-box: inherit; offset: inherit; opacity: inherit; order: inherit; orphans: inherit; outline: inherit; outline-offset: inherit; overflow-anchor: inherit; overflow-block: inherit; overflow-clip-margin: inherit; overflow-inline: inherit; overflow-wrap: inherit; overflow: inherit; overlay: inherit; overscroll-behavior-block: inherit; overscroll-behavior-inline: inherit; overscroll-behavior: inherit; padding-block: inherit; padding: inherit; padding-inline: inherit; page: inherit; page-orientation: inherit; paint-order: inherit; perspective: inherit; perspective-origin: inherit; pointer-events: inherit; position-try: inherit; position-visibility: inherit; print-color-adjust: inherit; quotes: inherit; r: inherit; reading-flow: inherit; reading-order: inherit; resize: inherit; rotate: inherit; ruby-align: inherit; ruby-position: inherit; rx: inherit; ry: inherit; scale: inherit; scroll-behavior: inherit; scroll-initial-target: inherit; scroll-margin-block: inherit; scroll-margin: inherit; scroll-margin-inline: inherit; scroll-marker-group: inherit; scroll-padding-block: inherit; scroll-padding: inherit; scroll-padding-inline: inherit; scroll-snap-align: inherit; scroll-snap-stop: inherit; scroll-snap-type: inherit; scroll-target-group: inherit; scroll-timeline: inherit; scrollbar-color: inherit; scrollbar-gutter: inherit; scrollbar-width: inherit; shape-image-threshold: inherit; shape-margin: inherit; shape-outside: inherit; shape-rendering: inherit; size: inherit; speak: inherit; stop-color: inherit; stop-opacity: inherit; stroke: inherit; stroke-dasharray: inherit; stroke-dashoffset: inherit; stroke-linecap: inherit; stroke-linejoin: inherit; stroke-miterlimit: inherit; stroke-opacity: inherit; stroke-width: inherit; tab-size: inherit; table-layout: inherit; text-align: inherit; text-align-last: inherit; text-anchor: inherit; text-autospace: inherit; text-box: inherit; text-combine-upright: inherit; text-decoration: inherit; text-decoration-skip-ink: inherit; text-emphasis: inherit; text-emphasis-position: inherit; text-indent: inherit; text-justify: inherit; text-overflow: inherit; text-shadow: inherit; text-transform: inherit; text-underline-offset: inherit; text-underline-position: inherit; text-wrap: inherit; timeline-scope: inherit; touch-action: inherit; transform: inherit; transform-box: inherit; transform-origin: inherit; transform-style: inherit; transition: inherit; translate: inherit; user-select: inherit; vector-effect: inherit; vertical-align: inherit; view-timeline: inherit; view-transition-class: inherit; view-transition-group: inherit; view-transition-name: inherit; visibility: inherit; border-spacing: inherit; -webkit-box-align: inherit; -webkit-box-decoration-break: inherit; -webkit-box-direction: inherit; -webkit-box-flex: inherit; -webkit-box-ordinal-group: inherit; -webkit-box-orient: inherit; -webkit-box-pack: inherit; -webkit-box-reflect: inherit; -webkit-line-break: inherit; -webkit-line-clamp: inherit; -webkit-mask-box-image: inherit; -webkit-rtl-ordering: inherit; -webkit-ruby-position: inherit; -webkit-tap-highlight-color: inherit; -webkit-text-combine: inherit; -webkit-text-decorations-in-effect: inherit; -webkit-text-fill-color: inherit; -webkit-text-security: inherit; -webkit-text-stroke: inherit; -webkit-user-drag: inherit; white-space-collapse: inherit; widows: inherit; width: inherit; will-change: inherit; word-break: inherit; word-spacing: inherit; x: inherit; y: inherit; z-index: inherit;"></slot><link href="chrome-extension://oldceeleldhonbafppcapldpdifcinji/content/styles/shadow.css" rel="stylesheet"></template><lt-div spellcheck="false" class="lt-mirror__wrapper notranslate" data-lt-scroll-top="0" data-lt-scroll-left="0" data-lt-scroll-top-scaled="0" data-lt-scroll-left-scaled="0" data-lt-scroll-top-scaled-and-zoomed="0" data-lt-scroll-left-scaled-and-zoomed="0" style="border: 0.909091px solid rgb(163, 163, 163) !important; border-radius: 3px !important; direction: ltr !important; font: 400 16px / 1.5 "Open Sans", sans-serif !important; font-synthesis: weight style small-caps !important; hyphens: manual !important; letter-spacing: normal !important; line-break: auto !important; margin: 24.5028px 0px 0px !important; padding: 8px 12px !important; text-align: start !important; text-decoration: none !important; text-indent: 0px !important; text-rendering: auto !important; text-transform: none !important; transform: none !important; transform-origin: 150px 68.8849px !important; unicode-bidi: normal !important; white-space: pre-wrap !important; word-spacing: 0px !important; overflow-wrap: break-word !important; writing-mode: horizontal-tb !important; zoom: 1 !important; -webkit-locale: "fr-CA" !important; -webkit-rtl-ordering: logical !important; width: 274.182px !important; height: 119.952px !important;"><lt-div class="lt-mirror__canvas" style="margin-top: 0px !important; margin-left: 0px !important; width: 274.182px !important; height: 120px !important; align-content: normal !important;"><lt-span></lt-span></lt-div></lt-div></lt-mirror><slot style="color-scheme: inherit; forced-color-adjust: inherit; mask: inherit; math-depth: inherit; position: inherit; position-anchor: inherit; text-size-adjust: inherit; appearance: inherit; color: inherit; font: inherit; font-palette: inherit; font-synthesis: inherit; position-area: inherit; text-orientation: inherit; text-rendering: inherit; text-spacing-trim: inherit; -webkit-font-smoothing: inherit; -webkit-locale: inherit; -webkit-text-orientation: inherit; -webkit-writing-mode: inherit; writing-mode: inherit; zoom: inherit; accent-color: inherit; place-content: inherit; place-items: inherit; place-self: inherit; alignment-baseline: inherit; anchor-name: inherit; anchor-scope: inherit; animation-composition: inherit; animation: inherit; app-region: inherit; aspect-ratio: inherit; backdrop-filter: inherit; backface-visibility: inherit; background: inherit; background-blend-mode: inherit; baseline-shift: inherit; baseline-source: inherit; block-size: inherit; border-block: inherit; border: inherit; border-radius: inherit; border-collapse: inherit; border-end-end-radius: inherit; border-end-start-radius: inherit; border-inline: inherit; border-start-end-radius: inherit; border-start-start-radius: inherit; inset: inherit; box-decoration-break: inherit; box-shadow: inherit; box-sizing: inherit; break-after: inherit; break-before: inherit; break-inside: inherit; buffered-rendering: inherit; caption-side: inherit; caret-animation: inherit; caret-color: inherit; caret-shape: inherit; clear: inherit; clip: inherit; clip-path: inherit; clip-rule: inherit; color-interpolation: inherit; color-interpolation-filters: inherit; color-rendering: inherit; columns: inherit; column-fill: inherit; gap: inherit; column-rule: inherit; column-span: inherit; contain: inherit; contain-intrinsic-block-size: inherit; contain-intrinsic-size: inherit; contain-intrinsic-inline-size: inherit; container: inherit; content: inherit; content-visibility: inherit; corner-shape: inherit; corner-block-end-shape: inherit; corner-block-start-shape: inherit; counter-increment: inherit; counter-reset: inherit; counter-set: inherit; cursor: inherit; cx: inherit; cy: inherit; d: inherit; display: contents; dominant-baseline: inherit; dynamic-range-limit: inherit; empty-cells: inherit; field-sizing: inherit; fill: inherit; fill-opacity: inherit; fill-rule: inherit; filter: inherit; flex: inherit; flex-flow: inherit; float: inherit; flood-color: inherit; flood-opacity: inherit; grid: inherit; grid-area: inherit; height: inherit; hyphenate-character: inherit; hyphenate-limit-chars: inherit; hyphens: inherit; image-orientation: inherit; image-rendering: inherit; initial-letter: inherit; inline-size: inherit; inset-block: inherit; inset-inline: inherit; interactivity: inherit; interest-delay: inherit; interpolate-size: inherit; isolation: inherit; letter-spacing: inherit; lighting-color: inherit; line-break: inherit; list-style: inherit; margin-block: inherit; margin: inherit; margin-inline: inherit; marker: inherit; mask-type: inherit; math-shift: inherit; math-style: inherit; max-block-size: inherit; max-height: inherit; max-inline-size: inherit; max-width: inherit; min-block-size: inherit; min-height: inherit; min-inline-size: inherit; min-width: inherit; mix-blend-mode: inherit; object-fit: inherit; object-position: inherit; object-view-box: inherit; offset: inherit; opacity: inherit; order: inherit; orphans: inherit; outline: inherit; outline-offset: inherit; overflow-anchor: inherit; overflow-block: inherit; overflow-clip-margin: inherit; overflow-inline: inherit; overflow-wrap: inherit; overflow: inherit; overlay: inherit; overscroll-behavior-block: inherit; overscroll-behavior-inline: inherit; overscroll-behavior: inherit; padding-block: inherit; padding: inherit; padding-inline: inherit; page: inherit; page-orientation: inherit; paint-order: inherit; perspective: inherit; perspective-origin: inherit; pointer-events: inherit; position-try: inherit; position-visibility: inherit; print-color-adjust: inherit; quotes: inherit; r: inherit; reading-flow: inherit; reading-order: inherit; resize: inherit; rotate: inherit; ruby-align: inherit; ruby-position: inherit; rx: inherit; ry: inherit; scale: inherit; scroll-behavior: inherit; scroll-initial-target: inherit; scroll-margin-block: inherit; scroll-margin: inherit; scroll-margin-inline: inherit; scroll-marker-group: inherit; scroll-padding-block: inherit; scroll-padding: inherit; scroll-padding-inline: inherit; scroll-snap-align: inherit; scroll-snap-stop: inherit; scroll-snap-type: inherit; scroll-target-group: inherit; scroll-timeline: inherit; scrollbar-color: inherit; scrollbar-gutter: inherit; scrollbar-width: inherit; shape-image-threshold: inherit; shape-margin: inherit; shape-outside: inherit; shape-rendering: inherit; size: inherit; speak: inherit; stop-color: inherit; stop-opacity: inherit; stroke: inherit; stroke-dasharray: inherit; stroke-dashoffset: inherit; stroke-linecap: inherit; stroke-linejoin: inherit; stroke-miterlimit: inherit; stroke-opacity: inherit; stroke-width: inherit; tab-size: inherit; table-layout: inherit; text-align: inherit; text-align-last: inherit; text-anchor: inherit; text-autospace: inherit; text-box: inherit; text-combine-upright: inherit; text-decoration: inherit; text-decoration-skip-ink: inherit; text-emphasis: inherit; text-emphasis-position: inherit; text-indent: inherit; text-justify: inherit; text-overflow: inherit; text-shadow: inherit; text-transform: inherit; text-underline-offset: inherit; text-underline-position: inherit; text-wrap: inherit; timeline-scope: inherit; touch-action: inherit; transform: inherit; transform-box: inherit; transform-origin: inherit; transform-style: inherit; transition: inherit; translate: inherit; user-select: inherit; vector-effect: inherit; vertical-align: inherit; view-timeline: inherit; view-transition-class: inherit; view-transition-group: inherit; view-transition-name: inherit; visibility: inherit; border-spacing: inherit; -webkit-box-align: inherit; -webkit-box-decoration-break: inherit; -webkit-box-direction: inherit; -webkit-box-flex: inherit; -webkit-box-ordinal-group: inherit; -webkit-box-orient: inherit; -webkit-box-pack: inherit; -webkit-box-reflect: inherit; -webkit-line-break: inherit; -webkit-line-clamp: inherit; -webkit-mask-box-image: inherit; -webkit-rtl-ordering: inherit; -webkit-ruby-position: inherit; -webkit-tap-highlight-color: inherit; -webkit-text-combine: inherit; -webkit-text-decorations-in-effect: inherit; -webkit-text-fill-color: inherit; -webkit-text-security: inherit; -webkit-text-stroke: inherit; -webkit-user-drag: inherit; white-space-collapse: inherit; widows: inherit; width: inherit; will-change: inherit; word-break: inherit; word-spacing: inherit; x: inherit; y: inherit; z-index: inherit;"></slot><link href="chrome-extension://oldceeleldhonbafppcapldpdifcinji/content/styles/shadow.css" rel="stylesheet"></template>
<label class="glsr-label" for="glsr_ulwey7za-content">
<span>Avis</span>
</label>
<textarea class="glsr-textarea" id="glsr_ulwey7za-content" name="site-reviews[content]" required="" placeholder="Dites aux gens votre avis" rows="5" data-lt-tmp-id="lt-52371" spellcheck="false" data-gramm="false"></textarea>
<div class="glsr-field-error"></div>
</div>
<div class="glsr-form-message">
</div>
<div data-field="submit-button">
<div class="wp-block-buttons is-layout-flex">
<div class="wp-block-button">
<button type="submit" class="glsr-button wp-block-button__link wp-element-button" aria-busy="false" data-loading="Submitting, please wait...">Soumettre l'avis</button>
</div>
</div>
</div>
</form>
</div></div></div></div>
<div style="margin-top:12px;">
<button class="hp-modal__close button">Fermer</button>
</div>
</div>
<button type="button" data-fancybox-close="" class="fancybox-button fancybox-close-small" title="Close"><svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 24 24"><path d="M13 12l5-5-1-1-5 5-5-5-1 1 5 5-5 5 1 1 5-5 5 5 1-1z"></path></svg></button></div>Thank you again for your help.
when i am on the vendor profile, i can see everything fine. But when i am on someone listing, then i cant see the stars average and if i click on send a review, i have no form. Only the message and the option close the window
error_log('🔵 SNIPPET VENDOR RATING CHARGÉ');
// Vérifier que les dépendances sont présentes
add_action('admin_notices', function() {
// Vérifier HivePress
if (!function_exists('hivepress')) {
echo '<div class="notice notice-error"><p>⚠️ HivePress n\'est pas actif ! Le système d\'avis ne fonctionnera pas.</p></div>';
}
// Vérifier Site Reviews
if (!function_exists('glsr')) {
echo '<div class="notice notice-error"><p>⚠️ Site Reviews n\'est pas actif ! Le système d\'avis ne fonctionnera pas.</p></div>';
}
});
/*
Title: Afficher note Site Reviews + bouton Ajouter un avis (VENDOR - CORRIGÉ)
Description: Les avis sont assignés au VENDOR, pas au listing
*/
// Handler AJAX pour récupérer le VRAI Vendor ID depuis un listing
function cv_get_real_vendor_id_ajax() {
$post_id = isset($_POST['post_id']) ? intval($_POST['post_id']) : 0;
if ($post_id <= 0) {
wp_send_json_error('Invalid post id', 400);
}
$post_type = get_post_type($post_id);
// Si c'est déjà un vendor, on retourne l'ID
if ($post_type === 'hp_vendor') {
wp_send_json_success(['vendor_id' => $post_id]);
}
// Si c'est un listing, on récupère le vendor via post_author
if ($post_type === 'hp_listing') {
$post = get_post($post_id);
if (!$post) {
wp_send_json_error('Post not found', 404);
}
// Chercher le vendor via l'auteur du listing
$user_id = $post->post_author;
// Trouver le vendor associé à cet utilisateur
$vendor = get_posts([
'post_type' => 'hp_vendor',
'author' => $user_id,
'posts_per_page' => 1,
'post_status' => 'publish'
]);
if (!empty($vendor)) {
wp_send_json_success(['vendor_id' => $vendor[0]->ID]);
}
}
wp_send_json_error('Vendor not found', 404);
}
// Enregistrer les hooks AJAX (obligatoire !)
add_action('wp_ajax_get_real_vendor_id', 'cv_get_real_vendor_id_ajax');
add_action('wp_ajax_nopriv_get_real_vendor_id', 'cv_get_real_vendor_id_ajax');
// Handler AJAX pour récupérer le formulaire et la note DU VENDOR
function cv_get_vendor_rating_ajax() {
$vendor_id = isset($_POST['vendor_id']) ? intval($_POST['vendor_id']) : 0;
if ($vendor_id <= 0) {
wp_send_json_error('Invalid vendor id', 400);
}
// Vérifier que c'est bien un vendor
if (get_post_type($vendor_id) !== 'hp_vendor') {
wp_send_json_error('Not a vendor', 400);
}
// Si form_only, renvoyer le formulaire Site Reviews assigné au VENDOR
if (isset($_POST['form_only']) && $_POST['form_only'] === '1') {
$html = do_shortcode('[site_reviews_form assign_to="post_'.$vendor_id.'" assigned_posts="'.$vendor_id.'" hide="title,name,email,terms"]');
wp_send_json_success($html);
}
// Renvoyer la note moyenne assignée au VENDOR
$shortcode = '[site_reviews_summary hide="bars,if-empty,rating" assigned_posts="' . $vendor_id . '"]';
$html = do_shortcode($shortcode);
if (empty(trim(strip_tags($html)))) {
$html = '<div class="hp-vendor-rating"><strong>Évaluations du vendeur :</strong><div>Aucune évaluation pour le moment.</div></div>';
} else {
$html = '<div class="hp-vendor-rating"><strong style="display:block;margin-bottom:6px;">Évaluations du vendeur :</strong>' . $html . '</div>';
}
wp_send_json_success($html);
}
// Enregistrer les hooks AJAX
add_action('wp_ajax_get_vendor_rating', 'cv_get_vendor_rating_ajax');
add_action('wp_ajax_nopriv_get_vendor_rating', 'cv_get_vendor_rating_ajax');
// Test de diagnostic
add_action('wp_ajax_test_ajax_works', function() {
wp_send_json_success('AJAX fonctionne !');
});
add_action('wp_ajax_nopriv_test_ajax_works', function() {
wp_send_json_success('AJAX fonctionne !');
});
error_log('🟢 HOOKS AJAX ENREGISTRÉS');
// Forcer l'assignation correcte lors de la soumission
add_filter('site-reviews/review/build/assigned_posts', function($assigned_posts, $request) {
if (isset($request['assigned_posts']) && !empty($request['assigned_posts'])) {
$vendor_id = intval($request['assigned_posts']);
if ($vendor_id > 0 && get_post_type($vendor_id) === 'hp_vendor') {
return [$vendor_id];
}
}
return $assigned_posts;
}, 10, 2);
// JS inline pour injecter les étoiles et le bouton
add_action('wp_enqueue_scripts', function() {
if (is_admin()) return;
$ajax_url = admin_url('admin-ajax.php');
$script = <<<JS
(function(){
document.addEventListener('DOMContentLoaded', function(){
var postId = 0;
// Méthode 1: Chercher le modal message (ex: message_send_modal_549)
var messageModal = document.querySelector('[id^="message_send_modal_"]');
if (messageModal) {
var modalId = messageModal.getAttribute('id');
var match = modalId.match(/message_send_modal_(\d+)/);
if (match) {
postId = parseInt(match[1], 10);
}
}
// Méthode 2: Si on est sur une page single
if (!postId || postId <= 0) {
var bodyClasses = document.body.className;
if (bodyClasses.indexOf('single-') >= 0) {
postId = parseInt('{$post_id_from_php}', 10);
}
}
if (!postId || postId <= 0) {
console.log('Post ID introuvable');
return;
}
console.log('Post ID trouvé:', postId);
// ÉTAPE 1: Récupérer le VRAI Vendor ID depuis le post ID
var data1 = new FormData();
data1.append('action', 'get_real_vendor_id');
data1.append('post_id', postId);
fetch('{$ajax_url}', { method:'POST', credentials:'same-origin', body:data1 })
.then(resp => resp.json())
.then(json => {
if(!json || !json.success) {
console.log('Erreur récupération vendor ID');
return;
}
var vendorId = json.data.vendor_id;
console.log('Vendor ID récupéré:', vendorId);
// ÉTAPE 2: Fetch des étoiles (note) du VENDOR
var data2 = new FormData();
data2.append('action', 'get_vendor_rating');
data2.append('vendor_id', vendorId);
fetch('{$ajax_url}', { method:'POST', credentials:'same-origin', body:data2 })
.then(resp => resp.json())
.then(json => {
if(!json || !json.success) return;
var html = json.data;
// ========== INJECTION 1: Zone principale ==========
var summary = document.querySelector('.hp-vendor__summary') ||
document.querySelector('.hp-listing__summary') ||
document.querySelector('.hp-vendor') ||
document.querySelector('.hp-listing');
if(summary) {
var wrapper = document.createElement('div');
wrapper.className = 'cv-vendor-rating-wrapper';
wrapper.style.marginTop = '12px';
wrapper.innerHTML = html;
var btn = document.createElement('button');
btn.textContent = 'Ajouter un avis';
btn.className = 'cv-leave-review-button button button-primary alt';
btn.style.display = 'block';
btn.style.marginTop = '8px';
btn.style.backgroundColor = '#ffc107';
btn.style.color = '#fff';
btn.style.border = 'none';
btn.style.padding = '8px 12px';
btn.style.borderRadius = '4px';
btn.style.cursor = 'pointer';
btn.addEventListener('click', function(e){
e.preventDefault();
var inner = document.getElementById('hp_vendor_review_modal_inner');
if(inner && inner.innerHTML.trim().length > 0){
if(window.jQuery && jQuery.fancybox){
jQuery.fancybox.open({ src: '#hp_vendor_review_modal', type: 'inline' });
} else {
document.getElementById('hp_vendor_review_modal').style.display = 'inline-block';
}
return;
}
var formData = new FormData();
formData.append('action', 'get_vendor_rating');
formData.append('vendor_id', vendorId);
formData.append('form_only', '1');
fetch('{$ajax_url}', { method:'POST', credentials:'same-origin', body: formData })
.then(resp => resp.json())
.then(json => {
if(!json || !json.success) return;
inner.innerHTML = json.data;
if(window.jQuery && jQuery.fancybox){
jQuery.fancybox.open({ src: '#hp_vendor_review_modal', type: 'inline' });
} else {
document.getElementById('hp_vendor_review_modal').style.display = 'inline-block';
}
});
});
wrapper.appendChild(btn);
var details = summary.querySelector('.hp-vendor__details--primary') ||
summary.querySelector('.hp-listing__details--primary');
if(details && details.parentNode) {
details.parentNode.insertBefore(wrapper, details.nextSibling);
} else {
summary.appendChild(wrapper);
}
}
// ========== INJECTION 2: Bloc vendeur sidebar ==========
var vendorBlock = document.querySelector('.hp-vendor--view-block');
if (vendorBlock) {
console.log('✅ Bloc vendeur sidebar trouvé');
// Créer le wrapper pour les étoiles
var sidebarWrapper = document.createElement('div');
sidebarWrapper.className = 'cv-vendor-rating-sidebar';
sidebarWrapper.style.marginTop = '1rem';
sidebarWrapper.style.paddingTop = '1rem';
sidebarWrapper.style.borderTop = '1px solid #e0e0e0';
sidebarWrapper.innerHTML = html;
// Chercher où insérer (après le contenu du vendor)
var vendorContent = vendorBlock.querySelector('.hp-vendor__content');
if (vendorContent) {
vendorContent.parentNode.insertBefore(sidebarWrapper, vendorContent.nextSibling);
console.log('✅ Avis injectés dans la sidebar');
} else {
// Fallback: insérer à la fin du bloc
vendorBlock.appendChild(sidebarWrapper);
console.log('✅ Avis injectés en fallback');
}
}
})
.catch(err => console.log('Erreur fetch rating', err));
})
.catch(err => console.log('Erreur fetch vendor ID', err));
});
})();
JS;
// Injecter le Post ID actuel
$post_id_from_php = 0;
if (is_singular()) {
$post_id_from_php = get_the_ID();
}
$script = str_replace('{$post_id_from_php}', $post_id_from_php, $script);
wp_add_inline_script('jquery-core', $script);
});
add_action('wp_footer', function() {
?>
<div id="hp_vendor_review_modal" class="hp-modal fancybox-content" style="display:none;">
<div class="hp-modal__content">
<h3 class="hp-modal__title">Laisser un avis sur ce vendeur</h3>
<div id="hp_vendor_review_modal_inner">
</div>
<div style="margin-top:12px;">
<button class="hp-modal__close button">Fermer</button>
</div>
</div>
</div>
<script>
(function(){
document.addEventListener('click', function(e){
if(e.target.closest('.hp-modal__close')){
var m = document.getElementById('hp_vendor_review_modal');
if(!m) return;
m.style.display = 'none';
}
});
})();
</script>
<style>
/* Masquer le doublon du rating en bas */
.cv-vendor-rating-sidebar {
display: none !important;
}
</style>
<?php
});