Skip to main content
Server-side mode routes recommendation requests through Magento to ensure personalized pricing, complex business rules, and custom data processing. This advanced implementation guide covers template customization and data extension.

Server-Side Mode Overview

How Server-Side Mode Works

  1. PureClarity provides SKUs - Recommendation algorithm returns product identifiers
  2. Magento processes SKUs - Server loads current product data with customer context
  3. Custom logic applied - Pricing rules, inventory, and business logic processed
  4. Template renders output - Knockout.js template displays final recommendations
  5. HTML delivered to page - Complete recommendation content served

Differences from Client-Side Mode

Template Management:
  • Server-side: Templates managed in Magento theme files
  • Client-side: Templates managed in PureClarity admin
Data Processing:
  • Server-side: Real-time Magento data with customer context
  • Client-side: Static data from pre-generated feeds
Customization:
  • Server-side: Full access to Magento functionality
  • Client-side: Limited to feed data and PureClarity template editor
Changes made in PureClarity Admin’s Template Editor or Recommender Designer will not affect server-side mode displays. All template customization must be done in Magento.

Template Customization

Default Template Location

The product recommender template is located at:

Override Template in Your Theme

To customize the template, copy it to your theme: Target location:
Example file structure:
Never modify the original template in the vendor directory as it will be overwritten during extension updates.

Basic Template Structure

The template uses Knockout.js data binding:

Available Data Fields

Standard product data available in templates:
  • id - Product ID
  • name - Product name
  • price - Formatted price string
  • url - Product page URL
  • image - Product image URL
  • description - Product description
  • sku - Product SKU
Additional fields through customization:
  • Custom attributes
  • Calculated pricing
  • Inventory information
  • Customer-specific data

Custom Data Extension

Extension Point

Extend product data using plugins on the ProductData class: Class: \Pureclarity\Core\Model\Serverside\Response\ProductData
Method: populateProductData() - Adds data to the array sent to Knockout

Implementation Example

1. Create di.xml configuration:
2. Create the plugin class:

Advanced Custom Pricing Example

Advanced Template Customization

Responsive Design Template

Template with Custom Styling

Performance Optimization

Caching Strategies

Batch Processing

Error Handling and Fallbacks

Graceful Degradation

API Integration with Timeouts

Testing Server-Side Implementation

Unit Testing Custom Data

Integration Testing

Configuration and Setup

Development Resources

Troubleshooting

Summary

Server-side mode implementation enables:
  • Custom pricing logic with real-time calculations
  • Template customization through Magento theme system
  • Data extension via plugin system
  • Performance optimization through caching and batch processing
  • Error handling with graceful degradation
Use server-side mode when your requirements exceed the capabilities of client-side recommendations and feed-based data delivery.