[英]Magento product images new option
大家好,我该如何在商品图片列表中添加一个选项? 如“排除并删除”复选框
@vrnet您几乎在那里...此外,您需要更新:
/js/mage/adminhtml/products.js(大量更改)。 基本上,您需要为JSON添加代码以处理新字段。 我需要在末端添加第二个标签,并最终复制标签代码,并更改变量名称以匹配代码变量。 应该很简单。
(第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”):
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" /> </td>
<td class="cell-page last"><input type="hidden" /> </td>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.