繁体   English   中英

Magento产品图片新选项

[英]Magento product images new option

大家好,我该如何在商品图片列表中添加一个选项? 如“排除并删除”复选框

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

  1. /js/mage/adminhtml/products.js(大量更改)。 基本上,您需要为JSON添加代码以处理新字段。 我需要在末端添加第二个标签,并最终复制标签代码,并更改变量名称以匹配代码变量。 应该很简单。

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

如有任何疑问,请给我发送电子邮件

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

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

我已经完成了一些工作,但是无法更新数据库中的数据。

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

谢谢大家的宝贵帮助。


这是我所做的(1.4.1.0):

1-更新表catalog_product_entity_media_gallery_value

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

  • 页面tinyint(4)未签名否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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM