Magento类别产品页面显示两次

时间:2017-03-10 07:24:26

标签: php magento layout categories

我有一个magento商店,几天前工作正常,但现在显示了类别产品页面 两次像下面的图像,我尝试编辑我的主题list.phtml文件。

我提到here 但它没有解决我的问题。

我的主要问题是类别产品布局在类别页面中显示两次。

screenshot here

list.phtml代码

<?php
   $_productCollection=$this->getLoadedProductCollection();
   $columnCount = themeOptions('column_count');
   $enable_ajax = themeOptions('enable_ajax');
   $this->setColumnCount($columnCount);
   $_helper = $this->helper('catalog/output');  

?>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<div class="category-products">
   <?php echo $this->getToolbarHtml() ?>
   <?php // List mode ?>
   <?php if($this->getMode()!='grid'): ?>
   <?php $_iterator = 0; ?>

   <ol class="products-list" id="products-list">
   <?php foreach ($_productCollection as $_product): ?>
       <li class="clearfix item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
           <?php include('view/labels.phtml')  ?>  
           <div class="image">
           <div class="additional-buttons">
              <a onclick="setLocation('<?php echo $this->getAddToWishlistUrl($_product) ?>')" class="buttons-wish" title="<?php echo $this->__('Add to Wishlist') ?>"></a>
              <a onclick="setLocation('<?php echo $this->getAddToCompareUrl($_product) ?>')" class="buttons-compare" title="<?php echo $this->__('Add to Compare') ?>"></a>
           </div>
           <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image" id="productimgover<?php echo $_product->getId()?>">

               <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(245,262) ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

           </a>
           </div>
            <?php // Product description ?>
           <div class="product-shop">
               <div class="f-fix">
                   <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>

View.phtml代码

<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>
<?php $enable_ajax = themeOptions('enable_ajax'); ?>

<script type="text/javascript">
    var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
   jQuery(document).ready(function() {

   if(jQuery( window ).width() > 1000)
   {
    if(jQuery('.product-view .more-views-wrapper').position().top < jQuery('.product-view .short-description').position().top)
        {
            jQuery('.product-view .more-views-wrapper').css("min-height",jQuery('.product-shop').height() - jQuery('.product-view .product-img-box .main-image').height() - 60);
        }
        else
        {
            jQuery('.product-view .short-description').css("min-height",jQuery('.product-view .product-img-box .zoom-container').height() - jQuery('.product-view .product-shop').height() + jQuery('.product-view .short-description').height());
        }
   }

    });
</script>

