Magento,我需要将第一个产品图片定义为缩略图 [英] Magento, i need define first product image as thumbnail

查看:78
本文介绍了Magento,我需要将第一个产品图片定义为缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经导入了旧的oscommerce网站,其中包含15000个magento产品!

I had imported my old oscommerce site with 15000 produts for magento!

但是很遗憾,缩略图不会自动定义

But unfortably, the thumbnails are dont defined automatically

http://imgur.com/cNdXd

我可以正常做,但是15000个产品是一个大数目,我需要花大量时间来做

i can do maually, but 15000 produts is a larg number and i need sped a big amout of time for do it

如果任何人都可以给我一条mysql命令来将第一个产品图像设置为基础图像,那么小图像和缩略图将很棒

if anywone can give-me a mysql command to set the first produts image as Base Image, Small Image and Thumbnail will be awesome

谢谢

推荐答案

尝试通过api更新它们:

Try update them via api:

$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');

$products = $proxy->call($sessionId, 'product.list');

foreach ($products as $product) {
    $images = $proxy->call($sessionId, 'product_media.list', $product['sku'])

    $imageFilename = $images[0]['file'];

    $proxy->call($sessionId, 'product_media.update', array(
        $product['sku'],
        $imageFilename,
        array('types' => array('image', 'thumbnail')
    ));
}

相关文档链接: http://www.magentocommerce.com/wiki/doc/webservices-api /api/catalog_product_attribute_media

http://www.magentocommerce.com/wiki/doc/webservices-api/api/catalog_product#catalog_product.list

这篇关于Magento,我需要将第一个产品图片定义为缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