Permalink
Browse files

Make sure the sort order gets incremented

  • Loading branch information...
1 parent b872586 commit 1c103382fe26507b10913ba1d6da86c2c702ccad @Mark-H committed Nov 14, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 core/components/bdlistings/elements/snippets/bdHookNewListing.snippet.php
@@ -64,14 +64,17 @@
$nr++;
}
+ $order = 1;
/* @var bdlImage $img */
foreach ($images as $i) {
if (!empty($i['name'])) {
$img = $modx->newObject('bdlImage',array('listing' => $listing->get('id')));
$response = $img->handleUpload($i,$listing->get('id'));
if (is_string($response)) {
$img->set('image',$response);
+ $img->set('sortorder',$order);
$img->save();
+ $order++;
}
else {
$hook->addError('message',$modx->lexicon('bdlistings.error.fileupload',array('file' => $i['name'])).' '.$response['error']);

0 comments on commit 1c10338

Please sign in to comment.