Product Edit page issue and rewrites
Author | Posts |
---|---|
April 25, 2014 at 10:48 pm 19415 | |
Mahi | I've created a child theme and have been editing some of the product pages to remove fields that are not necessary for my site. I've come across a weird bug in the process. In the products.php file you're calling the product-edit page if the action = edit. This seems fine if the product hasn't been published, but once the product has been published then the edit link URL on product listing page changes from something like "...?product_id=247&action=edit" to ".../product-name/edit". This is causing an issue where the system is using my customized product-edit template until the product has been published, then if a user goes back to the "dashboard - products" page and clicks on edit, then it starts using parent template instead. |
April 25, 2014 at 10:55 pm 19417 | |
Marita | I had similar issues with the EDIT product page not working – and it was the permalink structure in my settings – i had to set it to /product |
April 25, 2014 at 11:14 pm 19419 | |
Simon | Thanks Marita… I think this is a little different situation. Here’s the code in the product.php file
So this is looking for a GET with the parameter ‘action’ and that parameter must equal ‘edit’. Since the URL is being rewritten to pretty permalinks once the product is published there is no longer a URL that looks like this “/dashboard/products/?product_id=246&action=edit” instead it looks like this “/product-name/edit”. So I think an additional statement is needed in the if to account for the change in URL structure. |
April 26, 2014 at 12:31 am 19421 | |
Simon | I figured out the cause. In the rewrites.php file is this function:
Since it’s using get_template_directory it’s not seeing the same file in the child theme. I tried adding the same directory/file to my child theme and then changing get_template_directory() to get_stylesheet_directory(), but it’s not recognizing it. Probably has something to do with the function being part of a class that is being called in the functions.php file in the parent theme. I can change get_template_directory() to get_stylesheet_directory() in the parent theme’s rewrites.php file, but any updates will overwrite it. 🙁 |
April 26, 2014 at 4:13 am 19429 | |
Mahi | unfortunately, it will overwrite when next update comes out. Good news is team is working hard on it to make sure next version is compatible for child themes. So sorry for any inconvenience. |