Results 1 to 10 of 451

Threaded View

  1. #11
    Join Date
    Oct 2005
    Location
    Vila Nova de Gaia, Portugal
    Posts
    14
    Plugin Contributions
    0

    application error "Languages" and "Store Product Link" Loop

    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
    Attached Files Attached Files

 

 

Similar Threads

  1. News & Article Management
    By akumi in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 13 May 2008, 03:27 PM
  2. Regarding News & Article Management
    By akumi in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 12 May 2008, 05:27 PM
  3. News & Article Management- couple small problems
    By chufty bill in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 26 Oct 2006, 09:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR