2009-12-06 77 views
2

嘿家伙们,我如何添加一个选项产品图像列表?像排除&删除复选框Magento产品图片新选项

+0

你必须与Adminhtml文件的工作。你打算添加什么选项? – 2009-12-07 02:27:33

+0

我需要添加一个复选框选项产品图像列表,让我们说“在Flash上​​显示”...并在前端开发我需要使用此选项集所有产品图像。 – birkof 2009-12-07 12:59:48

回答

0

我想编码相同的功能。你有答案吗?

想法是为图库中的每个图像添加一个“用作页面”复选框。目标是将所有图片的JS旋转木马选中为“用作页面”。

我做了几件事但我无法更新数据库中的数据。

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

非常感谢您的宝贵帮助。


这是我所做的(1.4.1。0):

1更新表catalog_product_entity_media_gallery_value

增加了一个新的领域(这名字是 “页”):

  • 页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 /默认/缺省的/模板/目录/产品/帮手/画廊。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> 
1

@vrnet 你几乎没有... 此外,您将需要更新:

  1. /js/mage/adminhtml/products.js(吨的变化)。基本上你需要为JSON添加代码来处理你的新领域。我需要在我的末尾添加第二个标签并结束copyPasting标签代码并更改变量名称以匹配代码变量。应该非常简单。

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

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