-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
product page jquery removed, minor refacto
- Loading branch information
Showing
7 changed files
with
82 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,8 @@ | ||
import ProductGallery from '@js/product/components/ProductGallery'; | ||
import ProductGallery from './components/ProductGallery'; | ||
import DOMReady from "../theme/utils/DOMReady"; | ||
Check failure on line 2 in _dev/js/product/index.js GitHub Actions / Code quality - ESLint
|
||
|
||
function activateFirstProductTab() { | ||
$('.product-tabs .nav .nav-item:first-child a').tab('show'); | ||
} | ||
|
||
function handleProductDetailsToggle() { | ||
const $link = $('[href="#product-details"]'); | ||
const $tab = $($link.attr('href')); | ||
|
||
if ($tab.length && $link.length && $link.hasClass('active')) { | ||
$tab.addClass('show active'); | ||
} | ||
} | ||
|
||
$(() => { | ||
activateFirstProductTab(); | ||
DOMReady(() => { | ||
const gallery = new ProductGallery(); | ||
|
||
gallery.init(); | ||
|
||
prestashop.on('updatedProductCombination', (event) => { | ||
gallery.init(); | ||
|
||
const { product_add_to_cart: productAddToCart } = event; | ||
|
||
if (productAddToCart) { | ||
const node = document.createElement('div'); | ||
node.innerHTML = productAddToCart; | ||
|
||
const html = node.querySelector('.js-product-actions-buttons'); | ||
|
||
if (html) { | ||
const productActionsElement = document.querySelector('.js-product-actions-buttons'); | ||
|
||
productActionsElement.replaceWith(html); | ||
} | ||
} | ||
}); | ||
|
||
prestashop.on('updatedProduct', () => { | ||
handleProductDetailsToggle(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
<section class="product-attachments"> | ||
<p class="h5 text-uppercase">{l s='Download' d='Shop.Theme.Actions'}</p> | ||
{foreach from=$product.attachments item=attachment} | ||
<div class="attachment"> | ||
<h4><a href="{url entity='attachment' params=['id_attachment' => $attachment.id_attachment]}">{$attachment.name}</a></h4> | ||
<p>{$attachment.description}</p> | ||
<a href="{url entity='attachment' params=['id_attachment' => $attachment.id_attachment]}"> | ||
{l s='Download' d='Shop.Theme.Actions'} ({$attachment.file_size_formatted}) | ||
</a> | ||
</div> | ||
{/foreach} | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
{cms_images_block webpEnabled=$webpEnabled} | ||
<div class="product-description cms-content">{$product.description nofilter}</div> | ||
{/cms_images_block} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters