Ordering products alphabetically

Home Forums General Help Ordering products alphabetically

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1054
    Marc
    Guest

    How can I order products in a grid display alphabetical order ?
    I already tried the shortcode orderid=”title” but this doesn’t work.

    #1055
    Marc
    Guest

    I meant orderby=”title”

    #1074
    wham
    Guest

    Where are you making the change to the code? It should work

    #1085
    Marc
    Guest

    @wham

    I inserted this code in the grid page like this

    [dpsc_grid_display category=”219″ column=”2″ per_page=”50″ order=”ASC” orderby=”title” type=”duka”]

    It doesn’t work. What am I doing wrong ?

    #1087
    wham
    Guest

    Well, the orderby cannot currently be input into the shortcode 🙁

    You have to edit DukaPress code. Currently it is set to order by date.

    #1097
    Marc
    Guest

    … and how do I do that ?
    Do I make the changes here ?

    * Shortcode to display product in grid views
    *
    */
    add_shortcode(‘dpsc_grid_display’, ‘dpsc_pnj_grid_display’);
    function dpsc_pnj_grid_display($atts, $content=null) {
    $dp_shopping_cart_settings = get_option(‘dp_shopping_cart_settings’);
    extract(shortcode_atts( array(
    ‘category’ => ‘1’,
    ‘total’ => ’12’,
    ‘column’ => ‘3’,
    ‘per_page’ => ”,
    ‘type’ => ‘post’,
    ‘order’ => ‘DESC’
    ), $atts));

    if (!empty($per_page)) {
    $pagenum = isset($_GET[‘dpage’]) ? $_GET[‘dpage’] : 1;
    $count = count(get_posts(‘numberposts=’ . $total . ‘&post_type=’ . $type . ‘&meta_key=price&category=’ . $category));
    $page_links = paginate_links( array(
    ‘base’ => add_query_arg( ‘dpage’, ‘%#%’ ),
    ‘format’ => ”,
    ‘prev_text’ => __(‘«’),
    ‘next_text’ => __(‘»’),
    ‘total’ => ceil($count / $per_page),
    ‘current’ => $pagenum
    ));
    $post_offset = ($pagenum-1) * $per_page;
    $offset = ‘&offset=’.$post_offset;
    $page_links = ” . $page_links . ”;
    }
    else {
    $per_page = $total;
    $offset = ”;
    $page_links = ”;
    }
    if ($order != ‘rand’) {
    $order_string = ‘orderby=post_date&order=’ . $order . ‘&’;
    }
    else {
    $order_string = ‘orderby=rand&’;
    }

    THANK YOU FOR YOUR HELP

    #1101
    wham
    Guest

    change this

    $order_string = ‘orderby=post_date&order=’ . $order . ‘&’;

    to

    $order_string = ‘orderby=title&order=’ . $order . ‘&’;

    #1209
    Marc
    Guest

    Works perfectly.
    Many thanks !!!

    #1212
    wham
    Guest

    you’re very welcome 🙂

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Ordering products alphabetically’ is closed to new replies.
© 2024 DukaPress. All rights reserved.
Design By Madoido.