 danstegman
|
I have a client who isn’t happy with the layout of a full product list, and she wants it broken down by category. Not an ideal solution, but that’s what the client wants. If I do a regular products-page, I can drag and drop the items to her satisfaction, but if I break it down by category, it reverts to sorting the items by date entered. Is there a way to specify in the short code how you want them sorted? I’ve tried doing a drag and drop sort inside of each product category, but that doesn’t seem to change it.
The shortcodes I’m using are like this:
[wpsc_products category_url_name='apparel']
Is there a way to add a sort=”dragndrop” or some such in there? Haven’t found it in the docs.
Thanks in advance,
Dan Stegman
|
 cheey2003
|
1. (WPeC version 3.8) Go to wpsc-includes > shortcode.functions.php
2. Edit the sort_order and order settings for the shortcode
function wpsc_products_shorttag($atts) {
$query = shortcode_atts(array(
'product_id' => 0,
'old_product_id' => 0,
'product_url_name' => null,
'product_name' => null,
'category_id' => 0,
'category_url_name' => null,
'tag' => null,
'price' => 0, //if price = 'sale' it shows all sale products
'limit_of_items' => 0,
'sort_order' => null, // author,date,title,modified,parent,ID,rand,comment_count
'order' => 'ASC', // ASC or DESC
'number_per_page' => 0,
'page' => 0,
), $atts);
Note: As this method requires overwriting an existing include file, you may need to edit the file every WPeC update.
|
 glenbod
|
thanks Cheey2003. worked like a charm. i don’t see why the sorting stops working for other templates, but thanks!
|
 glenbod
|
Stop the lorry !!! If you don’t want to change the code: The code gave me the answer.
You can add to [wpsc_products category_url_name='NAME OF YOUR CATEGORY'] any of the following with an argument (I haven’t tried them all to see the effect):
`’product_id’ => 0,
‘old_product_id’ => 0,
‘product_url_name’ => null,
‘product_name’ => null,
‘category_id’ => 0,
‘category_url_name’ => null,
‘tag’ => null,
‘price’ => 0, //if price = ‘sale’ it shows all sale products
‘limit_of_items’ => 0,
‘sort_order’ => null, // author,date,title,modified,parent,ID,rand,comment_count
‘order’ => ‘ASC’, // ASC or DESC
‘number_per_page’ => 0,
‘page’ => 0,`
So to order by title simply put this in your page:
[wpsc_products category_url_name='YOUR CATEGORY NAME' sort_order='title']
It does mean setting up a new page for each category and inserting the above code, but it will get you what you want.
|
 glenbod
|
I tried to tag the code in the post above correctly. Anyway, the code works nicely.
|