Hello,
I have a large database in VM 2.0.24C, my problem is that i can't acces the Category or Products in the Backend of VM. I am getting an internal server erorr. In front everything is ok. I have set the maximum row to show from joomla to 6 but still can't acces the categories and products.
Can please someone help me.
Thank You
and the error is?
Hi,
The error is 500 internal server error. Or a blanck page .
thats no help - ask your host or search your logs for the specific error...
The table virtuemart_category has 3 mill records. It is a time out error.
Then nothing we can do to help - this is between you and your server - more resources, longer timeouts etc etc
A server needs enough resources to do the job your wanting it to do...
better question - how can your cat table posibly have 3 million records?
Hi,
it seams that my english is very bad. My problem and question is hove can i do to select only the first 6 or 10 categories or products in VM backend when i acces the category or product. My gues is that VM select all the data from that tables and that is taking too long, even i increase the server max_exec_time and php_memeory_limit.
Hmmm - this is interesting...
If I open in admin the products page
administrator/index.php?option=com_virtuemart&view=product
in file administrator/components/com_virtuemart/models/product.php it fires the getProducts() function line 1348
public function getProducts ($productIds, $front = TRUE, $withCalc = TRUE, $onlyPublished = TRUE, $single = FALSE) {
if (empty($productIds)) {
// vmdebug('getProducts has no $productIds','No ids given to get products');
// vmTrace('getProducts has no $productIds');
return array();
}
$maxNumber = VmConfig::get ('absMaxProducts', 700);
$products = array();
if ($single) {
foreach ($productIds as $id) {
$i = 0;
if ($product = $this->getProductSingle ((int)$id, $front)) {
$products[] = $product;
$i++;
}
if ($i > $maxNumber) {
vmdebug ('Better not to display more than ' . $maxNumber . ' products');
return $products;
}
}
}
else {
$i = 0;
foreach ($productIds as $id) {
if ($product = $this->getProduct ((int)$id, $front, $withCalc, $onlyPublished)) {
$products[] = $product;
$i++;
}
if ($i > $maxNumber) {
vmdebug ('Better not to display more than ' . $maxNumber . ' products');
return $products;
}
}
}
return $products;
}
you can see a line
$maxNumber = VmConfig::get ('absMaxProducts', 700);
this can be set in config - (don't see it) but any way as a test set to 2
$maxNumber = VmConfig::get ('absMaxProducts', 2);
no effect - all products returned
this part of the code is wrong
if ($single) {
foreach ($productIds as $id) {
$i = 0;
if ($product = $this->getProductSingle ((int)$id, $front)) {
$products[] = $product;
$i++;
}
if ($i > $maxNumber) {
vmdebug ('Better not to display more than ' . $maxNumber . ' products');
return $products;
}
}
}
the $i=0; is inside the loop so is reset to 0 every loop
if I change the code to
if ($single) {
$i = 0;
foreach ($productIds as $id) {
if ($product = $this->getProductSingle ((int)$id, $front)) {
$products[] = $product;
$i++;
}
print 'Debug Line '.__LINE__.' $i <pre>'; print_r ($i); print "</pre><br />\n";
if ($i > $maxNumber) {
vmdebug ('Better not to display more than ' . $maxNumber . ' products');
return $products;
}
}
}
then the code works as intended.. now it only returns 2 products (or what ever I set $maxNumber = VmConfig::get ('absMaxProducts', 700); to
Give it a go - may solve your problem - have no idea what other effects it may have but it is a start
Hi,
thank you, i will try and post back to you.
Thanks again.
hi,
i did as you told but, still having problems with categories. Is there a cod like this for categories too?
Thanks
did it fix the products?
if so the idea is now YOU search for the relavent code etc etc... ;)
afraid for some us us this sort of thing is our job.... how we feed ourselves
Hi,
The products ar not fixed with this. I deleted all the products and when i vant to acces in admin products it is hanging asa same as categories. So a think that the categories are the problem that is way i ask if is a cod like the product where to set a limit.
I don't know - but the idea is you ask for help or advice - people volunteer their time - you learn from this process and are able to do more on your site.
I have given you a good pointer as to where to look - you continue the process - have a look - experiment etc...
I'm sure your website is a commercial proposition - 3 million items! - if you need someone to fix your site for this particular problem then..... :)
maybe someone else has the time or urge.. ;)