I found another error that was making my news edit page take almost 5 minutes to show.
Everytime you want to insert or edit an article, the "Store product link" gets all the products from the database. I have 12 languages in my store (s) and almost 600 products.
The problem is that the 1st language was getting 600 produtcs, the 2nd language 1200, the 3rd 1800 products and so on... when the page finished loading i had 46800 product links in dropdown menus on a single page.
A big problem with an easy solution
Find:
Code:
$dropdown_products = $db->Execute("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . (int)$lang['id'] . "' order by pd.products_name");
$dropdown_products_array[] = array(
'id' => '',
'text' => TEXT_PLEASE_SELECT,
);
while (!$dropdown_products->EOF) {
$dropdown_products_array[] = array(
'id' => $dropdown_products->fields['products_id'],
'text' => $dropdown_products->fields['products_name'],
);
$dropdown_products->MoveNext();
}
and move it before:
Code:
foreach ($languages as $i => $lang) {
This way it's outside the loop!
I'm attaching the file "news.php" in zip format.
Regards
Bookmarks