New Landing How can we help? Themeforest Theme Support Dante adjust go to shop button

Viewing 15 posts - 16 through 30 (of 48 total)
  • Posted in: Dante
  • #151780
    Gizan86
    Member
    Post count: 252
    This reply has been marked as private.
    #151848
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    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">&times;</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
    Mohammad

    #151944
    Gizan86
    Member
    Post count: 252
    This reply has been marked as private.
    #151988
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I see that your changes are reflecting here. Please check attachment.
    Thanks
    Mohammad

    Attachments:
    You must be logged in to view attached files.
    #152010
    Gizan86
    Member
    Post count: 252

    Hi 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

    #152625
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Mohammad will assist your shortly

    – Kyle

    #152629
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    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
    Mohammad

    #152651
    Gizan86
    Member
    Post count: 252

    Hi Mohammed,
    everything seems to go wrong

    1) 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.
    #152969
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please provide me FTP login detail so i can make these changes to you easily.
    Thanks
    Mohammad

    #153211
    Gizan86
    Member
    Post count: 252
    This reply has been marked as private.
    #153389
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I managed to resolve the issue so please check.
    Thanks
    Mohammad

    #153442
    Gizan86
    Member
    Post count: 252
    This reply has been marked as private.
    #153507
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please transfer style.css of child theme to look this button correctly.
    Thanks
    Mohammad

    #153548
    Gizan86
    Member
    Post count: 252

    Thanks, it works!
    Great support..

    #153553
    Gizan86
    Member
    Post count: 252
    This reply has been marked as private.
Viewing 15 posts - 16 through 30 (of 48 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