fixed prestashop.on('updatedProduct') listener

This commit is contained in:
2025-04-28 14:55:41 +03:00
parent 64f50a5a59
commit 3bc20eafd7

View File

@@ -22,13 +22,17 @@
<script> <script>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
prestashop.on('updatedProduct', function(updatedData) {
applyPriceVisibility(priceToggleSelect.value);
});
const priceToggleSelect = document.getElementById('priceDisplayToggle'); const priceToggleSelect = document.getElementById('priceDisplayToggle');
const storageKey = 'priceDisplayPreference'; // Key for localStorage const storageKey = 'priceDisplayPreference'; // Key for localStorage
// Function to apply visibility based on preference // Function to apply visibility based on preference
function applyPriceVisibility(preference) { function applyPriceVisibility(preference) {
const vpcElements = document.querySelectorAll('.vpcrender'); const vpcElements = document.querySelectorAll('.vpcrender');
const mpcElements = document.querySelectorAll('.mpcrender'); const mpcElements = document.querySelectorAll('.mpcrender');
console.log('Applying preference:', preference); // For debugging console.log('Applying preference:', preference); // For debugging
console.log('Found VPC elements:', vpcElements.length); // For debugging console.log('Found VPC elements:', vpcElements.length); // For debugging