Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ public function handleGalleryTypeAttribute($pid, &$item, $storeid, $attrcode, $a
}
// use ";" as image separator
$images = explode(";", $ivalue);
$imageindex = 0;

// starting at 1, because otherwise if image renaming is used the main product image is already used for 0.
$imageindex = 1;

// for each image
foreach ($images as $imagefile) {
// trim image file in case of spaced split
Expand All @@ -106,7 +109,7 @@ public function handleGalleryTypeAttribute($pid, &$item, $storeid, $attrcode, $a
$imagefile = $infolist[0];
}
unset($infolist);
$extra=array("store"=>$storeid,"attr_code"=>$attrcode,"imageindex"=>$imageindex == 0 ? "" : $imageindex);
$extra=array("store"=>$storeid,"attr_code"=>$attrcode,"imageindex"=>$imageindex);
// copy it from source dir to product media dir
$imagefile = $this->copyImageFile($imagefile, $item, $extra);
unset($extra);
Expand Down Expand Up @@ -184,7 +187,7 @@ public function handleImageTypeAttribute($pid, &$item, $storeid, $attrcode, $att
$imagefile = trim($ivalue);

// else copy image file
$imagefile = $this->copyImageFile($imagefile, $item, array("store"=>$storeid, "attr_code"=>$attrcode));
$imagefile = $this->copyImageFile($imagefile, $item, array("store"=>$storeid, "attr_code"=>$attrcode,"imageindex"=>0));
$ovalue = $imagefile;
// add to gallery as excluded
if ($imagefile !== false) {
Expand Down