• Resolved calidriswl

    (@calidriswl)


    Hi,

    I’m editing a site (https://www.mix-it.be) of a company which sells soups and salads and stuff.

    I am editing the view of the products, which you get if you follow the link.
    At the moment every product belongs to a category like fresh soups or milkshakes. At the moment the quantities in which a product is sold is linked to the product itself. I want to change this.
    I have added an extra column to the wp_term_taxonomy table and now I need this table to be shown as a textfield in my admin panel and in the edit panel of the categories and I need to be able to get to it in my code like
    $current_category->quantities

    Can anybody help me with this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter calidriswl

    (@calidriswl)

    I managed to solve part of my problem.

    I got my extra column into the wp_term_taxonomy table:
    add_action on manage_category_custom_column
    And I can fill that column with the correct data from the database:

    $categories = get_terms( 'category', 'orderby=name&hide_empty=0' );
    foreach($categories as $category)
    	{
    		if ($column_name == 'quantities' && $term_id == $category->term_id)
    		{
    			echo $category->quantities;
    		}
    	}

    I also managed to get a new form field on the new category and edit category pages so the user can set the quantities.

    The only thing I can’t do is fill the column in the database if a new category gets made or if an existing one gets edited with the quantities the user gives me.

    Thread Starter calidriswl

    (@calidriswl)

    Found it after a long search and a little help from a friend.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Edit category table’ is closed to new replies.