Important
You are browsing documentation for version 5.0 of OroCommerce, supported until January 2025. Read the documentation for version 6.0 (the latest LTS version) to get up-to-date information.
See our Release Process documentation for more information on the currently supported and upcoming releases.
OroSalesBundle
OroSalesBundle adds sales leads, sales opportunities, and sales funnel entities to enable sales representative activities in Oro applications.
The bundle provides UI to manage these records and allows back-office administrators to enable and disable the functionality in the system configuration UI.
Note
You can find sales-related user documentation in the Manage Sales in the Back-Office and Workflows documentation.
Sales Customer Relations
Sales Entities Account Associations
You can associate the sales lead and opportunity entities with a customer entity. This option enables you to configure this relation and display a particular form type to choose or create a customer from any allowed types of customers in the application. You can define the icon image, choose a grid and create a form route data. Customer information will be displayed on the opportunity, lead view, and entity edit pages.
Migration Extension
To enable the association, create a migration and add a relation to the opportunity and the lead. Use migration extension CustomerExtension.
Migration example:
class YourMigration implements Migration, CustomerExtensionAwareInterface
{
use CustomerExtensionTrait;
/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
$this->customerExtension->addCustomerAssociation($schema, 'target_customer_table');
}
}
Icon Provider
You can define the icon image for your associated customer entity. This image appears on the list of customers in the form type component.
To define this icon, create a class that implements CustomerIconProviderInterface
and register the class as a service with
tag oro_sales.customer_icon
.
Example:
class CustomerIconProvider implements CustomerIconProviderInterface
{
const CUSTOMER_ICON_FILE = 'bundles/yourbundlename/img/customer-logo.png';
/**
* {@inheritdoc}
*/
public function getIcon($entity)
{
if (!$entity instanceof Customer) {
return null;
}
return new Image(Image::TYPE_FILE_PATH, ['path' => '/' . self::CUSTOMER_ICON_FILE]);
}
}
service.yml file:
oro_sales.provider.customer.customer_icon:
class: Oro\Bundle\YourBundle\Provider\Customer\CustomerIconProvider
tags:
- { name: oro_sales.customer_icon }
Entity Configuration
For the correct work of the customer integration function, configure an option for the customer entity.
First, add the default grid configuration.
If you want to create an option to enable for type component, add the routeCreate
option to the config.
Example:
/**
* @ORM\Entity()
* @ORM\Table(name="your_customer")
*
* @Config(
* routeCreate="your_customer_entity_create",
* defaultValues={
* "grid"={
* "default"="your-customer-select-grid"
* },
...
* }
* )
*/
class Customer extends ExtendCustomer
...