Viewing 15 posts - 1 through 15 (of 26 total)
  • #218602
    fixers
    Member
    Post count: 253

    Hi Guys

    Id like to change text and the link on the bag button in the drop down cart, when the cart is empty to a different page other then shop?

    Is this possible please?

    #218731
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please attach a marked screenshot to indicate the button link position because i am just little bit confuse.
    Thanks
    Mohammad

    #219900
    fixers
    Member
    Post count: 253

    Hi Mohammad

    Apologies for slow reply, out of office.

    See attached, I have had to use a screenshot from your demo site as the button is hidden on my site using css. The button which says go to shop -I would like to say ‘Browse’ and I would like to be able to point it to a custom URL.

    Is it possible?

    Attachments:
    You must be logged in to view attached files.
    #219926
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code at functions.php of child theme.

    function sf_woo_header_add_to_cart_fragment( $fragments ) {
    			global $woocommerce;
    
    			ob_start();
    
    			$cart_total = WC()->cart->get_cart_total();
    			$cart_count = $woocommerce->cart->cart_contents_count;
    			$cart_count_text = sf_product_items_text($cart_count);
    
    			$options = get_option('sf_neighborhood_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 bag', 'swiftframework'); ?>"><i class="sf-cart"></i><?php echo $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 bag', 'swiftframework'); ?>"><i class="sf-cart"></i><?php echo $cart_total; ?></a>
    				<?php }  ?>
    
    				<ul class="sub-menu">
    					<li>
    						<div class="shopping-bag">
    
    							<?php if ( sizeof($woocommerce->cart->cart_contents)>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
    									        $_product     		 = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
    									        $price 				 = apply_filters( 'woocommerce_cart_item_price', $woocommerce->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
    
    									        $product_title       = $_product->get_title();
    									        $product_short_title = ( strlen( $product_title ) > 25 ) ? substr( $product_title, 0, 22 ) . '...' : $product_title;
    								        ?>
    
    								        <?php if ($_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 $_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_short_title, $_product ); ?></a>
    									           		</div>
    									            	<div class="bag-product-price"><?php _e("Unit Price:", "swiftframework"); ?> <?php echo $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', 'swiftframework') ), $cart_item_key ); ?>
    
    									    	</div>
    
    								    	<?php } ?>
    
    								    <?php } ?>
    
    							    </div>
    
    							    <div class="bag-buttons">
    
    							    	<a class="sf-roll-button bag-button" href="<?php echo esc_url( $woocommerce->cart->get_cart_url() ); ?>"><span><?php _e('View shopping bag', 'swiftframework'); ?></span><span><?php _e('View shopping bag', 'swiftframework'); ?></span></a>
    
    							    	<a class="sf-roll-button checkout-button" href="<?php echo esc_url( $woocommerce->cart->get_checkout_url() ); ?>"><span><?php _e('Proceed to checkout', 'swiftframework'); ?></span><span><?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 = get_permalink( woocommerce_get_page_id( 'shop' ) ); ?>
    
    									<a class="sf-roll-button shop-button" href="<?php echo esc_url( $shop_page_url ); ?>"><span><?php _e('Go to the shop', 'swiftframework'); ?></span><span><?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;
    
    		}

    Now find this code from given code:-

    <?php $shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) ); ?>

    Change it with your url like:-

    <?php $shop_page_url = 'http://www.yoursite.com/'; ?>

    Thanks
    Mohammad

    #220190
    fixers
    Member
    Post count: 253
    This reply has been marked as private.
    #220411
    David Martin – Support
    Moderator
    Post count: 20834

    Hi Ben,

    Did you add in these two changes:

    Now find this code from given code:-

    <?php $shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) ); ?>

    Change it with your url like:-
    <?php $shop_page_url = 'http://www.yoursite.com/'; ?>

    Cheers,
    David.

    #220521
    fixers
    Member
    Post count: 253

    Hi David

    Yes I made the changes.

    Whats best to explore next?

    #220524
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    It is redirecting me to https://fixers.travel/home/

    What was the url you used?

    -Rui

    #221387
    fixers
    Member
    Post count: 253

    Hi Rui

    That is just the page set in woo commerce as shop, so no change.

    I have it set in functions to go back to – http://fixers.travel

    Any help greatly appreciated.

    Thanks

    #221462
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    Can you provide us ftp access to check your code?
    Use the private reply.

    -Rui

    #222058
    fixers
    Member
    Post count: 253
    This reply has been marked as private.
    #222355
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    Well using the admin it works but it’s difficult to edit anything and if something goes wrong the site will totally with the white screen. If you can provide a specific ftp user to that installation it will be great.

    Checked the code and that function doesn’t seem to be correct one.

    Probably will need to check this tomorrow with our head developer.Will say something tomorrow.

    -Rui

    #226317
    fixers
    Member
    Post count: 253
    This reply has been marked as private.
    #226325
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    Apologize, somehow this topic was left behind.
    Just forwarded it now to Ed to see if it’s possible to do something.

    -Rui

    #226786
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Hi there,

    You also need to override this function:

    if (!function_exists('sf_get_cart')) {
    		function sf_get_cart() {
    
    			$cart_output = "";
    
    			// Check if WooCommerce is active
    			if ( sf_woocommerce_activated() ) {
    
    				global $woocommerce;
    
    				$options = get_option('sf_neighborhood_options');
    				$show_cart_count = false;
    				if (isset($options['show_cart_count'])) {
    					$show_cart_count = $options['show_cart_count'];
    				}
    
    				$cart_total = WC()->cart->get_cart_total();
    				$cart_count = $woocommerce->cart->cart_contents_count;
    				$cart_count_text = sf_product_items_text($cart_count);
    
    				if ($show_cart_count) {
    					$cart_output .= '<li class="parent shopping-bag-item"><a class="cart-contents" href="'.$woocommerce->cart->get_cart_url().'" title="'.__("View your shopping bag", "swiftframework").'"><i class="sf-cart"></i>'.$cart_total.' ('.$cart_count.')</a>';
    				} else {
    					$cart_output .= '<li class="parent shopping-bag-item"><a class="cart-contents" href="'.$woocommerce->cart->get_cart_url().'" title="'.__("View your shopping bag", "swiftframework").'"><i class="sf-cart"></i>'.$cart_total.'</a>';
    
    				}
    	            $cart_output .= '<ul class="sub-menu">';
    	            $cart_output .= '<li>';
    				$cart_output .= '<div class="shopping-bag">';
    
    	            if ( sizeof($woocommerce->cart->cart_contents)>0 ) {
    
    	            	$cart_output .= '<div class="bag-header">'.$cart_count_text.' '.__('in the shopping bag', 'swiftframework').'</div>';
    
    	            	$cart_output .= '<div class="bag-contents">';
    
    	            	foreach ($woocommerce->cart->cart_contents as $cart_item_key => $cart_item) {
    
    	                    $_product     		 = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
    	                    $price 				 = apply_filters( 'woocommerce_cart_item_price', $woocommerce->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
    	                    $product_title       = $_product->get_title();
    	                    $product_short_title = ( strlen( $product_title ) > 25 ) ? substr( $product_title, 0, 22 ) . '...' : $product_title;
    
    	                    if ($_product->exists() && $cart_item['quantity']>0) {
    	                        $cart_output .= '<div class="bag-product clearfix">';
    	                      	$cart_output .= '<figure><a class="bag-product-img" href="'.get_permalink($cart_item['product_id']).'">'.$_product->get_image().'</a></figure>';
    	                        $cart_output .= '<div class="bag-product-details">';
    	                        $cart_output .= '<div class="bag-product-title"><a href="'.get_permalink($cart_item['product_id']).'">' . apply_filters('woocommerce_cart_widget_product_title', $product_short_title, $_product) . '</a></div>';
    	                        $cart_output .= '<div class="bag-product-price">'.__("Unit Price:", "swiftframework").'
    	                        '.$price.'</div>';
    	                        $cart_output .= '<div class="bag-product-quantity">'.__('Quantity:', 'swiftframework').' '.$cart_item['quantity'].'</div>';
    	                        $cart_output .= '</div>';
    	                        $cart_output .= 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', 'swiftframework') ), $cart_item_key );
    
    	                        $cart_output .= '</div>';
    	                	}
    	                }
    
    	                $cart_output .= '</div>';
    
    	                $cart_output .= '<div class="bag-buttons">';
    
    	                $cart_output .= '<a class="sf-roll-button bag-button" href="'.esc_url( $woocommerce->cart->get_cart_url() ).'"><span>'.__('View shopping bag', 'swiftframework').'</span><span>'.__('View shopping bag', 'swiftframework').'</span></a>';
    
    	                $cart_output .= '<a class="sf-roll-button checkout-button" href="'.esc_url( $woocommerce->cart->get_checkout_url() ).'"><span >'.__('Proceed to checkout', 'swiftframework').'</span><span>'.__('Proceed to checkout', 'swiftframework').'</span></a>';
    
    	               	$cart_output .= '</div>';
    
    	            } else {
    
    	           		$cart_output .= '<div class="bag-header">'.__("0 items in the shopping bag", "swiftframework").'</div>';
    
    	           		$cart_output .= '<div class="bag-empty">'.__('Unfortunately, your shopping bag is empty.','swiftframework').'</div>';
    
    	            	$shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) );
    
    	            	$cart_output .= '<div class="bag-buttons">';
    
    	            	$cart_output .= '<a class="sf-roll-button shop-button" href="'.esc_url( $shop_page_url ).'"><span>'.__('Go to the shop', 'swiftframework').'</span><span>'.__('Go to the shop', 'swiftframework').'</span></a>';
    
    	            	$cart_output .= '</div>';
    
    	            }
    
    			    $cart_output .= '</div>';
    	            $cart_output .= '</li>';
    	            $cart_output .= '</ul>';
    	            $cart_output .= '</li>';
    
    	        }
    
    			return $cart_output;
    
    		}
    	}
    

    – Ed

Viewing 15 posts - 1 through 15 (of 26 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