Install OroCommerce Application Clone and install the full OroCommerce application from orocommerce-application (this package is a dependency, not standalone).
git clone https://github.com/orocrm/orocommerce-application.git
cd orocommerce-application
composer install
php bin/console oro:install
First Use Case: Basic Product Management
/app_dev.php/admin) and navigate to Products > Products.Key Entry Points
OroCommerce\Bundle\ProductBundle\Entity/Product (core product model).oro_product.product_manager (for programmatic product operations).oro:product:import (for bulk imports via CSV/Excel).oro_api) to expose products via /api/products.Extend Product Attributes: Add custom fields via Doctrine extensions or Oro’s Attribute system.
# config/oro/product.yml
oro_product:
product_attributes:
custom_field:
type: string
label: 'Custom Field'
oro_product.product_attribute_manager to fetch/update attributes dynamically.Custom Product Types:
Subclass Oro\Bundle\ProductBundle\Entity\Product and override behaviors (e.g., validation).
namespace App\Entity;
use Oro\Bundle\ProductBundle\Entity\Product as BaseProduct;
class CustomProduct extends BaseProduct {
// Add custom logic (e.g., dynamic pricing)
}
Oro\Bundle\CustomerBundle\Entity\CustomerGroup to assign tiered pricing.
$product->setPrice($price->setCustomerGroup($group));
Oro\Bundle\OrderBundle\Entity\Quote) for B2B workflows.
oro_order.order_manager.ERP/CRM Sync:
Use Oro’s Integration bundles (e.g., oro_integration) to connect with external systems via:
order.create).// Example: Subscribe to order events
$eventDispatcher->addListener(
'oro_order.order.create',
[$this, 'onOrderCreate']
);
Payment Gateways:
Integrate with oro_payment bundle for custom payment methods.
# config/oro/payment.yml
oro_payment:
gateways:
custom_gateway:
class: App\Payment\Gateway\CustomGateway
oro_product.product_manager:
$products = $productManager->getProducts(['sku' => 'ABC123'], ['cache' => true]);
oro_batch for large imports/exports (e.g., product updates).Entity Inheritance Quirks
Product) without overriding the getNewEntityName() method in your EntityManager.Database Schema Conflicts
Gedmo\Timestampable). Ensure your migrations account for these.php bin/console doctrine:schema:update --dump-sql after adding custom fields.Event Dispatching Order
oro_product.product.update) may fire before/after your expectations.oro_event_dispatcher to log event priorities:
$dispatcher->addListener('oro_product.product.update', function() {
\Oro\Bundle\LogBundle\Logger\Logger::info('Event fired!');
}, -100); // Lower priority = earlier execution
API Versioning
/api/{version}/products). Ensure your clients target the correct version.# config/packages/dev/oro_logging.yml
oro_logging:
channels:
oro_product: true
/admin/system/data-auditor) to inspect entity changes.# List all installed bundles
php bin/console debug:container --tags="oro.bundle"
# Check product associations
php bin/console oro:product:association:list
Custom Business Rules
Oro\Bundle\RuleBundle to add dynamic product visibility/pricing:
namespace App\Rule\Condition;
use Oro\Bundle\RuleBundle\Condition\AbstractCondition;
class CustomProductCondition extends AbstractCondition {
// Implement logic (e.g., "Show product if customer group is VIP")
}
Frontend Customization
templates/OroProduct/ (e.g., product/view.html.twig).Testing Strategies
Oro\Bundle\TestFrameworkBundle\Test\WebTestCase.oro_product.product_manager:
$this->productManager = $this->createMock(ProductManager::class);
$this->productManager->method('getProduct')->willReturn($product);
Localization
oro_locale. Extend translations in translations/messages.en.yml:
Oro\Bundle\ProductBundle:
product: 'My Custom Product Name'
How can I help you explore Laravel packages today?