Skip to content

MailChimp E-commerce Stores integration for your Symfony 2 application

License

Notifications You must be signed in to change notification settings

mascoteroscom/MailChimpEcommerceBundle

Repository files navigation

MailChimpEcommerceBundle

Build Status Scrutinizer Code Quality

About

This bundle integrates MailChimp E-commerce Stores into your Symfony 2 application.

Requirements

This bundle use Guzzle for perform MailChimp requests. You need to add the guzzlehttp/guzzle package to your composer.json file.

$ composer require guzzlehttp/guzzle

Installation

Add the mascoteroscom/mailchimp-ecommerce-bundle package to your require section in the composer.json file.

$ composer require mascoteroscom/mailchimp-ecommerce-bundle

Add the MailChimpEcommerceBundle to your application's kernel:

<?php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Kevin92dev\MailChimpEcommerceBundle\MailChimpEcommerceBundle(),
        // ...
    );
    ...
}

Configuration

Configure the MailChimp E-commerce Stores client(s) in your config.yml:

parameters:
    mc_ecommerce.api_key: <YOUR-API-KEY>
    mc_ecommerce.store_id: 'YOUR-STORE-ID' # It can be any string

Define a new Guzzle client service in your services.yml:

services:
    mailchimp_ecommerce.guzzle_client:
        class: GuzzleHttp\Client

Usage

Example usage for create a product with a single variant:

<?php
$manager = $this->get('mc_ecommerce.product');

// Create variant
$variant = new ProductVariant();
$variant->setId('amazing-blue-jeans-variant');
$variant->setTitle('Amazing blue jeans');
$variant->setUrl('http://www.domain.es/amazing-blue-jeans');
$variant->setPrice(70.5);
$variant->setImageUrl('http://www.domain.es/images/amazing-blue-jeans.jpg');

// Create product
$product = new Product();
$product->setId('amazing-blue-jeans');
$product->setTitle('Amazing blue jeans');
$product->setProductVariants([$variant]);

$manager->create($product);

Example usage for edit a product:

<?php
$manager = $this->get('mc_ecommerce.product');
...
// Set new product price
$product->setPrice(65);

$manager->edit($product);

Example usage for delete a product:

<?php
$manager = $this->get('mc_ecommerce.product');
...
$manager->delete($product);

License

See LICENSE

Releases

No releases published

Packages

No packages published

Languages