更改视图模板后,Magento 添加到购物车按钮不起作用

问题描述 投票:0回答:1

嗨,感谢您的阅读!

我更改了产品视图。基本上,我将选项卡移至上方并将产品信息包装到选项卡中。看起来不错,但添加到购物车现在不起作用。我注意到,当我按下添加到购物车按钮时,审阅选项卡中的审阅表单会询问必填字段,选项卡表单也会询问相同的内容。此外,如果您在产品中有必需的选项,并且如果您没有选择它们,那么它也会要求它们。

not:控制台没有错误!

这是链接。

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

这是代码

<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>
forms magento
1个回答
2
投票

问题是您在另一个

<form>
标签内有一个
<form>
标签。
用于提交评论的表单位于“添加到购物车”表单内。 将评论表单放在添加到购物车表单之外,它应该可以工作

© www.soinside.com 2019 - 2024. All rights reserved.