21
General discussion / can someone help with a pwa?
« Last post by happymewtwo on April 20, 2024, 03:19:47 PM »Can someone help with the sw.js for a pwa? I created mine and it's not working.
contactEmail: {
required: '<?php echo osc_esc_js(__('Email: this field is required.', 'epsilon')); ?>',
email: '<?php echo osc_esc_js(__('Email: invalid format of email address.', 'epsilon')); ?>'
}
},
ignore: ":disabled",
ignoreTitle: false,
errorLabelContainer: "#error_list",
wrapper: "li",
invalidHandler: function(form, validator) {
$('html,body').animate({ scrollTop: $('body').offset().top}, { duration: 250, easing: 'swing'});
},
submitHandler: function(form){
$('button[type=submit], input[type=submit]').attr('disabled', 'disabled');
form.submit();
}
});
});
// Code to save keyword and id into database
if (Params::existParam('keywordMapping')) {
$keywordMapping = Params::getParam('keywordMapping');
if (!empty($keywordMapping)) {
list($keyword, $catId) = explode(':', $keywordMapping);
ModelEPS::newInstance()->saveCategoryMapping($keyword, $catId);
}
}
</script>
<?php osc_current_web_theme_path('footer.php'); ?>
</body>
</html>
public function saveCategoryMapping($keyword, $catId) {
try {
$existingMapping = $this->dao->select('*')
->from($this->getTable_keyword_category_mapping())
->where('keyword', $keyword)
->get();
if ($existingMapping && $existingMapping->numRows() > 0) {
$data = array(
'category' => $catId
);
$this->dao->where('keyword', $keyword);
$this->dao->update($this->getTable_keyword_category_mapping(), $data);
} else {
$data = array(
'keyword' => $keyword,
'category' => $catId
);
$this->dao->insert($this->getTable_keyword_category_mapping(), $data);
}
} catch (Exception $e) {
throw $e;
}
}