News:

Looking for documentation? Take a look on our wiki

Main Menu

VM2.0.18a: BUG in backend product sorting/up/down

Started by Neurotransmitter, February 01, 2013, 16:40:01 PM

Previous topic - Next topic

Neurotransmitter

Hi!

I am investigating some time in fixing the sorting function in backend productlist and found out, that the ordering number read out of the table _virtuemart_product_categories is wrong, if the product is linked to more than one category.

File: /joomla/administrator/components/com_virtuemart/views/product/tmpl/default.php  at position <!-- Reorder only when category ID is present --> ...
$product->ordering contains a wrong value, which is belongs to a different category than filtered above in the list!

So if you store your desired ordering, you get into trouble as the function saveorder runs with false values in variable $order.

Maybe this will help our experts!

Greetings,
Thomas



Neurotransmitter

Hi again,

here is a workaround which works for me quite well. VM 2.0.18a

/joomla/administrator/components/com_virtuemart/models

File: product.php  line ~ 900


...
} else {
  $product->virtuemart_category_id = JRequest::getInt ('virtuemart_category_id', 0);       
  # -------------------------
  # Patch for selecting the shown category in backend and getting the correct ordering       
  if (!empty($product->categories) and is_array ($product->categories) and !empty($product->categories[0]) AND empty($product->virtuemart_category_id)) {
    $product->virtuemart_category_id = $product->categories[0];       
  } elseif(!empty($product->virtuemart_category_id)) {           
    $product->virtuemart_category_id = JRequest::getInt ('virtuemart_category_id', 0);
  # END Patch
  # -------------------------
  } else {
    $product->virtuemart_category_id = 0;
  }
}


Apply ONLY, if your products are linked to more than one category (which is quite normal) and the sorting by hand and saving with the floppy-symbol wont work like estimated...and dont forget to backup your original file before!

Anyway...sorting by up/down icons is still not working. You have to sort manuel by typing numbers in the input fields...not an option for hundrets of products... :(

Your feedback is welcome.

Greeting,
Thomas