Custom Show and Hide for Fields Dependent on Category

Discussion in 'Javascript' started by zeppelin1899, Mar 11, 2012.

  1. zeppelin1899

    zeppelin1899 New Member

    Joined:
    Jun 19, 2011
    Messages:
    42
    Likes Received:
    0
    This could be useful if you have things like clothing sizes or shoe sizes that pertain only to certain categories.
    Is there a way to have show hide function for certain fields in your sell form or item page based on the category breadcrumb?
    This would be a useful mod for forms.
     
  2. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    1,993
    Likes Received:
    346
    Hi zeppelin1899,
    the idea is very easy with if statements but you would have to work on the additional fields. Problem is where do you stop as each category and each subcategories could has its own fields, pc's, tv's,etc.
    So many things to try and cover.
    if you just want for 1 category and its children should be straight forward.
     
  3. zeppelin1899

    zeppelin1899 New Member

    Joined:
    Jun 19, 2011
    Messages:
    42
    Likes Received:
    0
    I don't know how to write the if statements though.
    But are you saying you can write different ones for categories and subcategories?
    Like one for Clothing
    Another for Accessories>Shoes
    Another for Electronics>Tvs
     
  4. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    1,993
    Likes Received:
    346
    hi zeppelin,
    Right lets say for shoes you are going to want possibly 2 fields.
    One for size and one for color.
    The more I think about it it would be more practical for each auction to add its own fields.
    In the same category you could have sellers with different values on these fields where if you base it on category name they would be forced to all have the one field we have made up for them. not good.
    That is why I am thinking it would work better for making these fields on the sell page when you enter the auction data.
    This is how I imagine it:
    In sell.php while entering the auction data an option to add a field (Yes/ No), if yes: name the field (eg. select your size),
    and then build your size options (option 1: size 10, add another option->option 2: size 11, etc)
    Once all done then we save in the database the field and its options for that auction.
    In item.php we could look to see if this auction has additional fields and if it has we show them.
    Then as they buy the item they should have selected an option before allowed to proceed.
    The additional options then should be passes along with the auction name.

    Of course we are talking about buy now items, as if its a normal auction it will get messy as every bidder will want different sizes.
    Not a coder myself but like challenges.
     
  5. nay27uk

    nay27uk Super Moderator Staff Member

    Joined:
    Nov 24, 2009
    Messages:
    4,105
    Likes Received:
    293
    I agree with Pani100 the option for the seller to add the fields would be better than forcing every user to use only a chosen amount of fileds
     
  6. Xeonn

    Xeonn New Member

    Joined:
    Dec 15, 2011
    Messages:
    372
    Likes Received:
    54
    but this is not good option to give user adding fields. IMO fields connected to categories (ex. shoes has size ,color etc) should be added by admin. this works in probid well , and it is good for add this fields searchable in advanced search .
    this should be done and I am ready to develop this with someone who help me in writing additional files needed to this.
    How should this work? new table in database containing fields added in admin section ( like categories for ex. )
    in categories section in admin should be an option to check if additional fields is connected to this category and if yes choose which one. on sell page if in category is additional field it should be shown . thats it. I don't know sql very good , so there is a problem for me to write the code because we should work here with "join" commands in sql .
     
  7. Rupert Avery

    Rupert Avery New Member

    Joined:
    Nov 24, 2011
    Messages:
    157
    Likes Received:
    4
    I would like to add one field to one category
    the field I would like to add is

    Location, with a drop down menu.. how would I do this?
     

Share This Page