isotope / core

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

Fix various PHP 8 issues under Contao 4.13 #2441

Closed fritzmg closed 1 year ago

fritzmg commented 1 year ago

Fixes the following issues:

ErrorException:
Warning: Constant TL_FILES_URL already defined

  at vendor\isotope\isotope-core\system\modules\isotope\library\Isotope\Frontend.php:650
  at Isotope\Frontend::loadPageConfig(object(PageModel))
     (vendor\isotope\isotope-core\system\modules\isotope\library\Isotope\Frontend.php:605)
  at Isotope\Frontend::loadOrderEnvironment(object(Order))
     (vendor\isotope\isotope-core\system\modules\isotope\library\Isotope\Backend\ProductCollection\Callback.php:515)
  at Isotope\Backend\ProductCollection\Callback->printDocument(object(DC_Table))
     (vendor\contao\core-bundle\src\Resources\contao\classes\Backend.php:446)
  at Contao\Backend->getBackendModule('iso_orders', null)
     (vendor\contao\core-bundle\src\Resources\contao\controllers\BackendMain.php:168)
ErrorException:
Warning: Undefined array key 1

  at vendor\isotope\isotope-core\system\modules\isotope\library\Isotope\Frontend.php:677
  at Isotope\Frontend::loadPageConfig(object(PageModel))
     (vendor\isotope\isotope-core\system\modules\isotope\library\Isotope\Frontend.php:605)
  at Isotope\Frontend::loadOrderEnvironment(object(Order))
     (vendor\isotope\isotope-core\system\modules\isotope\library\Isotope\Backend\ProductCollection\Callback.php:515)
  at Isotope\Backend\ProductCollection\Callback->printDocument(object(DC_Table))
     (vendor\contao\core-bundle\src\Resources\contao\classes\Backend.php:446)
  at Contao\Backend->getBackendModule('iso_orders', null)
     (vendor\contao\core-bundle\src\Resources\contao\controllers\BackendMain.php:168)
ErrorException:
Warning: Attempt to read property "dateFormat" on null

  at vendor\isotope\isotope-core\system\modules\isotope\library\Isotope\Model\Document\Standard.php:180
  at Isotope\Model\Document\Standard->generateTemplate(object(Order), array(…))
     (vendor\inspiredminds\contao-isotope-pdf-templates\src\Isotope\Model\Document\Template.php:102)
  at InspiredMinds\ContaoIsotopePdfTemplatesBundle\Isotope\Model\Document\Template->generatePDF(object(Order), array(…))
     (vendor\isotope\isotope-core\system\modules\isotope\library\Isotope\Model\Document\Standard.php:37)
  at Isotope\Model\Document\Standard->outputToBrowser(object(Order))
     (vendor\isotope\isotope-core\system\modules\isotope\library\Isotope\Backend\ProductCollection\Callback.php:523)
  at Isotope\Backend\ProductCollection\Callback->printDocument(object(DC_Table))
     (vendor\contao\core-bundle\src\Resources\contao\classes\Backend.php:446)
  at Contao\Backend->getBackendModule('iso_orders', null)
     (vendor\contao\core-bundle\src\Resources\contao\controllers\BackendMain.php:168)
aschempp commented 1 year ago

Sorry I only noticed this PR after fixing all the stuff myself in b2a7448f2770c17fcf8de0cc4b74858958388df4. The page_id property is actually pageId, because the product collection dynamically stores additional fields in a serialized array (see https://github.com/isotope/core/blob/2.8/system/modules/isotope/library/Isotope/Model/ProductCollection.php#L730)