News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

After update to 4.8.2 cannot reorder images in the administration product

Started by piliop, September 05, 2026, 08:40:22 AM

Previous topic - Next topic

piliop

i have confirmed the problem in several different instances.
can anyone confirm it?

piliop

I have found a temp solution in administrator/components/com_virtuemart/models/media.php
I added some code and now i am able to change the order by dragging the images.

if needed i can provide the fix code.

jflash


piliop

in administrator\components\com_virtuemart\models\media.php

under the line 405 that seems like this :

if(!is_array($oldIds)) $oldIds = array($oldIds);

Add

       
if(isset($data['ordering'], $data['active_media_id'])){
            if(!isset($data['mediaordering']) || !is_array($data['mediaordering'])){
                $data['mediaordering'] = array();
            }
            $data['mediaordering'][(int)$data['active_media_id']] = (int)$data['ordering'];
        }


also

after line 440 whitch seems like this :

               
// Bind the media to the product,

replace the line   

             
  return  $table->bindChecknStore($data);
With

       
$result = $table->bindChecknStore($data);

        if(!empty($data['mediaordering']) && !empty($data['virtuemart_'.$type.'_id'])){
            $db = JFactory::getDbo();
            $relationTable = '#__virtuemart_'.$type.'_medias';
            $entityId = (int)$data['virtuemart_'.$type.'_id'];
            foreach($data['mediaordering'] as $mediaId => $ordering){
                $query = $db->getQuery(true)
                    ->update($db->quoteName($relationTable))
                    ->set($db->quoteName('ordering').' = '.(int)$ordering)
                    ->where($db->quoteName('virtuemart_'.$type.'_id').' = '.$entityId)
                    ->where($db->quoteName('virtuemart_media_id').' = '.(int)$mediaId);
                $db->setQuery($query)->execute();
            }
        }

        return $result;