This topic has 14 replies, 3 voices, and was last updated 8 years, 5 months ago ago by Eva Kemp
Hi,
I want to change the url in the pop up wich is opening after I click “add to cart”.
In the popup is a link “go to checkout”, and I want get it “go to cart”.
Which file I must modify?
http://img5.fotos-hochladen.net/uploads/addtocartpopm4u6a3ty8i.jpg
best regards
royal
Hello,
You can change link in wp-content/themes/royal/js/etheme.js file in line 1468, edit the code href: checkoutUrl,
write Cart page url instead of “checkoutUrl”, like href: http://your_page_url,
and change text in wp-content/themes/royal/framework/theme-functions.php in line 423.
Regards,
Eva Kemp.
Thank you, it works!
And what if I make a update of royal theme? Then it will be overwritten or?
How I can protect it? I want have it after update and dont want modify all time the file..
best regards
royal
Hello,
In this case you need to create child theme and add the code in your child theme functions.php file:
add_action( 'wp_enqueue_scripts', 'etheme' );
function etheme() {
wp_enqueue_script( 'etheme', get_stylesheet_directory_uri() . '/js/etheme.js' );
}
Create “js” folder in child theme and copy etheme.js file with needed changes in the child theme “js” directory so you won’t lose modifications after theme update.
Best regards,
Jack Richardson.
Hi, thanks for helping.
I created the folder and the files. But I think my etheme.js is wrong, because the modify with URL in the Pop-Up is not working.. It is the default, so not my URL I wish.
My etheme.js looks now to 100%:
function et_add_to_cart(data, $thisbutton, showEmodal) {
if(showEmodal) {
modalWindow.eModal('showModal');
}
if ( isIE() ) {
$thisbutton.addClass('adding-to-cart');
}
// Ajax action
$.post( woocommerce_params.ajax_url, data, function( response ) {
if(showEmodal) {
if($('.product-thumbnails img').length > 0) {
productImageSrc = $('.product-thumbnails img').first().attr('src');
} else {
productImageSrc = $('.product-images img, .images img').first().attr('src');
}
productName = $('.product-information .product-name, .product_title').first().text();
modalWindow.eModal('endLoading')
.eModal('setTitle',productName)
.eModal('addImage', productImageSrc)
.eModal('addText', successfullyAdded)
.eModal('addBtn',{
title: contBtn,
href: 'javascript:void(0);',
cssClass: 'btn filled',
hideOnClick: true
})
.eModal('addBtn',{
title: checkBtn,
href: 'http://www.saloni-moebel.de/cart',
cssClass: 'btn filled active'
});
}
if ( ! response )
return false;
var this_page = window.location.toString();
this_page = this_page.replace( 'add-to-cart', 'added-to-cart' );
$thisbutton.parent().find('#floatingCirclesG').remove();
fragments = response.fragments;
cart_hash = response.cart_hash;
if ( isIE() ) {
$thisbutton.removeClass('adding-to-cart');
}
setTimeout(function() {
$thisbutton.parent().parent().removeClass('loading');
$thisbutton.removeClass('added');
}, 3000)
// Cart widget load
$('#cartModal').replaceWith(fragments.cart_modal);
$('.cart_list').replaceWith( $(fragments.top_cart).find('.cart_list') );
$('.shopping-container').replaceWith(fragments.top_cart);
et_update_favicon();
$('body').trigger('cart_widget_refreshed');
// Unblock
$( '.widget_shopping_cart, .updating' ).stop( true ).css( 'opacity', '1' ).unblock();
// Cart page elements
$( '.shop_table.cart' ).load( this_page + ' .shop_table.cart:eq(0) > *', function() {
$( '.shop_table.cart' ).stop( true ).css( 'opacity', '1' ).unblock();
$( 'body' ).trigger( 'cart_page_refreshed' );
});
$( '.cart_totals' ).load( this_page + ' .cart_totals:eq(0) > *', function() {
$( '.cart_totals' ).stop( true ).css( 'opacity', '1' ).unblock();
});
// Trigger event so themes can refresh other areas
$('body').trigger( 'added_to_cart', [ fragments, cart_hash ] );
return true;
});
}
and my function.php:
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'child-style', get_stylesheet_uri(), array( 'bootstrap', 'parent-style' ) );
}
add_action( 'wp_enqueue_scripts', 'etheme' );
function etheme() {
wp_enqueue_script( 'etheme', get_stylesheet_directory_uri() . '/js/etheme.js' );
}
?>
What I do wrong?
King regards
Royal
Hello,
Please give us correct credentials to WP Dashboard.
Thank you.
Best regards,
Jack Richardson.
Hi, the informations to my WP are in attachment.
Best Regards
Royal
Hello,
I’ve copied the whole file etheme.js to the child theme and reverted changes back in parent etheme.js file.
Now child theme activated.
Please clear browser cache and check.
Best regards,
Jack Richardson.
Hi, thanks for quick support.
It works very fine, but now there is a bug on my product page.
..the product images are not changing by choosing an option from dropdown.
I’ve deactivated the child theme and it worked fine..
so I can say in my child theme is a litte bug.. I hope you can check it.
king regards
royal
Hello,
I’ve disabled zoom effect and now images are changed.
Please check.
Regards,
Eva Kemp.
Hi Eva,
thanks fox quick fix. Can you solve this problem without deactivating zoom.. because the zoom was nice..
best regards
royal
Hello,
I’ve added changed the other way.
I commented function in child functions.php and renamed etheme.js file in child “js” folder.
I added part of the code from theme-functions.php file to child functions.php and changed the code var checkoutUrl = '<?php echo esc_url( $woocommerce->cart->get_checkout_url() ); ?>';
to var checkoutUrl = '<?php echo esc_url( $woocommerce->cart->get_cart_url() ); ?>';
.
Please clear browser cache and check now.
Regards,
Eva Kemp.
Hi Eva,
you’re great! 🙂
thanks a lot.
best regards
royal
Hello,
You’re welcome.
Regards,
Eva Kemp.
The issue related to '‘Pop up after "add to cart" – How to modify’' has been successfully resolved, and the topic is now closed for further responses