2

嘿伙计们,我如何在产品图片列表中再添加一个选项?像排除和删除复选框

4

2 回答 2

1

@vrnet您几乎就在那里...此外,您需要更新:

  1. /js/mage/adminhtml/products.js(大量更改)。基本上你需要为 JSON 添加代码来处理你的新字段。我需要在最后添加第二个标签,最后复制粘贴标签代码并更改变量名称以匹配代码变量。应该很直截了当。

  2. (第 66 行)Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Backend_Media 类,您需要添加新列,以便从数据库加载回来。

如果您有任何问题,请给我发电子邮件

于 2010-11-10T22:11:45.090 回答
0

我正在尝试编写相同的功能。你有答案吗?

这个想法是为图像库中的每个图像添加一个“用作页面”复选框。目标是制作一个 JS 轮播,所有图片都检查为“用作页面”。

我做了一些事情,但我无法更新数据库中的数据。

--> 所以我的问题是:如何更新数据库中的数据并在复选框中检索它(0 或 1 取决于复选框)?

感谢大家非常宝贵的帮助。


这是我所做的(1.4.1.0):

1- 更新表 catalog_product_entity_media_gallery_value

添加了一个新字段(名称为“page”):

  • page tinyint(4) UNSIGNED 否 0

2- 对 Mage_Catalog_Model_Product_Attribute_Backend_Media 类进行了以下更改

第 49 行:

$localAttributes = array('label', 'position', 'disabled');

$localAttributes = array('label', 'position', 'disabled', 'page');

第 223 行:

$data['disabled'] = (int) $image['disabled'];

$data['disabled'] = (int) $image['disabled'];
$data['page'] = (int) $image['page'];

301线

$mediaGalleryData['images'][] = array(
    'file'     => $fileName,
    'position' => $position,
    'label'    => '',
    'disabled' => (int) $exclude
);

$mediaGalleryData['images'][] = array(
    'file'     => $fileName,
    'position' => $position,
    'label'    => '',
    'disabled' => (int) $exclude,
    'page' => (int) $exclude,
);

328号线

$fieldsMap = array(
    'label'    => 'label',
    'position' => 'position',
    'disabled' => 'disabled',
    'exclude'  => 'disabled',
);

$fieldsMap = array(
    'label'    => 'label',
    'position' => 'position',
    'disabled' => 'disabled',
    'exclude'  => 'disabled',
    'page'  => 'disabled',
);

3- 对模板 adminhtml/default/default/template/catalog/product/helper/gallery.phtml 进行了以下更改

第 64 行

    <th><?php echo Mage::helper('catalog')->__('Exclude') ?></th>

    <th><?php echo Mage::helper('catalog')->__('Exclude') ?></th>
    <th><?php echo Mage::helper('catalog')->__('Is Page') ?></th>

77号线

<td class="cell-disable a-center"><input type="checkbox" <?php if($_block->getElement()->getReadonly()):?> disabled="disabled"<?php endif;?> onclick="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>

<td class="cell-disable a-center"><input type="checkbox" <?php if($_block->getElement()->getReadonly()):?> disabled="disabled"<?php endif;?> onclick="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>
<td class="cell-page a-center"><input type="checkbox" <?php if($_block->getElement()->getReadonly()):?> disabled="disabled"<?php endif;?> onclick="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>

105 号线

从  

            <td class="cell-disable"><input type="hidden" />&nbsp;</td>
            <td class="cell-page last"><input type="hidden" />&nbsp;</td>
于 2010-07-21T08:22:41.473 回答