Support » Plugin: WP Data Access » Edit Woo Commerce Product Table

  • Resolved domsinclair

    (@domsinclair)


    Hi

    Really pleased to have found this plugin, finally there’s a database tool that oozes familiarity.

    Simple question I hope. I have a client who needs to be able to edit selected parts of the woo commerce product table (this one WC_PRODUCT_META_LOOKUP) on a more or less daily basis. Created a restricted editable view of that table would be the ideal way to go. It would help if edits could be inline.

    I don’t think that this is possible in the free version, but I have been able to confirm that I can see the table so I’m assuming and hoping that this would be possible were I to purchase the premium version. The first question then is can this be done with your premium version?

    Second question relates to custom fields that I have added to woo commerce products via the metabox plugin. I haven’t had an oppertunity to test this out in the free version yet (next job to do) but in theory could metabox custom fields linked to woo commerce products be edited in the same view (well obviously not exactly the same view I’d need to create a query to pull them together). I guess the actual question is do you support editable views of related data?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter domsinclair

    (@domsinclair)

    So I’ve done a fair bit of playing with the free edition. Plain wordpress site with woocommerce installed and the sample data provided by woocommerce loaded to have something to work with.

    I experimented by setting up a project and creating a page linked to the WC_PRODUCT_META_LOOKUP table. I disabled the ability to add and delete rows but retained the ability to edit.

    I can definitely edit the stock_quantity field and that gets saved back to the database, cofirmed by looking at it via phpmyadmin.

    However if I look at the standard product entry (accessed via the products menu these edits are not shown. If I make an ammendment here though it is reflected in my wpda project, so I’m at something of a loss. wpda is changing the backend values but they are not being registered in the edit view for Products.

    As WPDA is still very new to me I may be doing something wrong here but I’m not sure what.

    Thread Starter domsinclair

    (@domsinclair)

    Further experimentation results

    data altered by wpda gets saved back to the table and can be see by any queries created with wpda. BUT if I look at a product on the front end the chaged data is not shown, the only way to change product data and have it shown on the front end is to do so in the Products themselves. Then they will show up in the product page at the front end, but curiously they’ll also show up in the wpda queries.

    Were it not for the fact that I know there aren’t I’d almost be tempted to say that there are two different tables.

    Now I know from reading the documentation that inline editing in the free version is limited. Have I stumbled across one of these limits without realising it?

    Running out of ideas to try. I hoping now that this is just a limitation of the free version, because I really like what I’m seeing here.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi @domsinclair,

    Welcome to WP Data Access! Let me try to answer your questions…

    >>> I have a client who needs to be able to edit selected parts of the woo commerce product table

    WP Data Access allows you to edit any database table, as long you have the necessary credentials and the table has a primary or unique key. The key is necessary to uniquely identify the edited row.

    >>> It would help if edits could be inline.

    Inline editing is available in the premium license for the back-end and shortcode wpdadiehard. Inline editing is not available in Data Forms. Not yet! 😊

    >>> I guess the actual question is do you support editable views of related data?

    Sorry, this is not supported. But I like the idea, especially when it comes to CPTs. Have you tested CPT editing through views? Does it works? Does it perform with large tables? I’m interested in this topic. If you are familiar with CPTs we should discuss the possibilities…

    >>> BUT if I look at a product on the front end the chaged data is not shown, the only way to change product data and have it shown on the front end is to do so in the Products themselves.

    Are you sure this is the same table?

    >>> Were it not for the fact that I know there aren’t I’d almost be tempted to say that there are two different tables.

    Right! That is my guess as well.

    Best regards,
    Peter

    Thread Starter domsinclair

    (@domsinclair)

    @peterschulznl

    I should have realised that if it walks like a duck, quacks like a duck and looks like a duck then it almost certainly is a duck. Buried deep within the postmeta table were other references to product stock quantity and price.

    I managed to get a data project built and got a an editable backend form working. Not had as much success with an inline back end form thus far (signed up for the free premium trial to test it). I know you said that the inline front end inline data form editing is not yet available.

    Will play around some more and see if I can get that to function.

    Thread Starter domsinclair

    (@domsinclair)

    I got the inline editing working, left with one issue I;m trying to solve but without much luck.

    I need a parent- editing project between posts and posmeta. That I have managed to setup but all of the postmeta values are being returned whereas I would like to restrict them.

    I know taht it can be done becuase I have done it in the query builder:

    SELECT15_postmeta.post_id` as ‘Post_id’
    , 15_postmeta.meta_key as ‘Meta_key’
    , 15_postmeta.meta_value as ‘Meta_value’
    FROM 15_postmeta
    WHERE (15_postmeta.meta_key = ‘_stock’)
    OR (15_postmeta.meta_key = ‘_price’)
    ORDER BY 15_postmeta.post_id asc`

    I cannot achieve the same result in a template, tried adding the where clause makes no difference. Have I missed a step do you think?

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Dom,

    >>> I need a parent- editing project between posts and posmeta. That I have managed to setup but all of the postmeta values are being returned whereas I would like to restrict them.

    Yes, that is s bit tricky! Your data project page has a where clause. But that where clause works for your parent table only. If you want to restrict the number of rows for a child table, you need to create a project template and add your where clause there. This allows you to have multiple where clauses in case you have multiple child tables.

    Does this help?
    Peter

    Thread Starter domsinclair

    (@domsinclair)

    Hi Peter

    Thanks for getting back to me. I had thought that I was doing what you suggested, but obviously not. If I read the documentation correctly the project template (let’s call it Post query) is essentially the wrapper for what will be the overall Master detail query.

    To that query I add two data pages, one is essential the posts table (set to parent child) which in my case has a where clause on post type to filter down the posts to to just those of type product, which works, and of course I define the relationship to postmeta.

    I then add a separate data page for post meta, this is set to table . Currently It returns all 68 rows for each filtered post, but in reality I only want two where meta_key = ‘_price’ and meta_key = ‘_stock’. That I added to the Where clause in that data page. Is that not the correct thing to do? It doesn’t work, whatever.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Dom,

    >>> I then add a separate data page for post meta, this is set to table . Currently It returns all 68 rows for each filtered post, but in reality I only want two where meta_key = ‘_price’ and meta_key = ‘_stock’. That I added to the Where clause in that data page. Is that not the correct thing to do? It doesn’t work, whatever.

    I presume you want to create a master detail page? Is that correct?

    In that case you just need one data project page. The post table will be the base table for that page. After creating the post table page, you need to create a project template for the post table. Within the template just add the relationship to postmeta. See:
    https://wpdataaccess.com/docs/documentation/project-templates/relationships/

    This is where you create the connection between the post and the postmeta tables. When the relationship works, you need to add a template for the postmeta table as well. This is where you restrict the rows and columns shown on your detail page. The where clause is defined here:
    https://wpdataaccess.com/docs/documentation/project-templates/table-settings/#default-where

    Please let me know this help,
    Peter

    Thread Starter domsinclair

    (@domsinclair)

    Problem turned out to be a misunderstanding on my part. I was under the impression that the different table templates associated with the project needed to have different names and so I named them differently. In reality they should have had the same name. Once they did everything that I’d wanted to achieve worked.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Great! Thank you for reporting back! 👍

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.