setono/sylius-conversion-attribution-plugin

Setono example plugin for Sylius.

Fund package maintenance!
Setono

Installs: 2 703

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:sylius-plugin

v1.0.0-beta.3 2024-04-25 06:54 UTC

This package is auto-updated.

Last update: 2024-11-25 08:41:19 UTC


README

Latest Version Software License Build Status Code Coverage Mutation testing

See where customers are coming from by attributing conversions directly in your Sylius store

Installation

Download plugin

composer require setono/sylius-conversion-attribution-plugin

Notice that this also installs the setono/client-bundle which is required by this plugin to work properly.

If you want to use the default javascript injection, you should also install the setono/tag-bag-bundle.

See the installation instructions for the setono/tag-bag-bundle here.

Import routes

# config/routes/setono_sylius_conversion_attribution.yaml

setono_sylius_conversion_attribution:
    resource: "@SetonoSyliusConversionAttributionPlugin/Resources/config/routes.yaml"

Extend Customer and Order entities

<?php

declare(strict_types=1);

namespace App\Entity\Customer;

use Doctrine\ORM\Mapping as ORM;
use Setono\SyliusConversionAttributionPlugin\Model\CustomerInterface;
use Setono\SyliusConversionAttributionPlugin\Model\CustomerTrait;
use Sylius\Component\Core\Model\Customer as BaseCustomer;

/**
 * @ORM\Entity
 *
 * @ORM\Table(name="sylius_customer")
 */
class Customer extends BaseCustomer implements CustomerInterface
{
    use CustomerTrait;
}
<?php

declare(strict_types=1);

namespace App\Entity\Order;

use Doctrine\ORM\Mapping as ORM;
use Setono\SyliusConversionAttributionPlugin\Model\OrderInterface;
use Setono\SyliusConversionAttributionPlugin\Model\OrderTrait;
use Sylius\Component\Core\Model\Order as BaseOrder;

/**
 * @ORM\Entity
 *
 * @ORM\Table(name="sylius_order")
 */
class Order extends BaseOrder implements OrderInterface
{
    use OrderTrait;
}

Migrate your database

php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate