X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   New sort option as default (https://forum.x-cart.com/showthread.php?t=78567)

Ed B. 01-02-2024 12:13 PM

New sort option as default
 
This is a kind of follow up to an old thread https://forum.x-cart.com/showthread.php?t=78285


The module on the page https://developer.x-cart.com/5.4/basics/itemslist_introduction_--_showing_products_on_a_page/adding_new_so...n_to_itemslist shows how to add a new sort option to items list. Now I would like to make this new option the default sort order.


What we have, before adding new sort option is on the admin page admin.php?target=general_settings is what I attach below.


Now the drop down menu seems to come from the class View/FormField/Select/DefaultProductSortOrder.php



So I created a class that looks like
Code:

<?php
namespace XLite\Module\XCExample\SortingByDate\View\FormField\Select;

abstract class  DefaultProductSortOrder extends \XLite\View\FormField\Select\Def
aultProductSortOrder implements \XLite\Base\IDecorator
{
    protected function getDefaultOptions()
    {
        return array(
            'dateAsc'  => static::t('Date asc')
            'priceAsc'  => static::t('Price asc'),
            'priceDesc' => static::t('Price desc'),
            'nameAsc'  => static::t('Name asc'),
            'nameDesc'  => static::t('Name desc'),
        );
    }
}




However, this doesn't even compile (that is, after cache redeployment, there is no corresponding class under /var/run)


So, would anyone know how to make arrival date as default order?







All times are GMT -8. The time now is 08:00 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.