Author Topic: Multi Variant Child Products Not Fully Deleting!?  (Read 402 times)

trevorellis

  • Beginner
  • *
  • Posts: 24
  • A beginner
  • VirtueMart Version: VirtueMart 3.2.14
Multi Variant Child Products Not Fully Deleting!?
« on: April 29, 2019, 10:13:56 am »
Hello, I am using Virtuemart (ver. 3.4.2) with the Uber template (ver. 2.1.9) and I am having a problem with deleting multi variant child products.

I have tried following the advice in the following forum posts but so far have not been able to solve the problem:
https://forum.virtuemart.net/index.php?topic=140585.0;prev_next=prev#new
http://forum.virtuemart.net/index.php?topic=140138.0;prev_next=prev#new

When I deleted the multi variant child products by deleting them from the list of child products, empty lines are appearing on the list of multi variant custom fields (as shown in Img01).

However, these empty multi variant child products do NOT appear when I go into the list of child products (as shown in Img02).

I tried to delete these empty multi variant child products by going in my SQL database but they CANNOT be found in there (as shown in Img03).

I have also made sure the language settings on Virtuemart are set so that ONLY English is being (as shown in Img04).

So far, the only solution I have found is to clear the multi variant section of a product and re-enter all the multi variant child products again. Please help me so that I can fully delete child products.

StefanSTS

  • Global Moderator
  • Jr. Member
  • *
  • Posts: 416
  • VirtueMart Version: VM 4.2 on Joomla 4.5
Re: Multi Variant Child Products Not Fully Deleting!?
« Reply #1 on: April 29, 2019, 12:32:43 pm »
Hi,

I solved that problem on my side with adding this to my backend templates template.js file.

jQuery(function($) {
   $("#mvo tr.removable").append("<td><button class='deletemultichild'>Delete</button></td>");
   $("#mvo").on("click", ".deletemultichild", function() {
      $(this).parent().parent().remove();
   });
});

You get a delete button after every row in the custom fields. You can delete the empty ones and save the product.

Hope it helps
Stefan
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your life shop! Use Alpha versions only if you know what risk you are taking.

trevorellis

  • Beginner
  • *
  • Posts: 24
  • A beginner
  • VirtueMart Version: VirtueMart 3.2.14
Re: Multi Variant Child Products Not Fully Deleting!?
« Reply #2 on: April 29, 2019, 15:14:40 pm »
That looks exactly what I need. Can you give a bit more detail about the name/location of the .js file that I need to edit please?

StefanSTS

  • Global Moderator
  • Jr. Member
  • *
  • Posts: 416
  • VirtueMart Version: VM 4.2 on Joomla 4.5
Re: Multi Variant Child Products Not Fully Deleting!?
« Reply #3 on: April 29, 2019, 17:02:54 pm »
Actually, it might be better to add a module to the administrator.

Go to Joomla Menu -> Extensions -> Modules.
Change Site to Administrator.
Press New.
Use a Custom HTML Module.
On the right side chose position debug or footer in Isis template.
Paste the following code into it. (Please make sure, your editor is not removing the script.)

<script>
jQuery(function($) {
   $("#mvo tr.removable").append("<td><button class='deletemultichild'>Delete</button></td>");
   $("#mvo").on("click", ".deletemultichild", function() {
      $(this).parent().parent().remove();
   });
});
</script>

That should be it.
You can also make an override for the view files of the product edit, so the script would be only called in the product edit view. But the module should be fine, since nothing else will be touched by the script.
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your life shop! Use Alpha versions only if you know what risk you are taking.

trevorellis

  • Beginner
  • *
  • Posts: 24
  • A beginner
  • VirtueMart Version: VirtueMart 3.2.14
Re: Multi Variant Child Products Not Fully Deleting!?
« Reply #4 on: April 29, 2019, 19:43:16 pm »
Excellent, that has done exactly what we wanted. We have created the button using the Custom HTML module. Your advice was very helpful.  ;D