Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module is appearing in System -> Configuration -> Advanced (under Advanced Group) and is enabled
- Cache was deleted with rm -r var/cache
- Session was deleted with rm -r var/session
- stat -c "%a %n" app/code/local/Proweb/CustomClass/*
- 755 app/code/local/Proweb/CustomClass/Block
- 755 app/code/local/Proweb/CustomClass/Model
- 755 app/code/local/Proweb/CustomClass/etc
- 755 app/code/local/Proweb/CustomClass/sql
- app/etc/modules/Proweb_CustomClass.xml:
- <?xml version="1.0"?>
- <config>
- <modules>
- <Proweb_CustomClass>
- <active>true</active>
- <codePool>local</codePool>
- </Proweb_CustomClass>
- </modules>
- </config>
- app/code/local/Proweb/CustomClass/etc/Config.xml
- <?xml version="1.0"?>
- <config>
- <modules>
- <Proweb_CustomClass>
- <version>1.0</version>
- </Proweb_CustomClass>
- </modules>
- <global>
- <blocks>
- <Adminhtml>
- <rewrite>
- <Catalog_Product_Edit_Tab_Options_Option>
- Proweb_CustomClass_Block_Adminhtml_Option
- </Catalog_Product_Edit_Tab_Options_Option>
- </rewrite>
- </Adminhtml>
- </blocks>
- <resources>
- <customclass_setup>
- <setup>
- <module>Proweb_CustomClass</module>
- <class>Proweb_CustomClass_Model_Resource_Setup</class>
- </setup>
- </customclass_setup>
- </resources>
- </global>
- </config>
- app/code/local/Proweb/CustomClass/Block/Adminhtml/Options.php
- <?php
- class Proweb_CustomCss_Block_Adminhtml_Option extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option {
- public function getOptionValues()
- {
- $optionsArr = array_reverse($this->getProduct()->getOptions(), true);
- var_dump($optionsArr); exit;
- // $optionsArr = $this->getProduct()->getOptions();
- if (!$this->_values) {
- $showPrice = $this->getCanReadPrice();
- $values = array();
- $scope = (int) Mage::app()->getStore()->getConfig(Mage_Core_Model_Store::XML_PATH_PRICE_SCOPE);
- foreach ($optionsArr as $option) {
- /* @var $option Mage_Catalog_Model_Product_Option */
- $this->setItemCount($option->getOptionId());
- $value = array();
- $value['id'] = $option->getOptionId();
- $value['item_count'] = $this->getItemCount();
- $value['option_id'] = $option->getOptionId();
- $value['title'] = $this->escapeHtml($option->getTitle());
- $value['type'] = $option->getType();
- $value['is_require'] = $option->getIsRequire();
- $value['sort_order'] = $option->getSortOrder();
- $value['custom_class'] = $option->getCustomClass();
- $value['can_edit_price'] = $this->getCanEditPrice();
- if ($this->getProduct()->getStoreId() != '0') {
- $value['checkboxScopeTitle'] = $this->getCheckboxScopeHtml($option->getOptionId(), 'title',
- is_null($option->getStoreTitle()));
- $value['scopeTitleDisabled'] = is_null($option->getStoreTitle())?'disabled':null;
- }
- if ($option->getGroupByType() == Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT) {
- // $valuesArr = array_reverse($option->getValues(), true);
- $i = 0;
- $itemCount = 0;
- foreach ($option->getValues() as $_value) {
- /* @var $_value Mage_Catalog_Model_Product_Option_Value */
- $value['optionValues'][$i] = array(
- 'item_count' => max($itemCount, $_value->getOptionTypeId()),
- 'option_id' => $_value->getOptionId(),
- 'option_type_id' => $_value->getOptionTypeId(),
- 'title' => $this->escapeHtml($_value->getTitle()),
- 'price' => ($showPrice)
- ? $this->getPriceValue($_value->getPrice(), $_value->getPriceType()) : '',
- 'price_type' => ($showPrice) ? $_value->getPriceType() : 0,
- 'sku' => $this->escapeHtml($_value->getSku()),
- 'sort_order' => $_value->getSortOrder(),
- 'custom_class' => $this->escapeHtml($_value->getCustomClass())
- );
- if ($this->getProduct()->getStoreId() != '0') {
- $value['optionValues'][$i]['checkboxScopeTitle'] = $this->getCheckboxScopeHtml(
- $_value->getOptionId(), 'title', is_null($_value->getStoreTitle()),
- $_value->getOptionTypeId());
- $value['optionValues'][$i]['scopeTitleDisabled'] = is_null($_value->getStoreTitle())
- ? 'disabled' : null;
- if ($scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE) {
- $value['optionValues'][$i]['checkboxScopePrice'] = $this->getCheckboxScopeHtml(
- $_value->getOptionId(), 'price', is_null($_value->getstorePrice()),
- $_value->getOptionTypeId());
- $value['optionValues'][$i]['scopePriceDisabled'] = is_null($_value->getStorePrice())
- ? 'disabled' : null;
- }
- }
- $i++;
- }
- } else {
- $value['price'] = ($showPrice)
- ? $this->getPriceValue($option->getPrice(), $option->getPriceType()) : '';
- $value['price_type'] = $option->getPriceType();
- $value['sku'] = $this->escapeHtml($option->getSku());
- $value['custom_class'] = $option->getCustomClass();
- $value['max_characters'] = $option->getMaxCharacters();
- $value['file_extension'] = $option->getFileExtension();
- $value['image_size_x'] = $option->getImageSizeX();
- $value['image_size_y'] = $option->getImageSizeY();
- if ($this->getProduct()->getStoreId() != '0' &&
- $scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE) {
- $value['checkboxScopePrice'] = $this->getCheckboxScopeHtml($option->getOptionId(),
- 'price', is_null($option->getStorePrice()));
- $value['scopePriceDisabled'] = is_null($option->getStorePrice())?'disabled':null;
- }
- }
- $values[] = new Varien_Object($value);
- }
- $this->_values = $values;
- }
- return $this->_values;
- }
- public function getCustomCss() {
- var_dump($_POST);
- }
- }
- app/code/local/Proweb/CustomClass/Model/Resource/Setup.php
- <?php
- class Proweb_CustomClass_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
- }
- app/code/local/Proweb/CustomClass/sql/customclass_setup/mysql4-install-0.1.0.php
- <?php
- $installer = $this;
- $installer->startSetup();
- $installer->run("ALTER TABLE `catalog_product_option` ADD `custom_class` text");
- $installer->endSetup();
Advertisement
Add Comment
Please, Sign In to add comment