New Landing How can we help? Themeforest Theme Support Dante WPML Currency Switcher placement

Viewing 7 posts - 1 through 7 (of 7 total)
  • Posted in: Dante
  • #252928
    mikexavier
    Member
    Post count: 28

    Hi, I’ve been talking to WPML support about trying to get their currency switcher up and running.

    They’ve asked me to ask you how to include this piece of code so it’s visible beside (ideally left, but right ok too) the language switcher (which comes as an integrated option with Dante). Am I right in that Dante does not come with a currency switcher by default?

    Code:

    <div id="my-currency-switcher">

    <?php do_action('currency_switcher', array('format' => '%name% (%symbol%)'));?>

    </div>

    Cheers again for your epic support!

    Mike

    #253148
    David Martin – Support
    Moderator
    Post count: 20834

    Hi,

    Please install and activate the child theme, you will need to open the child theme functions.php and override the function sf_aux_links().

    Paste this into your child theme functions.php:

    /* AUX LINKS
    	================================================== */
    	if (!function_exists('sf_aux_links')) {
    		function sf_aux_links($position, $alt_version = FALSE, $header_version = "") {
    
    			// VARIABLES
    			$login_url = wp_login_url();
    			$logout_url = wp_logout_url( home_url() );
    			$my_account_link = get_admin_url();
    			$myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
    			if ( $myaccount_page_id ) {
    				$my_account_link = get_permalink( $myaccount_page_id );
    				$logout_url = wp_logout_url( get_permalink( $myaccount_page_id ) );
    			  	$login_url = get_permalink( $myaccount_page_id );
    			  	if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) {
    			    	$logout_url = str_replace( 'http:', 'https:', $logout_url );
    					$login_url = str_replace( 'http:', 'https:', $login_url );
    				}
    			}
    			$my_account_link = apply_filters('sf_header_myaccount_url', $my_account_link);
    			$options = get_option('sf_dante_options');
    			$show_sub = $options['show_sub'];
    			$show_translation = $options['show_translation'];
    			$sub_code = $options['sub_code'];
    			$show_account = $options['show_account'];
    			$show_cart = $options['show_cart'];
    			$show_wishlist = $options['show_wishlist'];
    			$tb_search_text = $options['tb_search_text'];
    			$aux_links_output = $ss_enable = "";
    			$sub_text = apply_filters('sf_subscribe_text', __("Subscribe", "swiftframework"));
    
    			if (isset($options['ss_enable'])) {
    				$ss_enable = $options['ss_enable'];
    			} else {
    				$ss_enable = true;
    			}
    
    			// LINKS + SEARCH OUTPUT
    			$aux_links_output .= '<nav class="std-menu '.$position.'">'. "\n";
    			$aux_links_output .= '<ul class="menu">'. "\n";
    			if ($show_account) {
    				if (is_user_logged_in()) {
    					$aux_links_output .= '<li><a href="'.wp_logout_url(home_url()).'">'. __("Sign Out", "swiftframework") .'</a></li>'. "\n";
    					if ( $myaccount_page_id ) {
    					$aux_links_output .= '<li><a href="'.$my_account_link.'" class="admin-link">'. __("My Account", "swiftframework") .'</a></li>'. "\n";
    					} else {
    					$aux_links_output .= '<li><a href="'.get_admin_url().'" class="admin-link">'. __("My Account", "swiftframework") .'</a></li>'. "\n";
    					}
    				} else {
    					$aux_links_output .= '<li><a href="'.$login_url.'">'. __("Login", "swiftframework") .'</a></li>'. "\n";
    				}
    			}
    			if ($show_sub) {
    				$aux_links_output .= '<li class="parent"><a href="#">'. $sub_text .'</a>'. "\n";
    				$aux_links_output .= '<ul class="sub-menu">'. "\n";
    				$aux_links_output .= '<li><div id="header-subscribe" class="clearfix">'. "\n";
    				$aux_links_output .= do_shortcode($sub_code) . "\n";
    				$aux_links_output .= '</div></li>'. "\n";
    				$aux_links_output .= '</ul>'. "\n";
    				$aux_links_output .= '</li>'. "\n";
    			}
    			if ($show_translation) {
    				$aux_links_output .= '<li class="parent aux-languages"><a href="#">'. __("Language", "swiftframework") .'</a>'. "\n";
    				$aux_links_output .= '<ul id="header-languages" class="sub-menu">'. "\n";
    				if (function_exists( 'sf_language_flags' )) {
    				$aux_links_output .= sf_language_flags();
    				}
    				$aux_links_output .= '</ul>'. "\n";
    				$aux_links_output .= '</li>'. "\n";
    				$aux_links_output .= '<li class="my-currency-switcher">'; ?>
    					<?php do_action('currency_switcher', array('format' => '%name% (%symbol%)'));?>
    				<?php
    				$aux_links_output .= '</li>'. "\n";
    			}
    			if ($header_version != "header-1") {
    				if ($show_cart) {
    				$aux_links_output .= sf_get_cart();
    				}
    				if ( class_exists( 'YITH_WCWL_UI' ) && $show_wishlist)  {
    				$aux_links_output .= sf_get_wishlist();
    				}
    			}
    				if (($position == "header-menu" && !$alt_version) && $ss_enable) {
    				$aux_links_output .= '<li><a class="swift-search-link" href="#"><i class="ss-zoomin"></i><span>'.do_shortcode($tb_search_text).'</span></a></li>'. "\n";
    				}
    			$aux_links_output .= '</ul>'. "\n";
    			$aux_links_output .= '</nav>'. "\n";
    
    			// RETURN
    			return $aux_links_output;
    		}
    	}

    Thanks.

    #253181
    mikexavier
    Member
    Post count: 28

    Hey, thanks for the reply… I added the code to the functions.php in child theme and it displayed the currency switcher but full width above the logo and below the top bar.

    Any other ideas on how to get integrated a little cleaner?

    Thanks!

    Mike

    Attachments:
    You must be logged in to view attached files.
    #253184
    mikexavier
    Member
    Post count: 28

    …even next to the shopping cart icon would make sense if that’s easier?

    #253345
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code at functions.php file instead of last code:-

    if (!function_exists('sf_aux_links')) {
    		function sf_aux_links($position, $alt_version = FALSE, $header_version = "") {
    
    			// VARIABLES
    			$login_url = wp_login_url();
    			$logout_url = wp_logout_url( home_url() );
    			$my_account_link = get_admin_url();
    			$myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
    			if ( $myaccount_page_id ) {
    				$my_account_link = get_permalink( $myaccount_page_id );
    				$logout_url = wp_logout_url( get_permalink( $myaccount_page_id ) );
    			  	$login_url = get_permalink( $myaccount_page_id );
    			  	if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) {
    			    	$logout_url = str_replace( 'http:', 'https:', $logout_url );
    					$login_url = str_replace( 'http:', 'https:', $login_url );
    				}
    			}
    			$my_account_link = apply_filters('sf_header_myaccount_url', $my_account_link);
    			$options = get_option('sf_dante_options');
    			$show_sub = $options['show_sub'];
    			$show_translation = $options['show_translation'];
    			$sub_code = $options['sub_code'];
    			$show_account = $options['show_account'];
    			$show_cart = $options['show_cart'];
    			$show_wishlist = $options['show_wishlist'];
    			$tb_search_text = $options['tb_search_text'];
    			$aux_links_output = $ss_enable = "";
    			$sub_text = apply_filters('sf_subscribe_text', __("Subscribe", "swiftframework"));
    
    			if (isset($options['ss_enable'])) {
    				$ss_enable = $options['ss_enable'];
    			} else {
    				$ss_enable = true;
    			}
    
    			// LINKS + SEARCH OUTPUT
    			$aux_links_output .= '<nav class="std-menu '.$position.'">'. "\n";
    			$aux_links_output .= '<ul class="menu">'. "\n";
    			if ($show_account) {
    				if (is_user_logged_in()) {
    					$aux_links_output .= '<li><a href="'.wp_logout_url(home_url()).'">'. __("Sign Out", "swiftframework") .'</a></li>'. "\n";
    					if ( $myaccount_page_id ) {
    					$aux_links_output .= '<li><a href="'.$my_account_link.'" class="admin-link">'. __("My Account", "swiftframework") .'</a></li>'. "\n";
    					} else {
    					$aux_links_output .= '<li><a href="'.get_admin_url().'" class="admin-link">'. __("My Account", "swiftframework") .'</a></li>'. "\n";
    					}
    				} else {
    					$aux_links_output .= '<li><a href="'.$login_url.'">'. __("Login", "swiftframework") .'</a></li>'. "\n";
    				}
    			}
    			if ($show_sub) {
    				$aux_links_output .= '<li class="parent"><a href="#">'. $sub_text .'</a>'. "\n";
    				$aux_links_output .= '<ul class="sub-menu">'. "\n";
    				$aux_links_output .= '<li><div id="header-subscribe" class="clearfix">'. "\n";
    				$aux_links_output .= do_shortcode($sub_code) . "\n";
    				$aux_links_output .= '</div></li>'. "\n";
    				$aux_links_output .= '</ul>'. "\n";
    				$aux_links_output .= '</li>'. "\n";
    			}
    			if ($show_translation) {
    				$aux_links_output .= '<li class="parent aux-languages"><a href="#">'. __("Language", "swiftframework") .'</a>'. "\n";
    				$aux_links_output .= '<ul id="header-languages" class="sub-menu">'. "\n";
    				if (function_exists( 'sf_language_flags' )) {
    				$aux_links_output .= sf_language_flags();
    				}
    				$aux_links_output .= '</ul>'. "\n";
    				$aux_links_output .= '</li>'. "\n";
    				
    			}
    			if ($header_version != "header-1") {
    				if ($show_cart) {
    				$aux_links_output .= sf_get_cart();
    				}
    
    $aux_links_output .= '<li class="my-currency-switcher">'; ?>
    					<?php do_action('currency_switcher', array('format' => '%name% (%symbol%)'));?>
    				<?php
    				$aux_links_output .= '</li>'. "\n";
    				if ( class_exists( 'YITH_WCWL_UI' ) && $show_wishlist)  {
    				$aux_links_output .= sf_get_wishlist();
    				}
    			}
    				if (($position == "header-menu" && !$alt_version) && $ss_enable) {
    				$aux_links_output .= '<li><a class="swift-search-link" href="#"><i class="ss-zoomin"></i><span>'.do_shortcode($tb_search_text).'</span></a></li>'. "\n";
    				}
    			$aux_links_output .= '</ul>'. "\n";
    			$aux_links_output .= '</nav>'. "\n";
    
    			// RETURN
    			return $aux_links_output;
    		}
    	}
    

    Thanks
    Mohammad

    #253427
    mikexavier
    Member
    Post count: 28

    Thanks, I’m not sure what I’ve done, but adding this code doesn’t display anything.

    I played around with the shortcode for the currency switcher placing it in the top bar and then customizing with CSS … seems to be a workable solution for now.

    #253430
    David Martin – Support
    Moderator
    Post count: 20834

    Glad you got it sorted, the looks to have also need some custom CSS. If you decide to go with the above please add that to the site and let us know and we will help you with that.

    Thanks.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register