DELETE PRODUCT MAIN PIC AND GALLERY

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 25 reply threads
  • Author
    Posts
    • #51389
      Alex
      Guest

      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

    • #51438
      WCFM Forum
      Keymaster

      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

    • #51460
      Alex
      Guest

      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?

    • #51461
      Alex
      Guest

      Another thing…
      the problem of deleting only 1 pics x time in media folder remains (for vendors) !

    • #51463
      Alex
      Guest

      ps. I just tried and seems it does not work…

    • #51464
      WCFM Forum
      Keymaster

      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

    • #51468
      Alex
      Guest

      Yes, I tried a lot of time….it does not work… 🙁

    • #51469
      Alex
      Guest

      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.

    • #51476
      WCFM Forum
      Keymaster

      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

    • #51487
      Alex
      Guest

      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.jpg

      Since 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!!!

    • #51519
      Alex
      Guest

      Any option to do that?

      Any option to have more than one photo deleted at a time in “media” page?

    • #51524
      WCFM Forum
      Keymaster

      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

    • #51541
      Alex
      Guest

      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

    • #51542
      Alex
      Guest

      ps. there’s no “thrash” on media page.

    • #51543
      Alex
      Guest

      NO “trash”… 🙂

    • #51560
      Alex
      Guest

      Any solution?

    • #51648
      Alex
      Guest

      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

    • #51649

      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.

    • #51651

      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.

    • #51680
      Alex
      Guest

      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

    • #51681

      Hi Alex

      Have you got a screen shot of how you have typed this in wp-config.ph p file please

    • #51683

      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.

    • #51715
      Alex
      Guest

      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!

    • #51716
      Alex
      Guest

      AHAHAHAH WAS CAUSE OF THIS BLOG!!!!

      HERE IF I WRITE ” ‘ ” IS THE SAME OF ” ‘ ” I CAN’T SHOW THE DIFFERENCE HERE!!!

    • #51750

      Good glad you got it working and glad I could help

    • #51810
      WCFM Forum
      Keymaster

      Great to know that it’s working for you guys.

      So, hope this issue now resolved for you!

      Have a great weekend 🙂

Viewing 25 reply threads
  • The topic ‘DELETE PRODUCT MAIN PIC AND GALLERY’ is closed to new replies.