102 lines
3.2 KiB
PHP
102 lines
3.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Product Link Checker
|
|
*
|
|
* @author Panariga
|
|
* @copyright 2025 Panariga
|
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
|
*/
|
|
|
|
if (!defined('_PS_VERSION_')) {
|
|
exit;
|
|
}
|
|
|
|
class ProductLinkChecker extends Module
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this->name = 'productlinkchecker';
|
|
$this->tab = 'seo';
|
|
$this->version = '2.0.0';
|
|
$this->author = 'Panariga';
|
|
$this->need_instance = 0;
|
|
$this->ps_versions_compliancy = ['min' => '1.7.0', 'max' => _PS_VERSION_];
|
|
$this->bootstrap = true;
|
|
|
|
parent::__construct();
|
|
|
|
$this->displayName = $this->l('Product Link Checker');
|
|
$this->description = $this->l('Generates a JSON list of all product links for testing purposes.');
|
|
|
|
$this->confirmUninstall = $this->l('Are you sure you want to uninstall this module?');
|
|
}
|
|
|
|
/**
|
|
* Installation of the module.
|
|
*/
|
|
public function install()
|
|
{
|
|
if (!parent::install()) {
|
|
return false;
|
|
}
|
|
|
|
// Generate and save a unique security token
|
|
$token = Tools::passwdGen(32);
|
|
Configuration::updateValue('PLC_SECURITY_TOKEN', $token);
|
|
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Uninstallation of the module.
|
|
*/
|
|
public function uninstall()
|
|
{
|
|
Configuration::deleteByName('PLC_SECURITY_TOKEN');
|
|
|
|
return parent::uninstall();
|
|
}
|
|
|
|
/**
|
|
* Module configuration page.
|
|
*/
|
|
public function getContent()
|
|
{
|
|
// Define the available data fields for each controller based on your code
|
|
$product_fields = [
|
|
'plc_name' => $this->l('Name'),
|
|
'plc_link_rewrite' => $this->l('Link Rewrite'),
|
|
'plc_description' => $this->l('Description'),
|
|
'plc_description_short' => $this->l('Short Description'),
|
|
'plc_meta_title' => $this->l('Meta Title'),
|
|
'plc_meta_description' => $this->l('Meta Description'),
|
|
'plc_reference' => $this->l('Reference'),
|
|
'plc_ean13' => $this->l('EAN13'),
|
|
'plc_upc' => $this->l('UPC'),
|
|
'plc_mpn' => $this->l('MPN'),
|
|
];
|
|
|
|
$category_fields = [
|
|
'plc_name' => $this->l('Name'),
|
|
'plc_link_rewrite' => $this->l('Link Rewrite'),
|
|
'plc_description' => $this->l('Description'),
|
|
'plc_additional_description' => $this->l('Additional Description'),
|
|
'plc_meta_title' => $this->l('Meta Title'),
|
|
'plc_meta_description' => $this->l('Meta Description'),
|
|
];
|
|
|
|
$this->context->smarty->assign([
|
|
'security_token' => Configuration::get('PLC_SECURITY_TOKEN'),
|
|
'shops' => Shop::getShops(true, null, true),
|
|
'languages' => Language::getLanguages(true),
|
|
'product_controller_url' => $this->context->link->getModuleLink($this->name, 'product', [], true),
|
|
'category_controller_url' => $this->context->link->getModuleLink($this->name, 'category', [], true),
|
|
'product_fields' => $product_fields,
|
|
'category_fields' => $category_fields,
|
|
]);
|
|
|
|
return $this->display(__FILE__, 'views/templates/admin/configure.tpl');
|
|
}
|
|
}
|