Jump to content

ContextErrorException al crear combinaciones en un producto


naturalba

Recommended Posts

Os dejo abajo error que me sale tras haber configurado un artículo con diferentes combinaciones e intentar añadirlo al carrito.

 

Esta es mi (futura) tienda: http://vivirahora.es/comprar

 

Y este es el artículo en cuestión que genera el problema: http://vivirahora.es/comprar/index.php?id_product=55&id_product_attribute=58&rewrite=lampara-de-sal-2-a-4-kg&controller=product&id_lang=1#/29-peso_tamano-1_2_kg

 

 

1/1 ContextErrorException in CartPresenter.php line 83: Notice: Undefined offset: 1
  1. in CartPresenter.php line 83
  2. at ErrorHandler->handleError('8', 'Undefined offset: 1', '/htdocs/public/www/comprar/src/Adapter/Cart/CartPresenter.php', '83', array('rawProduct' => array('id_product_attribute' => '59', 'id_product' => '55', 'cart_quantity' => '2', 'id_shop' => '1', 'id_customization' => null, 'name' => 'Lámpara de sal', 'is_virtual' => '0', 'description_short' => '<p><strong>Atención: el envío de lámparas de sal a domicilio implica costes extra por el sobrepeso que conlleva (importe variable según la franja de peso de la lámpara).</strong></p>', 'available_now' => '', 'available_later' => '', 'id_category_default' => '2', 'id_supplier' => '0', 'id_manufacturer' => '0', 'manufacturer_name' => null, 'on_sale' => '0', 'ecotax' => '0.000000', 'additional_shipping_cost' => '0.00', 'available_for_order' => '1', 'price' => '12.396693', 'active' => '1', 'unity' => '', 'unit_price_ratio' => '0.000000', 'quantity_available' => '999', 'width' => '0.000000', 'height' => '0.000000', 'depth' => '0.000000', 'out_of_stock' => '1', 'weight' => '4', 'date_add' => '2017-05-24 00:13:44', 'date_upd' => '2017-05-31 22:10:30', 'quantity' => '2', 'link_rewrite' => 'lampara-de-sal-2-a-4-kg', 'category' => 'inicio', 'unique_id' => '0000000055000000005900', 'id_address_delivery' => '0', 'advanced_stock_management' => '0', 'supplier_reference' => null, 'customization_quantity' => null, 'price_attribute' => '5.785123', 'ecotax_attr' => '0.000000', 'reference' => '', 'weight_attribute' => '4', 'ean13' => '', 'isbn' => '', 'upc' => '', 'minimal_quantity' => '0', 'wholesale_price' => '4.900000', 'id_image' => '55-170', 'legend' => '', 'reduction_type' => '0', 'is_gift' => false, 'stock_quantity' => '999', 'price_without_reduction' => '14.999999', 'price_with_reduction' => '14.999999', 'price_with_reduction_without_tax' => '12.396693', 'total' => '24.79', 'total_wt' => '30', 'price_wt' => '14.999999', 'reduction_applies' => false, 'quantity_discount_applies' => false, 'allow_oosp' => '1', 'features' => array(), 'attributes' => array('Peso/ Tamaño : 2', '4 kg'), 'attributes_small' => '2-4 kg', 'rate' => '21', 'tax_name' => 'IVA ES 21%'), 'settings' => object(ProductPresentationSettings), 'attributesArray' => array('Peso/ Tamaño' => '2'), 'attribute' => '4 kg', 'key' => 'Peso/ Tamaño ', 'value' => ' 2')) in CartPresenter.php line 83
  3. at CartPresenter->presentProduct(array('id_product_attribute' => '59', 'id_product' => '55', 'cart_quantity' => '2', 'id_shop' => '1', 'id_customization' => null, 'name' => 'Lámpara de sal', 'is_virtual' => '0', 'description_short' => '<p><strong>Atención: el envío de lámparas de sal a domicilio implica costes extra por el sobrepeso que conlleva (importe variable según la franja de peso de la lámpara).</strong></p>', 'available_now' => '', 'available_later' => '', 'id_category_default' => '2', 'id_supplier' => '0', 'id_manufacturer' => '0', 'manufacturer_name' => null, 'on_sale' => '0', 'ecotax' => '0.000000', 'additional_shipping_cost' => '0.00', 'available_for_order' => '1', 'price' => '12.396693', 'active' => '1', 'unity' => '', 'unit_price_ratio' => '0.000000', 'quantity_available' => '999', 'width' => '0.000000', 'height' => '0.000000', 'depth' => '0.000000', 'out_of_stock' => '1', 'weight' => '4', 'date_add' => '2017-05-24 00:13:44', 'date_upd' => '2017-05-31 22:10:30', 'quantity' => '2', 'link_rewrite' => 'lampara-de-sal-2-a-4-kg', 'category' => 'inicio', 'unique_id' => '0000000055000000005900', 'id_address_delivery' => '0', 'advanced_stock_management' => '0', 'supplier_reference' => null, 'customization_quantity' => null, 'price_attribute' => '5.785123', 'ecotax_attr' => '0.000000', 'reference' => '', 'weight_attribute' => '4', 'ean13' => '', 'isbn' => '', 'upc' => '', 'minimal_quantity' => '0', 'wholesale_price' => '4.900000', 'id_image' => '55-170', 'legend' => '', 'reduction_type' => '0', 'is_gift' => false, 'stock_quantity' => '999', 'price_without_reduction' => '14.999999', 'price_with_reduction' => '14.999999', 'price_with_reduction_without_tax' => '12.396693', 'total' => '24.79', 'total_wt' => '30', 'price_wt' => '14.999999', 'reduction_applies' => false, 'quantity_discount_applies' => false, 'allow_oosp' => '1', 'features' => array(), 'attributes' => 'Peso/ Tamaño : 2-4 kg', 'attributes_small' => '2-4 kg', 'rate' => '21', 'tax_name' => 'IVA ES 21%'))
  4. at array_map(array(object(CartPresenter), 'presentProduct'), array(array('id_product_attribute' => '59', 'id_product' => '55', 'cart_quantity' => '2', 'id_shop' => '1', 'id_customization' => null, 'name' => 'Lámpara de sal', 'is_virtual' => '0', 'description_short' => '<p><strong>Atención: el envío de lámparas de sal a domicilio implica costes extra por el sobrepeso que conlleva (importe variable según la franja de peso de la lámpara).</strong></p>', 'available_now' => '', 'available_later' => '', 'id_category_default' => '2', 'id_supplier' => '0', 'id_manufacturer' => '0', 'manufacturer_name' => null, 'on_sale' => '0', 'ecotax' => '0.000000', 'additional_shipping_cost' => '0.00', 'available_for_order' => '1', 'price' => '12.396693', 'active' => '1', 'unity' => '', 'unit_price_ratio' => '0.000000', 'quantity_available' => '999', 'width' => '0.000000', 'height' => '0.000000', 'depth' => '0.000000', 'out_of_stock' => '1', 'weight' => '4', 'date_add' => '2017-05-24 00:13:44', 'date_upd' => '2017-05-31 22:10:30', 'quantity' => '2', 'link_rewrite' => 'lampara-de-sal-2-a-4-kg', 'category' => 'inicio', 'unique_id' => '0000000055000000005900', 'id_address_delivery' => '0', 'advanced_stock_management' => '0', 'supplier_reference' => null, 'customization_quantity' => null, 'price_attribute' => '5.785123', 'ecotax_attr' => '0.000000', 'reference' => '', 'weight_attribute' => '4', 'ean13' => '', 'isbn' => '', 'upc' => '', 'minimal_quantity' => '0', 'wholesale_price' => '4.900000', 'id_image' => '55-170', 'legend' => '', 'reduction_type' => '0', 'is_gift' => false, 'stock_quantity' => '999', 'price_without_reduction' => '14.999999', 'price_with_reduction' => '14.999999', 'price_with_reduction_without_tax' => '12.396693', 'total' => '24.79', 'total_wt' => '30', 'price_wt' => '14.999999', 'reduction_applies' => false, 'quantity_discount_applies' => false, 'allow_oosp' => '1', 'features' => array(), 'attributes' => 'Peso/ Tamaño : 2-4 kg', 'attributes_small' => '2-4 kg', 'rate' => '21', 'tax_name' => 'IVA ES 21%'))) in CartPresenter.php line 282
  5. at CartPresenter->present(object(Cart)) in FrontController.php line 500
  6. at FrontControllerCore->assignGeneralPurposeVariables() in FrontController.php line 525
  7. at FrontControllerCore->initContent() in Controller.php line 205
  8. at ControllerCore->run() in Dispatcher.php line 369
  9. at DispatcherCore->dispatch() in index.php line 28

 

