<commit_before><?php namespace Octommerce\Octommerce\Classes;

use Db;
use Octommerce\Octommerce\Contracts\QuerySort;

class ProductSort extends QuerySort
{
    public $implement;

    /**
     * @inheritDoc
     */
    protected $sortList = [
        'name asc'        => 'Name (ascending)',
        'name desc'       => 'Name (descending)',
        'created_at asc'  => 'Created (ascending)',
        'created_at desc' => 'Created (descending)',
        'price asc'       => 'Price (ascending)',
        'price desc'      => 'Price (descending)',
        'random'          => 'Random',
        'sort_order asc'  => 'Reordered (ascending)',
        'sort_order desc' => 'Reordered (descending)',
        'salesAsc'        => 'Sales (ascending)',
        'salesDesc'       => 'Sales (descending)'
    ];

    /**
     * Order random products
     */
    public function random()
    {
        $this->builder->orderByRaw("RAND()");
    }

    /**
     * Order products by sales (Ascending)
     */
    public function salesAsc()
    {
        $this->orderBySales();
    }

    /**
     * Order products by sales (Descending)
     */
    public function salesDesc()<commit_msg>Fix ambiguous when order by created_at<commit_after><?php namespace Octommerce\Octommerce\Classes;

use Db;
use Octommerce\Octommerce\Contracts\QuerySort;

class ProductSort extends QuerySort
{
    public $implement;

    /**
     * @inheritDoc
     */
    protected $sortList = [
        'name asc'        => 'Name (ascending)',
        'name desc'       => 'Name (descending)',
        'createtAtAsc'    => 'Created (ascending)',
        'createtAtDesc'   => 'Created (descending)',
        'price asc'       => 'Price (ascending)',
        'price desc'      => 'Price (descending)',
        'random'          => 'Random',
        'sort_order asc'  => 'Reordered (ascending)',
        'sort_order desc' => 'Reordered (descending)',
        'salesAsc'        => 'Sales (ascending)',
        'salesDesc'       => 'Sales (descending)'
    ];

    /**
     * Order products by created_at asc
     */
    public function createtAtAsc()
    {
        $this->builder->orderBy('octommerce_octommerce_products.created_at', "asc");
    }

    /**
     * Order products by created_at desc
     */
    public function createtAtDesc()
    {
        $this->builder->orderBy('octommerce_octommerce_products.created_at', 'desc');
    }

    /**
     * Order random products
     */
    public function random()
    {
        $this->builder->orderByRaw('RAND()');
    }

    /**
     * Order products by sales (Ascending)
     */
    public function salesAsc()
    {
        $this->orderBySales();
    }

    /**
     * Order products by sales (Descending)
     */
    public function salesDesc()
{'fraction_non_alphanumeric': 0.14368650217706821, 'fraction_numerical': 0.0, 'mean_word_length': 2.140091116173121, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7184791', 'n_tokens_mistral': 834, 'n_tokens_neox': 808, 'n_words': 182}