Created
August 30, 2013 06:54
-
-
Save Rokko11/6386962 to your computer and use it in GitHub Desktop.
Problem: Werte von Bundle/Option werden nicht im option.phtml vorselektiert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
optionTemplate = '<div id="<?php echo $this->getFieldId() ?>_{{index}}" class="option-box"> ' + | |
'<div class="option-title"> ' + | |
'<label for="<?php echo $this->getFieldName() ?>[{{index}}][title]"><?php echo Mage::helper('bundle')->__('Default Title') ?> <span class="required">*</span></label>' + | |
<?php if ($this->isDefaultStore()): ?> | |
'<input class="input-text required-entry" type="text" name="<?php echo $this->getFieldName() ?>[{{index}}][title]" id="id_<?php echo $this->getFieldName() ?>_{{index}}_title" value="{{title}}">' + | |
<?php else: ?> | |
'<input class="input-text required-entry" type="text" name="<?php echo $this->getFieldName() ?>[{{index}}][default_title]" id="id_<?php echo $this->getFieldName() ?>_{{index}}_default_title" value="{{default_title}}">' + | |
<?php endif; ?> | |
'<?php echo $this->jsQuoteEscape($this->getOptionDeleteButtonHtml()) ?>' + | |
'</div>' + | |
'<table class="option-header" cellpadding="0" cellspacing="0">' + | |
'<thead>' + | |
'<tr>' + | |
<?php if (!$this->isDefaultStore()): ?> | |
'<th class="opt-title"><?php echo Mage::helper('bundle')->__('Store View Title') ?> <span class="required">*</span></th>' + | |
<?php endif; ?> | |
'<th class="opt-type"><?php echo Mage::helper('bundle')->__('Input Type') ?></th>' + | |
'<th class="opt-req"><?php echo $this->jsQuoteEscape(Mage::helper('bundle')->__('Is Required')) ?></th>' + | |
'<th class="opt-order"><?php echo Mage::helper('bundle')->__('Position') ?></th>' + | |
'<th class="opt-cms"><?php echo Mage::helper('cmsforbundle')->__('Static Block') ?></th>' + | |
'<th> </th>' + | |
'</tr>' + | |
'</thead>' + | |
'<tbody>' + | |
'<tr>' + | |
'<input type="hidden" id="<?php echo $this->getFieldId() ?>_id_{{index}}" name="<?php echo $this->getFieldName() ?>[{{index}}][option_id]" value="{{option_id}}">' + | |
'<input type="hidden" name="<?php echo $this->getFieldName() ?>[{{index}}][delete]" value="" class="delete">' + | |
<?php if (!$this->isDefaultStore()): ?> | |
'<td><input class="input-text required-entry" type="text" name="<?php echo $this->getFieldName() ?>[{{index}}][title]" id="id_<?php echo $this->getFieldName() ?>_{{index}}_title_store" value="{{title}}"></td>' + | |
<?php endif; ?> | |
'<td><?php echo $this->getTypeSelectHtml() ?></td>' + | |
'<td><?php echo $this->getRequireSelectHtml() ?></td>' + | |
'<td><input class="input-text validate-zero-or-greater" type="text" name="<?php echo $this->getFieldName() ?>[{{index}}][position]" value="{{position}}"></td>' + | |
'<td><?php echo Mage::helper('cmsforbundle')->getStaticBlockHtml() ?></td>' + | |
'<td> <?php echo $this->jsQuoteEscape($this->getAddSelectionButtonHtml()) ?></td>' + | |
'</tr>' + | |
'</tbody>' + | |
'</table>' + | |
'<div id="<?php echo $this->getFieldId() ?>_search_{{index}}">' + | |
'</div>' + | |
'</div>'; | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rokko_CmsForBundle_Helper_Data extends Mage_Core_Helper_Abstract { | |
public function getStaticBlockHtml(){ | |
$select = Mage::app()->getLayout()->createBlock('adminhtml/html_select') | |
->setData(array( | |
'id' => 'bundle_option_{{index}}_block', | |
'class' => 'select' | |
)) | |
->setName('bundle_options[{{index}}][block_id]') | |
->setOptions(Mage::getResourceModel('cms/block_collection')->load()->toOptionArray()); | |
return $select->getHtml(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$installer->startSetup(); | |
$table = $installer->getConnection()->addColumn($installer->getTable('bundle/option'), 'block_id', | |
array( | |
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER, | |
'unsigned' => true, | |
'nullable' => true, | |
'default' => '0', | |
'comment' => 'Cms Block Id' | |
) | |
); | |
$installer->getConnection() | |
->addForeignKey( | |
$installer->getFkName('bundle/option', 'block_id', 'cms/block', 'block_id'), $installer->getTable('bundle/option'), 'block_id', $installer->getTable('cms/block'), 'block_id', | |
Varien_Db_Ddl_Table::ACTION_SET_NULL, Varien_Db_Ddl_Table::ACTION_CASCADE | |
); | |
$installer->endSetup(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment