Product images are serving from different paths on

2019-09-02 04:23发布

问题:

Product images are serving from different paths in view page & in sitemap.

1) product view page : media/catalog/product/W/i/image-name.jpg : link1

2) http://sitename.com/media/sitemap.xml : media/product/ee7/image-name.jpg : link2

but i want product images should serve from same path in both links:

media.phtml

<?php
    $_product = $this->getProduct();
    $_helper = $this->helper('catalog/output');
    $dexxtz = Mage::helper('productzoom');

    $dexxtz->getCss();
    $dexxtz->getJs();
?>

<ul id="etalage">
    <li>                
        <img class="etalage_thumb_image"
        src="<?php echo Mage::getModel('catalog/product_media_config')->getMediaUrl($_product->getImage()); ?>" />
        <img class="etalage_source_image" title="<?php echo $_product->getImageLabel(); ?>" src="<?php echo $dexxtz->getImageFeatured($this->helper('catalog/image')->init($_product, 'image'), true); ?>" />
    </li>


    <?php 
        foreach ($this->getGalleryImages() as $_image) {
            if(Mage::registry('current_product')->getImage() != $_image->getFile()) { ?>                
            <li>
                <img class="etalage_thumb_image" src="<?php echo $dexxtz->getImageFeatured($this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile())); ?>" />



                <img class="etalage_source_image" title="<?php echo $_image->getLabel(); ?>" src="<?php echo $dexxtz->getImageFeatured($this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()), true); ?>" />


            </li> 
        <?php 
            }    
        }
    ?>   
</ul>

回答1:

For delivering images in the frontend you should always use this call <?php echo Mage::getModel('catalog/product_media_config')->getMediaUrl( $_product->getSmallImage()); ?> as it utilizes the Magento cache, if enabled.

Definately not default Magento is this path media/product/ee7/image-name.jpg - all product media related stuff is in media/catalog/product. It might be that you have an extension that uses media/product to store and server images - but this is not default Magento. Please check your extensions, especially how the links in the sitemap are created.