New Zenner
- Join Date:
- Jul 2009
- Posts:
- 1
- Plugin Contributions:
- 0
Slow loading categories on main page!!
Hi
I am new in zen cart
I just install the latest zen cart 1.3.8
i didn't do any magor change on zencart, just a little bit.
i want to setup all categories befor start adding any product
so i wrote a code to pick up categories name from a file and put into database:
$idd='0';
for($i=1980;$i<=2009;$i++)
{
$idd++;
$q = "INSERT INTO categories_description set categories_id='$idd', language_id='1' , categories_name='$i', categories_description='$i' ";
$result = mysql_query($q, $connection);
$p = "INSERT INTO categories set categories_id='$idd', parent_id='0', sort_order='0', date_added='2009-07-20 00:49:29', categories_status ='1' ";
$result = mysql_query($p, $connection);
$parr1=$idd;
$same="";
$file=fopen ("car.txt","r");
while(! feof($file))
{
$str=fgets($file);
$pieces =explode(" ",$str);
if($same != $pieces[0])
{
$idd++;
$q = "INSERT INTO categories_description set categories_id='$idd', language_id='1' , categories_name='$pieces[0]', categories_description='$pieces[0]' ";
$result = mysql_query($q, $connection);
$same=$pieces[0];
$p = "INSERT INTO categories set categories_id='$idd', parent_id='$parr1', sort_order='0', date_added='2009-07-20 00:49:29', categories_status ='1' ";
$result = mysql_query($p, $connection);
$parr2=$idd;
}
$model=substr($str,strlen($pieces[0]));
if ($model=="") $model = "Other";
$idd++;
$q = "INSERT INTO categories_description set categories_id='$idd', language_id='1' , categories_name='$model', categories_description='$model' ";
$result = mysql_query($q, $connection);
$same=$pieces[0];
$p = "INSERT INTO categories set categories_id='$idd', parent_id='$parr2', sort_order='0', date_added='2009-07-20 00:49:29', categories_status ='1' ";
$result = mysql_query($p, $connection);
}
fclose($file);
car.txt :
Acura TL
Acura Vigor
Alfa 147
Alfa 164 Sedan
Alfa 1750
Audi Super 90
Audi TT
Audi V8 Quattro
BMW 128i
BMW 135i
BMW 1602
BMW 1800
BMW 2002
...
i want to have same make and carmodel in every year,
this code works perfectly.:yes:
with 50 to 200 categories it is good but with somthing around 6000
categories, my site slow down, it takes 35s to load main page
and when i click on any category it takes 20s to show subcategory
also in admin page it takes 45s to open categories list to edit or
add something.
i dont have any product yet , just categories........
what happen if i add 3000 product to this categories :blink::frusty:
what should i do to have all this categories and speed up loading
time ?????????