Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Feature Request › DELETE PRODUCT MAIN PIC AND GALLERY
- This topic has 25 replies, 3 voices, and was last updated 5 years, 9 months ago by WCFM Forum.
- AuthorPosts
- March 6, 2019 at 4:32 pm #51389AlexGuest
I use a lot of marketplaces website…in everyone of them when I delete a product the main pic and the gallery pics are deleted together automatically!
How can I obtain this function with your plugin?
Now in a short time any user will have hundreds of unuseful pics with a great space used for in my server!
In your plugin the vendor have to go on Media folder and can delete only 1 pics x time!
Excuse me for bad english.
Thanks - March 7, 2019 at 5:20 am #51438WCFM ForumMember
Hi,
Well, WordPress or WooCommerce none has any such option to delete attachments on main product/article delete.
But WCFM has a special option for this, just enable that by adding this code to your child theme’s functions.php –
add_filter( 'wcfm_is_allow_delete_post_media', '__return_true' );
Thank You
- March 7, 2019 at 6:58 am #51460AlexGuest
WOW! THANK YOU VERY MUCH!!!
I know wp or wc does not have this function but I thought was normal for a multivendor plugin!
Don’t you think this is an essential feature to put in your next release? - March 7, 2019 at 7:01 am #51461AlexGuest
Another thing…
the problem of deleting only 1 pics x time in media folder remains (for vendors) ! - March 7, 2019 at 7:05 am #51463AlexGuest
ps. I just tried and seems it does not work…
- March 7, 2019 at 7:06 am #51464WCFM ForumMember
HI,
Don’t you think this is an essential feature to put in your next release?
*** WCFM has this function already, but by default disabled. That’s why I gave you that line to enable that.
Thank You
- March 7, 2019 at 7:22 am #51468AlexGuest
Yes, I tried a lot of time….it does not work… 🙁
- March 7, 2019 at 7:24 am #51469AlexGuest
Why “by defauld disabled”?
Don’t you think any user must have the possibility to choose if enable or not without asking you?
Btw, It does not work. - March 7, 2019 at 7:48 am #51476WCFM ForumMember
Hi,
Where you have added that line? Show me screenshot!
How you are deleting products? Frontend or Backend.
Why “by defauld disabled”?
*** It’s not default feature of WP and WC, so we do not want to alter that by default!
Thank You
- March 7, 2019 at 8:13 am #51487AlexGuest
I added that line on the function.php of my theme child (I’ve already done a lot of changes this way).
PIC: http:\\www.sdrang.com/ALE/pic1.jpgSince this function must be useful for vendors (or I will find the server full of useless photos when they will delete their products),
OBVIOUSLY I’m trying from front end using a vendor profile!!! - March 7, 2019 at 10:22 am #51519AlexGuest
Any option to do that?
Any option to have more than one photo deleted at a time in “media” page?
- March 7, 2019 at 11:28 am #51524WCFM ForumMember
Hi,
Please do a fresh test and check.
Create a product as vendor, add a new image with that.
Now, delete that product and check whether it’s deleted or not?
Well, if you are deleting product from fornend then it will go into “trash”, so you have to delete that permanently from wp-admin -> products
Thank You
- March 7, 2019 at 1:09 pm #51541AlexGuest
1-I enter to a vendor profile, I create a new product uploading new main pic and new gallery pics.
2-I go into media folder of your plugin and I see the pics correctly with their association to the product.
3-I come back to products and I delete the product just added.
4-I come back to media folder to see if also the pics are deleted and they’re still there.It does not work.
what am I doing wrong?
Thanks
- March 7, 2019 at 1:10 pm #51542AlexGuest
ps. there’s no “thrash” on media page.
- March 7, 2019 at 1:11 pm #51543AlexGuest
NO “trash”… 🙂
- March 7, 2019 at 6:01 pm #51560AlexGuest
Any solution?
- March 8, 2019 at 1:34 pm #51648AlexGuest
1-I enter to a vendor profile, I create a new product uploading new main pic and new gallery pics.
2-I go into media folder of your plugin and I see the pics correctly with their association to the product.
3-I come back to products and I delete the product just added.
4-I come back to media folder to see if also the pics are deleted and they’re still there.It does not work.
what am I doing wrong?
Thanks
- March 8, 2019 at 2:06 pm #51649The Garden EmporiumParticipant
Hi
Mybe I can help with this, I wanted this feature as well and was glad you asked for it, it did take a few attempts to get this working.
What WCFM mean by product goes to trash is that it goes in to the bin on the backend of wp-admin.
The product will then be deleted in 30 days.how I got this working on WCFM front end for vendor to delete product and media at same time.
1. place add_filter( ‘wcfm_is_allow_delete_post_media’, ‘__return_true’ ); in your child theme’s functions.php
2. place define(‘EMPTY_TRASH_DAYS’, 0); in your wp-config.php file just before the line that says ‘That’s all, stop editing! Happy blogging.’This will delete the product and any media linked to the product as soon as the vendor presses delete on front end.
- March 8, 2019 at 2:48 pm #51651The Garden EmporiumParticipant
Just a word of warning that this will also take the bin function from wp-admin as well so when you delete a page,post or any other it will not go to the bin and will be deleted and will not be able to restore any at all, you can change this to a delay of any days you want by adding this code in the wp-config
define(‘EMPTY_TRASH_DAYS’, 0);
and change the 0 to how many days you would like to keep deleted items before they are deleted.
- March 8, 2019 at 5:50 pm #51680AlexGuest
If I put the point 2) I receive this error:
Warning: Use of undefined constant ‘EMPTY_TRASH_DAYS’ – assumed ‘‘EMPTY_TRASH_DAYS’’ (this will throw an Error in a future version of PHP) in /web/htdocs/www.sdrang.com/home/wp-config.php on line 83
- March 8, 2019 at 8:25 pm #51681The Garden EmporiumParticipant
Hi Alex
Have you got a screen shot of how you have typed this in wp-config.ph p file please
- March 8, 2019 at 9:12 pm #51683The Garden EmporiumParticipant
Two possible reasons for this error
There are two lines of the same type of code
or
you have put the line of code after wp-config.php loads settings.php
make sure there is only one line of the this code
and
make sure you put the line of code above the line that has require_once(ABSPATH . ‘wp-settings.php’);
if you screenshot your wp-config.php with out your database information or any passwords I can have a look at for you.
- March 9, 2019 at 12:25 pm #51715AlexGuest
OOOOOOHHH YEEESSSS!!!!
IT WORKS!!!!!The error was because I do copy/paste of your write: define(‘EMPTY_TRASH_DAYS’, 0);
but the “‘” was wrong!!! the correct is “‘” !!!! so: define(‘EMPTY_TRASH_DAYS’, 0);
THANK YOU VERY VERY MUCH!
- March 9, 2019 at 12:28 pm #51716AlexGuest
AHAHAHAH WAS CAUSE OF THIS BLOG!!!!
HERE IF I WRITE ” ‘ ” IS THE SAME OF ” ‘ ” I CAN’T SHOW THE DIFFERENCE HERE!!!
- March 9, 2019 at 7:16 pm #51750The Garden EmporiumParticipant
Good glad you got it working and glad I could help
- March 10, 2019 at 6:54 am #51810WCFM ForumMember
Great to know that it’s working for you guys.
So, hope this issue now resolved for you!
Have a great weekend 🙂
- AuthorPosts
- The topic ‘DELETE PRODUCT MAIN PIC AND GALLERY’ is closed to new replies.