View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002081 | OXID eShop (all versions) | 1.01. Products (product, categories, manufacturer, promotions etc.) | public | 2010-09-02 16:24 | 2012-12-07 14:27 |
Reporter | Moehlis | Assigned To | |||
Priority | normal | Severity | tweak | Reproducibility | always |
Status | resolved | Resolution | won't fix | ||
Product Version | 4.4.0 revision 28699 | ||||
Summary | 0002081: getPictureGallery creates wrong array index if a previous pic is missing | ||||
Description | esample: an article with following pictures set: pic1: none pic2: image.jpg the output of oxarticles::getPictureGallery() will be something like: Array ( ZoomPic => 1 ZoomPics => Array 1 => Array id => 1 file => image.jpg ) The important thing is the id - it is "1". Seems ok, but causes problems if you have a special treatment for the first zoom pic (you cannot rely on the index, because its not the first zoompic, its the second one) | ||||
Steps To Reproduce | old: core/oxarticle.php:2178 EE 4.4.0 rev28699 oxarticles::getPictureGallery(): for ( $j = 1,$c = 1; $j <= $iZoomPicCount; $j++) { $sVal = $this->getZoomPictureUrl($j); if ( !$oStr->strstr($sVal, 'nopic.jpg')) { if ($this->getConfig()->getConfigParam('blFormerTplSupport')) { $sVal = $this->_sDynImageDir."/".$sVal; } $blZoomPic = true; $aZoomPics[$c]['id'] = $c; $aZoomPics[$c]['file'] = $sVal; //anything is better than empty name, because <img src=""> calls shop once more = x2 SLOW. if (!$sVal) { $aZoomPics[$c]['file'] = "nopic.jpg"; } $c++; } } solution: for ( $j = 1,$c = 1; $j <= $iZoomPicCount; $j++) { $sVal = $this->getZoomPictureUrl($j); if ( !$oStr->strstr($sVal, 'nopic.jpg')) { if ($this->getConfig()->getConfigParam('blFormerTplSupport')) { $sVal = $this->_sDynImageDir."/".$sVal; } $blZoomPic = true; $aZoomPics[$c]['id'] = $c; $aZoomPics[$c]['file'] = $sVal; //anything is better than empty name, because <img src=""> calls shop once more = x2 SLOW. if (!$sVal) { $aZoomPics[$c]['file'] = "nopic.jpg"; } } $c++; // <- ! } | ||||
Tags | Products | ||||
Theme | Both | ||||
Browser | All | ||||
PHP Version | any | ||||
Database Version | any | ||||
|
using $j instead of $c seems to be more efficiently |
|
@Developers: please check from the source code side if it is like described. Please consider suggested code snippet. |
|
getPictureGallery() method returns only array of available pictures. If someone needs to rely on actual ID's of pictures, including the missing ones, you need to change the code for your needs, cause that's how this picture gallery works and shop functioning correctly. |