VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Quality & Testing VirtueMart 1.1.x => Virtuemart 1.1 Development (Archiv) => Q&T Resolved => Topic started by: donmarvin on July 13, 2008, 03:06:03 AM

Title: SOLVED: productsnapshots output order when displaying a row of products
Post by: donmarvin on July 13, 2008, 03:06:03 AM
VM 1.1; J1.5

When listing a row of product ID's like this:

{product_snapshot:id=161|160|157|155}

the output always returns the row in order of product ID, not the order you put it in.  For example, the products in the code above would be shown in this order:

155, 157, 160, 161

To correct this, in plugins/content/vmproductsnapshots.php, around line 160, directly after:   

$db->query( $q ) ;

insert this code:

   
    $ordering=explode(",",$params['id']);
    $db->recordx = array();
    foreach($ordering as $key1 => $value1) {
        foreach ($db->record as $key2 => $value2) {
            $a = "'" . $value2->product_id . "'";
            if ($a == $value1) {
                $db->recordx[] = $value2;
            }
        }
    }
    foreach($db->record as $key => $value) {
        $db->record[$key] = $db->recordx[$key];
    }


This should display the products in the order in which you designated.
Title: Re: SOLVED: productsnapshots output order when displaying a row of products
Post by: aravot on July 24, 2008, 20:44:57 PM
Fixed in SVN 1485, thank you.