zimmer-media Posted December 25, 2017 Posted December 25, 2017 step 1 Add an entry to the database in the table prefixproductlang (for example name - what you need) step 2.1 modify the file “Product.php” from “/classes/Product.php”, preferably in the folder classes Override “/override/classes/Product.php” save see the lines /** @var string Long description */ public $description; /** @var string Short description */ public $description_short; just add the following /** @var string Extra Field */ public $extra_field; step 2.2 for example find 'name' => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 128], 'description' => ['type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'], after this insert 'extra_field' => ['type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'], step 3 copy your informations.tpl under override / controllers / admin / templates / products / informations.tpl for example and find the code (depending on where this additional field should appear.) <div class="form-group"> <div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="description" type="tinymce" multilang="true"}</span></div> <label class="control-label col-lg-2" for="description_{$id_lang}"> <span class="label-tooltip" data-toggle="tooltip" title="{l s='Appears in the body of the product page.'}"> {l s='Description'} </span> </label> <div class="col-lg-9"> {include file="controllers/products/textarea_lang.tpl" languages=$languages input_name='description' class="autoload_rte" input_value=$product->description} </div> </div> after this insert <div class="form-group"> <div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="extra_field" type="tinymce" multilang="true"}</span></div> <label class="control-label col-lg-2" for="extra_field_{$id_lang}"> <span class="label-tooltip" data-toggle="tooltip" title="{l s='Appears in the body of the product page.'}"> {l s='Extrafield'} </span> </label> <div class="col-lg-9"> {include file="controllers/products/textarea_lang.tpl" languages=$languages input_name='extra_field' class="autoload_rte" input_value=$product->extra_field} </div> </div> step 4 if you want to see this field in your frontoffice product view - in your theme product.tpl add the follow code with in your tpl ( for example default theme) find {if isset($product) && $product->description} <section id="product-description" class="page-product-box"> <h3 class="page-product-heading">{l s='More info'}</h3> <div class="rte">{$product->description}</div> </section> {/if} insert after this {if isset($product) && $product->extra_field} <section id="extra_field" class="page-product-box"> <h3 class="page-product-heading">{l s='Extrafield'}</h3> <div class="rte">{$product->extra_field}</div> </section> {/if} backoffice product page frontoffice product page new
zimmer-media Posted December 25, 2017 Author Posted December 25, 2017 Of course, more than one text box can be added as needed to customize the data (change all "extra_field"). It is important in the product.tpl the title of the text field {ls = 'Extrafield'} </ h3> for the front view and in the informations.tpl the name of your textarea { ls = 'Extrafield'} correctly, so that you do not confuse this when entering. In the front view, the text areas are only displayed if data has been saved in the field.
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