agencednd/google-manufacturer-bundle
Installation:
composer require agencednd/google-manufacturer-bundle
AppKernel.php.config/bundles.php:
Dnd\GoogleManufacturerBundle\DndGoogleManufacturerBundle::class => ['all' => true],
config/routes/routes.yml:
dnd_google_manufacturer:
resource: "@DndGoogleManufacturerBundle/Resources/config/routing.yml"
Configure Media Handling:
Update liip_imagine.yml to ensure images are processed correctly:
liip_imagine:
filter_sets:
thumbnail_full:
quality: 100
format: jpeg
filters:
relative_resize: { scale: 1.0 }
Clear Cache & Rebuild Assets:
php bin/console cache:clear --env=prod
php bin/console pim:installer:assets --env=prod
yarn run webpack
First Export Profile:
gtin, title, brand, description, image_link) to your Akeneo PIM attributes.Attribute Mapping:
gtin, brand) and optional (e.g., color, size) Google Manufacturer attributes to Akeneo PIM attributes.brand (Google Manufacturer) → manufacturer (Akeneo PIM attribute).Product Details & Feature Descriptions:
<g:product_detail>
<g:section_name>Specifications</g:section_name>
<g:attribute_name>Weight</g:attribute_name>
<g:attribute_value>500g</g:attribute_value>
</g:product_detail>
<g:feature_description>
<g:headline>Wireless Connectivity</g:headline>
<g:text>Supports Bluetooth 5.0</g:text>
</g:feature_description>
Validation Levels:
low, medium, high) in the export profile to control validation strictness.high for production to enforce Google’s requirements (e.g., GTIN format, description length).Automated Exports:
bin/console akeneo:batch:job google_manufacturer_profile_code
Image Handling:
web/media during export. Ensure your Akeneo PIM media storage is configured to allow writes to this directory.Akeneo PIM Events:
pim_enrich.product_variant_update or pim_catalog.product_save to auto-trigger exports when products are updated:
// In a custom bundle's EventSubscriber
public function onProductUpdate(ProductUpdateEvent $event)
{
$this->exportManager->runExport('google_manufacturer_profile_code');
}
Custom Validation:
Dnd\GoogleManufacturerBundle\Validator\GoogleManufacturerValidator service:
# config/services.yaml
Dnd\GoogleManufacturerBundle\Validator\GoogleManufacturerValidator:
arguments:
- '@validator'
- '@your_custom_validator'
Dynamic Attribute Mapping:
size to shoe_size for footwear).Testing:
xmllint --schema google-manufacturer.xsd output.xml --noout
Image Paths:
web/media. If using a CDN or custom storage, override the Dnd\GoogleManufacturerBundle\Renderer\ImageRenderer service to adjust paths:
// config/services.yaml
Dnd\GoogleManufacturerBundle\Renderer\ImageRenderer:
arguments:
- '@your_custom_image_service'
GTIN Validation:
high acceptance level enforces this, but custom GTINs (e.g., 8 digits) may fail. Use a custom validator to handle exceptions:
use Dnd\GoogleManufacturerBundle\Validator\Constraints as GoogleAssert;
/**
* @GoogleAssert\ValidGtin(groups={"google_manufacturer"})
*/
Locale-Specific Attributes:
title in the target language). Ensure your Akeneo PIM locale settings match the export profile’s locale.Media Permissions:
web/media directory permissions (chmod -R 775 web/media).Circular Dependencies:
XML Validation Errors:
APP_DEBUG=true) and check the export log:
bin/console debug:config dnd_google_manufacturer
bin/console akeneo:batch:job --log to see detailed job execution.Missing Attributes:
high acceptance level to surface errors:
# config/packages/dnd_google_manufacturer.yaml
dnd_google_manufacturer:
acceptance_level: high
Performance Issues:
php.ini):
memory_limit = 2G
Custom Renderers:
Dnd\GoogleManufacturerBundle\Renderer\AbstractRenderer to add custom XML nodes (e.g., for warranty info):
namespace App\GoogleManufacturer\Renderer;
use Dnd\GoogleManufacturerBundle\Renderer\AbstractRenderer;
class WarrantyRenderer extends AbstractRenderer
{
public function render(): string
{
return sprintf('<g:warranty>%s</g:warranty>', $this->getProduct()->getWarranty());
}
}
config/services.yaml:
Dnd\GoogleManufacturerBundle\Renderer\RendererCollection:
arguments:
- ['@app.google_manufacturer.warranty_renderer']
Pre/Post-Export Hooks:
namespace App\EventListener;
use Dnd\GoogleManufacturerBundle\Event\PreExportEvent;
class GoogleManufacturerListener
{
public function onPreExport(PreExportEvent $event)
{
$event->getProducts()->each(function ($product) {
$product->setDescription($this->formatDescription($product->getDescription()));
});
}
}
config/services.yaml:
App\EventListener\GoogleManufacturerListener:
tags:
- { name: 'kernel.event_listener', event: 'dnd_google_manufacturer.pre_export' }
Custom Validation Rules:
Dnd\GoogleManufacturerBundle\Validator\Constraints\ValidGtin:
namespace App\Validator\Constraints;
use Symfony\Component\Validator\Constraint;
class ValidCustomGtin extends Constraint
{
public $message = 'The GTIN {{ value }} is not valid for your region.';
}
use App\Validator\Constraints as AppAssert;
/**
* @AppAssert\ValidCustomGtin
*/
private $gtin;
4
How can I help you explore Laravel packages today?