Vinai / nicer-image-names

Magento extension to build catalog image file names from product attributes so they have neat descriptive names.
77 stars 31 forks source link

Product Name Not Showing #9

Closed ghost closed 10 years ago

ghost commented 10 years ago

I have issue with "Nicer Seo Image Name" that is it is not showing product "name" attribute on the frontend.

We can see it correctly on the category Page, but we have this issue on Product Page. Please check :

Product Page :

http://www.dantunes.de/oberteile/lucie-finesse.html

Category Page :http://www.dantunes.de/oberteile.html

I am sending you the screen shot for this query :

SELECT * FROM core_config_data WHERE path LIKE 'catalog/nicerimagenames/%‘;

along with media file code, we are using ultimo theme it has in build cloud zoom.

<?php
/**
 * @var $_product   Mage_Catalog_Model_Product
 */
?>
<?php
    $_product = $this->getProduct();
    $_helper = $this->helper('catalog/output');
    $helpZoom = $this->helper('infortis_cloudzoom');
    $helpImg = $this->helper('infortis/image');

    //Get image sizes. If height is not specified, aspect ratio will be kept.
    $imgWidth       = intval($helpZoom->getCfg('images/main_width'));
    $imgHeight      = intval($helpZoom->getCfg('images/main_height'));
    $bigImageWidth  = intval($helpZoom->getCfg('general/big_image_width'));
    $bigImageHeight = intval($helpZoom->getCfg('general/big_image_height'));

    //If main image width is not specified, use default values
    if ($imgWidth <= 0)
    {
        $imgWidth = 364;
        $imgHeight = 364;
    }
    //$imgBorder = 1;
    //$imgPadd = 5;
    //$imgTotalPadd = ($imgBorder + $imgPadd) * 2; //12
    //$imgWidth -= $imgTotalPadd;
    //$imgHeight -= $imgTotalPadd;

    //If main image width is not specified, use default values
    if ($bigImageWidth <= 0)
    {
        $bigImageWidth = 650;
        $bigImageHeight= 650;
    }

    //Thumbnail images size
    $thumbImgWidth = 65;
    $thumbImgHeight = 65;
    $thumbTotalPadd = 14; //Additional padding, border and margin (horizontal axis) around the image
    $thumbTotalWidth = $thumbImgWidth + $thumbTotalPadd;
//  $thumbsShowCount = 3;
//  $thumbTotalWidth = floor(($imgWidth * 0.8) / $thumbsShowCount);
//  $thumbImgWidth = $thumbTotalWidth - $thumbTotalPadd;
//  $thumbImgHeight = $thumbTotalWidth - $thumbTotalPadd;

    //Aspect ratio settings
    if ($helpZoom->getCfg('images/aspect_ratio'))
    {
        //Height will be computed automatically (based on width) to keep the aspect ratio of the image
        $imgHeight = 0;
        $bigImageHeight= 0;
        $thumbImgHeight = 0;
    }
?>

<?php //Main image ?>

<div class="img-box img-box-style1">
<?php if ($_product->getImage() != 'no_selection' && $_product->getImage()): ?>

    <?php if($helpZoom->isCloudZoomEnabled()): //If module enabled ?>

        <?php
            $zoomClasses = '';
            if ($helpZoom->useCloudZoom() == false)
                $zoomClasses .= ' simple-mode';
            else
            {
                if ($helpZoom->isPositionInside())
                    $zoomClasses .= ' zoom-inside';
            }
        ?>

        <p class="product-image<?php echo $zoomClasses; ?>">

            <a href="<?php echo $helpImg->getImg($_product, $bigImageWidth, $bigImageHeight); ?>" class="cloud-zoom" id="zoom1" rel="<?php echo $helpZoom->getCloudZoomOptions(); ?>">
                <img src="<?php echo $helpImg->getImg($_product, $imgWidth, $imgHeight); ?>" alt="<?php echo $this->htmlEscape($this->getImageLabel());?>" title="<?php echo $this->htmlEscape($this->getImageLabel());?>" />
            </a>

            <?php if($helpZoom->useLightbox()): ?>
                <?php
                    $zoomBtnClasses = '';
                    if ($helpZoom->useCloudZoom() == false)
                        $zoomBtnClasses .= ' zoom-btn-large';
                    else
                        $zoomBtnClasses .= ' zoom-btn-small';
                ?>
                <a id="zoom-btn" class="lightbox-group<?php echo $zoomBtnClasses; ?>" href="<?php echo $helpImg->getImg($_product, $bigImageWidth, $bigImageHeight); ?>" title="<?php echo $this->getImageLabel(); ?>"><?php echo $this->__('Zoom'); ?></a>

            <?php endif; ?>
        </p>

    <?php else: //Module disabled. Show images in Magento default style ?>

        <p class="product-image">
            <img src="<?php echo $helpImg->getImg($_product, $imgWidth, $imgHeight); ?>" alt="<?php echo $this->htmlEscape($this->getImageLabel());?>" title="<?php echo $this->htmlEscape($this->getImageLabel());?>" />
        </p>

    <?php endif; ?>

<?php else: //No image ?>

    <p class="product-image">
        <?php
            $_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize($imgWidth).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
            echo $_helper->productAttribute($_product, $_img, 'image');
        ?>
    </p>

