Totally Zenned
- Join Date:
- Aug 2004
- Posts:
- 278
- Plugin Contributions:
- 0
Can specials be sorted?
Hi,
Is it possible to sort the specials and have them displayed in the newest special first order? If so, how would I go about doing this?
Thanks
Rick
Views: 4,910
Totally Zenned
Hi,
Is it possible to sort the specials and have them displayed in the newest special first order? If so, how would I go about doing this?
Thanks
Rick
Oba-san
Currently, there isn't a sort order to select on the Specials page and the Centerbox and sidebox are built from a random selection ...
You could customize these peices to sort your specials, but you don't want to lose the feature of having 9 out of 20 specials change between clicks for the customer as it is good spider food as well as good impulse shopping ... :smile:
Are you trying to sort the centerbox differently or the specials page itself?
Totally Zenned
We just want to sort the specials page itself.
Thanks
Rick
Oba-san
You would need to customize the sort for the Specials page:
/includes/modules/pages/specials/main_template_vars.php
NOTE: There is not an override for this file, so backup the original as well as your changes ...
The select statement currently reads:
$specials_query_raw = "SELECT p.products_id, p.products_image, pd.products_name
FROM (" . TABLE_PRODUCTS . " p
LEFT JOIN " . TABLE_SPECIALS . " s on p.products_id = s.products_id
LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
WHERE p.products_id = s.products_id and p.products_id = pd.products_id and p.products_status = '1'
AND s.status = 1
AND pd.language_id = :languagesID
ORDER BY s.specials_date_added DESC";
You need to alter the ORDER BY to better suit your needs ...
New Zenner
I want to do this too. If I want the Specials category on the main page to be alphabetical, how do I change this code? I tried specials_name but it didn't seem to like it much. lol Do I leave the DESC in there?
Sorry, I'm lost when it comes to coding.
Thanks!
Tracy
Oba-san
You would need to do the order by pd.products_name ...
New Zenner
Cool, thanks! Is there a way to sort them randomly? I sure wish I knew code!!
Oba-san
What is the point of sorting by name if you want them random? :unsure:
Look in the Specials Centerbox for how the specials can be sorted randomly ...
NOTE: the Specials Centerbox has a limit on how many are included that would need to be removed from the SELECT statement ...
New Zenner
Because I want to know how to do them both ways.
Thanks,
Tracy
New Zenner
Does anyone know how to sort the Specials category randomly? I'd really like to have it random.
Thanks!
Tracy
New Zenner
Random sorting of Specials? Anyone?
Oba-san
Have you peeked in the specials module for specials_index.php where it uses: ExecuteRandomMulti
You could alter the specials.php to utilize something similar with a little bit of tweaking ... :smile:
New Zenner
I have no idea how to do that. I'm not a coder. :(
Ajeh:
Have you peeked in the specials module for specials_index.php where it uses: ExecuteRandomMulti
You could alter the specials.php to utilize something similar with a little bit of tweaking ... :smile:
Are you talking about this line?
if ($specials_index_query != '') $specials_index = $db->ExecuteRandomMulti($specials_index_query, MAX_DISPLAY_SPECIAL_PRODUCTS_INDEX);
Do I paste it in the other file exactly the same way? Where is specials.php, the other guy told me to edit main_template_vars.php. Sorry, I'm really more of a hardware girl. Wires make sense, code doesn't!
Tracy
New Zenner
How do I modify the below code to sort by model number?
ORDER BY s.specials_date_added DESC";
ORDER BY s.specials_????? DESC";
Thanks
Oba-san
Seeing the whole SQL line would help to determine how to change the ORDER ...
New Zenner
Hi all..
Ive been trying to sort my specials page by sort_order with the following code but it keeps returning an unknown column error. My apologies, im not a programmer, but im assuming a need to define the column some how??? Please help...
$specials_query_raw = "SELECT p.products_id, p.products_image, pd.products_name,
p.master_categories_id
FROM (" . TABLE_PRODUCTS . " p
LEFT JOIN " . TABLE_SPECIALS . " s on p.products_id = s.products_id
LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
WHERE p.products_id = s.products_id and p.products_id = pd.products_id and p.products_status = '1'
AND s.status = 1
AND pd.language_id = :languagesID
ORDER BY sort_order, s.specials_date_added DESC";
1054 Unknown column 'sort_order' in 'order clause'
in:
[SELECT p.products_id, p.products_image, pd.products_name, p.master_categories_id FROM (zen_products p LEFT JOIN zen_specials s on p.products_id = s.products_id LEFT JOIN zen_products_description pd on p.products_id = pd.products_id ) INNER JOIN zen_categories_description cd ON (p.master_categories_id = cd.categories_id AND cd.language_id=1 AND cd.categories_description LIKE '%-###### Net 02-%') WHERE p.products_id = s.products_id and p.products_id = pd.products_id and p.products_status = '1' AND s.status = 1 AND pd.language_id = 1 ORDER BY sort_order, s.specials_date_added DESC limit 99]
Oba-san
Your error message and the SELECT that you posted do not match ...
Are you sure you are getting the SELECT from where the error is being generated? :unsure:
New Zenner
thats interesting..
the only change i made was to add "sort_order" to the line :
ORDER BY sort_order, s.specials_date_added DESC";
the orig was
ORDER BY s.specials_date_added DESC";
and thats the error that followed...
Ajeh:
Your error message and the SELECT that you posted do not match ...
Are you sure you are getting the SELECT from where the error is being generated? :unsure:
Oba-san
Could you go to the Tools ... Developers Tool Kit ... and in the bottom input box try a search on:
INNER JOIN
and select Catalog/Admin and click search ...
what file(s) come up?
Then a search on:
cd.categories_description
what file(s) come up?
do any contain a SELECT similar to the one you posted that displays in the error message?
If you read your SELECT statement then read the error message, you will notice there are things in the error message that are not even referenced in the SELECT ...
Oba-san
Also, you have:
sort_order
in the WHERE ... if this is from the table:
products
that should be:
p.products_sort_order
NOTE: the p is not really needed as it is unique but it helps with clarity ...
NOTE: If you added a new field to the table:
specials
for sort order, make sure that you spelled it correctly ...
Tell staff why this post should be reviewed.