cyberespia Posted June 12, 2015 Share Posted June 12, 2015 I added 3 new fields to my prestashop 1.6 according to the following steps_: 1. ALTER TABLE `ps_product` ADD `c_duration` varchar(255); ALTER TABLE `ps_product` ADD `c_year` varchar(255); ALTER TABLE `ps_product` ADD `c_studios` varchar(255); 2. Upload to override/classes/--> Product.php <?php Product::$definition['fields']['c_duration'] = array('type' => ObjectModel::TYPE_INT, 'validate' => 'isInt'); Product::$definition['fields']['c_year'] = array('type' => ObjectModel::TYPE_STRING, 'validate' => 'isString'); Product::$definition['fields']['c_studios'] = array('type' => ObjectModel::TYPE_STRING, 'validate' => 'isGenericName', 'values' => array('option a', 'option b'), 'default' => 'option a'); class Product extends ProductCore { public $c_duration = 0; public $c_year = ''; public $c_studios = ''; } 3.En admin theme add: admin/themes/default/template/controllers/products/informations.tpl: <div class="form-group"> <label class="control-label col-lg-3" for="c_duration"> <span class="label-tooltip" data-toggle="tooltip" title="{l s='Duration'}"> {l s='Duration'} </span> </label> <div class="col-lg-5"> <input type="text" id="c_duration" name="c_duration" value="{$product->c_duration|htmlentitiesUTF8}" /> </div> </div> <div class="form-group"> <label class="control-label col-lg-3" for="c_duration"> <span class="label-tooltip" data-toggle="tooltip" title="{l s='Year Film'}"> {l s='Year Film'} </span> </label> <div class="col-lg-5"> <input type="text" id="c_year" name="c_year" value="{$product->c_year|htmlentitiesUTF8}" /> </div> </div> <div class="form-group"> <label class="control-label col-lg-3" for="c_duration"> <span class="label-tooltip" data-toggle="tooltip" title="{l s='Studios Film'}"> {l s='Studios Film'} </span> </label> <div class="col-lg-5"> <select name="c_studios" id="c_studios"> <option value="option a" {if $product->c_studios == 'option a'}selected="selected"{/if}> option a </option> <option value="option b" {if $product->c_studios == 'option b'}selected="selected"{/if}> option b </option> </select> </div> </div> 3. and add in my template /public_html/alquilerdepeliculas/themes/default-bootstrap/product.tpl <p>Duration: {$product->c_duration}</p> <p>Year: {$product->c_year}</p> <p>Studio: {$product->c_studios}</p> All is working correctly. My question is how do I make a field with "select multiple" (in my previous example for the field: "c_studios") In HTML is: <select multiple="multiple"> <option value="Opcion 1">Opcion 1</option> <option value="Opcion 2">Opcion 2</option> </select> I would appreciate your help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now