[ic] loop search fails with SQl database
Rolf Schaufelberger
interchange-users@icdevgroup.org
Wed Jun 25 09:47:00 2003
I have Interchange V4.8.7 up an d running whith the foundation store.
Next I implemented the tutorial store which also worked fine. Now I changed
the products database from txt file to mysql table. The table was created
manually (not filled by makecat). Now, my index.html with [loop search=..]
does'nt show anything, while [sql typ=list...] works.
In detail :
catalog.cfg
============
ParseVariables Yes
ifndef SQLDSN
Variable SQLDSN dbi:mysql:test
endif
Require module DBI
Require module DBD::mysql
Message -i -n Using MySQL, DSN=__SQLDSN__...
# Tell the default DBM we are using something else.
Variable SOME_DATABASE 1
Database products products.txt SQL
Database products DSN __SQLDSN__
Database products KEY sku
Database products COLUMN_DEF "sku=char(64) NOT NULL PRIMARY KEY"
Database products COLUMN_DEF "description=VARCHAR(128) NOT NULL"
Database products COLUMN_DEF "title=VARCHAR(128) DEFAULT '' NOT NULL"
Database products INDEX title
Database products COLUMN_DEF "price=DECIMAL(12,2) NOT NULL"
Database products INDEX price
NoImport products
ProductFiles products
=============================================
I pulled all in here from the foundation examples.
Next
=========================
rs@linux:~/catalogs/tutorial> ls -l products/
insgesamt 16
-rw------- 1 rs users 19 Jun 25 10:30 products.autonumber
-rw------- 1 rs users 1 Jun 25 10:16 products.sql
-rw-r--r-- 1 rs users 0 Jun 25 10:51 products.txt
=========================
And index.html
======================
<table cellpadding=5>
<tr>
<th>ID #</th>
<th>Beschreibung</th>
<th>Preis</th>
</tr>
[loop search="ra=yes/fi=products"]
<tr>
<td>[loop-code]</td>
<td><a href="[loop-code].html">[loop-field description]</a></td>
<td align=right>[currency][loop-field price][/currency]</td>
<td>[order [loop-code]]Bestellen[/order]</td>
</tr>
[/loop]
</table>
<TABLE BORDER=2>
<TR><TH><B>SKU</B></TH><TH><B>Description</B></TH>
[sql type=list
query="select sku,description from products"]
<TR>
<TD>[page [sql-code]][sql-code]</A></TD>
<TD>[sql-param description]</TD>
</TR>
[/sql]
</TABLE>
=========================
and
=========================
mysql> desc products;
+-------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------+------+-----+---------+-------+
| sku | varchar(64) | | PRI | | |
| description | varchar(128) | | | | |
| title | varchar(128) | | | | |
| price | decimal(12,2) | | | 0.00 | |
+-------------+---------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
===========================
Now, the first table in index.html is empty while the second is correct. Also
[page [sql-code]] works (i.e flypage.html) and ord/basket.html works (code
exactly taken from tutorial ). Search doesn't work.
So where is my problem (beside the documentation, which I consider to be a
problem :-( )
Rolf Schaufelberger
rolf.schaufelberger@web.de