2012-11-16 47 views

回答

1

为什么不只是在基于类型ID的view.phtml中做例外?

<?php if($_product->getTypeId() == "configurable"){ ?> 
      <div class="product-view"> ... </div> 

     <?php } else { ?> 
      <div class="product-view"> ... </div> 
     <?php } ?> 
+0

谢谢,我已应用此解决方案。 – Dar

2

此代码应该在任何地方,只能运行一次。运行此代码后,您可以将其删除。

$setup = new Mage_Eav_Model_Entity_Setup('core_setup'); 

     $setup->addAttribute('catalog_product', 'attributename', array(
      'group'    => 'Geral', 
      'label'    => 'Backend label', 
      'note'    => '', 
      'type'    => 'int', //backend_type 
      'input'    => 'text', //frontend_input 
      'frontend_class' => '', 
      'source'   => 'sourcetype/attribute_source_type', 
      'backend'   => '', 
      'frontend'   => '', 
      'global'   => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 
      'required'   => true, 
      'visible_on_front' => false, 
      'apply_to'   => 'simple', 
      'is_configurable' => false, 
      'used_in_product_listing' => false, 
      'sort_order'  => 5, 
     )); 
+0

感谢您的解决方案,但我需要显示配置相同的属性。所以,这不会帮助我。谢谢 – Dar

+0

你说你只需要简单的产品。 – Guerra

+0

您可以将代码从'apply_to'=>'simple'更改为'apply_to'=> array('simple','configured','grouped','virtual','bundle','downloadable') – Guerra

相关问题