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 18, 2015 at 12:45 am #151094
Hi, I’m trying to change the “go to shop” button in the header to an icon reveal button to a urlpage but do not seem to be succesful. I located the code that I should change but would it be possible to let me know how I should adjust this code exactly?
Also it looks like the header.php is not applying to my site. I copied the whole file header.php and moved it to the dante-child/includes/ folder as you can see in the code I pasted the word testing in the titles but on my site they do not appear.
thanks
} else { $cart_output .= '<div class="bag-header">'.__("testing 0 items in the shopping bag", "swiftframework").'</div>'; $cart_output .= '<div class="bag-empty">'.__('testing Unfortunately, your shopping bag is empty.','swiftframework').'</div>'; $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' ) ); } $cart_output .= '<div class="bag-buttons">'; $cart_output .= '<a class="sf-button standard sf-icon-reveal shop-button" href="'.esc_url( $shop_page_url ).'"><i class="ss-cart"></i><span class="text">'.__('Go to the shop', 'swiftframework').'</span></a>'; $cart_output .= '</div>';
Attachments:
You must be logged in to view attached files.February 18, 2015 at 8:11 am #151125You see the part:
$cart_output .= '<a class="sf-button standard sf-icon-reveal shop-button" href="'.esc_url( $shop_page_url ).'"><i class="ss-cart"></i><span class="text">'.__('Go to the shop', 'swiftframework').'</span></a>';
Change to:
$cart_output .= '<a class="sf-button standard sf-icon-reveal shop-button" href="YOURURLHERE"><i class="ss-cart"></i><span class="text">'.__('Go to the shop', 'swiftframework').'</span></a>';
—
Are you referring to the header.php file or the sf-header.php file?
– Kyle
February 18, 2015 at 9:58 am #151147Thanks Kyle,
I applied the url change in the code but just like the text, also this url change does not appear on my site. It seems as thought the child sf-header.php is not catching on. Is my set up correct? I thought I needed to change sf-header.php in order to make this change work but please correct me if I’m wrong..
February 18, 2015 at 10:04 am #151150With framework files you an’t override the parent file. Instead you need to copy the function and add to your functions.php file
– Kyle
February 18, 2015 at 11:05 am #151171Ah ok 🙂
I copied the file functions.php to my child theme and added the whole function there:
/* CART DROPDOWN ================================================== */ 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_dante_options'); $show_cart_count = false; if (isset($options['show_cart_count'])) { $show_cart_count = $options['show_cart_count']; } $cart_total = $woocommerce->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 cart", "swiftframework").'"><i class="ss-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 cart", "swiftframework").'"><i class="ss-cart"></i>'.$cart_total.'</a>'; } $cart_output .= '<ul class="sub-menu">'; $cart_output .= '<li>'; $cart_output .= '<div class="shopping-bag">'; if ( $cart_count != "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) { $bag_product = $cart_item['data']; $product_title = $bag_product->get_title(); $product_short_title = (strlen($product_title) > 25) ? substr($product_title, 0, 22) . '...' : $product_title; if ($bag_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']).'">'.$bag_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, $bag_product) . '</a></div>'; $cart_output .= '<div class="bag-product-price">'.__("Unit Price:", "swiftframework").' '.woocommerce_price($bag_product->get_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">×</a>', esc_url( $woocommerce->cart->get_remove_url( $cart_item_key ) ), __('Remove this item', 'woocommerce') ), $cart_item_key ); $cart_output .= '</div>'; } } $cart_output .= '</div>'; $cart_output .= '<div class="bag-buttons">'; if ( version_compare( WOOCOMMERCE_VERSION, "2.1.0" ) >= 0 ) { $cart_url = apply_filters( 'woocommerce_get_checkout_url', WC()->cart->get_cart_url() ); $checkout_url = apply_filters( 'woocommerce_get_checkout_url', WC()->cart->get_checkout_url() ); $cart_output .= '<a class="sf-button standard sf-icon-reveal bag-button" href="'.esc_url( $cart_url ).'"><i class="ss-view"></i><span class="text">'. __('View shopping bag', 'swiftframework').'</span></a>'; $cart_output .= '<a class="sf-button standard sf-icon-reveal checkout-button" href="'.esc_url( $checkout_url ).'"><i class="ss-creditcard"></i><span class="text">'.__('Proceed to checkout', 'swiftframework').'</span></a>'; } else { $cart_output .= '<a class="sf-button standard sf-icon-reveal bag-button" href="'.esc_url( $woocommerce->cart->get_cart_url() ).'"><i class="ss-view"></i><span class="text">'. __('View shopping bag', 'swiftframework').'</span></a>'; $cart_output .= '<a class="sf-button standard sf-icon-reveal checkout-button" href="'. esc_url( $woocommerce->cart->get_checkout_url() ).'"><i class="ss-creditcard"></i><span class="text">'.__('Proceed to checkout', 'swiftframework').'</span></a>'; } $cart_output .= '</div>'; } else { $cart_output .= '<div class="bag-header">'.__("testing 0 items in the shopping bag", "swiftframework").'</div>'; $cart_output .= '<div class="bag-empty">'.__('testing Unfortunately, your shopping bag is empty.','swiftframework').'</div>'; $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' ) ); } $cart_output .= '<div class="bag-buttons">'; $cart_output .= '<a class="sf-button standard sf-icon-reveal shop-button" href="http://test.freshfolds.nl/start/"><i class="ss-cart"></i><span class="text">'.__('test 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; }
However, after doing that my whole site gets blank. What am i doing wrong?
February 18, 2015 at 11:07 am #151172I’m getting a 403 forbidden on your site, can you check
– Kyle
February 18, 2015 at 11:44 am #151192This reply has been marked as private.February 18, 2015 at 12:03 pm #151199Ahh it’s because you’re using a different language, in that case you will need to use POEdit to edit the .po file. Find the ‘go to shop’ string and translate it to what you want to use.
You don’t need the code in the functions.php file
– Kyle
February 18, 2015 at 3:01 pm #151281This reply has been marked as private.February 18, 2015 at 4:12 pm #151303The best way to check that is first make the change to the parent theme, if it works, transfer it to your child theme’s functions.php file and test again. It’s more likely that you’ve just not edited the right part
– Kyle
February 18, 2015 at 7:15 pm #151380This reply has been marked as private.February 19, 2015 at 12:37 am #151426Hi,
Can you provide us ftp access so we can give it a try?
Use the private reply option.-Rui
February 19, 2015 at 2:15 am #151433This reply has been marked as private.February 19, 2015 at 2:24 am #151435This reply has been marked as private.February 19, 2015 at 11:13 am #151526Hi,
Was missing a closing bracket in the code. I created you a functions.php file inside the child theme.
Test if it’s ok.
-Rui
-
Posted in: Dante
You must be logged in and have valid license to reply to this topic.