After Adding a Product Redirect to Shopping Cart doesnot work


After installed theme theme130k customer cannot redirect to shopping cart ,modify the following file make it return to what I want to do:

app\design\frontend\default\theme130k\template\ajax\catalog\product\view\addtocart.phtml

app\design\frontend\default\theme130k\template\ajax\catalog\product\options.phtml

app\design\frontend\default\theme130k\template\ajax\catalog\product\view.phtml


    	productAddToCartForm.submit = function(button, url) {

		if (this.validator.validate()) {

			var form = this.form;

			var oldUrl = form.action;

			if (url) {

				form.action = url;

			}

			var e = null;

			// Start of our new ajax code

			if (!url) {

				url = jQuery('#product_addtocart_form').attr('action');

			}

			url = url.replace("checkout/cart","ajax/index"); // New Code

			var data = jQuery('#product_addtocart_form').serialize();

			data += '&isAjax=1';

			jQuery('#ajax_loader').show();

			try {

				jQuery.ajax( {

					url : url,

					dataType : 'json',

					type : 'post',

					data : data,

					success : function(data) {

						jQuery('#ajax_loader').hide();

						if(data.status == 'ERROR'){

							jQuery('body').append('<div class="alert"></div>');

						jQuery('.alert').slideDown(400);

								jQuery('.alert').html(data.message).append('<button></button>');

				jQuery('button').click(function () {

                jQuery('.alert').slideUp(400);

                 });	

					jQuery('.alert').slideDown('400',function(){

									 	setTimeout(function(){

											jQuery('.alert').slideUp('400',function(){jQuery(this).slideUp(400)});

										},7000)

									 });



						}else{

													jQuery('.alert').html(data.message).append('<button></button>');

						jQuery('.alert').slideDown(400);

				jQuery('.alert').html(data.message).append('<button></button>');

				jQuery('button').click(function () {

                jQuery('.alert').slideUp(400);

                 });	

					jQuery('.alert').slideDown('400',function(){

									 	setTimeout(function(){

											jQuery('.alert').slideUp('400',function(){jQuery(this).slideUp(400)});

										},7000)

									 });



	                        if(jQuery('.block-cart')){

	                            jQuery('.block-cart').replaceWith(data.sidebar);

	                        }

	                        if(jQuery('.header .links')){

	                            jQuery('.header .links').replaceWith(data.toplink);

	                        }

										if(jQuery('.block-cart-header')){

	            jQuery('.block-cart-header').replaceWith(data.sidebar_header);

	        }

						}


					}


				});

			} catch (e) {

			}

			// End of our new ajax code

			this.form.action = oldUrl;

			if (e) {

				throw e;

			}

		}

	}.bind(productAddToCartForm);

the above code change to the following code.


    productAddToCartForm.submit = function(button, url) {
        if (this.validator.validate()) {
            var form = this.form;
            var oldUrl = form.action;

            if (url) {
                form.action = url;
            }
            var e = null;
            try {
                this.form.submit();
            } catch (e) {
            }
            this.form.action = oldUrl;
            if (e) {
                throw e;
            }

            if (button && button != 'undefined') {
                button.disabled = true;
            }
        }
    }.bind(productAddToCartForm);


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值