<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; ?>>
        <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 id="addedoverlay" style='display:none'> </div>
        <div id='added' style='display:none'></div>
        <div id='productname' style='display:none'><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></div>

        <div class="ll-col-2 product-img-box">
            <?php echo $this->getChildHtml('media') ?>
        </div>

        <div class="ll-col-2 product-shop">
                <div class="product-name">
                    <div class="additional-buttons">
                       <a onclick="setLocation('<?php echo $this->getAddToWishlistUrl($_product) ?>')" class="buttons-wish" title="<?php echo $this->__('Add to Wishlist') ?>"></a>
                       <a onclick="setLocation('<?php echo $this->getAddToCompareUrl($_product) ?>')" class="buttons-compare" title="<?php echo $this->__('Add to Compare') ?>"></a>
                    </div>
                    <h1 style="color: #EA8831!important; text-transform: capitalize!important;font-family: Quicksand !important;font-weight: 600!important;font-size:27px;" ><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
                </div>



                <div class="product-subdata clearfix">
                    <?php echo $this->getChildHtml('alert_urls') ?>
                    <?php echo $this->getChildHtml('extrahint') ?>
                    <?php if($_product->getTypeId() != 'bundle'): ?>
                        <?php echo $this->getPriceHtml($_product) ?>
                    <?php else: ?>


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

                    <?php endif;?>


                        <?php if($_product->getTypeId() != 'bundle'): ?>
                            <div class="addtocont">
                            <span class="product-code"><?php echo $this->__('Product code:').' <strong>'.$_product->getSku().'</strong>'; ?></span>
                            <?php echo $this->getChildHtml('product_type_data') ?>
                            </div>
                        <?php endif;?>


                    <div class="rating-wrapper"><?php echo $this->getReviewsSummaryHtml($_product, false, true)?></div>

                    <?php echo $this->getTierPriceHtml() ?>
                </div>


                <div class="cart-buttons-wrapper">
                <?php if ($_product->isSaleable() && $this->hasOptions()):?>
                <div id="container2"><?php echo $this->getChildChildHtml('container2', '', true, true) ?></div>
            <?php endif;?>

                    <?php if ($_product->isSaleable() && $this->hasOptions()):?>

                        <div id="container1"><?php echo $this->getChildChildHtml('container1', '', true, true) ?><div class="clear"></div></div>
                    <?php endif;?>   

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

                    <?php if (!$this->hasOptions()):?>

                        <div class="add-to-box">
                            <?php if($_product->isSaleable()): ?>

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


                            <?php endif; ?>

                        </div>
                    <?php endif; ?>  
                </div>

                <?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;?>



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


        </div>



        <div class="clearer"></div>
    </form>
    <?php if($enable_ajax): ?>
    <script type="text/javascript">
    //<![CDATA[


        var productAddToCartForm = new VarienForm('product_addtocart_form');
        var url = jQuery('#product_addtocart_form').attr('action');
        url = url.replace("checkout/cart","ajax/index");    

        var msgHtml;
        var productImg = jQuery('.main-thumbnail').html();
        var windowOver = jQuery('#addedoverlay');
        var windowBox = jQuery('#added');
        var titleForBox = jQuery('#productname').text();   
        var data = {'isAjax':1}

        jQuery('#product_addtocart_form').ajaxForm({
            url: url,
            data: data,
            dataType: 'json',
            beforeSubmit: function(){    
                if(productAddToCartForm.validator.validate()){
                    windowOver.show();
                    windowBox.show().css({
                        backgroundImage: "url('<?php echo $this->getSkinUrl('images/loading.gif')?>')"
                    });                    
                }else{
                    return false;
                }
            },
            error: function(data){
                windowBox.css({
                      backgroundImage: 'none'
                }).html('<?php echo $this->__('Error') ?>');                       
                windowOver.one('click',function(){
                    hidewindow(windowBox,windowOver);                    
                });        

                jQuery('#hidewindow').click(function(){
                    hidewindow(windowBox,windowOver);                    
                });
            },
            success : function(data,statusText,xhr ){
                if(data.status == 'SUCCESS'){
                    if(jQuery('.block-cart')){
                        jQuery('.block-cart').replaceWith(data.sidebar);
                    }
                    if(jQuery('.block-cart-header')){
                        jQuery('.block-cart-header').replaceWith(data.topcart);
                    }     
                    msgHtml = '<div class="added-content"><div style="float:left;">' + productImg + '</div><em>' + titleForBox + '</em> <?php echo $this->__('was successfully added to your shopping cart.') ?><div style="clear:both;"></div><a id="hidewindow" href="javascript:void(0);"><?php echo $this->__('Continue shopping') ?></a>&nbsp;<a href="<?php echo $this->getUrl('checkout/cart')?>"><?php echo $this->__('View cart & checkout') ?></a></div>';             
                }else{
                    msgHtml = '<div class="added-content"><p class="error-msg" style="margin-bottom:15px;">' + data.message + '</p><a id="hidewindow" href="javascript:void(0);"><?php echo $this->__('Continue shopping') ?></a>&nbsp;<a href="<?php echo $this->getUrl('checkout/cart')?>"><?php echo $this->__('View cart & checkout') ?></a></div>';
                }                      

                windowBox.css({
                      backgroundImage: 'none'
                }).html(msgHtml);                      
                windowOver.one('click',function(){
                    hidewindow(windowBox,windowOver);                    
                });        

                jQuery('#hidewindow').click(function(){
                    hidewindow(windowBox,windowOver);                    
                });    
            }
        }); 

        function hidewindow(windowBox,windowOver){
            windowOver.fadeOut(400);
            windowBox.fadeOut(400).html('');    
        }

    //]]>
    </script>
    <?php else: ?>
    <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>
    <?php endif; ?>
    </div>
    <div class="clear"></div>
    <div class="product-tabs-area clearfix">
    <div class="product-collateral clearfix">
        <?php echo $this->getChildHtml('info_tabs') ?>
        <?php echo $this->getChildHtml('product_additional_data') ?>
    </div>
       <?php if(themeOptions('use_share')): ?>
    <div class="social-share clearfix">
    <div class="ss-facebook clearfix"><a class="image" href="http://www.facebook.com/sharer.php?u=<?php echo $_product->getProductUrl(); ?>" target="_blank"></a><a class="title" href="http://www.facebook.com/sharer.php?u=<?php echo $_product->getProductUrl(); ?>" target="_blank">Share on Facebook</a></div>
    <div class="ss-twitter clearfix"><a class="image" href="https://twitter.com/share?url=<?php echo $_product->getProductUrl(); ?>" target="_blank"></a><a class="title" href="https://twitter.com/share?url=<?php echo $_product->getProductUrl(); ?>" target="_blank">Tweet this item</a></div>
    <div class="ss-email clearfix"><a class="image" href="mailto:enteryour@addresshere.com?subject=<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>&amp;body=<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?> - <?php echo $_product->getProductUrl(); ?>" target="_blank"></a><a class="title" href="mailto:enteryour@addresshere.com?subject=<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>&amp;body=<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?> - <?php echo $_product->getProductUrl(); ?>" target="_blank">Tell your friend</a></div>
    <div class="ss-pinterest clearfix"><a class="image" href="http://pinterest.com/pin/create/button/?url=<?php echo $_product->getProductUrl(); ?>&amp;description=<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>&amp;media=<?php echo $_product->getMediaConfig()->getMediaUrl($_product->getData('image')); ?>" target="_blank"></a><a class="title" href="http://pinterest.com/pin/create/button/?url=<?php echo $_product->getProductUrl(); ?>&amp;description=<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>&amp;media=<?php echo $_product->getMediaConfig()->getMediaUrl($_product->getData('image')); ?>" target="_blank">Pin this item</a></div>
    </div>
    <?php endif; ?>
    </div>
    <?php echo $this->getChildHtml('upsell_products') ?>
    <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('product_promo_block')->toHtml(); ?>
    <?php echo $this->getChildHtml('related_products') ?>

</div>

P.S。代码与原始代码完全相同

0 个答案:

没有答案
相关问题