Setup second level sort order

In Mypdf.php, modify the cmp method to this (secondary sort by SKU): 

private function cmp($a, $b)
{
    $productDetailsArray = array('custom','custom2','custom3','custom4','custom5','Sku','Name');
    if (in_array($this->_sortBy, $productDetailsArray)) {
        if ($a['productDetails'][$this->_sortBy] != $b['productDetails'][$this->_sortBy]) {
            return $a['productDetails'][$this->_sortBy] > $b['productDetails'][$this->_sortBy];
        }
        else {
            return $a['productDetails']['Sku'] > $b['productDetails']['Sku'];
        }
    }
    //return strcmp($a[$this->_sortBy], $b[$this->_sortBy]);
    return $a[$this->_sortBy] > $b[$this->_sortBy];
}

Still need help? Contact Us Contact Us