formsmagento

Magento Add to Cart button is not working after changing view template


Hi thanks for reading!

I changed the product view. Basically i moved the tabs to up and wrap the product information into a tab. Looks good but add to cart is not working now. What I noticed that when I press add to cart button the review form in the review tab asking for required fields also the tabs form asking same thing. Also if you have required option in the product and if you don't select them it's asking for them as well.

not: there is no error in the console!

here is the link.

http://vps58123967.123-vps.co.uk/v4u-smooths.html

and here is the code

<form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
<div class="product-box">

    <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="row">


    <div class="span<?php echo $span0?>">
        <div class="product-img-box">
            <div class="row">

                <?php if(Mage::helper('buyshopconfig')->getMediaCount($_product) or !empty($_video)):?>
                <div class="span<?php echo $span1?>">
                    <div class="more-views flexslider">
                        <ul  class="slides">
                            <?php if(Mage::helper('lightboxes')->isActive()):?>
                            <?php echo Mage::helper('buyshopconfig')->getMediaInProductPopup($_product,$widthMedium,$heightMedium,$widthSmall,$heightSmall)?>
                            <?php else: ?>
                            <?php echo Mage::helper('buyshopconfig')->getMediaInProduct($_product,$widthMedium,$heightMedium,$widthSmall,$heightSmall)?>
                            <?php endif;?>
                            <?php if(!empty($_video)):?>
                            <li><a   class="video"  href="<?php echo Mage::helper('catalog/output')->productAttribute($this->getProduct(), $_video, 'video') ?>"><i class=" icon-link"></i></a></li>
                            <?php endif;?>
                        </ul>
                    </div>
                </div>
                <?php endif;?>

                <div class="span<?php echo $span2?>">
                    <div class="product-image">
                        <a <?php echo $main_image_popup;?> title="<?php echo $this->htmlEscape($_product->getImageLabel())?>" <?php if(!Mage::helper('lightboxes')->isActive()):?>class="cloud-zoom"<?php endif;?> href="<?php echo Mage::getModel('catalog/product_media_config')->getMediaUrl( $_product->getImage() )?>" <?php if(!Mage::helper('lightboxes')->isActive()):?>id='zoom1' data-rel="position: 'right', adjustX: 10, adjustY: 0"<?php endif;?>>
                            <img class="product-retina" data-image2x="<?php echo Mage::helper('catalog/image')->init($_product, 'thumbnail', $_product->getFile())->resize($widthMedium*2, $heightMedium*2)?>" src="<?php echo Mage::helper('catalog/image')->init($_product, 'thumbnail', $_product->getFile())->resize($widthMedium, $heightMedium)?>" alt=""  />
                        </a>
                    </div>
                    <div class="pull-right hidden"><a href="#" class="fancybox fancy-zoom"><i class="icon-zoom-in"></i></a></div>
                </div>

            </div>
        </div>
    </div>


    <div class="span<?php echo $span3?>">

        <div class="row">
            <div class="span6">
                <ul class="nav-tabs" id="myTab">
                    <li class="active"><a href="#product">Product</a></li>
                    <li><a href="#tab1"><?php echo $this->__('Description') ?></a></li>
                    <?php if(!$modules_enable['Mage_Review']):?><li><a href="#tab2"><?php echo $this->__('Reviews') ?></a></li><?php endif;?>
                    <?php if ($_customtab && Mage::getStoreConfig('buyshoplayout/product_info/custom_tab')): ?>
                    <li><a href="#tab4"><?php if(!empty($_customtabtitle)) echo html_entity_decode($this->helper('catalog/output')->productAttribute($this->getProduct(), $_customtabtitle, 'customtabtitle'));else echo 'Custom tab title' ?></a></li>
                    <?php endif;?>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="product">
                        <div class="product-shop">

                            <?php echo $this->getChildHtml('custom_related_block') ?>

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

                                <?php if(Mage::getStoreConfig('buyshoplayout/product_info/sku')):?>
                                    <p><?php echo $this->__('SKU') ?>: <b><?php echo nl2br($_product->getSku()) ?></b></p>
                                <?php endif; ?>

                                <?php if(!Mage::getStoreConfig('buyshopconfig/options/catalog_mode')):?>
                                <div class="product_type_data_price"><?php echo $this->getChildHtml('product_type_data') ?></div>
                                <?php endif; ?>

                                <?php if ($_product->getShortDescription()):?>
                                    <div class="short-description"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>
                                <?php endif;?>

                                <?php if(!Mage::getStoreConfig('buyshopconfig/options/catalog_mode')):?>
                                <?php  echo $this->getPriceHtml($_product) ?>
                                <?php endif; ?>

                              <?php if(!Mage::getStoreConfig('buyshopconfig/options/catalog_mode')):?>
                                <?php echo $this->getChildHtml('alert_urls') ?>
                                <?php echo $this->getTierPriceHtml() ?>
                                <?php echo $this->getChildHtml('extrahint') ?>




                                    <?php if (!$this->hasOptions()):?>
                                        <?php if($_product->isSaleable()): ?>
                                            <?php echo $this->getChildHtml('addtocart') ?>
                                        <?php endif; ?>
                                        <?php echo $this->getChildHtml('extra_buttons') ?>
                                    <?php endif; ?>
                                <?php endif; ?>



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


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



                                <div class="add-to-links">
                                    <ul>
                                        <?php echo Mage::helper('buyshopconfig')->addWishCompLink($_product,$this,true); ?>
                                        <?php if ($this->canEmailToFriend()): ?>
                                        <li><a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>" class="small_icon_color"><i class="icon-at"></i></a><a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>"><?php echo $this->__('Email to a friend') ?></a></li>
                                        <?php endif; ?>
                                    </ul>
                                </div>

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


                                <div class="socialsplugins_wrapper">
                                    <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('buyshop_social_like_buttons')->toHtml() ?>
                                </div>
                                <?php if(Mage::getStoreConfig('buyshoplayout/product_info/qr')):?>
                                <div class="clearfix hidden-phone" style="margin: 20px 0 0 0">
                                    <img src="http://api.qrserver.com/v1/create-qr-code/?size=100x100&data=<?php echo Mage::helper("core/url")->getCurrentUrl()  ?>" alt="QR:  <?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>"/>
                                </div>
                                <?php endif;?>

                            </div>
                        </div>
                    </div>
                    <div class="tab-pane" id="tab1">
                        <?php foreach ($this->getChildGroup('detailed_info', 'getChildHtml') as $alias => $html):?>
                        <div class="box-collateral <?php echo "box-{$alias}"?>">
                            <?php if ($title = $this->getChildData($alias, 'title')):?>
                            <h2><?php echo $this->escapeHtml($title); ?></h2>
                            <?php endif;?>
                            <?php echo $html; ?>
                        </div>
                        <?php endforeach;?>
                    </div>
                    <div class="tab-pane" id="tab2">
                        <?php echo $this->getChildHtml('reviews') ?>
                    </div>
                    <div class="tab-pane" id="tab3">
                        <?php echo $this->getChildHtml('product_additional_data') ?>
                    </div>

                    <?php if ($_customtab): ?>
                    <div class="tab-pane" id="tab4">
                        <?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_customtab, 'customtab') ?>
                    </div>
                    <?php endif; ?>

                </div>
            </div>
        </div>
    </div>
</div>

</div>
<!--PRODUCT BOX EOF-->




</form>

Solution

  • The problem is that you have a <form> tag inside an other <form> tag.
    The form for submitting a review is inside the add to cart form. Put the review form outside the add to cart form and it should work