New Landing How can we help? Themeforest Theme Support Dante Override /swift-framework/sf-woocommerce.php

Viewing 16 post (of 16 total)
  • Posted in: Dante
  • #147666
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    I already told you I can’t go backward in my IDE(code editor). that login goes directly to that folder. Nevermind that now that I’m seeing the code changes you made and there is a better alternative to place this inside the child theme.

    Add the changes directly in the functions.php because the function inside sf-woocommerce check if the same function has already been declared previously in the child theme.

    
    /* Add Shipping Calculator to after cart action */
    	add_action( 'woocommerce_after_cart_table', 'woocommerce_shipping_calculator', 10 );
    	
    
    	/* ADD TO CART HEADER RELOAD
    	================================================== */ 
    	if (!function_exists('sf_woo_header_add_to_cart_fragment')) {
    		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="fa fa-shopping-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="fa fa-shopping-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="fa fa-shopping-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;
    			
    		}
    		add_filter('add_to_cart_fragments', 'sf_woo_header_add_to_cart_fragment'); 
    	}
    	

    -Rui

Viewing 16 post (of 16 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