VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: Alexikakos on January 16, 2019, 11:35:34 AM

Title: Show me specific custom field list, when i select another custom filed...
Post by: Alexikakos on January 16, 2019, 11:35:34 AM
hi all,
I have virtuemart (v3.4.2) shop which sell cars.

I have 4 customs fields:
1. manufacture (in costum field, not virtuemart manufacture. It is String type and list, so in add new product process, in backend you select from drop down list the manufacture)
2. model (String type and list with cars model)
3. cc
4. year

I am try to find a way, in backend, when i add a new product and i choose, in custom field manufacture "BMW", in model drop down list to show me only BMW models. Not from other manufacture.

ps i use "vm custom Filters PRO" for filtering the results.

Any idea??? :P
Title: Re: Show me specific custom field list, when i select another custom filed...
Post by: Dimi on January 17, 2019, 14:04:44 PM
Hello,
I have the same problem. I've been searching for a solution but i have found nothing.

I am also using the custom fields PRO plugin. Is there any other plugin that can help?
Title: Re: Show me specific custom field list, when i select another custom filed...
Post by: Studio 42 on January 17, 2019, 14:13:09 PM
You can certainly verify if manufacturer is selected and hide or nor render the second list using javascript or php if the list is not dynamic rendered using ajax.
Title: Re: Show me specific custom field list, when i select another custom filed...
Post by: Alexikakos on January 17, 2019, 15:01:47 PM
I created a custom field (string - list) for every car brand and in list i have assign all model of specific brand , separating with ( ; ). The name of custom field, for brand models, is the same with manufacturer. eg i have a custom field named "BMW" and inside i have in list all BMW models. (same name for vm manufacturer and model custom field)

Remember i have also custom fields "year" and "cc", which are used in every product - car.

I try to find a solution (i suppose java) which when i select from virtuemart  manufacturer "BMW" in custom filed area, i want to appear custom field "BMW", "cc", "year". if a select from vm manufacturer "Fiat"  i want to appear custom field "Fiat", "cc", "year".

i just dont know how...
Title: Re: Show me specific custom field list, when i select another custom filed...
Post by: Studio 42 on January 17, 2019, 15:09:43 PM
I have understand the problem. This need to modify the PHP or Javascript.
I dont know exactly the code of vm custom Filters PRO, so i cannot write the code without access to the site and some time to develop it.
PM me or use any contatct form in my website, if you dont find a solution, so i can do the Job.
Title: Re: Show me specific custom field list, when i select another custom filed...
Post by: Dimi on January 17, 2019, 15:21:46 PM
Could we possibly have all the custom fields appear in the Add Product page (without clicking on each custom field) and then, when the user adds a Manufacturer, only the Manufacturers model will remain open (the rest will be hidden) using some javascript.

E.g.
I am creating a new product that is Fiat (manufacturer),  Punto (model - custom field) and 2001(year-custom field). So, when the page opens, all the custom fields are open (models and years, including BMW and Toyota models).  When I enter the manufacturer (Fiat), the custom fields Year and Fiat Models remain visible while the rest hide.

Is there a way we could do this?
Title: Re: Show me specific custom field list, when i select another custom filed...
Post by: Studio 42 on January 17, 2019, 16:38:22 PM
Quote from: Δήμητρα Ροδοστόγλου on January 17, 2019, 15:21:46 PM
Could we possibly have all the custom fields appear in the Add Product page (without clicking on each custom field) and then, when the user adds a Manufacturer, only the Manufacturers model will remain open (the rest will be hidden) using some javascript.

E.g.
I am creating a new product that is Fiat (manufacturer),  Punto (model - custom field) and 2001(year-custom field). So, when the page opens, all the custom fields are open (models and years, including BMW and Toyota models).  When I enter the manufacturer (Fiat), the custom fields Year and Fiat Models remain visible while the rest hide.

Is there a way we could do this?
Certainly, but this need some custom code. I cannot answer you with a generic solution.
Title: Re: Show me specific custom field list, when i select another custom filed...
Post by: diri on June 24, 2020, 09:04:12 AM
This problem is old. I tried different ways to overcome some of the limits of VM without changing code or development. Best result I achived with grouping custom fields. But: It's no fun to work with it the way it is implemented. Eg automatic assignement to specified categories is missing in core to be able to manage products in an easy and effective (=productive) way.

Using manufacturer as product and model (= product) as custom field is no real solution. Because of structure of DB custom fields impose to many limits especially when there are many products and attributes.

Even with car manufacturers (eg Fiat) there are many models and spare parts as well as many other products being related. Here one should be able to assign manufacturer (eg Fiat) to multiple categories to have chance to select or add parts related to Fiat in any product category being available. You might describe it with original and 3rd party products.

The basic most limiting factor for such problems I encountered in real world scenario is VM's limit to assign a manufacturer to one product category only. This is a limit is far from reality since many years. Removing this limit is kind of basic in core to use product categories and custom fields more efficient. Fixing DB structure not only but also in relation to custom fields is overdue as well.

In case you have multiple manufacturers offering products in multiple categories this limit being imposed causes a real nightmare at the end. Sorry.

Onliest solution I see at the moment is an own backend with extra tables (might be in extra DB) which transfers data to VM tables while taking VM's limits into account. Missing import / export capability of VM is another missing core feature which forces to develop some own extension or depend on products like CSVI.

cu, diri
Title: Re: Show me specific custom field list, when i select another custom filed...
Post by: pinochico on June 24, 2020, 09:57:37 AM
try this: https://breakdesigns.net/extensions/joomla/dependent-custom-fields-for-all