PHPackages                             pricemind/magento-connector - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. pricemind/magento-connector

ActiveMagento2-module[API Development](/categories/api)

pricemind/magento-connector
===========================

Tracks Magento price changes and sends them asynchronously to an external API.

1.0.3(8mo ago)1171MITPHPPHP &gt;=7.4CI passing

Since Aug 29Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/pricemind/magento-connector)[ Packagist](https://packagist.org/packages/pricemind/magento-connector)[ RSS](/packages/pricemind-magento-connector/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (8)Versions (4)Used By (0)

Pricemind Magento Module
========================

[](#pricemind-magento-module)

A Magento 2 module that automatically tracks product price changes and synchronizes them with the Pricemind API for competitive price monitoring and analysis.

Features
--------

[](#features)

- **Real-time Price Tracking**: Automatically detects and sends product price changes to Pricemind
- **Special Price Support**: Tracks special prices and their date ranges
- **Custom Fields Integration**: Syncs special price start/end dates as custom fields
- **Multi-store Support**: Website-level configuration for different stores
- **Error Handling**: Failed API requests are logged and stored for retry
- **Non-blocking**: Uses short timeouts to avoid disrupting store operations
- **Secure Configuration**: API keys are encrypted in the database

Requirements
------------

[](#requirements)

- Magento 2.3+
- PHP 7.4+
- Active Pricemind account with API access

Installation
------------

[](#installation)

### Via Composer (Recommended)

[](#via-composer-recommended)

```
composer require pricemind/magento-connector
php bin/magento module:enable Stellion_Pricemind
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush
```

### Manual Installation

[](#manual-installation)

1. Download the module files
2. Extract to `app/code/Stellion/Pricemind/`
3. Run the following commands:

```
php bin/magento module:enable Stellion_Pricemind
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush
```

Configuration
-------------

[](#configuration)

### Admin Configuration

[](#admin-configuration)

1. Navigate to **Stores → Configuration → Pricemind → API**
2. Configure the following settings:

#### API Settings

[](#api-settings)

- **Base URL**: Pricemind API endpoint (default: `https://api.pricemind.io/`)
- **API Access Key**: Your Pricemind API key in format `..`
- **Channel**: Select your Pricemind channel (populated after saving API key)

#### Source Detection

[](#source-detection)

The module automatically detects and displays:

- **Detected Source is Magento**: Shows if the channel source is identified as Magento
- **Source Type**: The detected source type
- **Source Title**: The source title from Pricemind

### Multi-store Configuration

[](#multi-store-configuration)

The module supports website-level configuration:

1. Set **Configuration Scope** to your desired website
2. Configure API settings for each website independently
3. Each website can use different Pricemind channels

How It Works
------------

[](#how-it-works)

### Price Change Detection

[](#price-change-detection)

The module listens for the `catalog_product_save_commit_after` event and detects changes in:

- **Regular Price** (`price`)
- **Special Price** (`special_price`)
- **Special Price From Date** (`special_from_date`)
- **Special Price To Date** (`special_to_date`)

### API Integration

[](#api-integration)

When a price change is detected, the module:

1. **Sends Price Data** to `POST /v1/channels/{channelId}/prices`:

    ```
    {
      "product_sku": "V92516",
      "price": "100.00",
      "currency": "USD",
      "special_price": "90.00",
      "includes_tax": true
    }
    ```
2. **Sends Special Price Dates** to `PUT /v1/custom-fields`:

    ```
    {
      "channel_id": 123,
      "machine_name": "special_price_start_date",
      "product_sku": "V92516",
      "value": "2024-01-01"
    }
    ```

### Custom Fields Mapping

[](#custom-fields-mapping)

Special price date ranges are mapped to custom fields:

- `special_from_date` → `special_price_start_date`
- `special_to_date` → `special_price_end_date`

### Error Handling

[](#error-handling)

Failed API requests are stored in the `stellion_pricemind_failed_request` table with:

- Request details (endpoint, method, headers, payload)
- Error message and status
- Retry count and next attempt timestamp
- Created/updated timestamps

Database Schema
---------------

[](#database-schema)

The module creates one table:

### `stellion_pricemind_failed_request`

[](#stellion_pricemind_failed_request)

Stores failed API requests for potential retry processing:

ColumnTypeDescription`entity_id`INTPrimary key`endpoint`VARCHAR(255)Target API endpoint`method`VARCHAR(16)HTTP method`headers`TEXTRequest headers (JSON)`payload`TEXTRequest payload (JSON)`error`TEXTLast error message`retry_count`INTNumber of retry attempts`status`SMALLINTStatus (0=pending, 1=retrying, 2=abandoned, 3=sent)`next_attempt_at`TIMESTAMPNext retry timestamp`created_at`TIMESTAMPCreated timestamp`updated_at`TIMESTAMPUpdated timestampAPI Endpoints Used
------------------

[](#api-endpoints-used)

The module integrates with these Pricemind API endpoints:

- `GET /v1/channels` - Fetch available channels
- `GET /v1/channels/{id}/sources/active` - Get active channel source
- `GET /v1/channels/{id}/product-domain?sku={sku}` - Lookup product domain
- `POST /v1/channels/{id}/prices` - Create/update price
- `PUT /v1/custom-fields` - Update custom field values

Security
--------

[](#security)

- **API Key Encryption**: API keys are encrypted using Magento's encryption service
- **Masked Logging**: API keys are masked in error logs as `***`
- **Short Timeouts**: 1-2 second timeouts prevent long-running requests
- **ACL Permissions**: Admin configuration requires `Stellion_Pricemind::config` permission

Performance Considerations
--------------------------

[](#performance-considerations)

- **Non-blocking**: Short timeouts (1s connect, 2s total) prevent blocking store operations
- **Async Processing**: Price updates are sent asynchronously during product saves
- **Error Tolerance**: Failed requests don't disrupt normal store functionality
- **Selective Updates**: Only sends data when prices actually change

Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

1. **No price updates sent**:

    - Verify API key is configured and valid
    - Check channel ID is selected
    - Ensure product prices are actually changing
2. **API connection errors**:

    - Verify Base URL is correct
    - Check firewall/network connectivity
    - Review error logs in `var/log/system.log`
3. **Channel not loading**:

    - Save API key configuration first
    - Check API key format: `..`
    - Verify API key has channel access

### Logging

[](#logging)

The module logs events with the prefix `[Stellion_Pricemind]`:

- **Warnings**: Non-2xx API responses, send failures
- **Errors**: API key decryption failures, channel fetch errors

Check logs in:

- `var/log/system.log`
- `var/log/exception.log`

### Failed Requests

[](#failed-requests)

Monitor failed requests in the database:

```
SELECT * FROM stellion_pricemind_failed_request
WHERE status = 0
ORDER BY created_at DESC;
```

Development
-----------

[](#development)

### Module Structure

[](#module-structure)

```
app/code/Stellion/Pricemind/
├── Block/Adminhtml/System/Config/Form/Field/
│   └── Channel.php              # Channel selection field
├── Model/
│   ├── Api/Client.php           # Pricemind API client
│   ├── Config/
│   │   ├── Backend/Channel.php  # Channel config backend
│   │   └── Source/Channels.php  # Channel options source
│   ├── FailedRequest.php        # Failed request model
│   ├── ResourceModel/           # Database resources
│   └── Sender.php               # HTTP request sender
├── Observer/
│   └── ProductPriceChangeObserver.php  # Main price change handler
├── etc/
│   ├── acl.xml                  # Admin permissions
│   ├── adminhtml/system.xml     # Admin configuration
│   ├── config.xml               # Default configuration
│   ├── db_schema.xml            # Database schema
│   ├── events.xml               # Event observers
│   └── module.xml               # Module declaration
└── registration.php             # Module registration

```

### Extending the Module

[](#extending-the-module)

To extend functionality:

1. **Add Custom Fields**: Modify the observer to send additional product attributes
2. **Retry Logic**: Implement cron job to retry failed requests
3. **Bulk Updates**: Add CLI command for bulk price synchronization
4. **Webhooks**: Add webhook endpoint for bidirectional sync

Support
-------

[](#support)

For technical support or feature requests:

- Create an issue in the project repository
- Contact Pricemind support team
- Review the [Pricemind API documentation](https://api.pricemind.io/docs)

License
-------

[](#license)

This module is released under the MIT License. See LICENSE file for details.

Changelog
---------

[](#changelog)

### Version 1.0.0

[](#version-100)

- Initial release
- Real-time price change tracking
- Special price and date range support
- Multi-store configuration
- Error handling and logging
- Failed request storage

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance60

Regular maintenance activity

Popularity15

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

3

Last Release

250d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dd9812fc1e73e6abab81c545077695802ae2579f2320084a92074f1cf23d02c2?d=identicon)[lsimeonov](/maintainers/lsimeonov)

---

Tags

magento2api integrationpricemindprice-tracking

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pricemind-magento-connector/health.svg)

```
[![Health](https://phpackages.com/badges/pricemind-magento-connector/health.svg)](https://phpackages.com/packages/pricemind-magento-connector)
```

###  Alternatives

[smile/elasticsuite

Magento 2 merchandising and search engine built on ElasticSearch

8044.5M33](/packages/smile-elasticsuite)[mollie/magento2

Mollie Payment Module for Magento 2

1121.6M10](/packages/mollie-magento2)[dotdigital/dotdigital-magento2-extension

Dotdigital for Magento 2

50374.2k18](/packages/dotdigital-dotdigital-magento2-extension)[lizardmedia/module-varnish-warmer

Varnish Cache Warmer Magento2 module by Lizard Media

6276.8k](/packages/lizardmedia-module-varnish-warmer)[opengento/module-category-import-export

This module add the capability to import and export the categories from the back-office.

119.1k](/packages/opengento-module-category-import-export)[mage-os/module-inventory-reservations-grid

Add a grid with the list of inventory reservations.

126.8k](/packages/mage-os-module-inventory-reservations-grid)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
