0

Quick view add to cart redirect to Shopping cart page so that i changed this

System » Configuration » Checkout » Shopping Cart » After Adding a Product Redirect to Shopping Cart that disables this

After that it pass quick view url in that main page url. So i need to reload the same page. How i fix that?

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/**
 * Product view template
 *
 * @see Mage_Catalog_Block_Product_View
 * @see Mage_Review_Block_Product_View
 */
?>
<?php $_helper = $this->helper('catalog/output'); ?>
<?php $pageLayout = str_replace(array('page/','.phtml'),'',Mage::app()->getLayout()->getBlock('root')->getTemplate()); ?>
<?php $_product = $this->getProduct(); ?>
<?php $setting = Mage::helper('em0113settings'); ?>




<script type="text/javascript">
    var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
</script>
<div class="Individual">
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
<div class="product-view">
    <div class="product-essential">
    <form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
        <?php echo $this->getBlockHtml('formkey') ?>
        <div class="no-display">
            <input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
            <input type="hidden" name="related_product" id="related-products-field" value="" />
        </div>

        <div class="product-img-box" style="width:<?php echo $setting->getImageProduct_BaseImageWidth(390) ?>px;">
            <?php echo $this->getChildHtml('media') ?>
        </div>
        <?php 
            $related_product_collection = $_product->getRelatedProductCollection();
            $related_product_collection->AddStoreFilter();
            $count  =   count($related_product_collection);
        ?>
        <div class="product-shop <?php if($count > 0 && $pageLayout=='1column'): ?>has-related<?php else: ?>no-related<?php endif ?>">
            <div class="product-shop-wrapper <?php if($_product->isGrouped()): ?>grouped<?php endif ?>">
            <?php list($_prev_prod, $_next_prod) = Mage::helper('em0113settings/product')->getPreviousNextProducts($this->getProduct()); ?>

            <!--<?php if($_prev_prod != NULL): ?>
            <a href="<?php echo $_prev_prod->getProductUrl(); ?>" title="<?php echo $this->__('Previous') ?>" class="prev"><?php echo $this->__('Previous') ?></a>
            <?php endif; ?>

            <?php if($_next_prod != NULL): ?>
            <a href="<?php echo $_next_prod->getProductUrl(); ?>" title="<?php echo $this->__('Next') ?>" class="next"><?php echo $this->__('Next') ?></a>
            <?php endif; ?>-->

            <div class="product-name">
                <h2><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h2>
            </div>

            <?php echo $this->getReviewsSummaryHtml($_product, false, true)?>

            <!--<?php if ($this->canEmailToFriend()): ?>
                <p class="email-friend"><a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>"><?php echo $this->__('Email to a Friend') ?></a></p>
            <?php endif; ?>-->

            <div class="Pro_des">
            <?php if ($_product->getShortDescription()):?>
                <div class="short-description">
                <hr> 
                <br/>
             <!--       <h2><?php echo $this->__('Quick Overview') ?></h2>  -->
                    <div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>
                </div>
            <?php endif;?>
            </div>



            <!--

            <?php if ($this->displayProductStockStatus()): ?>
                <?php if($_product->isSaleable()): ?>
                    <p class="availability in-of-stock"><span><?php echo $this->__('In of stock') ?></span></p>
                <?php else : ?>
                    <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                <?php endif; ?>
            <?php endif; ?>

            -->


            <hr class="hr">

            <div class="check_delivery">
                <?php echo $this->getLayout()->createBlock('core/template')->setTemplate('checkdelivery/checkdelivery.phtml')->toHtml();?>
            </div> 

            <div class="Quick">
            <div class="Quick_1">
            <!--<?php if ($_product->getShortDescription()):?>
                <div class="short-description">
                    <h2><?php echo $this->__('Quick Overview') ?></h2>
                    <div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>
                </div>
            <?php endif;?>-->

            <div class="product-data">
                <?php echo $this->getChildHtml('alert_urls') ?>
                <?php echo $this->getChildHtml('product_type_data') ?>
                <?php echo $this->getChildHtml('extrahint') ?>
                <?php echo $this->getTierPriceHtml() ?>

            </div>
            <?php if (!$this->hasOptions()):?>
                <div class="add-to-box">
                    <?php if($_product->isSaleable()): ?>
                        <?php echo $this->getChildHtml('addtocart') ?>
                    <?php else:?>
                        <?php echo $this->getChildHtml('addto') ?>
                    <?php endif; ?>

                    <?php if ($_product->isAvailable()) {?>

                    <div><?php $buttonTitle = $this->__('Add to Cart'); ?>
    <button type="button" title="<?php echo $buttonTitle ?>" id="product-addtocart-button" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
</div>

<br/>


                    <div ><button class="button buy-now" onclick="location.href ='{{config path="web/unsecure/base_url"}}/checkout/cart/add?product=1&qty=1'">
<span><span>Buy Now</span></span></button>
</div>






          <?php }?>
                </div>
                <?php echo $this->getChildHtml('extra_buttons') ?>
            <?php elseif (!$_product->isSaleable()): ?>
                <div class="add-to-box">
                    <?php echo $this->getChildHtml('addto') ?>
                </div>




            <?php endif; ?>
            </div>

            <div class="Quick_2">

                <!-- Soled By -->
                <div class="soled_by">
                    <?php 
                        $helper=Mage::helper('marketplace');
                        $_product=Mage::registry('current_product');
                        $productowner=Mage::getModel('marketplace/product')->isCustomerProduct($_product['entity_id']);
                        if($productowner['userid']!=""){
                        $captchenable = $percent = Mage::getStoreConfig('marketplace/marketplace_options/captcha');
                    $rowsocial=Mage::getModel('marketplace/userprofile')->getPartnerProfileById($productowner['userid']);
                    }   
                    ?>
                        <script type="text/javascript">
                            if (typeof jQuery == 'undefined'){
                                document.write(unescape("%3Cscript src='//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
                            }
                    </script> 



                    <div class="soled-by-dealer">
                    <!--<div class="block-title"><strong><span>
                        <?php   if($rowsocial['shoptitle']!='')
                                echo $rowsocial['shoptitle'];
                            else
                                echo  $rowsocial['profileurl']; ?>
                        </span></strong>
                    </div>-->

                            <h5> SOLD BY : </h5>

                             <span>


                                       <?php if($rowsocial['profileurl'] == "kidsdial2")
                                            {?>

                                            <a href="<?php echo  Mage::getUrl('marketplace/seller/collection').$rowsocial['profileurl'] ?>" title="<?php echo "Totaltoys"; ?>" id="siteconnect">
                                       <?php echo "Totaltoys"; ?></a><?php

                                            }

                                            else{?>

                                                <a href="<?php echo  Mage::getUrl('marketplace/seller/collection').$rowsocial['profileurl'] ?>" title="<?php echo $rowsocial['profileurl']; ?>" id="siteconnect">
                                       <?php echo $rowsocial['profileurl']; ?></a><?php 
                                            }

                                       ?>
                             </span>        


                    </div>
                    <br/>


                    <div class="delivery_details">


                        <div class="COD">
                        <?php $attribute = $_product->getResource()->getAttribute('cod_available');
                            $attribute_value = $attribute ->getFrontend()->getValue($_product);
                                if ($attribute_value == "Yes")
                                {?>

                               <h5> CASH ON DELIVERY </h5>

                                <div class="Delivery_hover_details">?<p class="killing"><?php echo "Available";?></p><?php 
                                        }

                                        else
                                        {?><i class="fa fa-times"></i>
                                    <p><?php 
                                            echo " Not Available";
                                        }

                                    ?></p>
                                   <span class="coupontooltip">
                                       <div class="cod_content">
                                           <h5>How do I place a Cash on Delivery (COD) order?</h5>
                                            <p>All items that have the "Cash on Delivery Available" icon are valid for order by Cash on Delivery.</p>
                                            <p>Add the item(s) to your cart and proceed to checkout.When prompted to choose a payment option, select "Cash on Delivery". </p>
                                            <p>Once you place the order you will receive confirmation call from our customer support for validation with in 48 hours. Once verified and confirmed, your order will be processed for shipment in the time specified, from the date of confirmation. You will be required to make a cash-only payment to our courier partner at the time of delivery of your order to complete the payment.</p>
                                            <p>Terms & Conditions</p>
                                            <p>The maximum order value for COD is ₹5000.</p>
                                            <p>e-Gift Vouchers or Store Credit cannot be used for COD orders.</p>
                                            <p>Cash-only payment at the time of delivery.</p>
                                        </div>
                                    </span>

                                </div>


</div>

                        </div> 





            <div class="Delivery">
                <h5> Delivered By </h5>
                <div class="Delivery_hover_details">?
                    <span class="coupontooltip">
                        <div class="delivery_content">
                          <h5>What is the estimated delivery time?</h5>
                            <p>Sellers generally procure and ship the items within the time specified on the product page. Business days exclude public holidays and Sundays.</p>
                            <p>Estimated delivery time depends on the following factors:
                            <li>Time of the order, usually orders made after 2:00pm can be shipped only on next workingday</li>
                            <li>The Seller offering the product</li>
                            <li>Product's availability with the Seller</li>
                            <li>The destination to which you want the order shipped to and the Seller's location</li></p>
                        </div>
                    </span>
                </div>
                <ul class="fk-ul-disc">
                        <li class= "abc">Usually Delivered in 3-5 business days.</li>

            </ul>
            </div>


              <div class= "bottom3">

                <!-- wholesale available -->
                           <?php
                       //$product is your current product 
if($_product->getTierPrice()) {
   echo " 
<div class = 'quickphp'>
    <h5>Wholesale</h5>
    Available.<br>
    Usually Delivered in 10-15 business days.
</div>
   ";
}
else{
  echo " 
<div class = 'quickphp'>
    <h5>Wholesale</h5>
    Not Available.<br>
</div>
  ";

}
?>










            <div class="avail">
             <?php if ($this->displayProductStockStatus()): ?>
                <?php if($_product->isSaleable()): ?>
                    <p class="availability in-of-stock"> <h5>Availability</h5> <?php echo $this->__('In Stock') ?></span></p>
                <?php else : ?>
                    <p class="availability out-of-stock"> <h5>Availability</h5> <?php echo $this->__('Out of stock') ?></span></p>
                <?php endif; ?>
            <?php endif; ?>
        </div>


        <div class="replace">

                    <span> <b>7 days</b> Replacement Guarantee</span>
                    <div class="Delivery_hover_details">?
                        <span class="coupontooltip">

                       <h5> How do I return an item purchased on Totaltoys.com</h5>
                        <p>Conveniently, you can call us at 092-434-22233 and email us at contact@totaltoys.com with order number, invoice number and product name. If you've received an item in a 'Damaged', 'Defective' or 'Not as Described' state.</p>

                        <h5>Return & Replacement policy:</h5>
                            <p>Returns or replacement request should be placed within 7 days from the date of delivery.</p>
                            <p>As we receive your request, our concerned team will contact you to validate the compliant. The validation process may require submitting of product photos. Once the validation process is completed then further action will be taken.
                            Once the product reaches to us/seller, the replacement will be proceed in 1-2 working days after physical inspection of the goods and shipment will be done simultaneously.</p>
                            <p>If you've received an item in a 'Damaged', 'Defective' or 'Not as Described' state, all replacements/pickups will be done free of cost.</p>
                            <p>If the packaging is tampered with or damaged, before accepting delivery of the goods, please refuse to take delivery of the package, and call us on 092-434-22233 or mail us at contact@totaltoys.com , mentioning your order reference number. We shall make our best efforts to ensure that a replacement delivery is made to you at the earliest.</p>
                            <p>In the rare circumstances where a pickup cannot be done, you can ship the product through any courier. You will be reimbursed the shipping charges against the original receipt.</p>
                            <p>Replacement is subjected to availability of stock. In case a replacement is not available, the amount will be refunded to your account from which the purchase was made. (Amount includes shipping and gift wrapping charges)</p>

                            <h5> Return Request is not Accepted If:</h5>

                            <li>Return request is made outside the specified time period</li>

                            <li>Missing of tags, labels, original packing, and invoice.</li>

                            <li>Misused or Mishandle of the product from customer end.</li>

                            <p>For all refunds we will refund the amount to same mode of payment as used during checkout. Refunds for cash on delivery will be made via online transfer of funds to the customers bank account.</p>
                            <p>If the customer chooses to cancel the order before the product is shipped, he will be entitled to a 100% refund.
                            Do I have to return the free gift when I return a product?</p>

                            <p>Yes. The free gift is included as part of the item order and needs to be returned along with the originally delivered product</p>

                            <p>Please contact us on   contact@totaltoys.com  or call us at 092-434-22233 for any doubts and concerns</p>



                        </span>
                    </div>


                </div>


</div>




            </div>

            </div>










            <?php echo $this->getChildHtml('other');?>
            <?php echo $this->getChildHtml('short_des_after'); ?>

            <?php if ($_product->isSaleable() && $this->hasOptions()):?>
                <?php echo $this->getChildChildHtml('container1', '', true, true) ?>
            <?php endif;?>
                <?php echo $this->getChildHtml('shippingreturns') ?>

        </div>
    </div>


      <div class="clearer"></div>
        <?php if ($_product->isSaleable() && $this->hasOptions()):?>
            <?php echo $this->getChildChildHtml('container2', '', true, true) ?>
        <?php endif;?>
    </form>  
</div>  
    <!-- Add button share facebook -->
    <?php if ($setting->getImageProduct_ViewSocial()): ?>
        <div id="social-share" class="hide-lte0 hide-lte1 hide-lte2"></div>
        <script type="text/javascript">
            jQuery(document).ready(function($){
                jQuery('#social-share').dcSocialShare({
                    buttons: 'facebook,plusone,twitter,pinterest',
                    twitterId: 'designchemical',
                    email: 'moc//niamod/liame',
                    align: 'right',
                    floater: false
                });
            });
        </script>
    <?php endif; ?>
    <script type="text/javascript">
    //<![CDATA[
        var productAddToCartForm = new VarienForm('product_addtocart_form');
        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);

        productAddToCartForm.submitLight = function(button, url){
            if(this.validator) {
                var nv = Validation.methods;
                delete Validation.methods['required-entry'];
                delete Validation.methods['validate-one-required'];
                delete Validation.methods['validate-one-required-by-name'];
                // Remove custom datetime validators
                for (var methodName in Validation.methods) {
                    if (methodName.match(/^validate-datetime-.*/i)) {
                        delete Validation.methods[methodName];
                    }
                }

                if (this.validator.validate()) {
                    if (url) {
                        this.form.action = url;
                    }
                    this.form.submit();
                }
                Object.extend(Validation.methods, nv);
            }
        }.bind(productAddToCartForm);
    //]]>
    </script>
    </div>






</div>
1

First of all quick view is not adefault feature magento.You have use 3rd party Quick view extension.

I don't know what extension,you have used.But for prevent this redirection, I will suggest you

send current url as a param (param should be return_url) for quick view add to cart Form

As magento as system,if an add cart to Action event is occurred from Mage_Checkout_CartController::addAction

Then after cart successfully Magento first check return_url value if it have then it redirect to this page else redirect to other page which basic of your rest logic like After Adding a Product Redirect to Shopping Cart

This fundamental you can find at \Mage_Checkout_CartController::_goBack

` protected function _goBack() { $returnUrl = $this->getRequest()->getParam('return_url'); if ($returnUrl) {

            if (!$this->_isUrlInternal($returnUrl)) {
                throw new Mage_Exception('External urls redirect to "' . $returnUrl . '" denied!');
            }

            $this->_getSession()->getMessages(true);
            $this->getResponse()->setRedirect($returnUrl);
        } elseif (!Mage::getStoreConfig('checkout/cart/redirect_to_cart')
            && !$this->getRequest()->getParam('in_cart')
            && $backUrl = $this->_getRefererUrl()
        ) {
            $this->getResponse()->setRedirect($backUrl);
        } else {
            if (($this->getRequest()->getActionName() == 'add') && !$this->getRequest()->getParam('in_cart')) {
                $this->_getSession()->setContinueShoppingUrl($this->_getRefererUrl());
            }
            $this->_redirect('checkout/cart');
        }
        return $this;
    } `

If quick view use <form>...</form> then use return_url hidden field and send current page url it's value.

<input type="hidden" name="return_url" value ="YOUR_CURRENT_URL" /
/>

Update:

as per as your code you need to add

<input type="hidden" name="return_url" value ="YOUR_CURRENT_URL" /
/>

after

 <input type="hidden" name="related_product" id="related-products-field" value="" />
| improve this answer | |
  • If i changed in this \Mage_Checkout_CartController::_goBack after that coupen code success message also redirect to home page – Magento 2 Sep 22 '15 at 7:44
  • There are no change required at goBack() function .. only send current page url as return_url to AddToCart Action – Amit Bera Sep 22 '15 at 7:47
  • can you please tell me how to add return_rul to Add to cart Action – Magento 2 Sep 22 '15 at 7:53
  • please show the code quick view – Amit Bera Sep 22 '15 at 7:56
  • check my updated question – Magento 2 Sep 22 '15 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.