<?php endif; ?>

<?php //Thumbnails ?>

    <?php
     $imageCount = count($this->getGalleryImages());

        //Modify thumbnail slider depending on number of thumbnails
        $sliderClasses = '';
        if ($imageCount > 0)
        {
            if ($imageCount <= 5)
                $sliderClasses .= " count-$imageCount";
            else
                $sliderClasses .= " count-multi";
        }
        if ($imageCount < 3)
            $sliderClasses .= ' hide-direction-nav';
    ?>

    <?php if ($imageCount > 0): ?>

    <div class="more-images itemslider itemslider-thumbnails gen-slider-arrows3 <?php if($sliderClasses) echo $sliderClasses; ?>">
        <?php if ($_product->getTypeId() == "configurable" && Mage::helper('colorselectorplus')->getUsesSwatchAttribs($_product) == 'yes'): ?>                  
                <?php echo Mage::helper('colorselectorplus')->getMoreViewsZoom($_product); ?>
        <?php else : ?>     

        <ul class="thumbnails slides">

        <?php //Display thumbnails with cloud zoom or lightbox ?>
        <?php if ($helpZoom->isCloudZoomEnabled()): ?>

            <?php foreach ($this->getGalleryImages() as $_image): ?>
                <?php //Skip, if no image
                    if ($_image->getFile() == NULL)
                        continue; ?>
                <li>
                    <a href="<?php echo $helpImg->getImg($_product, $bigImageWidth, $bigImageHeight, 'image', $_image->getFile()); ?>" class="cloud-zoom-gallery lightbox-group" title="<?php echo $this->htmlEscape($_image->getLabel()); ?>"
                        rel="useZoom:'zoom1', smallImage: '<?php echo $helpImg->getImg($_product, $imgWidth, $imgHeight, 'image', $_image->getFile()); ?>'">

                        <img src="<?php echo $helpImg->getImg($_product, $thumbImgWidth, $thumbImgHeight, 'thumbnail', $_image->getFile()); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()); ?>"/>

                    </a>
                </li>
            <?php endforeach; ?>

        <?php else: //Show thumbnails in Magento default style, without cloud zoom and lightbox ?>

            <?php foreach ($this->getGalleryImages() as $_image): ?>
                <?php //Skip, if no image
                    if ($_image->getFile() == NULL)
                        continue; ?>
                <li>
                    <a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>">
                        <img src="<?php echo $helpImg->getImg($_product, $thumbImgWidth, $thumbImgHeight, 'thumbnail', $_image->getFile()); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>"/>
                    </a>
                </li>
            <?php endforeach; ?>

        <?php endif; ?>
        </ul>
        <?php endif; ?>
    </div> <!-- end: more-images -->
    <?php endif; ?>

</div> <!-- end: img-box -->

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

<script type="text/javascript">
//<![CDATA[

    jQuery(function($) {
        var t; $(window).resize(function() { clearTimeout(t); t = setTimeout(function() { $(".more-images .cloud-zoom-gallery").first().click(); }, 200); });
    });

    jQuery(function($) {
        $('.itemslider-thumbnails').flexslider({
            namespace: "",
            animation: "slide",
            easing: "easeInQuart",
            animationSpeed: 300,
            animationLoop: false,
            slideshow: false,

            pauseOnHover: true,
            controlNav: false,

            itemWidth: <?php echo $thumbTotalWidth; ?>,
            move: 1
        });
    });
//]]>
</script>

sql_query

Thanks Pulkit Seth

Vinai commented 10 years ago

Thanks for the information. Which version of Magento and of the NicerImageNames extension are you using?

ghost commented 10 years ago

Hi,

We are using 1.7.0.2 version of Magento and 0.2.2 version of Nicer Image Name.

Regards Pulkit Seth

Vinai commented 10 years ago

Its a really strange thing that is happening for you. I've spent quite some time trying to understand, but I must admit - I can't. The name really should be readily available in the label, just like the brand and the sku. On local instances (1.7.0.2 and 1.8.0.0) the name works just fine as part of the alt attribute.

You could try updating to the latest version - 0.2.3 - to see if that changes anything, but I doubt it. The update was mainly refactoring for better maintainability in future.

Unless you are willing to give me developer access to a test instance to debug I don't know what to do.

Vinai commented 10 years ago

I’ve set up a 1.7.0.2 dev environment with the app folder data you sent, but with a standard database, since the DB dump was broken.

The following modules had to be deactivated because they stopped Magento from running completely, either because they where causing exceptions to be thrown directly, or because they required libraries which are not present within the app/ directory:

After I disabled those modules, I configured the ultimo theme to be used. Then I refreshed the complete cache, and loaded a frontend product detail page, and checked if the ALT tag was generated correctly by the Nicer SEO Image Names extension.

With no other configuration, the ALT images where still generated correctly on the product detail pages.

The issue on your server must stem from either one of the modules above, or because of some difference in the configuration.

I’m afraid I’ve already spent a lot of time trying to debug the issue. At this point I have to say I can’t afford the time to dig deeper, since it seems to be some kind of strange extension conflict, unique to your setup.

I’m afraid you will have to look for help elsewhere, or simply remove the Netzarbeiter_NicerImageNames extension.