Skip to content

Conversation

@CySSoO
Copy link
Contributor

@CySSoO CySSoO commented Oct 23, 2025

Summary

  • load available FAQ entries and product associations in the product extra tab and expose them to the template
  • add an admin UI block to select FAQ tags per product with multilingual labels
  • persist FAQ/product links, validate submissions, clean up on delete, and invalidate relevant caches

Testing

  • php -l everblock.php
  • php -l models/EverblockFaq.php
  • php -l models/EverblockFaqProduct.php

https://chatgpt.com/codex/tasks/task_e_68f9bd1883a8832289837a6cd1d52da1

@CySSoO CySSoO merged commit e721cf9 into master Oct 23, 2025
0 of 6 checks passed
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +64 to +103
<div class="container border rounded p-3 mb-3">
<input type="hidden" name="everblock_faq_form_submitted" value="1">
<div class="row">
<div class="col-lg-12 col-xl-12">
<h3 class="h4">{l s='FAQ associations' mod='everblock'}</h3>
<p class="help-block">{l s='Select the FAQ tags to link to this product. At least one tag is required.' mod='everblock'}</p>
{if $everblock_faqs|@count}
<ul class="list-unstyled">
{foreach from=$everblock_faqs item=faq}
<li class="mb-2">
<div class="checkbox">
<label>
<input type="checkbox" name="everblock_faq_ids[]" value="{$faq.id_everblock_faq|escape:'htmlall':'UTF-8'}"{if in_array($faq.id_everblock_faq, $everblock_selected_faq_ids)} checked="checked"{/if}>
<strong>{$faq.tag_name|escape:'htmlall':'UTF-8'}</strong>
{if !$faq.active}
<span class="label label-warning">{l s='Inactive' mod='everblock'}</span>
{/if}
</label>
</div>
<div class="faq-translations text-muted small">
{foreach from=$ever_languages item=language}
<span class="label label-default">{$language.iso_code|escape:'htmlall':'UTF-8'}</span>
<span class="faq-title">
{if isset($faq.titles[$language.id_lang]) && $faq.titles[$language.id_lang] !== ''}
{$faq.titles[$language.id_lang]|escape:'htmlall':'UTF-8'}
{else}
<em>{l s='No title' mod='everblock'}</em>
{/if}
</span>
{if not $language@last}
<span class="text-muted"> | </span>
{/if}
{/foreach}
</div>
</li>
{/foreach}
</ul>
{else}
<div class="alert alert-info">{l s='No FAQ entries are available for the current shop.' mod='everblock'}</div>
{/if}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Product saves fail when no FAQs exist

The new validation in hookActionAdminProductsControllerSaveBefore() requires at least one FAQ id whenever everblock_faq_form_submitted is present. The template now always sends that hidden field (even when $everblock_faqs is empty), so editing a product in a shop without any FAQ entries will always trigger the hook with an empty selection and add an error, making the product impossible to save. Consider omitting the hidden field when no FAQs are available or skipping the “at least one tag” check when $everblock_faqs is empty.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants