-
Notifications
You must be signed in to change notification settings - Fork 14
Add product FAQ association management #598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add product FAQ association management #598
Conversation
There was a problem hiding this 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".
| <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} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68f9bd1883a8832289837a6cd1d52da1