- This topic has 21 replies, 3 voices, and was last updated 6 years, 3 months ago by Tom.
-
AuthorPosts
-
January 8, 2018 at 3:15 am #465650Jacob
Hื
I wanted to know if I could,Adding a cart icon with number of items and total cost in nav menu.January 8, 2018 at 8:58 am #465951LeoStaffCustomer SupportHi there,
Take a look at this for the quantity: https://generatepress.com/forums/topic/show-quantity-in-cart-in-menu-instead-of-total-costs/
The cost should be there by default. You can check it out here:
http://demo.generatepress.com/shop/Let me know if this helps.
January 8, 2018 at 3:05 pm #466223JacobThanks. Leo
I just add this code, its work.
But the icon did not change, it’s still CART
After I press CART it does not open a window and shows me the stuff.January 8, 2018 at 4:25 pm #466262LeoStaffCustomer SupportMake sure this option is not checked: https://docs.generatepress.com/article/load-essentials-icons/
January 9, 2018 at 2:00 am #466429JacobNo. I still have the title Rewriting Cart. It does not change it to the icon.
I want it to look like this site template: https://www.templatemonster.com/demo/60096.htmlWhen I click on the icon, I open a small window that has the View Cart / Checkout option.
And it shows me the products I’ve put into the basketJanuary 9, 2018 at 9:11 am #466812TomLead DeveloperLead DeveloperIn the code Leo linked to: https://generatepress.com/forums/topic/show-quantity-in-cart-in-menu-instead-of-total-costs/#post-332691
Find this:
<?php _e( 'Cart','generate-woocommerce' );?>
And replace it with this:
<i class="fa fa-cart"></i>
January 9, 2018 at 10:06 am #466858JacobHi. Tom Thanks for the replay
But it still does not look like a website template I put here.
And I replaced what you told me to change. And still do not have the icon (product basket)January 9, 2018 at 2:29 pm #466998LeoStaffCustomer SupportLooks like it’s working to me: https://s18.postimg.org/69i6019w9/2018-01-09_1429.png
January 9, 2018 at 2:59 pm #467033JacobThanks Leo
Yes, I managed to fix it. But I wanted to click on an icon, open a window that could see the products and improve cart / checkout
As formatted on this site
https://www.templatemonster.com/demo/60096.htmlJanuary 9, 2018 at 7:17 pm #467171TomLead DeveloperLead DeveloperAt this point that would require a custom plugin, although we do have something like that planned in a future version.
I believe one of our users created a custom plugin to achieve this sort of layout (without any styling). If you join our Facebook group (GeneratePress Community) and ask about it, someone might be able to point you to that plugin.
January 10, 2018 at 7:14 am #467605JacobThanks Tom
I think I’ll stick with the code you gave me here.
But my problem with this code, which I can not seem to translate into my language.
(View your shopping cart) this title to my languageJanuary 10, 2018 at 10:03 am #467770TomLead DeveloperLead DeveloperThat text is on the line above where you switched out the cart text for the icon – you should be able to edit it directly.
January 10, 2018 at 11:49 am #467863JacobI changed the title, but he does not recognize my language (Hebrew)
He shows me icons of question marks
https://s10.postimg.org/k9frwme15/image.jpgJanuary 10, 2018 at 11:38 pm #468159TomLead DeveloperLead DeveloperCan I see your code? Paste it into the editor, highlight it and then click the “code” button in the editor toolbox ๐
January 11, 2018 at 12:33 am #468174Jacob<?php /** * GeneratePress. * * Please do not make any edits to this file. All edits should be done in a child theme. * * @package GeneratePress */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } // Set our theme version. define( 'GENERATE_VERSION', '2.0.1' ); if ( ! function_exists( 'generate_setup' ) ) { add_action( 'after_setup_theme', 'generate_setup' ); /** * Sets up theme defaults and registers support for various WordPress features. * * @since 0.1 */ function generate_setup() { // Make theme available for translation. load_theme_textdomain( 'generatepress' ); // Add theme support for various features. add_theme_support( 'automatic-feed-links' ); add_theme_support( 'post-thumbnails' ); add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'status' ) ); add_theme_support( 'woocommerce' ); add_theme_support( 'title-tag' ); add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) ); add_theme_support( 'customize-selective-refresh-widgets' ); add_theme_support( 'custom-logo', array( 'height' => 70, 'width' => 350, 'flex-height' => true, 'flex-width' => true ) ); // Register primary menu. register_nav_menus( array( 'primary' => __( 'Primary Menu', 'generatepress' ), ) ); /** * Set the content width to something large * We set a more accurate width in generate_smart_content_width() */ global $content_width; if ( ! isset( $content_width ) ) { $content_width = 1200; /* pixels */ } // This theme styles the visual editor to resemble the theme style. add_editor_style( 'css/admin/editor-style.css' ); } } /** * Get all necessary theme files */ require get_template_directory() . '/inc/theme-functions.php'; require get_template_directory() . '/inc/defaults.php'; require get_template_directory() . '/inc/class-css.php'; require get_template_directory() . '/inc/css-output.php'; require get_template_directory() . '/inc/general.php'; require get_template_directory() . '/inc/customizer.php'; require get_template_directory() . '/inc/markup.php'; require get_template_directory() . '/inc/element-classes.php'; require get_template_directory() . '/inc/typography.php'; require get_template_directory() . '/inc/plugin-compat.php'; require get_template_directory() . '/inc/migrate.php'; require get_template_directory() . '/inc/deprecated.php'; if ( is_admin() ) { require get_template_directory() . '/inc/meta-box.php'; require get_template_directory() . '/inc/dashboard.php'; } /** * Load our theme structure */ require get_template_directory() . '/inc/structure/archives.php'; require get_template_directory() . '/inc/structure/comments.php'; require get_template_directory() . '/inc/structure/featured-images.php'; require get_template_directory() . '/inc/structure/footer.php'; require get_template_directory() . '/inc/structure/header.php'; require get_template_directory() . '/inc/structure/navigation.php'; require get_template_directory() . '/inc/structure/post-meta.php'; require get_template_directory() . '/inc/structure/sidebars.php'; function custom_wc_cart_link() { ob_start(); ?> <a href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" class="cart-contents" title="ืขืืื ืฉืื"<?php esc_attr_e( 'View your shopping cart','generate-woocommerce' ); ?>"> <i class="fa fa-shopping-cart" aria-hidden="true"></i> <small><?php echo sprintf ( _n( '%d', '%d', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?></small> </a> <?php return ob_get_clean(); } function custom_wc_menu_cart( $nav, $args ) { if ( $args->theme_location == 'primary' && generatepress_wc_get_setting( 'cart_menu_item' ) ) { return sprintf( '%1$s <li class="wc-menu-item %4$s" title="%2$s"> %3$s </li>', $nav, esc_attr__( 'View your shopping cart','generate-woocommerce' ), custom_wc_cart_link(), is_cart() ? 'current-menu-item' : '' ); } // Our primary menu isn't set, return the regular nav return $nav; } add_action( 'after_setup_theme','remove_wc_cart_item' ); function remove_wc_cart_item() { remove_filter( 'wp_nav_menu_items','generatepress_wc_menu_cart', 10, 2 ); add_filter( 'wp_nav_menu_items','custom_wc_menu_cart', 10, 2 ); add_filter( 'woocommerce_add_to_cart_fragments', 'custom_wc_cart_link' ); }
-
AuthorPosts
- You must be logged in to reply to this topic.