# Partner Pages (Archived Full Guidance)

This archive preserves the previously embedded long-form guidance from `.cursor/rules/partner-pages.mdc`.

# Partner Pages Patterns

# Partner Pages (Pointer Rule)

## Critical Guardrails

1. Use centralized partner config/helpers; do not hardcode partner maps in page files.
2. Keep partner slug → HubSpot value mapping deterministic and logged.
3. Validate partner attribution end-to-end after partner config changes.

## Canonical References

- `docs/systems/partner-pages/PARTNER_PAGES_GUIDE.md`
- `docs/ai/RULE_TO_DOC_MAPPING.md`

Keep detailed implementation examples in the canonical partner guide, not in this rule.
    "value" => $partner  // Use mapped value, not slug
]
```

### HubSpot Field

Partner data stored in `partner__c` custom field for attribution and reporting.

**Important Notes:**

- `partner__c` is an enumeration (dropdown) with specific accepted values
- Partner slugs (e.g., `gastroberatung`) must be mapped to HubSpot values (e.g., `Gastro Beratung`)
- Values are case-sensitive and must match exactly
- See `docs/systems/partner-pages/HUBSPOT_INTEGRATION.md` for complete integration guide

## Testing Checklist

Before deploying partner changes:

- [ ] Run validation script: `php v2/scripts/dev-helpers/test-partner-pages.php`
- [ ] Test partner URL on all landing page versions
- [ ] Verify logo displays correctly
- [ ] Test form submission includes partner parameter
- [ ] Verify partner slug is mapped to HubSpot value (check logs)
- [ ] Verify HubSpot receives `partner__c` field with correct value (not slug)
- [ ] Run partner attribution test: `php v2/scripts/hubspot/test-partner-attribution.php partner-slug`
- [ ] Test special pricing (if applicable)
- [ ] Verify responsive logo display (mobile/desktop)

## Common Pitfalls

### ❌ Pitfall 1: Hardcoding Partner Data

```php
// WRONG: Creates duplication
$partnerlogo = match ($partner) {
    'kassenprofis' => ['/html/images/partner/kassenprofis.png', 'w-48'],
    // ...
};
```

**Fix:** Use centralized config

```php
// CORRECT
require_once __DIR__ . '/../config/partner-config.php';
$partnerlogo = getPartnerLogo($partner);
```

### ❌ Pitfall 2: Inconsistent Partner Lists

**Problem:** Different landing pages have different partners

**Fix:** All pages use centralized config - automatically consistent

### ❌ Pitfall 3: Missing Logo Assets

**Problem:** Partner configured but logo file doesn't exist

**Fix:**

1. Add logo to `/v2/img/partner/partner-slug.webp`
2. Run validation script to verify
3. Test logo display

### ❌ Pitfall 4: Wrong Logo Path

**Problem:** Logo path doesn't match actual file location

**Fix:**

- Use relative paths from web root (e.g., `/v2/img/partner/logo.webp`)
- Verify file exists at specified path
- Check file permissions

## Files That Use Partner System

**Landing Pages:**

- `v2/pages/landingpage.php`
- `v2/pages/landingpage_v2-alt.php`
- `v2/pages/landingpage_v3.php`
- `v2/pages/landingpage_v4.php`
- `v2/pages/kostenlos-testen.php`
- `v2/pages/kostenlos_testen_neu.php`

**URL Generator:**

- `v2/pages/landingpageurlgenerator.php`

**Configuration:**

- `v2/config/partner-config.php`

**Validation:**

- `v2/scripts/dev-helpers/test-partner-pages.php`

## Related Documentation

- `docs/systems/partner-pages/PARTNER_PAGES_GUIDE.md` - Complete system guide
- `docs/systems/partner-pages/HUBSPOT_INTEGRATION.md` - HubSpot integration and value mapping
- `docs/development/ATTRIBUTION_DEBUGGING_GUIDE.md` - Partner attribution troubleshooting
- `.cursor/rules/global.mdc` - Universal patterns and best practices

## Quick Reference

**Get partner logo:**

```php
$partnerlogo = getPartnerLogo($partner); // Returns [path, class]
```

**Check if valid partner:**

```php
if (isValidPartner($partner)) { /* ... */ }
```

**Get special pricing:**

```php
$pricing = getPartnerSpecialPricing($partner); // Returns code or null
```

**Get all partners:**

```php
$partners = getAllPartners(); // Returns all configs
```
