Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Icecat Demo Bundle Laravel Package

akeneo/icecat-demo-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

First Steps

  1. Check Compatibility

    • Do not use with modern Akeneo PIM (deprecated since 2013). Verify if a newer alternative (e.g., akeneo/demo-bundle) exists for your Akeneo version.
    • If legacy support is required, ensure your project uses Akeneo PIM 1.x (or a fork compatible with this bundle).
  2. Installation

    composer require --prefer-dist akeneo/icecat-demo-bundle:dev-master
    
    • Add to app/AppKernel.php (or config/bundles.php for Symfony 4+):
      new Pim\Bundle\IcecatDemoBundle\PimIcecatDemoBundle(),
      
  3. Configure Parameters Update app/config/parameters.yml (or .env for Symfony 4+):

    installer_data: 'PimIcecatDemoBundle:icecat_demo'
    
  4. First Data Load Run in production environment (as warned in the README):

    ./install.sh db  # If using Akeneo's install script
    php app/console doctrine:fixtures:load --append --fixtures=vendor/akeneo/icecat-demo-bundle/Pim/Bundle/IcecatDemoBundle/DataFixtures/
    php app/console cache:clear --env=prod
    php app/console pim:icecat-demo:import --env=prod
    php app/console pim:completeness:calculate --env=prod
    php app/console pim:versioning:refresh --env=prod
    

Implementation Patterns

Workflow for Demo Data

  1. Use Case: Quick PIM Demo Setup

    • Purpose: Populate Akeneo with real-world product data (e.g., electronics, appliances) from Icecat’s database for testing/presentation.
    • Steps:
      • Load fixtures (products, categories, attributes) via doctrine:fixtures:load.
      • Trigger the Icecat-specific import with pim:icecat-demo:import to enrich data (e.g., add technical specs, images).
      • Calculate completeness (pim:completeness:calculate) to simulate a "ready for launch" state.
  2. Integration with Akeneo Features

    • Product Data: The bundle provides pre-populated products with Icecat-specific attributes (e.g., energy_efficiency_class, screen_size). Extend existing Akeneo attribute types to support these.
    • Media Management: Icecat data may include images/videos. Use Akeneo’s media API to attach these to products.
    • Localization: Icecat data is multilingual. Leverage Akeneo’s locale system to ensure translations are preserved.
  3. Customization

    • Override Fixtures: Extend the bundle’s fixtures (located in DataFixtures/) to add custom products or modify existing ones.
    • Post-Import Logic: Hook into the pim:icecat-demo:import command to run additional logic (e.g., send notifications, update inventory).
      # config/services.yaml (Symfony 4+)
      services:
          App\Command\PostIcecatImportCommand:
              tags:
                  - { name: 'console.command' }
              arguments:
                  $icecatImporter: '@pim_icecat_demo.importer'
      
  4. Testing

    • Unit Tests: Mock the Icecat importer service to test product enrichment logic.
    • Functional Tests: Use the loaded demo data to test Akeneo’s export, import, or API endpoints.

Gotchas and Tips

Pitfalls

  1. Deprecation Warning

    • Issue: The bundle is not compatible with Akeneo PIM 2.x+ or Symfony 4/5.
    • Workaround: Use a fork or alternative (e.g., akeneo/demo-bundle). If stuck with this bundle, pin to a specific dev-master commit and avoid updates.
  2. Database Overwrite

    • Issue: The install.sh db command drops and recreates your database. Always back up first.
    • Tip: Use --append with doctrine:fixtures:load to avoid accidental data loss in development.
  3. Missing Dependencies

    • Issue: The bundle assumes Akeneo PIM’s core modules (e.g., Pim\Bundle\CatalogBundle). If missing, install via:
      composer require akeneo/pim-community-standard
      
  4. Icecat-Specific Attributes

    • Issue: Attributes like energy_efficiency_class may not exist in your Akeneo instance.
    • Fix: Create custom attributes or extend existing ones (e.g., pim_catalog_installer:create-attribute).
  5. Command Order Matters

    • Issue: Running pim:completeness:calculate before pim:icecat-demo:import may fail due to missing product data.
    • Tip: Follow the exact order in the README.

Debugging Tips

  1. Check Fixture Loading

    • Enable Doctrine debug mode to verify fixtures are loaded:
      # app/config/config_dev.yml
      doctrine:
          dbal:
              logging: true
      
    • Look for errors in var/log/dev.log.
  2. Icecat Importer Logs

    • The pim:icecat-demo:import command may log issues to var/log/prod.log. Add --verbose for details:
      php app/console pim:icecat-demo:import --env=prod --verbose
      
  3. Symfony Cache Issues

    • If commands fail silently, clear all caches:
      php app/console cache:clear --env=prod --no-debug
      

Extension Points

  1. Custom Icecat Data Sources

    • Override the importer service to fetch data from a custom source (e.g., CSV, API):
      # config/services.yaml
      pim_icecat_demo.importer:
          class: App\Service\CustomIcecatImporter
          arguments:
              - '@pim_catalog.repository.product'
      
  2. Post-Import Events

    • Listen for the pim_icecat_demo.import event to trigger actions:
      // src/EventListener/IcecatImportListener.php
      class IcecatImportListener implements EventSubscriberInterface
      {
          public static function getSubscribedEvents()
          {
              return [
                  'pim_icecat_demo.import' => 'onIcecatImport',
              ];
          }
      
          public function onIcecatImport(IcecatImportEvent $event)
          {
              // Custom logic (e.g., update inventory, send emails)
          }
      }
      
  3. Attribute Mapping

    • Extend the bundle’s attribute mapping to support new Icecat fields. Example:
      // src/DependencyInjection/Compiler/IcecatPass.php
      public function process(ContainerBuilder $container)
      {
          $definition = $container->findDefinition('pim_icecat_demo.importer');
          $definition->addMethodCall('addAttributeMap', [
              'icecat_field' => 'akeneo_attribute_code',
          ]);
      }
      
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver