product labeltype and productgriddeslenght

Hello
i have this another warning in the log file

Code:

2014-04-19T14:01:17+00:00 ERR (3): Notice: Undefined variable: labeltype  in mypath/app/design/frontend/default/jm_megamall/template/catalog/product/list.phtml on line 144
2014-04-19T14:01:17+00:00 ERR (3): Notice: Undefined variable: productgriddeslenght  in mypath/app/design/frontend/default/jm_megamall/template/catalog/product/list.phtml on line 167

5 answers

Profile photo of chavan 100.00 $tone April 20, 2014
Public

can you please send me the list.phtml file

/app/design/frontend/default/jm_megamall/template/catalog/product/list.phtml

I will check and fix this and send it to you again

#1
Profile photo of chavan 100.00 $tone April 21, 2014
Public

Try replacing the complete code into list.phtml

Code:

<?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 [email protected] 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.
 *
 * egory    design
 * @package     base_default
 * Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Product list template
 *
 * @see Mage_Catalog_Block_Product_List
 */
?>
<div class="category-page">
<?php
    $_productCollection=$this->getLoadedProductCollection();
    $_helper = $this->helper('catalog/output');
    $baseconfig =  Mage::helper("jmbasetheme")->getactiveprofile();

    if ($baseconfig) : 
        $productlistimagewidth = $baseconfig["productlistimagewidth"];
        $productlistimageheight = $baseconfig["productlistimageheight"];
        $productlistdeslenght = $baseconfig["productlistdeslenght"];
        $productgridimageheight = $baseconfig["productgridimageheight"];
        $productgridimagewidth = $baseconfig["productgridimagewidth"];
        $showlabel = $baseconfig["showlabel"];
    else :
        $productlistimagewidth = 150;
        $productlistimageheight = 225;
        $productlistdeslenght = 0;
        $productgridimageheight = 225;
        $productgridimagewidth = 150;
        $showlabel = 0;
    endif;
?>

<?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="item<?php if(++$_iterator == 1): echo ' first'; endif; if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
                    <div class="inner">
                    <?php // Product Image ?>
                    <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
                        <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($productlistimagewidth,$productlistimageheight); ?>" width="<?php echo $productlistimagewidth; ?>" height="<?php echo $productlistimageheight; ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
                    </a>
                    <?php // Product description ?>
                    <div class="product-shop">
                        <div class="f-fix">
                            <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
                            <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>                                
                            <?php echo $this->getReviewsSummaryHtml($_product, true, true)?>
                            <?php echo $this->getPriceHtml($_product, true) ?>
                            <div class="short-description">
                                <?php $sdesc = $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
                                <?php 
                                    if ($productlistdeslenght) :
                                        echo substr(strip_tags($sdesc), 0, $productlistdeslenght).'...';
                                    else : 
                                        echo $sdesc;
                                    endif;
                                ?>
                            </div>
                            <div class="btn-cart"></div>
                            <ul class="add-to-links">
                                <li>
                                    <?php if($_product->isSaleable()): ?>
                                        <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
                                            <span><?php echo $this->__('Add to Cart') ?></span>
                                        </button>
                                    <?php else: ?>
                                        <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                                    <?php endif; ?>
                                </li>
                                <?php if ($this->helper('wishlist')->isAllow()) : ?>
                                    <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
                                <?php endif; ?>
                                <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                                    <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
                                <?php endif; ?>
                            </ul>
                        </div>
                    </div>
                </div>
            </li>
        <?php endforeach; ?>
        </ol>
        <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>

    <?php else: ?>

        <?php // Grid Mode ?>

        <?php $_collectionSize = $_productCollection->count() ?>
        <?php $_columnCount = $this->getColumnCount(); ?>
        <?php 
        if($baseconfig["productgridnumbercolumn"]) : 
            $_columnCount = $baseconfig["productgridnumbercolumn"];
        endif;
        ?>
        <ul class="products-grid products-grid-special">
            <?php $i=0; foreach ($_productCollection as $_product): ?>
                <?php
                    $_rowCount = ceil($_collectionSize/$_columnCount);
                    if ($i%$_columnCount==0) : $j++; endif;
                    if ($i++%$_columnCount==0): $width = 100; endif;
                    if ($_columnCount):
                        $width = 100/$_columnCount;
                        $width = "style=\"width:{$width}%;\"";  
                    endif;
                    $return = false;
                ?>
                 <li class="item <?php if ($j==$_rowCount) : echo "item-row-last"; endif; ?> <?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>" <?php echo $width; ?>>
                    <div class="inner">
                        <div class="product-image">
                            <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>">
                                <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($productgridimagewidth,$productgridimageheight); ?>" width="<?php echo $productgridimagewidth; ?>" height="<?php echo $productgridimageheight; ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
                                <?php if(isset($labeltype)); ?>
                                <?php if ($labeltype && $showlabel): ?>
                                    <span class="ico-label <?php echo $labeltype; ?>-label"><?php echo $labelname;    ?></span>        
                                <?php endif; ?>
                                <?php endif; ?>
                            </a>
                            <div class="actions">
                                <?php if($_product->isSaleable()){ ?>
                                <button class="form-button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
                                    <span class="fa fa-shopping-cart"></span>
                                </button>
                                <?php } else { ?>
                                <div class="out-of-stock"><?php echo $this->helper("catalog")->__('Out of stock') ?></div>
                                <?php } ?>
                                <ul class="add-to-links">
                                    <?php if ($this->helper('wishlist')->isAllow()) : ?>
                                    <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist">
                                        <?php echo $this->__('Wishlist') ?>
                                    </a></li>
                                    <?php endif; ?>
                                    <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                                    <li>
                                        <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Compare') ?></a></li>
                                    <?php endif; ?>
                                </ul>
                                <?php if(isset($productgriddeslenght)); ?>
                                <?php if($productgriddeslenght) : ?>
                                    <p class="pdescription"><?php echo substr(nl2br(strlen($_product->getDescription()) > 10 ? $_product->getDescription() : $_product->getShortDescription()), 0, $productgriddeslenght).'...';?></p>
                                <?php endif; ?>
                                <?php endif; ?>
                            </div>
                        </div>
                        <h5 class="product-name">
                            <a title="<?php echo $this->htmlEscape($_product->getName()) ?>" href="<?php echo $_product->getProductUrl() ?>">
                            <?php 
                                if (strlen($_product->getName()) > 35) :
                                    echo strip_tags(substr($_product->getName(), 0, 25)).'...';
                                else : 
                                    echo $_product->getName();
                                endif;
                            ?>
                            </a>
                        </h5>
                        <?php echo $this->getReviewsSummaryHtml($_product, true, true)?>
                        <?php echo $this->getPriceHtml($_product, true) ?>
                        
                     </div>
                </li>
            <?php endforeach ?>
        </ul>
            <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
    <?php endif; ?>
    <div class="toolbar-bottom">
        <?php echo $this->getToolbarHtml() ?>
    </div>
</div>
<?php endif; ?>
</div>
#3
Profile photo of matteo sitta 0.00 $tone April 21, 2014
Public

Thanks Chavan,

i have replaced

Code:

<?php if(isset($productgriddeslenght)); ?>

with

Code:

<?php if(isset($productgriddeslenght)): ?>

and now the list.phtml is clean , but in the log i found this:

Code:

2014-04-21T23:33:15+00:00 ERR (3): Notice: Undefined index: productgriddeslenght  in mypath/app/design/frontend/base/default/template/joomlart/jmbasetheme/jmbasethemehead.html on line 38
2014-04-21T23:33:15+00:00 ERR (3): Notice: Undefined variable: curenturl  in mypath/app/design/frontend/base/default/template/jmquickview/quickviewhead.phtml on line 4
2014-04-21T23:33:15+00:00 ERR (3): Notice: Undefined variable: j  in mypath/app/design/frontend/default/jm_megamall/template/catalog/product/list.phtml on line 131

but the quick-start should already be clear from these warning

Matteo

#4
Profile photo of chavan 100.00 $tone April 22, 2014
Public

These are all warnings and can be least bothered, but you are asking for a fix, so we will do it.

For Undefined variable J list.phtml

Code:

<?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 [email protected] 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.
 *
 * egory    design
 * @package     base_default
 * Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Product list template
 *
 * @see Mage_Catalog_Block_Product_List
 */
?>
<div class="category-page">
<?php
    $_productCollection=$this->getLoadedProductCollection();
    $_helper = $this->helper('catalog/output');
    $baseconfig =  Mage::helper("jmbasetheme")->getactiveprofile();

    if ($baseconfig) : 
        $productlistimagewidth = $baseconfig["productlistimagewidth"];
        $productlistimageheight = $baseconfig["productlistimageheight"];
        $productlistdeslenght = $baseconfig["productlistdeslenght"];
        $productgridimageheight = $baseconfig["productgridimageheight"];
        $productgridimagewidth = $baseconfig["productgridimagewidth"];
        $showlabel = $baseconfig["showlabel"];
    else :
        $productlistimagewidth = 150;
        $productlistimageheight = 225;
        $productlistdeslenght = 0;
        $productgridimageheight = 225;
        $productgridimagewidth = 150;
        $showlabel = 0;
    endif;
?>

<?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="item<?php if(++$_iterator == 1): echo ' first'; endif; if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
                    <div class="inner">
                    <?php // Product Image ?>
                    <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
                        <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($productlistimagewidth,$productlistimageheight); ?>" width="<?php echo $productlistimagewidth; ?>" height="<?php echo $productlistimageheight; ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
                    </a>
                    <?php // Product description ?>
                    <div class="product-shop">
                        <div class="f-fix">
                            <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
                            <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>                                
                            <?php echo $this->getReviewsSummaryHtml($_product, true, true)?>
                            <?php echo $this->getPriceHtml($_product, true) ?>
                            <div class="short-description">
                                <?php $sdesc = $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
                                <?php 
                                    if ($productlistdeslenght) :
                                        echo substr(strip_tags($sdesc), 0, $productlistdeslenght).'...';
                                    else : 
                                        echo $sdesc;
                                    endif;
                                ?>
                            </div>
                            <div class="btn-cart"></div>
                            <ul class="add-to-links">
                                <li>
                                    <?php if($_product->isSaleable()): ?>
                                        <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
                                            <span><?php echo $this->__('Add to Cart') ?></span>
                                        </button>
                                    <?php else: ?>
                                        <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                                    <?php endif; ?>
                                </li>
                                <?php if ($this->helper('wishlist')->isAllow()) : ?>
                                    <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
                                <?php endif; ?>
                                <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                                    <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
                                <?php endif; ?>
                            </ul>
                        </div>
                    </div>
                </div>
            </li>
        <?php endforeach; ?>
        </ol>
        <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>

    <?php else: ?>

        <?php // Grid Mode ?>

        <?php $_collectionSize = $_productCollection->count() ?>
        <?php $_columnCount = $this->getColumnCount(); ?>
        <?php 
        if($baseconfig["productgridnumbercolumn"]) : 
            $_columnCount = $baseconfig["productgridnumbercolumn"];
        endif;
        ?>
        <ul class="products-grid products-grid-special">
            <?php $i=0; $j=0; foreach ($_productCollection as $_product): ?>
                <?php
                    $_rowCount = ceil($_collectionSize/$_columnCount);
                    if ($i%$_columnCount==0) : $j++; endif;
                    if ($i++%$_columnCount==0): $width = 100; endif;
                    if ($_columnCount):
                        $width = 100/$_columnCount;
                        $width = "style=\"width:{$width}%;\"";  
                    endif;
                    $return = false;
                ?>
                 <li class="item <?php if ($j==$_rowCount) : echo "item-row-last"; endif; ?> <?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>" <?php echo $width; ?>>
                    <div class="inner">
                        <div class="product-image">
                            <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>">
                                <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($productgridimagewidth,$productgridimageheight); ?>" width="<?php echo $productgridimagewidth; ?>" height="<?php echo $productgridimageheight; ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
                                <?php if(isset($labeltype)); ?>
                                <?php if ($labeltype && $showlabel): ?>
                                    <span class="ico-label <?php echo $labeltype; ?>-label"><?php echo $labelname;    ?></span>        
                                <?php endif; ?>
                                <?php endif; ?>
                            </a>
                            <div class="actions">
                                <?php if($_product->isSaleable()){ ?>
                                <button class="form-button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
                                    <span class="fa fa-shopping-cart"></span>
                                </button>
                                <?php } else { ?>
                                <div class="out-of-stock"><?php echo $this->helper("catalog")->__('Out of stock') ?></div>
                                <?php } ?>
                                <ul class="add-to-links">
                                    <?php if ($this->helper('wishlist')->isAllow()) : ?>
                                    <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist">
                                        <?php echo $this->__('Wishlist') ?>
                                    </a></li>
                                    <?php endif; ?>
                                    <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                                    <li>
                                        <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Compare') ?></a></li>
                                    <?php endif; ?>
                                </ul>
                                <?php if(isset($productgriddeslenght)); ?>
                                <?php if($productgriddeslenght) : ?>
                                    <p class="pdescription"><?php echo substr(nl2br(strlen($_product->getDescription()) > 10 ? $_product->getDescription() : $_product->getShortDescription()), 0, $productgriddeslenght).'...';?></p>
                                <?php endif; ?>
                                <?php endif; ?>
                            </div>
                        </div>
                        <h5 class="product-name">
                            <a title="<?php echo $this->htmlEscape($_product->getName()) ?>" href="<?php echo $_product->getProductUrl() ?>">
                            <?php 
                                if (strlen($_product->getName()) > 35) :
                                    echo strip_tags(substr($_product->getName(), 0, 25)).'...';
                                else : 
                                    echo $_product->getName();
                                endif;
                            ?>
                            </a>
                        </h5>
                        <?php echo $this->getReviewsSummaryHtml($_product, true, true)?>
                        <?php echo $this->getPriceHtml($_product, true) ?>
                        
                     </div>
                </li>
            <?php endforeach ?>
        </ul>
            <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
    <?php endif; ?>
    <div class="toolbar-bottom">
        <?php echo $this->getToolbarHtml() ?>
    </div>
</div>
<?php endif; ?>
</div>

can you please send these 2 files jmbasethemehead.html and quickviewhead.phtml , so i will make the amendment and repost it

#5

Please login or Register to Submit Answer

Written By

Comments