¿Alquien me puede decir cuál es el fallo? He cambiado parametros pero no sé qué es lo que lo está causando.

 

Hasta que no elimino el carrito abandonado desde el panel de control no vuelve a funcionar bien la página.

 

Gracias por adelantado!

 

Link to comment
Share on other sites

  • 3 months later...

Buenas, quizás ya solucionaste el problema, pero lo apunto por si a alguien más le pasa:

 

En mi caso la excepción (error) se lanzaba cuando quería añadir un producto a la cesta que tenía como atributo algo que en su valor contenía un guión.

Es decir, si por ejemplo, intentaba añadir un par de medias donde sus atributos de combinación era: 36-40; el producto no sólo que no se añadía, sino que al recargar la página también lanzaba la famosa ContextErrorException.

 

Mi solución fue cambiar el valor de un guión a una barra invertida ( / ). Supongo que estaría utilizando el divisor elegido de manera incorrecta a la hora de añadir el producto al carrito.

 

En fin, espero haber ayudado a alguien. Saludos.

Link to comment
Share on other sites

  • 1 month later...

Vuelvo a comentar para decir que también me pasó cuando el nombre del grupo de atributos contenía un guión.

 

En resumen:

 - El nombre del grupo de atributos no puede contener guión.

 - Tampoco puede hacerlo el nombre del atributo en cuestión.

Ejemplo:

 - Producto con el atributo Talla 36-40 (Da error)

 - Producto con el atributo Talla 36 el cual está dentro del grupo de atributos Hombre-Mujer (Da error)

 

La solución: como ya indiqué en el anterior post, es renombrar los atributos/grupos de atributos a un nombre que no contenga un guión (Ejemplos: Talla 36-40 a Talla 36/40; Hombre-Mujer a Hombre/Mujer).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...