Files
productlinkchecker/README.md
2025-09-26 13:10:13 +03:00

185 lines
8.9 KiB
Markdown

Of course. Here is a comprehensive `README.md` file for your module. It explains the purpose, features, and usage, with a special focus on the intended use case of feeding data into AI models and external tools.
---
# Product Link Checker for PrestaShop
![License: AFL 3.0](https://img.shields.io/badge/License-AFL%203.0-blue.svg)
![PrestaShop Compatibility](https://img.shields.io/badge/PrestaShop-1.7.x%20%7C%208.x-brightgreen)
A PrestaShop module that provides secure, configurable JSON endpoints to export detailed product and category data. It is designed to act as a data bridge between your store and external services, such as SEO audit tools, data analysis platforms, and AI models for large-scale content generation and optimization.
## The Problem It Solves
Managing and optimizing a large e-commerce catalog is a monumental task. Manually checking thousands of product links, meta descriptions, or product identifiers is inefficient and prone to error. This module provides a programmatic way to extract this data, enabling powerful, automated workflows.
**Primary Use Cases:**
* **AI-Powered Content Generation:** Export product data (name, attributes, short description) in JSON format and feed it into AI models like GPT-4 to automatically generate unique, high-quality long descriptions or meta tags at scale.
* **Batch SEO Audits:** Pull a complete list of all product and category URLs, along with their meta titles and descriptions, to quickly identify missing or non-optimized SEO data using external scripts or tools.
* **Data Integrity Checks:** Systematically audit product identifiers (EAN, MPN, UPC, Reference) across the entire catalog, including all combinations, to ensure consistency and accuracy for marketplace feeds.
* **Third-Party Integration:** Provide a live, filterable data feed for external services, custom-built dashboards, or internal stock management tools.
## Key Features
* **Secure JSON Endpoints:** Access is protected by a unique 32-character security token, preventing unauthorized access to your store data.
* **Separate Product & Category Data:** Dedicated controllers for `products` and `categories` provide clean, focused data sets.
* **Interactive URL Builder:** A user-friendly back-office interface allows you to visually build the exact API URL you need without writing any code.
* **Granular Data Selection:** Choose exactly which data fields to include in the JSON output (e.g., name, description, meta tags, identifiers) to keep the payload minimal and efficient.
* **Multi-Store & Multi-Language Support:** Filter data by a specific shop or language, or pull data for all of them at once.
* **Handles Product Combinations:** The product endpoint correctly exports each product attribute combination as a unique item, complete with its own URL, reference, EAN, and other details.
## Installation
1. Download the `productlinkchecker.zip` file.
2. Navigate to your PrestaShop Back Office.
3. Go to **Modules > Module Manager**.
4. Click the **"Upload a module"** button.
5. Drag & drop or select the downloaded ZIP file to install the module.
6. Once installed, click the **"Configure"** button.
## Configuration & Usage
The module's configuration page is an interactive URL generator.
1. **Find Your Security Token:** The first thing you'll see is your unique security token. You will need this for every request.
2. **Select an Endpoint:** Choose between the **Product Links** and **Category Links** tabs.
3. **Apply Filters (Step 1):**
* **Shop:** Select a specific shop or leave as "All Shops".
* **Language:** Select a specific language or leave as "All Languages".
* **Status:** Choose to export only "Active" items or "All" items.
4. **Select Data Fields (Step 2):**
* Check the boxes for each piece of data you want to include in the JSON response (e.g., `name`, `meta_description`, `ean13`).
5. **Get Your URL (Step 3):**
* The **Generated URL** is updated in real-time as you change your selections.
* Use the **Copy** button to copy the URL to your clipboard.
* Use the **Open** button to view the JSON output directly in your browser.
## API Endpoints & Data Structure
### Authentication
All requests must include the security token as a query parameter: `?token=YOUR_SECRET_TOKEN`.
### Base URLs
* **Products:** `https://yourshop.com/module/productlinkchecker/product`
* **Categories:** `https://yourshop.com/module/productlinkchecker/category`
### Available Parameters
| Parameter | Description | Example |
| -------------------------- | --------------------------------------------------------------------------- | ----------------------------- |
| `token` | **(Required)** Your unique security token. | `...&token=a1b2c3d4e5f6...` |
| `plc_id_shop` | Filter by a specific shop ID. If omitted, all shops are included. | `...&plc_id_shop=1` |
| `plc_id_lang` | Filter by a specific language ID. If omitted, all languages are included. | `...&plc_id_lang=2` |
| `plc_only_active` | Set to `1` to only include active products/categories. | `...&plc_only_active=1` |
| `plc_name` | Set to `1` to include the `name` field in the response. | `...&plc_name=1` |
| `plc_link_rewrite` | Set to `1` to include the `link_rewrite` field. | `...&plc_link_rewrite=1` |
| `plc_description` | Set to `1` to include the `description` field. | `...&plc_description=1` |
| `plc_meta_title` | Set to `1` to include the `meta_title` field. | `...&plc_meta_title=1` |
| `plc_meta_description` | Set to `1` to include the `meta_description` field. | `...&plc_meta_description=1` |
| **Product Only Parameters**| | |
| `plc_description_short` | Set to `1` to include the `description_short` field. | `...&plc_description_short=1` |
| `plc_reference` | Set to `1` to include the `reference` (SKU). | `...&plc_reference=1` |
| `plc_ean13` | Set to `1` to include the `ean13` barcode. | `...&plc_ean13=1` |
| `plc_upc` | Set to `1` to include the `upc` barcode. | `...&plc_upc=1` |
| `plc_mpn` | Set to `1` to include the `mpn` (Manufacturer Part Number). | `...&plc_mpn=1` |
| **Category Only Parameters**| | |
|`plc_additional_description`| Set to `1` to include the `additional_description` field. | `...&plc_additional_description=1` |
---
### Sample JSON Output
#### Product with Combinations
**URL:** `.../product?token=...&plc_name=1&plc_reference=1`
```json
{
"1_1": {
"id_lang": 1,
"id_shop": 1,
"id_product": 1,
"id_product_attribute": 1,
"active": true,
"link": "http://yourshop.com/en/men/1-1-hummingbird-printed-t-shirt.html#/1-size-s/8-color-white",
"name": "Hummingbird printed t-shirt",
"reference": "demo_1",
"attributes": [
{
"group_name": "Size",
"attribute_name": "S"
},
{
"group_name": "Color",
"attribute_name": "White"
}
]
},
"1_2": {
"id_lang": 1,
"id_shop": 1,
"id_product": 1,
"id_product_attribute": 2,
"active": true,
"link": "http://yourshop.com/en/men/1-2-hummingbird-printed-t-shirt.html#/2-size-m/8-color-white",
"name": "Hummingbird printed t-shirt",
"reference": "demo_1_m",
"attributes": [
{
"group_name": "Size",
"attribute_name": "M"
},
{
"group_name": "Color",
"attribute_name": "White"
}
]
}
}
```
#### Category
**URL:** `.../category?token=...&plc_name=1&plc_meta_title=1`
```json
[
{
"id_lang": "1",
"id_shop": "1",
"id_category": "3",
"id_parent": "2",
"active": "1",
"name": "Men",
"meta_title": "Men"
},
{
"id_lang": "1",
"id_shop": "1",
"id_category": "4",
"id_parent": "2",
"active": "1",
"name": "Women",
"meta_title": "Women"
}
]
```
## Security
The endpoint is protected by a 32-character security token which is automatically generated upon installation. This token is required for all API requests.
**Important:** Treat this token like a password. Do not share it publicly or commit it to public code repositories. If you believe your token has been compromised, you can uninstall and reinstall the module to generate a new one.
## License
This module is licensed under the [Academic Free License (AFL 3.0)](http://opensource.org/licenses/afl-3.0.php).
## Author
Panariga