feat(main): Add base theme: This is the falcon theme out of the box.
This is falcon v3.1.2
This commit is contained in:
45
_dev/js/product/index.js
Normal file
45
_dev/js/product/index.js
Normal file
@ -0,0 +1,45 @@
|
||||
import $ from 'jquery';
|
||||
import ProductGallery from '@js/product/components/ProductGallery';
|
||||
|
||||
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();
|
||||
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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user