• Resolved lodisy

    (@lodisy)


    Hello,

    as some brands names include char that still cannot be recognized, for example brand name ΛCROИYM? with slug acronym will result a null navigation for the listing.

    Changing the following code does not work:

    protected static function replace_specials_characters($s){
    		$s = preg_replace("/á|à|a|?|a/","a",$s);
    		$s = preg_replace("/á|à|?|?|Λ/","A",$s);//not working
    		$s = preg_replace("/é|è|ê/","e",$s);
    		$s = preg_replace("/é|è|ê/","E",$s);
    		$s = preg_replace("/í|ì|?/","i",$s);
    		$s = preg_replace("/í|ì|?/","I",$s);
    		$s = preg_replace("/ó|ò|?|?|o/","o",$s);
    		$s = preg_replace("/ó|ò|?|?/","O",$s);
    		$s = preg_replace("/ú|ù|?/","u",$s);
    		$s = preg_replace("/ú|ù|?/","U",$s);
    		$s = preg_replace("/ü/","UE",$s);
        	$s = preg_replace("/ü/","ue",$s);
    		$s = preg_replace('/[^a-zA-Z0-9_.-]/', '', $s);
    		return $s;
    	}
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter lodisy

    (@lodisy)

    I have changed the code into:

    public static function get_brands( $hide_empty = false, $order_by = 'slug', $order = 'ASC', $only_featured = false, $pwb_term = false )

    and also:

    $brands         = \Perfect_Woocommerce_Brands\Perfect_Woocommerce_Brands::get_brands( true, 'slug', 'ASC' );
    
    $letter = $brand->slug[0];
    

    It works except the ASC order is not correct, seems like order by the create time of the brand ( not sure yet).

    https://i.loli.net/2018/12/22/5c1d32c2b4085.jpg

    • This reply was modified 6 years, 2 months ago by lodisy.
    Thread Starter lodisy

    (@lodisy)

    It works well after I re create brands and assign products to them.

    Plugin Contributor titodevera

    (@titodevera)

    Solved ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to order brands via slug rather than name in a-z listing?’ is closed to new replies.