Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Dante › adjust go to shop button
New Landing › How can we help? › Themeforest Theme Support › Dante › adjust go to shop button
- This topic has 47 replies, 4 voices, and was last updated 9 years by Mohammad – SUPPORT.
-
Posted in: Dante
-
February 19, 2015 at 9:01 pm #151780This reply has been marked as private.February 20, 2015 at 5:51 am #151848
Hi,
You need to paste and edit this code at functions.php of child theme.function sf_woo_header_add_to_cart_fragment( $fragments ) { global $woocommerce; ob_start(); $cart_count = $woocommerce->cart->cart_contents_count; $cart_count_text = sf_product_items_text($cart_count); $options = get_option('sf_dante_options'); $show_cart_count = false; if (isset($options['show_cart_count'])) { $show_cart_count = $options['show_cart_count']; } ?> <li class="parent shopping-bag-item"> <?php if ($show_cart_count) { ?> <a class="cart-contents" href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping cart', 'swiftframework'); ?>"><i class="ss-cart"></i><?php echo $woocommerce->cart->get_cart_total(); ?> (<?php echo $cart_count; ?>)</a> <?php } else { ?> <a class="cart-contents" href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping cart', 'swiftframework'); ?>"><i class="ss-cart"></i><?php echo $woocommerce->cart->get_cart_total(); ?></a> <?php } ?> <ul class="sub-menu"> <li> <div class="shopping-bag"> <?php if ( $cart_count != "0" ) { ?> <div class="bag-header"><?php echo $cart_count_text; ?> <?php _e('in the shopping bag', 'swiftframework'); ?></div> <div class="bag-contents"> <?php foreach ($woocommerce->cart->cart_contents as $cart_item_key => $cart_item) { ?> <?php $bag_product = $cart_item['data']; $product_title = $bag_product->get_title(); ?> <?php if ($bag_product->exists() && $cart_item['quantity']>0) { ?> <div class="bag-product clearfix"> <figure><a class="bag-product-img" href="<?php echo get_permalink($cart_item['product_id']); ?>"><?php echo $bag_product->get_image(); ?></a></figure> <div class="bag-product-details"> <div class="bag-product-title"> <a href="<?php echo get_permalink($cart_item['product_id']); ?>"> <?php echo apply_filters('woocommerce_cart_widget_product_title', $product_title, $bag_product); ?></a> </div> <div class="bag-product-price"><?php _e("Unit Price:", "swiftframework"); ?> <?php echo woocommerce_price($bag_product->get_price()); ?></div> <div class="bag-product-quantity"><?php _e('Quantity:', 'swiftframework'); ?> <?php echo $cart_item['quantity']; ?></div> </div> <?php echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf('<a href="%s" class="remove" title="%s">×</a>', esc_url( $woocommerce->cart->get_remove_url( $cart_item_key ) ), __('Remove this item', 'woocommerce') ), $cart_item_key ); ?> </div> <?php } ?> <?php } ?> </div> <div class="bag-buttons"> <a class="sf-button standard sf-icon-reveal bag-button" href="<?php echo esc_url( $woocommerce->cart->get_cart_url() ); ?>"><i class="ss-view"></i><span class="text"><?php _e('View shopping bag', 'swiftframework'); ?></span></a> <a class="sf-button standard sf-icon-reveal checkout-button" href="<?php echo esc_url( $woocommerce->cart->get_checkout_url() ); ?>"><i class="ss-creditcard"></i><span class="text"><?php _e('Proceed to checkout', 'swiftframework'); ?></span></a> </div> <?php } else { ?> <div class="bag-header"><?php _e("0 items in the shopping bag", "swiftframework"); ?></div> <div class="bag-empty"><?php _e('Unfortunately, your shopping bag is empty.','swiftframework'); ?></div> <div class="bag-buttons"> <?php $shop_page_url = ""; if ( version_compare( WOOCOMMERCE_VERSION, "2.1.0" ) >= 0 ) { $shop_page_url = get_permalink( wc_get_page_id( 'shop' ) ); } else { $shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) ); } ?> <a class="sf-button standard sf-icon-reveal checkout-button" href="<?php echo esc_url( $shop_page_url ); ?>"><i class="ss-cart"></i><span class="text"><?php _e('Go to the shop', 'swiftframework'); ?></span></a> </div> <?php } ?> </div> </li> </ul> </li> <?php $fragments['.shopping-bag-item'] = ob_get_clean(); return $fragments; }
In this code, you can change all your desire text and links easily.
Thanks
MohammadFebruary 20, 2015 at 12:21 pm #151944This reply has been marked as private.February 20, 2015 at 2:21 pm #151988Hi,
I see that your changes are reflecting here. Please check attachment.
Thanks
MohammadAttachments:
You must be logged in to view attached files.February 20, 2015 at 3:33 pm #152010Hi Mohammad,
>That is the old code that I removed because your code gives me a white screen.
I inserted the code you gave now and left it now. As you can see my whole screen is white at the moment.>The screenshot you show is only of the first second, then for some reason it switches to the old cart dropdown. (as you see the button is also not showing in your screenshot, after the first seconds it does)
thanks
February 24, 2015 at 8:48 am #152625Mohammad will assist your shortly
– Kyle
February 24, 2015 at 9:00 am #152629Hi,
1)I want to exchange the button url for the shop to a custom page.
I see that you have resolved the issue.2) I want to change the text on the button from “go to shop” to “place an order”
Please paste this code at functions.php of child theme.function sf_text_strings( $translated_text, $text, $domain ) { switch ( $translated_text ) { case 'go to shop' : $translated_text = __( 'Place an order', 'woocommerce' ); break; } return $translated_text; } add_filter( 'gettext', 'sf_text_strings', 20, 3 );
Thanks
MohammadFebruary 24, 2015 at 10:03 am #152651Hi Mohammed,
everything seems to go wrong1) I don’t know why you say this? It shows the default shopping page, not my own url. (see screenshot 1)
2) If I past this code in functions .php it does not work and it shows a string on my website. (see screenshot 2)
* I have pasted your previous code of post #151848 in functions.php but as I said when I paste that code my whole website goes blank. (I left it like that for 4 days so you could see but just removed the functions code yesterday because I need to use the website and otherwise it is unusable.
Attachments:
You must be logged in to view attached files.February 25, 2015 at 9:11 am #152969Hi,
Please provide me FTP login detail so i can make these changes to you easily.
Thanks
MohammadFebruary 25, 2015 at 11:16 pm #153211This reply has been marked as private.February 26, 2015 at 12:43 pm #153389Hi,
I managed to resolve the issue so please check.
Thanks
MohammadFebruary 26, 2015 at 2:36 pm #153442This reply has been marked as private.February 26, 2015 at 4:43 pm #153507Hi,
Please transfer style.css of child theme to look this button correctly.
Thanks
MohammadFebruary 26, 2015 at 7:33 pm #153548Thanks, it works!
Great support..February 26, 2015 at 8:02 pm #153553This reply has been marked as private. -
Posted in: Dante
You must be logged in and have valid license to reply to this topic.