开发者

How to change Magento default media structure?

开发者 https://www.devze.com 2023-03-14 02:41 出处:网络
I am developing Magento and I need to change default media structure on it. I have two category and subcategory named Cat1 and subCat1 .

I am developing Magento and I need to change default media structure on it. I have two category and subcategory named Cat1 and subCat1 . I want to save images physically to this path : media/catalog/product/cat开发者_如何学JAVA1/subcat1/image.jpg instead of media/catalog/product/i/m/image.jpg . How could I do this? Thanks


Rather than re-hack the system you could put your own controller that returns the product image for a given category/product URL. This would remove the need to rewrite core functionality.

If writing modules phases you (it should!) then you can use the API on a cron job to go through every product, retrieve its category URL, product name and primary image to then copy (or link) the primary image to the desired path, e.g. images/cat1/subcat1/sku.jpg

This approach will mean that the images will download quicker, you can also tailor them to a desired size with a bit of Imagemagick image processing.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号