Sửa file
\wp-content\themes\Avada\includes\woo-config.php
dòng 666.
/*---------------------------------
function avada_woocommerce_catalog_ordering()
----------------------------------------*/
switch ( $pob ) {
case 'height':
$po = 'desc';
break;
case 'width':
$po = 'desc';
break;
/*---------------
tìm đến dòng switch ( $pob ) thêm vào như sau
function avada_woocommerce_catalog_ordering()
-------------------*/
switch ( $pob ) {
case 'height':
$order_string = __( 'Height', 'Avada' );
break;
case 'width':
$order_string = __( 'Width', 'Avada' );
break;
/*----------------------------
html hiển thị lên select box
function avada_woocommerce_catalog_ordering()
------------------------------*/
$html .= '<li class="' . ( ( $pob == 'width' ) ? 'current' : '' ) . '"><a href="' . fusion_add_url_parameter( $query_string, 'product_orderby', 'width' ) . '">' . __( 'Sort by', 'Avada' ) . ' <strong>' . __( 'width', 'Avada' ) . '</strong></a></li>';
$html .= '<li class="' . ( ( $pob == 'height' ) ? 'current' : '' ) . '"><a href="' . fusion_add_url_parameter( $query_string, 'product_orderby', 'height' ) . '">' . __( 'Sort by', 'Avada' ) . ' <strong>' . __( 'height', 'Avada' ) . '</strong></a></li>';
/*---------------
function avada_woocommerce_get_catalog_ordering_args
----------------------*/
function avada_woocommerce_get_catalog_ordering_args( $args ) {
global $woocommerce;
if ( isset( $_SERVER['QUERY_STRING'] ) ) {
parse_str( $_SERVER['QUERY_STRING'], $params );
}
$pob = ! empty( $params['product_orderby'] ) ? $params['product_orderby'] : 'default';
$po = ! empty( $params['product_order'] ) ? $params['product_order'] : 'asc';
switch ( $pob ) {
case 'width':
$orderby = 'meta_value_num';
$order = 'desc';
$meta_key = '_width';
break;
case 'height':
$orderby = 'meta_value_num';
$order = 'desc';
$meta_key = '_height';
break;
Trước khi thêm
sau khi thêm
No comments:
Post a Comment