agencednd/attribute-description-bundle
Installation:
composer require agencednd/attribute-description-bundle:1.1.*
app/AppKernel.php:
$bundles[] = new Dnd\Bundle\AttributeDescriptionBundle\DndAttributeDescriptionBundle();
Attribute and AttributeTranslation entities in app/config/config.yml:
akeneo_storage_utils:
mapping_overrides:
-
original: Pim\Bundle\CatalogBundle\Entity\Attribute
override: Dnd\Bundle\AttributeDescriptionBundle\Entity\Attribute
-
original: Pim\Bundle\CatalogBundle\Entity\AttributeTranslation
override: Dnd\Bundle\AttributeDescriptionBundle\Entity\AttributeTranslation
php bin/console doctrine:schema:update --force
First Use Case:
description-en_US) for each locale.Manual Description Management:
Bulk Import/Export:
description-{locale_code} columns (e.g., description-en_US) to your CSV/Excel attribute import file.
Example:
code,type,description-en_US,description-fr_FR
color,select,Choose your shirt color,Choisissez la couleur de votre chemise
Localization Handling:
AttributeTranslation entities, inheriting Akeneo’s localization system.AttributeTranslationRepository to fetch descriptions programmatically:
$description = $attributeTranslation->getDescription();
Frontend Integration:
twig/product/_attribute.html.twig) to display descriptions:
{% if attribute.description %}
<div class="attribute-description">{{ attribute.description }}</div>
{% endif %}
AttributeTranslation to add validation rules for descriptions (e.g., max length):
use Symfony\Component\Validator\Constraints as Assert;
/**
* @Assert\Length(max=500)
*/
private $description;
GET /api/rest/v1/attributes/{code} (descriptions included in response).AttributeUpdateEvent to log or process description changes:
public function onAttributeUpdate(AttributeUpdateEvent $event) {
$attribute = $event->getAttribute();
// Custom logic for descriptions...
}
Schema Mismatch:
doctrine:schema:update after installation will cause errors when saving descriptions.Locale-Specific Descriptions:
null in the DB.Caching Issues:
php bin/console cache:clear
Attribute Type Limitations:
text attribute type for descriptions.description-{locale_code} column exists in imports.attribute_translation.description values:
SELECT * FROM attribute_translation WHERE locale = 'en_US';
{{ dump(attribute) }}
Custom Description Fields:
AttributeTranslation to add metadata (e.g., isVisible, priority):
/**
* @ORM\Column(type="boolean")
*/
private $isVisible = true;
AttributeTranslationType to expose these fields in the UI.Dynamic Description Logic:
AttributeDescriptionRenderer service to conditionally show/hide descriptions:
# config/services.yml
services:
dnd_attribute_description.renderer:
class: AppBundle\Service\CustomAttributeDescriptionRenderer
decorates: dnd_attribute_description.renderer
arguments: ['@dnd_attribute_description.renderer.inner']
Import/Export Customization:
Dnd\Bundle\AttributeDescriptionBundle\Importer\AttributeImporter to add pre/post-processing for descriptions:
public function process($currentStepResults, $stepExecution) {
// Custom logic before/after description import
}
How can I help you explore Laravel packages today?