isotope / core

Core repository of Isotope eCommerce, an eCommerce extension for Contao Open Source CMS
https://isotopeecommerce.org
136 stars 107 forks source link

Fix warnings in `DC_ProductData` #2498

Closed fritzmg closed 1 month ago

fritzmg commented 10 months ago

If you install the official Isotope demo and then edit the variants of a product in the back end (in dev), the following error will occur:

Warning: Undefined array key "reference"

  at isotope\vendor\isotope\isotope-core\system\modules\isotope\drivers\DC_ProductData.php:2234
  at DC_ProductData->parentView()
     (isotope\vendor\isotope\isotope-core\system\modules\isotope\drivers\DC_ProductData.php:174)
  at DC_ProductData->showAll()
     (isotope\vendor\contao\core-bundle\src\Resources\contao\classes\Backend.php:667)
  at Contao\Backend->getBackendModule('iso_products', null)
     (isotope\vendor\contao\core-bundle\src\Resources\contao\controllers\BackendMain.php:168)
  at Contao\BackendMain->run()
     (isotope\vendor\contao\core-bundle\src\Controller\BackendController.php:49)
  at Contao\CoreBundle\Controller\BackendController->mainAction()
     (isotope\vendor\symfony\http-kernel\HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (isotope\vendor\symfony\http-kernel\HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (isotope\vendor\symfony\http-kernel\Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (isotope\public\index.php:44)    

After fixing this one, the following error will occur:

ErrorException:
Warning: Array to string conversion

  at isotope\vendor\isotope\isotope-core\system\modules\isotope\drivers\DC_ProductData.php:2237
  at DC_ProductData->parentView()
     (isotope\vendor\isotope\isotope-core\system\modules\isotope\drivers\DC_ProductData.php:174)
  at DC_ProductData->showAll()
     (isotope\vendor\contao\core-bundle\src\Resources\contao\classes\Backend.php:667)
  at Contao\Backend->getBackendModule('iso_products', null)
     (isotope\vendor\contao\core-bundle\src\Resources\contao\controllers\BackendMain.php:168)
  at Contao\BackendMain->run()
     (isotope\vendor\contao\core-bundle\src\Controller\BackendController.php:49)
  at Contao\CoreBundle\Controller\BackendController->mainAction()
     (isotope\vendor\symfony\http-kernel\HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (isotope\vendor\symfony\http-kernel\HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (isotope\vendor\symfony\http-kernel\Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (isotope\public\index.php:44)         

May be this needs to be fixed somewhere else though? $options will be an array containing the infos of the product variant here.

aschempp commented 10 months ago

This is most likely obsolete in 2.9 since we're using the DataContainer::generateRecordLabel method?

fritzmg commented 10 months ago

I don't know, would need to be tested in 2.9. But this is for 2.8 anyway.

aschempp commented 1 month ago

Closing this since there will not be a new 2.8 release

fritzmg commented 1 month ago

Yes, the error does not occur in 2.9 anymore. I tested by installing the isotope demo and then updating directly to 2.9.x-dev.