added CSV export
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{* views/templates/admin/configure.tpl *}
|
||||
<div class="panel">
|
||||
|
||||
<div class="panel-heading">
|
||||
<i class="icon-link"></i> {l s='Product Link Checker Configuration' mod='productlinkchecker'}
|
||||
</div>
|
||||
@@ -62,6 +63,20 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* --- NEW FORMAT SELECTOR --- *}
|
||||
<div class="form-group">
|
||||
<label class="col-lg-3 control-label">{l s='Output Format' mod='productlinkchecker'}</label>
|
||||
<div class="col-lg-9">
|
||||
<span class="switch prestashop-switch fixed-width-lg">
|
||||
<input type="radio" name="format" id="format_prod_json" value="json" class="plc-builder-input" data-type="product" checked="checked">
|
||||
<label for="format_prod_json">JSON</label>
|
||||
<input type="radio" name="format" id="format_prod_csv" value="csv" class="plc-builder-input" data-type="product">
|
||||
<label for="format_prod_csv">CSV</label>
|
||||
<a class="slide-button btn"></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h4>{l s='2. Select Data Fields to Include' mod='productlinkchecker'}</h4>
|
||||
<div class="form-group">
|
||||
@@ -135,9 +150,23 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* --- NEW FORMAT SELECTOR --- *}
|
||||
<div class="form-group">
|
||||
<label class="col-lg-3 control-label">{l s='Output Format' mod='productlinkchecker'}</label>
|
||||
<div class="col-lg-9">
|
||||
<span class="switch prestashop-switch fixed-width-lg">
|
||||
<input type="radio" name="format" id="format_cat_json" value="json" class="plc-builder-input" data-type="category" checked="checked">
|
||||
<label for="format_cat_json">JSON</label>
|
||||
<input type="radio" name="format" id="format_cat_csv" value="csv" class="plc-builder-input" data-type="category">
|
||||
<label for="format_cat_csv">CSV</label>
|
||||
<a class="slide-button btn"></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h4>{l s='2. Select Data Fields to Include' mod='productlinkchecker'}</h4>
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<div class="col-lg-9 col-lg-offset-3">
|
||||
{foreach from=$category_fields key=key item=label}
|
||||
<div class="checkbox">
|
||||
@@ -174,14 +203,12 @@
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Base URLs and token from Smarty
|
||||
const baseUrls = {
|
||||
product: '{$product_controller_url|escape:'javascript':'UTF-8'}',
|
||||
category: '{$category_controller_url|escape:'javascript':'UTF-8'}'
|
||||
};
|
||||
const token = '{$security_token|escape:'javascript':'UTF-8'}';
|
||||
|
||||
// Function to build the URL based on selected options
|
||||
const buildUrl = (type) => {
|
||||
let baseUrl = baseUrls[type];
|
||||
let params = new URLSearchParams();
|
||||
@@ -195,7 +222,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
if (input.checked && input.value) {
|
||||
params.append(input.name, input.value);
|
||||
}
|
||||
} else { // select
|
||||
} else {
|
||||
if (input.value) {
|
||||
params.append(input.name, input.value);
|
||||
}
|
||||
@@ -208,24 +235,20 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
document.getElementById('open-url-' + type).href = finalUrl;
|
||||
};
|
||||
|
||||
// Attach event listeners to all inputs
|
||||
document.querySelectorAll('.plc-builder-input').forEach(input => {
|
||||
input.addEventListener('change', (event) => {
|
||||
buildUrl(event.target.dataset.type);
|
||||
});
|
||||
});
|
||||
|
||||
// Initial build for both tabs on page load
|
||||
buildUrl('product');
|
||||
buildUrl('category');
|
||||
});
|
||||
|
||||
// Simple copy to clipboard function
|
||||
function copyToClipboard(type) {
|
||||
const urlInput = document.getElementById('generated-url-' + type);
|
||||
urlInput.select();
|
||||
document.execCommand('copy');
|
||||
// Optional: show a small feedback message
|
||||
showSuccessMessage('{l s="URL copied to clipboard!" mod='productlinkchecker' js=1}');
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user