:bug: estoy reportando un error :bug:
Versión de Akeneo: CE 4.0.31
Al descargar el pdf desde la página de enriquecimiento del producto, va a la siguiente URL y muestra el error: http://<pimhost>/enrich/product/1018/download-pdf?dataLocale=en_US&dataScope=ecommerce
Impossible to invoke a method ("__toString") on a string variable ("Some value")
in vendor/akeneo/pim-community-dev/src/Akeneo/Pim/Enrichment/Bundle/Resources/views/Product/renderPdf.html.twig (line 118)
Sucede porque para pim_catalog_simpleselect
y pim_catalog_multiselect
tipo content
ya está convertido a cadena en esta línea 114 :
{% set content = optionLabels[attribute.code] %}
Otro problema relacionado en la misma página está en la línea 110 :
Para el tipo pim_catalog_image
content
es una instancia de Akeneo\Pim\Enrichment\Component\Product\Value\MediaValue
que tiene la propiedad data
pero no la propiedad media
. Pero esa línea usa content.media
causando un error.
La siguiente diferencia podría solucionar el problema por ahora
diff --git a/src/Akeneo/Pim/Enrichment/Bundle/Resources/views/Product/renderPdf.html.twig b/src/Akeneo/Pim/Enrichment/Bundle/Resources/views/Product/renderPdf.html.twig
index 3730bea3c2b..7576ad0ef82 100644
--- a/src/Akeneo/Pim/Enrichment/Bundle/Resources/views/Product/renderPdf.html.twig
+++ b/src/Akeneo/Pim/Enrichment/Bundle/Resources/views/Product/renderPdf.html.twig
@@ -107,11 +107,12 @@
{% set content = product.getValue(attribute.code, locale_attribute, channel_attribute) %}
{% set manualHeight = true %}
- {% if 'pim_catalog_image' == attribute.type and content.media is not null %}
- {% set content = content.media.originalFilename %}
+ {% if 'pim_catalog_image' == attribute.type and content.data is not null %}
+ {% set content = content.data.originalFilename %}
{% set manualHeight = false %}
{% elseif ('pim_catalog_simpleselect' == attribute.type or 'pim_catalog_multiselect' == attribute.type) and attribute.code in optionLabels|keys %}
{% set content = optionLabels[attribute.code] %}
+ {% set manualHeight = false %}
{% endif %}
{% if content != null and manualHeight == true %}
Hola @adhocore ,
Gracias por abrir este número con una descripción tan precisa.
con respecto a su primer problema con __toString
, pronto se fusionará una solución rápida en 4.0.x: https://github.com/akeneo/pim-community-dev/pull/12430
Para el segundo problema, intentaré tomarme el tiempo para investigarlo lo antes posible.
Hola,
¿Tienes alguna noticia sobre el segundo número?
Muchas gracias 🙏
La solución podría ser usar la función twig definida en el atributo de medios de esa manera:
{% if 'pim_catalog_image' == attribute.type and content.media is defined and content.media is not null %}
Lo siento por no responder antes.
Lo investigué y abrí un PR al respecto: https://github.com/akeneo/pim-community-dev/pull/12496
Debería fusionarse pronto en 4.0.x.
Muchas gracias 👍 💪
por favor, siéntase libre de cerrar este problema si tenemos una nueva versión de akeneo con las correcciones, gracias
Comentario más útil
Lo siento por no responder antes.
Lo investigué y abrí un PR al respecto: https://github.com/akeneo/pim-community-dev/pull/12496
Debería fusionarse pronto en 4.0.x.