Magento后台单一产品删除图片添加全选和全不选选项

本文介绍Magento后台产品图片管理模块的实现细节,包括如何通过gallery.phtml文件配置产品图片的显示方式,如图片标签、排序及排除选项等,并提供用于全选和全不选图片的JavaScript代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Magento后台产品多图管理模块文件:app/design/adminhtml/default/default/template/catalog/product/helper/gallery.phtml
找到

<thead>
        <tr class="headings">
            <th><?php echo Mage::helper('catalog')->__('Image') ?></th>
            <th><?php echo Mage::helper('catalog')->__('Label') ?></th>
            <th><?php echo Mage::helper('catalog')->__('Sort Order') ?></th>
            <?php foreach ($_block->getImageTypes() as $typeId=>$type): ?>
            <th><?php echo $type['label'] ?></th>
            <?php endforeach; ?>
            <th><?php echo Mage::helper('catalog')->__('Exclude') ?></th>
            <th class="last"><?php echo Mage::helper('catalog')->__('Remove') ?>&nbsp;|&nbsp;<em onclick="checkAll()">全选</em>&nbsp;|&nbsp;<em onclick="uncheckAll()">全不选</em></th>
        </tr>
</thead>

js部分

<script>
    function uncheckAll() {
        var a = window.document.getElementsByTagName("input");
        for (var i = 0; i < a.length; i++) {
            if (a[i].type == "checkbox" && a[i].disabled == false) {
                a[i].checked = true;
                a[i].click();
            }
        }
    }
    function checkAll() {
        var a = window.document.getElementsByTagName("input");
        for (var i = 0; i < a.length; i++) {
            if (a[i].type == "checkbox" && a[i].disabled == false) {
                a[i].checked = false;
                a[i].click();
            }
        }
    }

</script>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值