I have HTML Code 2 input file in view of a action.
<form action="#" id="appForm" name="appForm"
enctype="multipart/form-data" method="post">
<input type="file" name="picture" id="picture">
<input type="file" name="attach_file" id="attach_file">
</form>
After that, i submit this form to a action of controller. Code in action to get Post
if($this->getRequest()->isPost()) {
$item = array_merge_recursive($this->params()->fromPost(), $this->params()->fromFiles());
$item['id'] = $this->params()->fromRoute('id');
$item['action'] = 'edit';
$validator = new ArticleValidator($item);
if($validator->isError()) {
$error = array_merge($error, $validator->getError());
$item = $validator->getData();
}else{
echo ' save data';
die();
}
}
And code in ArticleValidator
namespace Admin\Form;
class ArticleValidator {
protected $_arrError = null;
protected $_arrData;
public function __construct($arrParam = array(), $options = null) {
// avatar
if (!empty($arrParam['picture']['name'])) {
$size = new \Zend\Validator\File\Size(array('min' => 1, 'max' => 2097152));
$ext = new \Zend\Validator\File\Extension('gif,jpg,jpeg,png');
$adapterPicture = new \Zend\File\Transfer\Adapter\Http();
$adapterPicture->setValidators(array($size, $ext), $arrParam['picture']['name']);
if (!$adapterPicture->isValid()) {
$message = $adapterPicture->getMessages();
$this->_arrError['picture'] = current($message);
$arrParam['picture'] = '';
}
}
// attach_file
if (!empty($arrParam['attach_file']['name'])) {
$size = new \Zend\Validator\File\Size(array('min' => 1, 'max' => 5242880));
$ext = new \Zend\Validator\File\Extension('rar,zip,gz,docx,pdf,xlsx');
$adapterFile = new \Zend\File\Transfer\Adapter\Http();
$adapterFile->setValidators(array($size, $ext), $arrParam['attach_file']['name']);
if (!$adapterFile->isValid()) {
$message = $adapterFile->getMessages();
$this->_arrError['attach_file'] = current($message);
$arrParam['attach_file'] = '';
}
}
}
}
When i post a valid image into 'picture' field. $this->_arrError will have "File '' was not uploaded". I check and know that, $adapterPicture also check 'attach_file' field. Because i do not post a file into 'attach_file', so it say not uploaded ( for attach_file).
So, how i can check only for 'picture' field and then check only for 'attach_file'.
PS: I'm not use Zend\Form. Just a HTML code with 2 input type=file. And then, check file use \Zend\File\Transfer\Adapter\Http
Related
I have a Syncfusion MVC Datagrid and I need to display a custom button in each row to take some action. The Employee Details column is cut and pasted from their website: https://help.syncfusion.com/aspnetmvc/grid/columns?cs-save-lang=1&cs-lang=razor
VS error:
Cannot convert lambda expression to type 'object' because it is not a
delegate type
What is the correct syntax to make the button appear?
Also, I will need correct jscript/controller code to callback the controller and get back the ID or selected item.
#Html.EJS().Grid("DataGrid").DataSource(ds => ds.Json(ViewBag.datasource).UpdateUrl("/Management/Update").InsertUrl("/Management/Insert").RemoveUrl("/Management/Remove").Adaptor("RemoteSaveAdaptor")).AllowTextWrap().Columns(col =>
{
col.Field("Id").IsPrimaryKey(true).Visible(false).Add();
col.Field("ResourceGroup").HeaderText("Source VM Resource Group").Add();
col.Field("VMName").HeaderText("Source VM Name").Add();
col.Field("ImageDate").HeaderText("Image Capture Start Date").Width(150).Format("yyyy-MMM-dd hh:mm").HeaderTextAlign(Syncfusion.EJ2.Grids.TextAlign.Center).EditType("datetimepickeredit").Edit(new { #params = new { min = System.DateTime.UtcNow, showclearbutton = true } }).Add();
col.Field("ImageRecurrance").HeaderText("Image Recurrence (days)").EditType("numericedit").Edit(new { #params = new { min = 0, step = 10, decimals = 0, strictmode = true } }).Width(100).Add();
col.Field("ImageVersion").HeaderText("Image Version").Add();
col.HeaderText("Employee Details").Commands(command =>
{
command.Type("detail")
.ButtonOptions(new Syncfusion.JavaScript.Models.ButtonProperties()
{
Text = "Details",
Width = "100px",
Click = "onClick"
}).Add();
})
.TextAlign(TextAlign.Center)
.Width(150)
.Add();
}).ActionFailure("OnActionFailure").AllowTextWrap(true).TextWrapSettings(text => { text.WrapMode(Syncfusion.EJ2.Grids.WrapMode.Header); }).AllowPaging().FilterSettings(filter => { filter.Type(Syncfusion.EJ2.Grids.FilterType.Menu); }).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).ShowDeleteConfirmDialog(true).Mode(Syncfusion.EJ2.Grids.EditMode.Dialog); }).Toolbar(toolbarItems).TextWrapSettings(text => { text.WrapMode(Syncfusion.EJ2.Grids.WrapMode.Header); }).Render()
The button is simple with the following Column Template:
Management = Controller
Select = Action
${Id} = value to pass on QueryString
<a href='/Management/Select?Id=${Id}'>
<button class='e-control e-btn e-lib' id='button' type='button'>Related</button>
</a>
Grid Definition
#{int buttonWidth = 160; }
#Html.EJS().Grid("DataGrid").DataSource(ds => ds.Json(ViewBag.datasource).UpdateUrl("/Management/Update").InsertUrl("/Management/Insert").RemoveUrl("/Management/Remove").Adaptor("RemoteSaveAdaptor")).AllowTextWrap().Columns(col =>
{
col.Field("Id").IsPrimaryKey(true).Visible(false).Add();
col.Field("RG").HeaderText("RG").Width(#colWidth).Add();
col.Template("<a href='/Management/Select?Id=${Id}'><button class='e-control e-btn e-lib' id='button' type='button'>Related</button></a>").AllowEditing(false).Width(#buttonWidth).Add();
}).ActionFailure("OnActionFailure").AllowTextWrap(true).TextWrapSettings(text => { text.WrapMode(Syncfusion.EJ2.Grids.WrapMode.Header); }).AllowPaging().FilterSettings(filter => { filter.Type(Syncfusion.EJ2.Grids.FilterType.Menu); }).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).ShowDeleteConfirmDialog(true).Mode(Syncfusion.EJ2.Grids.EditMode.Dialog); }).Toolbar(toolbarItems).TextWrapSettings(text => { text.WrapMode(Syncfusion.EJ2.Grids.WrapMode.Header); }).Render()
Controller
public class ManagementController : Controller
{
...
public ActionResult Select(object newItem)
{
var id = System.Convert.ToInt32(this.Request.QueryString["Id"]);
My automatic generated base form class is as follows:
abstract class BaseGestorForm extends BaseFormDoctrine {
public function setup() {
$this->setWidgets(array(
'persona_fk' => new sfWidgetFormInputHidden(),
'unitat_fk' => new sfWidgetFormInputHidden(),
'baixa' => new sfWidgetFormDateTime(),
));
$this->setValidators(array(
'persona_fk' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('persona_fk')), 'empty_value' => $this->getObject()->get('persona_fk'), 'required' => false)),
'unitat_fk' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('unitat_fk')), 'empty_value' => $this->getObject()->get('unitat_fk'), 'required' => false)),
'baixa' => new sfValidatorDateTime(array('required' => false)),
));
$this->widgetSchema->setNameFormat('gestor[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
$this->setupInheritance();
parent::setup();
}
public function getModelName() {
return 'Gestor';
}
}
In the form I added two extra fields (totes_unitats and unitats_a_gestionar). The first field is a drop down list where users select one or more choices and using jquery when a user press a button the options selected are added to unitats_a_gestionar drop down list. At the same time, these options are removed from totes_unitats list.
class GestorForm extends BaseGestorForm {
public function configure() {
unset($this['baixa']);
$this->widgetSchema['persona_fk'] = new sfWidgetFormChoice(array(
'choices' => UsuariLdap::getAllUsuaris()
));
$this->widgetSchema['totes_unitats'] = new sfWidgetFormChoice(array(
'choices' => UnitatTable::findAllUnitatsPerOrdreArray(),
'multiple' => true
));
$this->widgetSchema['unitats_a_gestionar'] = new sfWidgetFormChoice(array(
'choices' => array(),
'multiple' => true
));
$this->widgetSchema->setLabels(array(
'persona_fk' => 'Gestor',
'unitat_fk' => 'Unitat',
'totes_unitats' => 'Totes les unitats',
'unitats_a_gestionar' => 'Unitats a gestionar'
));
$this->validatorSchema->setOption('allow_extra_fields', true);
$this->validatorSchema['persona_fk'] = new sfValidatorString(array('required' => true), array('required' => 'Requerit'));
}
}
Where I find the problem is in the actions file. First of all, I call the executeNouGestor method that renders the form. Then when the user press to proceed and create the Gestor object, it calls executeValidaGestor that validates the form. This last method calls processFormGestor where there is no way to retrieve the unitats_a_gestionar extra field.
public function executeNouGestor(sfWebRequest $request) {
$this->gestorForm = new GestorForm();
}
public function executeValidaGestor(sfWebRequest $request) {
$this->forward404Unless($request->isMethod(sfRequest::POST));
$this->gestorForm = new GestorForm();
$this->processFormGestor($request, $this->gestorForm);
$this->setTemplate('nouGestor');
}
protected function processFormGestor(sfWebRequest $request, sfForm $gestorForm) {
$gestorForm->bind($request->getParameter($gestorForm->getName()), $request->getFiles($gestorForm->getName()));
if ($gestorForm->isValid()) {
var_dump($_POST);
var_dump($request->getParameterHolder()->getAll());
...
}
}
These two var_dump shows me the following information:
var_dump($_POST):
array(2) {
["gestor"]=>
array(2) {
["persona_fk"]=>
string(3) "330"
["_csrf_token"]=>
string(32) "91e18aa0570bfc7558d21ebb4b98f512"
}
["Desar"]=>
string(5) "Desar"
}
var_dump($request->getParameterHolder()->getAll()):
array(4) {
["gestor"]=>
array(2) {
["persona_fk"]=>
string(3) "330"
["_csrf_token"]=>
string(32) "91e18aa0570bfc7558d21ebb4b98f512"
}
["Desar"]=>
string(5) "Desar"
["module"]=>
string(13) "administracio"
["action"]=>
string(12) "validaGestor"
}
So, as you can see, in ["gestor"] there is no track neither totes_unitats nor unitats_a_gestionar extra form fields. I have no idea why. The way I show the form fields in the template is as usual:
<?php echo $gestorForm['persona_fk']->renderLabel(); ?>
<div class="input"><?php echo $gestorForm['persona_fk']->render(); ?></div>
<div class="error-input"><?php echo $gestorForm['persona_fk']->renderError(); ?></div>
<?php echo $gestorForm['totes_unitats']->renderLabel(); ?>
<div class="input multiple"><?php echo $gestorForm['totes_unitats']->render(); ?></div>
<div class="error-input"><?php echo $gestorForm['totes_unitats']->renderError(); ?></div>
<?php echo $gestorForm['unitats_a_gestionar']->renderLabel(); ?>
<div class="input multiple"><?php echo $gestorForm['unitats_a_gestionar']->render(); ?></div>
<div class="error-input"><?php echo $gestorForm['unitats_a_gestionar']->renderError(); ?></div>
I also add the jquery code that manage the options added or removed between the two drop down lists with multiple selection:
function afegirTreureUnitats() {
var boto_afegir = $("#btn-multiple-afegir");
var boto_treure = $("#btn-multiple-treure");
boto_afegir.click(function() {
var selectedItems = $("#gestor_totes_unitats option:selected");
var output = [];
$.each(selectedItems, function(key, e)
{
output.push('<option value="' + e.value + '">' + e.text + '</option>');
});
$("#gestor_unitats_a_gestionar").append(output.join(""));
ordenaOptionsSelect("gestor_unitats_a_gestionar");
selectedItems.remove();
});
boto_treure.click(function() {
var selectedItems = $("#gestor_unitats_a_gestionar option:selected");
var output = [];
$.each(selectedItems, function(key, e)
{
output.push('<option value="' + e.value + '">' + e.text + '</option>');
});
$("#gestor_totes_unitats").append(output.join(""));
ordenaOptionsSelect("gestor_totes_unitats");
selectedItems.remove();
});
}
function ordenaOptionsSelect(idSelect)
{
var options = $('#' + idSelect + ' option');
options.sort(function(a, b)
{
if (a.text > b.text)
return 1;
else if (a.text < b.text)
return -1;
else
return 0;
});
$('#' + idSelect).empty().append(options);
}
$(document).ready(function() {
afegirTreureUnitats();
});
The form rendered has this appearance:
https://drive.google.com/file/d/0B0Mz720p9Q_DN1RnYWIyR0pXOTQ/edit?usp=sharing
I have also found a curious fact. If I select one of the options in the drop down list, either totes_unitats or unitats_a_gestionar they are sent through POST method, but only one (if I select more than one I only can get one of the options selected).
When you use <select> elements on the form, or <input> of type radio or checkbox the browser will send their values on form submission only when the fields have any options selected.
The list of options in the <select> tag is not sent back to the server. Only the values of the options which are actually selected.
You can resolve your problem in two ways:
Either create a JS which will modify your form just before sending it and will select all the items on both your lists. This way your form will send the values and you will be able to work with them on the server side.
Other option is to add two hidden fields which will keep the lists of the options and modify these lists together with the <select> fields.
I want to get different URLs for different languages.
For example:
http://www.example.com/en/users/create
http://www.example.com/es/usuarios/crear
I have g11n enabled and I tried this:
Router::connect('/users/create',array('controller'=>'User','action'=>'add'));
Router::connect('/usuarios/crear',array('controller'=>'User','action'=>'add'));
But,... in header.html.php where I have the menu code:
<ul id="nav">
<li class="menu-item ">
<?php echo $this->html->link('New User','/user/add') ?>
</li>
</ul>
I need a function that returns the link:
...
when the current language is Spanish.
or
...
when the current language is English.
Sorry for my english...
Edit:
I have solved the problem overriding \lithium\template\helper\Html class.
<?php
namespace app\extensions\helper;
use lithium\core\Environment;
function getLanguage($locale)
{
$res = array_shift(explode('_', $locale));
if(!$res)return '?';
else return $res;
}
class CustomHtml extends \lithium\template\helper\Html {
private static $_mapping = array(
'Users' => array(
'Add' => array(
'es' => '/es/usuarios/crear',
'en' => '/en/users/create',
)
)
);
/**
* Override Helper::link
*/
public function link($title, $url = null, array $options = array()) {
if(is_array($url))
{
if(key_exists('controller', $url))
{
$controller = $url['controller'];
if(key_exists('action', $url))
{
$action = $url['action'];
$locale = key_exists('locale', $url) ? $url['locale'] : getLanguage(Environment::get('locale'));
$new_url = $this->_matchUrl($controller, $action, $locale);
if($new_url)
{
return parent::link($title, $new_url,$options);
}
else
{
die('?');
}
}
}
}
return parent::link($title,$url,$options);
}
private function _matchUrl($controller, $action, $locale)
{
if(isset(self::$_mapping[$controller][$action][$locale]))
{
return self::$_mapping[$controller][$action][$locale];
}
return null;
}
}
Now in template I can use this function to get the correct link:
<?php echo $this->CustomHtml->link('Create user',array('controller'=>'Users', 'action' => 'add')) ?>
I am sure it isn't the best solution. But it works...
Here is an example that includes locale-based routing: https://gist.github.com/nateabele/1512502
I have a WP front end post form that I have made for my website, the Idea was to make it so artists can post up their own mixtape submissions!
So far I have managed to get the form to either use the image uploaded as the featured image OR give me the images ID so I can put it in the post content, the problem is I need both! I need the image automatically set as the thumbnail for the post and I need the ID so I can set the form to automatically put the image where I want it in the post!
So far I have located the problem to be this bit of code:
if ($_FILES) {
foreach ($_FILES as $file => $array) {
$newupload = insert_attachment($file,$pid);
// $newupload returns the attachment id
}
}
I say this as, the location of this code is what changes whether I successfully get the ID of the attachment or whether the image is set as the thumbnail.
The whole code is as follows:
function insert_attachment($file_handler,$post_id,$setthumb='false') {
// check to make sure its a successful upload
if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
require_once(ABSPATH . "wp-admin" . '/includes/file.php');
require_once(ABSPATH . "wp-admin" . '/includes/media.php');
$attach_id = media_handle_upload( $file_handler, $post_id );
if ($setthumb) update_post_meta($post_id,'_thumbnail_id',$attach_id);
return $attach_id;
}
function mixtape_fep($content = null) {
global $post;
// We're outputing a lot of html and the easiest way
// to do it is with output buffering from php.
ob_start(); ?> <?php
if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == "new_post") {
// Do some minor form validation to make sure there is content
if (isset ($_POST['title'])) {
$title = $_POST['title'];
} else {
echo 'Please enter the wine name';
}
if (isset ($_POST['description'])) {
$description = $_POST['description'];
} else {
echo 'Please enter some notes';
}
$cover_id = get_post_meta($post->ID, 'thumb', true);
$cover = wp_get_attachment_link($cover_id);
$content = $cover.'<br /><br />'.$description;
$tags = $_POST['post_tags'];
// ADD THE FORM INPUT TO $new_post ARRAY
$new_post = array(
'post_title' => $title,
'post_content' => $content,
'post_category' => array($_POST['cat']), // Usable for custom taxonomies too
'tags_input' => array($tags),
'post_status' => 'publish', // Choose: publish, preview, future, draft, etc.
'post_type' => 'post' //'post',page' or use a custom post type if you want to
);
//SAVE THE POST
$pid = wp_insert_post($new_post);
if ($_FILES) {
foreach ($_FILES as $file => $array) {
$newupload = insert_attachment($file,$pid);
// $newupload returns the attachment id of the file that
// was just uploaded. Do whatever you want with that now.
}
}
//SET OUR TAGS UP PROPERLY
wp_set_post_tags($pid, $_POST['post_tags']);
//REDIRECT TO THE NEW POST ON SAVE
$link = get_permalink( $pid );
wp_redirect( $link );
} // END THE IF STATEMENT THAT STARTED THE WHOLE FORM
//POST THE POST YO
do_action('wp_insert_post', 'wp_insert_post'); ?>
The issue of assigning the thumbnail and inserting the image was fixed by adding this into the code:
if ( $_FILES ) {
$files = $_FILES['cover'];
foreach ($files['name'] as $key => $value) {
if ($files['name'][$key]) {
$file = array(
'name' => $files['name'][$key],
'type' => $files['type'][$key],
'tmp_name' => $files['tmp_name'][$key],
'error' => $files['error'][$key],
'size' => $files['size'][$key]
);
$_FILES = array("cover" => $file);
foreach ($_FILES as $file => $array) {
$newupload = insert_attachment($file,$post->ID);
}
}
}
}
and then
set_post_thumbnail( $pid, $newupload );
below the insert post function.
I want to extend the custom options feature of Magento. I cant use any of the existing ones like sku or title. I need a completely new one, called "path". What are the steps to add it? It seems adding a row to catalog_product_option is part of it, but I think there is much more to do?
I did something super simple in the past that you may or may not find useful. Our situation was the need for an Auto Complete field in new text options. So in the design\adminhtml\default\default\template\catalog\product\edit\options\type\text.phtml, this is the new javascript var for OptionTemplateText:
OptionTemplateText = '<table class="border" cellpadding="0" cellspacing="0">'+
'<tr class="headings">'+
'<th class="type-price"><?php echo Mage::helper('catalog')->__('Price') ?></th>'+
'<th class="type-type"><?php echo Mage::helper('catalog')->__('Price Type') ?></th>'+
'<th class="type-sku"><?php echo Mage::helper('catalog')->__('SKU') ?></th>'+
'<th class="type-last last"><?php echo Mage::helper('catalog')->__('Max Characters') ?> </th>'+
'<th class="type-last last"><?php echo Mage::helper('catalog')->__('Auto Complete') ?> </th>'+
'</tr>'+
'<tr>'+
'<td><input type="text" class="input-text validate-number product-option-price" id="product_option_{{option_id}}_price" name="product[options][{{option_id}}][price]" value="{{price}}"></td>'+
'<td><?php echo $this->getPriceTypeSelectHtml() ?>{{checkboxScopePrice}}</td>'+
'<td><input type="text" class="input-text" name="product[options][{{option_id}}][sku]" value="{{sku}}"></td>'+
'<td class="type-last last"><input type="text" class="input-text validate-zero-or-greater" name="product[options][{{option_id}}][max_characters]" value="{{max_characters}}"></td>'+
'<td class="type-last last"><input type="text" class="input-text" name="product[options][{{option_id}}][auto_complete]" value="{{auto_complete}}"> * service URL</td>'+
'</tr>'+
'</table>';
Then we overwrote the Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option with our own quick class using this rewrite:
<global>
<blocks>
<adminhtml>
<rewrite>
<catalog_product_edit_tab_options_option>MyNameSpace_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option</catalog_product_edit_tab_options_option>
</rewrite>
</adminhtml>
</blocks>
</global>
And here's the whole class.
class MyNameSpace_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option {
public function __construct() {
parent::__construct();
$this->setTemplate('catalog/product/edit/options/option.phtml');
}
public function getOptionValues() {
$optionsArr = array_reverse($this->getProduct()->getOptions(), true);
if (!$this->_values) {
$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->htmlEscape($option->getTitle());
$value['type'] = $option->getType();
$value['is_require'] = $option->getIsRequire();
$value['sort_order'] = $option->getSortOrder();
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) {
$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->htmlEscape($_value->getTitle()),
'price' => $this->getPriceValue($_value->getPrice(), $_value->getPriceType()),
'price_type' => $_value->getPriceType(),
'sku' => $this->htmlEscape($_value->getSku()),
'sort_order' => $_value->getSortOrder(),
);
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'] = $this->getPriceValue($option->getPrice(), $option->getPriceType());
$value['price_type'] = $option->getPriceType();
$value['sku'] = $this->htmlEscape($option->getSku());
$value['max_characters'] = $option->getMaxCharacters();
$value['auto_complete'] = $option->getAutoComplete();
$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;
}
}
The last piece to this puzzle was this little bitty sql statement:
ALTER TABLE `catalog_product_option` ADD COLUMN `auto_complete` VARCHAR(255) NULL DEFAULT NULL AFTER `max_caharacters`;