← All changes
|
src/Addons/RequestAQuote/Frontend/Adapters/AbstractLayoutAdapter.php
+8
-1
7.1.7
→
8.0.2
View file →
| @@ -65,9 +65,15 @@ | ||
| 65 | 65 | string $style = 'padding: 5px 10px; margin: 0;', |
| 66 | 66 | string $idPrefix = 'tpt-raq-link', |
| 67 | 67 | bool $isHidden = false |
| 68 | 68 | ): string { |
| 69 | - QuoteFormDisplay::addModalToRender( $form, $productId ); | |
| 69 | + // One modal per product family: variations share their parent's modal. Variation tables can be | |
| 70 | + // loaded by AJAX after the page (and its wp_footer) has been rendered, so a modal keyed by the | |
| 71 | + // variation ID would never reach the page. The JS resolves a variation's trigger to the parent | |
| 72 | + // modal and writes the selected variation into the modal's product field. | |
| 73 | + $parentId = QuoteFormDisplay::getModalProductId( $productId ); | |
| 74 | + | |
| 75 | + QuoteFormDisplay::addModalToRender( $form, $parentId ); | |
| 70 | 76 | $autoOpenQty = $form->getAutoOpenQuantity(); |
| 71 | 77 | |
| 72 | 78 | if ( $isHidden ) { |
| 73 | 79 | $style = 'display:none;'; |
| @@ -82,8 +88,9 @@ | ||
| 82 | 88 | return ServiceContainer::getInstance()->getFileManager()->renderTemplate( 'frontend/integrated/quote-button.php', |
| 83 | 89 | array( |
| 84 | 90 | 'form' => $form, |
| 85 | 91 | 'productId' => $productId, |
| 92 | + 'parentId' => $parentId, | |
| 86 | 93 | 'classes' => $classes, |
| 87 | 94 | 'idAttr' => $idAttr, |
| 88 | 95 | 'autoOpenQty' => $autoOpenQty, |
| 89 | 96 | 'style' => $style, |