b_otho Posted December 14, 2017 Posted December 14, 2017 Hi everyone, I've been struggling to make an extra field visible in the dropdown box that shows up after searching for a product to add in the admin order view. I'm pretty new to Thirty Bees but managed to add my own fields to products, product lists, imports etc. But I can't seem to figure this out. Any help is much appreciated.
0 b_otho Posted December 20, 2017 Author Posted December 20, 2017 No one who's had the same need at some point?
0 wakabayashi Posted December 20, 2017 Posted December 20, 2017 Could you please describe the issue more in in detail? I don't understand what you mean with extra field. Do you have coded a module?
0 b_otho Posted December 21, 2017 Author Posted December 21, 2017 I have made a "title" field on my products. I sell vinyl records and CD's, and the product name is the artist, and my custom title field is the name of their record. Because of this I have severals product with the same name. When I then search for products to add when creating orders in the back office, I get multiple results with same name. That's why it would nice to add my title field to the results. Hope it makes sense.
0 wakabayashi Posted December 21, 2017 Posted December 21, 2017 Why do just write the artist as product name? I would do it like that: artist - album name
0 zimmer-media Posted December 21, 2017 Posted December 21, 2017 @b_otho I join the comment from @wakabayashi. My additional recommendation to deposit the artist in the article features and then set up as a filter for the end user. You may also set up and enter additional features such as the type of disc CD / DVD / LP, etc.
0 zimmer-media Posted December 21, 2017 Posted December 21, 2017 @b_otho Alternatively, I do not know if you need, for example, information in the manufacturer lists or supplier lists. If they are invisible / deactivated for the customer, then use them, for example. you can use artist as manufacturer or supplier. So you can separately customize the product list view and filter such as from this topic: https://forum.thirtybees.com/topic/1223/product-list-bo-with-manufacturers-and-suppliers-columns
0 b_otho Posted December 22, 2017 Author Posted December 22, 2017 @wakabayashi: I see your point. The only reason I'm not writing it as "artist - album name" is because I need to be able to export csv files with the two fields in their own columns. Otherwise it would make my life so much easier also with friendly urls, how it appears on invoices etc... @zimmer-media: I'm going to use either manufacturer or supplier as the record label, haven't decided on which one yet, but I guess I could use the one left as my artist. I'll look into that. I've already added my own custom field, as mentioned in the post you link to, so it's not a problem for me to edit that list and add extra fields if needed. It still doesn't really solve my problem though as either supplier or manufacturer won't come up in the results when I create orders. The ideal solution for me, no matter which kind of input field I use, is that both artist name and album name come up in these results.
0 datakick Posted December 22, 2017 Posted December 22, 2017 @b_otho said in Add extra field to product selection in admin orders: I see your point. The only reason I’m not writing it as “artist - album name” is because I need to be able to export csv files with the two fields in their own columns. Otherwise it would make my life so much easier also with friendly urls, how it appears on invoices etc… If this is the only reason then I believe the best you could do is to either modify csv export to output name as two columns use a module that can do this split during export automatically (wink wink, shameless plug)
0 b_otho Posted December 22, 2017 Author Posted December 22, 2017 @datakick that's interesting. Can your module do something like that?
0 datakick Posted December 22, 2017 Posted December 22, 2017 @b_otho yeah, sure, quite easily. My module let you create list of (almost) any data in your system. Columns can contain expressions, similar to excel formulas. For examle you can replace string, perform mathematical operation, etc... So basically you can get the data out in any format you need. Once you have a list, you can export it to csv manually, schedule it to generate csv file periodically, or even create endpoint (url) that, when accessed, will return up-to-date csv file. I have prepared a short youtube video that shows how to create list and split product name to two columns. youtube video The module is paid, but there's a 14 day trial period, so feel free to test it out. And shoot me an email if you need any help
0 b_otho Posted December 22, 2017 Author Posted December 22, 2017 That does indeed look quite awesome. I'll have a look at it and get back to you. Thanks!
0 zimmer-media Posted December 22, 2017 Posted December 22, 2017 @b_otho You can also follow the hints of Nemo and customize your code in your files / overrides. Continuing then only the invoice and the produkt.tpl would have to be adjusted. If necessary, additional files where the additional field should appear. The other note from the forum, which I have previously used even with PS, I can not find right now. https://mypresta.eu/en/art/developer/new-field-product-backoffice.html
0 zimmer-media Posted December 23, 2017 Posted December 23, 2017 its not perfect, but helpful as example to add extra field for product name step 1 Add an entry to the database in the table prefix_product 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 int Supplier id */ public $id_supplier; /** @var int default Category id */ public $id_category_default; /** @var int default Shop id */ public $id_shop_default; /** @var string Manufacturer name */ public $manufacturer_name; just add the following /** @var string Artist name */ public $artist_name; step 2.2 for example find 'id_supplier' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedId'], 'reference' => ['type' => self::TYPE_STRING, 'validate' => 'isReference', 'size' => 32], after this add 'artist_name' => ['type' => self::TYPE_STRING, 'validate' => 'isReference', 'size' => 200], step 3 copy your informations.tpl under override / controllers / admin / templates / products / informations.tpl and find the code <div class="form-group"> <div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="name" type="default" multilang="true"}</span></div> <label class="control-label col-lg-2 required" for="name_{$id_lang}"> <span class="label-tooltip" data-toggle="tooltip" title="{l s='The public name for this product.'} {l s='Invalid characters:'} <>;=#{}"> {l s='Name'} </span> </label> <div class="col-lg-5"> {include file="controllers/products/input_text_lang.tpl" languages=$languages input_class="{$class_input_ajax}{if !$product->id || Configuration::get('PS_FORCE_FRIENDLY_PRODUCT')}copy2friendlyUrl{/if} updateCurrentText" input_value=$product->name input_name="name" required=true } </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="name" type="default" multilang="true"}</span></div> <label class="control-label col-lg-2"> <span class="label-tooltip" data-toggle="tooltip" title="{l s='The second public name for this product.'} {l s='Invalid characters:'} <>;=#{}"> {l s='Artist Name'} </span> </label> <div class="col-lg-5"> <input type="text" id="artist_name" name="artist_name" value="{$product->artist_name|default:''}"/> </div> </div> step 4 product view - in your theme product.tpl ``` {$product->name|escape:'html':'UTF-8'} change to {$product->name|escape:'html':'UTF-8'} - {$product->artist_name|escape:'html':'UTF-8'} ``` my result: For the invoice etc, you should include {$product-> artist_name | escape: 'html': 'UTF-8'}
0 zimmer-media Posted December 23, 2017 Posted December 23, 2017 I expand my information In the product list of the BO for filtering, adjust the following parameters in the code: for example under "/override/controllers/admin/AdminProductsController.php" after the code $this->fields_list['name'] = [ 'title' => $this->l('Name'), 'filter_key' => 'b!name', ]; add: $this->fields_list['artist_name'] = [ 'title' => $this->l('Artist'), ]; with filter
0 b_otho Posted December 23, 2017 Author Posted December 23, 2017 @zimmer-media: Thanks for all you work you're putting into this. I have already made a field as you describe by using Nemo's tutorials though, but got stuck when I wanted to add this field to dropdown that comes up after searching for products in bo order creation.
Question
b_otho
Hi everyone,
I've been struggling to make an extra field visible in the dropdown box that shows up after searching for a product to add in the admin order view.
I'm pretty new to Thirty Bees but managed to add my own fields to products, product lists, imports etc. But I can't seem to figure this out.
Any help is much appreciated.
15 answers to this question
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