Hi,
on my 1.7.4.3 Shop i have a default core's "sort by" mechanism from SearchProvider.php/GetAvailableSortOrders() where i can choise entity, field and direction of my sort order.
$sortSalesDesc = new SortOrder('product', 'sales', 'desc');
But in BO i have set many features for my products (like weight, year, ecc).
How i can modify my sort order using the value of this features getting the info from the various ps_feature_xx tab? I also created a simply view on DB that collect quickly the data i search for, but how i can sort from this view?
USE psdb;
CREATE VIEW v_ps_product_sort
AS
SELECT
p.id_product,
fp.id_feature_value,
p.price,
p.date_add,
pl.name,
fvl.value
FROM
psdb.ps_product as p,
psdb.ps_product_lang as pl,
psdb.ps_feature_product as fp,
psdb.ps_feature_value_lang as fvl
WHERE
p.id_product = pl.id_product and
p.id_product = fp.id_product and
fvl.id_feature_value = fp.id_feature_value and
fp.id_feature = 9 and
pl.id_shop = 11 and
pl.id_lang = 1 and
fvl.id_lang = 1
order by fvl.value asc;
$sortMyFeatures = new SortOrder('?????', 'db view column name', 'desc');
i find various guide to add 'sortby' item but all these get data from simply DB tab, not from the union between two or more related tables or from view.
Thanks