There is a demo online store in which there is a filter for sorting goods sidebar
Now the sorting of goods works alphabetically (in the forward and reverse direction) and the price in the drop-down list in one direction. I strive to make the price be implemented exactly the same way as the alphabet using a link, not a drop-down list (as can be seen in the picture and website), but unlike the list the link is not &orderby=price How can this be corrected? I give the code:
$product_order = array(); $product_order['menu_order'] = "Default"; $product_order['price'] = "Price"; $product_order_key = !empty($params['orderby']) ? $params['orderby'] : 'menu_order'; $product_sort_key = !empty($params['product_sort']) ? $params['product_sort'] : 'ASC'; $product_sort_key = strtolower($product_sort_key); ?> <div class="sort-param sort-param-order"> <div class="custom-select"> <div class="select-title"><?php echo $product_order[$product_order_key] ?></div> <ul class="select-list"></ul> <select name="param-count"> <option data-href="menu_order" selected value="menu_order"> <?php echo $product_order['menu_order'] ?> </option> <option data-href="price" value="price"> <?php echo $product_order['price'] ?> </option> </select> </div><!--/ .custom-select--> </div> <div class="order-param-button"> <a title="<?php esc_html_e('Click to order products', MAD_BASE_TEXTDOMAIN) ?>" data-href="price" data-sort="<?php echo esc_attr($product_sort_key) ?>&orderby=price" class="order-param-<?php echo sanitize_html_class($product_sort_key) ?>" href="javascript:void(0)"> <?php echo $product_order['price'] ?></a> </div><!--/ .order-param-button--> <div class="order-param-button"> <a title="<?php esc_html_e('Click to order products', MAD_BASE_TEXTDOMAIN) ?>" data-sort="<?php echo esc_attr($product_sort_key) ?>" class="order-param-<?php echo sanitize_html_class($product_sort_key) ?>" href="javascript:void(0)"> Алфавит</a> </div><!--/ .order-param-button--> ps now the price and the alphabet are considered only in one direction correctly, and when you click on them again, everything gets lost in a heap and the filter for some reason starts to be considered for all products