aoropeza / customerpartner
Module for managing Customer Partners and specific login flows.
Package info
github.com/adolforopeza/CustomerPartner
Type:magento2-module
pkg:composer/aoropeza/customerpartner
This package is auto-updated.
Last update: 2026-03-19 20:21:46 UTC
README
This module enables the creation of unique Partner URLs that facilitate the automatic assignment of visitors to specific Customer Groups upon registration or login.
Business Context
The core function of this module is to establish a 1:1 mapping between a specific URL and a Magento Customer Group.
Example Scenario:
- Partner A (e.g., eBay): You create a partner entry with URL key
ebaylinked to the "eBay Customers" group.- URL:
http://yourstore.com/partner/ebay - Result: Any user registering or logging in via this URL is assigned to the "eBay Customers" group.
- URL:
- Partner B (e.g., Amazon): You create a partner entry with URL key
amazonlinked to the "Amazon Customers" group.- URL:
http://yourstore.com/partner/amazon - Result: Any user registering or logging in via this URL is assigned to the "Amazon Customers" group.
- URL:
Key Features:
- URL Registration: Administrators can register specific URL keys (e.g.,
ebay,amazon). - Group Assignment:
- New Users: If a visitor registers an account after visiting a partner URL, they are immediately assigned to the linked Customer Group.
- Existing Users: If an existing customer logs in via a partner URL, their account is updated to belong to the linked Customer Group.
- Partner Specificity: Each URL is unique to a specific partner and maps to a unique Customer Group context.
Note: This module handles the assignment logic only. Any specific offers, pricing, or restrictions associated with the Customer Group must be configured separately using standard Magento features (e.g., Cart Price Rules, Catalog Price Rules).
Installation
Composer
To install the module via Composer:
composer require aoropeza/customerpartner bin/magento module:enable Aoropeza_CustomerPartner bin/magento setup:upgrade bin/magento setup:di:compile
Usage
Admin Configuration
- Go to the Magento Admin Panel.
- Navigate to the Aoropeza Customer Partner grid.
- Create New Partner:
- Name: The name of the partner (e.g., "eBay").
- URL Key: The unique URL segment (e.g.,
ebay). - Customer Group: The specific group to assign (e.g., "eBay Customers").
- Is Active: Enable/Disable the link.
Frontend Flow
- A user accesses the partner URL:
http://yourstore.com/partner/{url_key}. - The module sets a tracking cookie for that specific partner.
- Registration: When the user creates an account, the system reads the cookie and assigns the new account to the partner's Customer Group.
- Login: If a user logs in, the system reads the cookie and updates their existing account to the partner's Customer Group.
API Reference
The module exposes standard REST endpoints for managing Customer Partner entities.
Base URL
/rest/V1/aoropeza-customerpartner/customer_partner
Endpoints
1. Create Customer Partner
POST /rest/V1/aoropeza-customerpartner/customer_partner
Request Payload
{
"customerPartner": {
"name": "Summer VIP",
"url_key": "summer-vip",
"customer_group_id": 4,
"is_active": 1,
"description": "Exclusive access for summer partners"
}
}
Response Example
{
"entity_id": 15,
"name": "Summer VIP",
"url_key": "summer-vip",
"customer_group_id": 4,
"is_active": 1,
"description": "Exclusive access for summer partners",
"created": "2026-01-12 10:00:00",
"updated": "2026-01-12 10:00:00"
}
2. Update Customer Partner
PUT /rest/V1/aoropeza-customerpartner/customer_partner/{id}
Request Payload
{
"customerPartner": {
"name": "Summer VIP Updated",
"is_active": 0
}
}
Response Example
{
"entity_id": 15,
"name": "Summer VIP Updated",
"url_key": "summer-vip",
"customer_group_id": 4,
"is_active": 0,
"description": "Exclusive access for summer partners",
"created": "2026-01-12 10:00:00",
"updated": "2026-01-12 12:30:00"
}
3. Get Customer Partner Details
GET /rest/V1/aoropeza-customerpartner/customer_partner/{id}
Request Payload
None
Response Example
{
"entity_id": 15,
"name": "Summer VIP Updated",
"url_key": "summer-vip",
"customer_group_id": 4,
"is_active": 0,
"description": "Exclusive access for summer partners",
"created": "2026-01-12 10:00:00",
"updated": "2026-01-12 12:30:00"
}
4. Search/List Customer Partners
GET /rest/V1/aoropeza-customerpartner/customer_partner/search
Request Payload
Parameters passed via query string (SearchCriteria).
Example: ?searchCriteria[filter_groups][0][filters][0][field]=is_active&searchCriteria[filter_groups][0][filters][0][value]=1
Response Example
{
"items": [
{
"entity_id": 15,
"name": "Summer VIP",
"url_key": "summer-vip",
"customer_group_id": 4,
"is_active": 1,
"description": "Exclusive access for summer partners",
"created": "2026-01-12 10:00:00",
"updated": "2026-01-12 10:00:00"
}
],
"search_criteria": {
"filter_groups": [
{
"filters": [
{
"field": "is_active",
"value": "1",
"condition_type": "eq"
}
]
}
]
},
"total_count": 1
}
5. Delete Customer Partner
DELETE /rest/V1/aoropeza-customerpartner/customer_partner/{id}
Request Payload
None
Response Example
true