Skip to content

Configurable product page: no image gallery shown and PHP exception thrown in some circumstances #4644

Open
@OnyXxL

Description

@OnyXxL

Preconditions (*)

  1. OpenMage 19.x to 20.10.2
  2. PHP8.3

Steps to reproduce (*)

  1. Create an attribute e.g. "size" for Configurable Products with some size values
  2. Create a configurable product with "size" as a configurable attribute
  3. In System > Configuration > Catalog > Configurable swatches > General settings,
  • select something else than "---Please select---" in "Product Attribute to Use for Swatches in Product Listing".
  • don't select "size" in "Product Attributes to Show as Swatches in Product Detail"
  1. On the Frontend, go to the product page just created, the gallery is not showing. Yet the Configurable options can be selected and are present in a drop-down menu

Expected result (*)

  1. The product image gallery of a Configurable product should show even if the attribute is not selected in System > Configuration > Catalog > Configurable swatches > General settings > Product Attributes to Show as Swatches in Product Detail
    Some store owners might just want to have a drop-down menu in the product page instead of buttons/swatches, and may want avoid showing swatches on a Product list (Category).
  2. No PHP exception should be trhown

Actual result (*)

  1. exception.log:

TypeError: array_unique(): Argument #1 ($array) must be of type array, null given in /app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php:386
Stack trace:
#0 /app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php(386): array_unique()
#1 /app/code/core/Mage/Catalog/Block/Product/View/Media.php(95): Mage_ConfigurableSwatches_Helper_Productimg->filterImageInGallery()
#2 /app/design/frontend/rwd/default/template/catalog/product/view/media.phtml(37): Mage_Catalog_Block_Product_View_Media->isGalleryImageVisible()
#3 /app/code/core/Mage/Core/Block/Template.php(274): include('...')
#4 /app/code/core/Mage/Core/Block/Template.php(311): Mage_Core_Block_Template->fetchView()
#5 /app/code/core/Mage/Core/Block/Template.php(324): Mage_Core_Block_Template->renderView()
#6 /app/code/core/Mage/Core/Block/Abstract.php(926): Mage_Core_Block_Template->_toHtml()
#7 /app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Abstract->toHtml()
#8 /app/code/core/Mage/Core/Block/Abstract.php(587): Mage_Core_Block_Abstract->_getChildHtml()
#9 /app/design/frontend/rwd/default/template/catalog/product/view.phtml(45): Mage_Core_Block_Abstract->getChildHtml()
#10 /app/code/core/Mage/Core/Block/Template.php(274): include('...')
#11 /app/code/core/Mage/Core/Block/Template.php(311): Mage_Core_Block_Template->fetchView()
#12 /app/code/core/Mage/Core/Block/Template.php(324): Mage_Core_Block_Template->renderView()
#13 /app/code/core/Mage/Core/Block/Abstract.php(926): Mage_Core_Block_Template->_toHtml()
#14 /app/code/core/Mage/Core/Block/Text/List.php(35): Mage_Core_Block_Abstract->toHtml()
#15 /app/code/core/Mage/Core/Block/Abstract.php(926): Mage_Core_Block_Text_List->_toHtml()
#16 /app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Abstract->toHtml()
#17 /app/code/core/Mage/Core/Block/Abstract.php(587): Mage_Core_Block_Abstract->_getChildHtml()
#18 /app/design/frontend/rwd/default/template/page/1column.phtml(37): Mage_Core_Block_Abstract->getChildHtml()
#19 /app/code/core/Mage/Core/Block/Template.php(274): include('...')
#20 /app/code/core/Mage/Core/Block/Template.php(311): Mage_Core_Block_Template->fetchView()
#21 /app/code/core/Mage/Core/Block/Template.php(324): Mage_Core_Block_Template->renderView()
#22 /app/code/core/Mage/Core/Block/Abstract.php(926): Mage_Core_Block_Template->_toHtml()
#23 /app/code/core/Mage/Core/Model/Layout.php(573): Mage_Core_Block_Abstract->toHtml()
#24 /app/code/core/Mage/Core/Controller/Varien/Action.php(393): Mage_Core_Model_Layout->getOutput()
#25 /app/code/core/Mage/Catalog/Helper/Product/View.php(144): Mage_Core_Controller_Varien_Action->renderLayout()
#26 /app/code/core/Mage/Catalog/controllers/ProductController.php(121): Mage_Catalog_Helper_Product_View->prepareAndRender()
#27 /app/code/core/Mage/Core/Controller/Varien/Action.php(424): Mage_Catalog_ProductController->viewAction()
#28 /app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(255): Mage_Core_Controller_Varien_Action->dispatch()
#29 /app/code/core/Mage/Core/Controller/Varien/Front.php(181): Mage_Core_Controller_Varien_Router_Standard->match()
#30 /app/code/core/Mage/Core/Model/App.php(358): Mage_Core_Controller_Varien_Front->dispatch()
#31 /app/Mage.php(758): Mage_Core_Model_App->run()
#32 /index.php(56): Mage::run()

  1. system.log:

ERR (3): Warning: Undefined array key "labels" in /pub/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php on line 386

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions