Para crear manualmente un espacio de búsqueda del Asesor de productos se
requiere entender el subsistema de catálogo y el esquema de base de datos
asociado. El espacio de búsqueda se compone de tablas de bases de datos adicionales que contienen información extraída de las siguientes tablas estándar de WebSphere Commerce:
Nota: Esta información
no se aplica a los usuarios de iSeries. Consulte
Crear un espacio de búsqueda del Asesor de
productos utilizando un archivo XML.
Es preciso efectuar los pasos siguientes para crear las tablas de base de datos necesarias para dar soporte a búsquedas del Asesor de productos. A lo largo de estos pasos, se le proporcionarán sentencias SQL de ejemplo para crear un espacio de búsqueda simple, que se compone de tablas, vistas y los índices adecuados. Estas sentencias incluyen datos, como los ID de productos y categorías, que tendrá que sustituir por sus propios datos. Aquí se muestran a efectos de demostración. En los casos en que una sentencia SQL devuelva datos, sobre todo cuando los datos se utilicen como entrada en un paso posterior, dichos datos aparecerán en negrita y entre corchetes a continuación de la sentencia SQL.
Nota: Los ejemplos de este archivo son específicos de DB2. Los usuarios de Oracle deben referirse al programa de utilidad de ejemplo adecuado, para sentencias SQL específicas de Oracle.
db2 "select distinct(attribute_id),language_id,attrtype_id,name
from attribute
donde
catentry_id in(select catentry_id from catgpenrel where
catgroup_id=1)
order by attribute_id"
db2 create table ICT1
( PRRFNBR int not null,
PRNBR varchar(64) );
db2 create table ICTDESC1
( PRRFNBR int not null,
PRSDESC varchar(254),
AVAILABLE int not null,
PRTHMB varchar(254),
XMLDETAIL long varchar,
LANGUAGE_ID int not null,
F_COLOR char(254),
F_SIZE int,
Constraint ictd1_pk
primary key (prrfnbr,language_id) );
db2 create view ICV1_NULL as select ic.prrfnbr,
ic.prnbr,
icd.PRSDESC,
icd.AVAILABLE,
icd.PRTHMB,
icd.XMLDETAIL,
icd.LANGUAGE_ID,
icd.F_COLOR,
icd.F_SIZE,
p.ipsgnbr,
p.storeid,
p.ppprc,
p.setccurr
from ICTPRICES p, ICT1 ic, ICTDESC1 icd
where ic.PRRFNBR=p.CATENTRY_ID and
ic.PRRFNBR=icd.PRRFNBR and
p.IPSGNBR is NULL;
db2 "insert into icrootcat
(rootcategoryid,catgroup_id,pfpasync,pfreq,tablename,
lastmodified)
values
(1,1,0,1,'ICV1_','2000-06-15-14.48.25.686000')"
db2 "insert into icexplfeat
(featureid,catgroup_id,columnname,length,datatype,keysequence,
nullable,location,included,relevance)
values
(1, 1,'F_COLOR',254,'com.ibm.commerce.datatype.DsString',
0,1,1,1,0);
db2 "insert into icexplfeat
(featureid,catgroup_id,columnname,length,datatype,keysequence,
nullable,location,included,relevance)
values
(2, 1,'F_SIZE',4,'com.ibm.commerce.datatype.DsInteger',
0,1,1,1,0);
db2 "insert into icexplfeat
(featureid,catgroup_id,columnname,length,datatype,keysequence,
nullable,location,included,relevance)
values
(3, 1,'PRRFNBR',4,'com.ibm.commerce.datatype.DsInteger',
1,0,0,1,0);
db2 "insert into icexplfeat
(featureid,catgroup_id,columnname,length,datatype,keysequence,
nullable,location,included,relevance)
values
(4,1,'PRNBR',254,'com.ibm.commerce.datatype.DsString',
0,0,0,1,0);
db2 "insert into icexplfeat
(featureid,catgroup_id,columnname,length,datatype,keysequence,
nullable,location,included,relevance)
values
(5, 1,'PRSDESC',254,'com.ibm.commerce.datatype.DsString',
0,1,3,1,0);
db2 "insert into icexplfeat
(featureid,catgroup_id,columnname,length,datatype,keysequence,
nullable,location,included,relevance)
values
(6, 1,'PRTHMB',254,'com.ibm.commerce.datatype.DsImage',
0,1,3,1,0);
db2 "insert into icexplfeat
(featureid,catgroup_id,columnname,length,datatype,keysequence,
nullable,location,included,relevance)
values
(7, 1,'XMLDETAIL',32700,'com.ibm.commerce.datatype.DsURLLink',
0,1,3,1,0);
db2 "insert into icexplfeat
(featureid,catgroup_id,columnname,length,datatype,keysequence,
nullable,location,included,relevance)
values
(8, 1,'PPPRC',16,'com.ibm.commerce.datatype.DsCurrency',
0,0,2,1,0);
db2 "insert into icexplfeat
(featureid,catgroup_id,columnname,length,datatype,keysequence,
nullable,location,included,relevance)
values
(9, 1,'AVAILABLE',4,'com.ibm.commerce.datatype.DsInteger',
0,0,3,1,0);
db2 "insert into icexpldesc (featureid,language_id,name,
unitofmeasure,description,elaboration,scale,precision)
values
(1, 1,'Color','','Color',NULL,0,0);
db2 "insert into icexpldesc (featureid,language_id,name,
unitofmeasure,description,elaboration,scale,precision)
values
(2, 1,'Talla','','Talla',NULL,0,0);
db2 "insert into icexpldesc (featureid,language_id,name,
unitofmeasure,description,elaboration,scale,precision)
values
(3, 1,'CATENTRY_ID','','Número de referencia de producto',NULL,0,0);
db2 "insert into icexpldesc (featureid,language_id,name,
unitofmeasure,description,elaboration,scale,precision)
values
(4, 1,'PARTNUMBER','','ProductNumber/SKU',NULL,0,0);
db2 "insert into icexpldesc (featureid,language_id,name,
unitofmeasure,description,elaboration,scale,precision)
values
(5, 1,'SHORTDESCRIPTION','','Descripción breve',NULL,0,0);
db2 "insert into icexpldesc (featureid,language_id,name,
unitofmeasure,description,elaboration,scale,precision)
values
(6, 1,'THUMBNAIL','','Archivo de imagen reducida',NULL,0,0);
db2 "insert into icexpldesc (featureid,language_id,name,
unitofmeasure,description,elaboration,scale,precision)
values
(7, 1,'XMLDETAIL','','Detalle XML',NULL,0,0);
db2 "insert into icexpldesc (featureid,language_id,name,
unitofmeasure,description,elaboration,scale,precision)
values
(8, 1,'STANDARDPRICE','','MSRP',NULL,2,15);
db2 "insert into icexpldesc (featureid,language_id,name,
unitofmeasure,description,elaboration,scale,precision)
values
(9, 1,'AVAILABLE','','Disponibilidad',NULL,0,0);
db2 "insert into ict1 (select catentry_id,partnumber
from catentry where catentry_id in (select catentry_id
from catgpenrel where catgroup_id=1))"
db2 "import from catentry.del of del insert into ict1"
db2 "insert into ictdesc1 (PRRFNBR,PRSDESC,AVAILABLE,
PRTHMB,XMLDETAIL,LANGUAGE_ID)
(select c2.catentry_id,c2.shortdescription,c2.available,
c2.thumbnail, c2.xmldetail, c2.language_id
from catentry c1, catentdesc c2
where c1.catentry_id=c2.catentry_id
and c2.language_id=-1
and c2.published=1
and (c2.catentry_id in (select catentry_id from catgpenrel
where catgroup_id=1)))"
db2 "update ictdesc1 set F_Color =
(select stringvalue from attrvalue
where ictdesc1.prrfnbr=attrvalue.catentry_id
and ictdesc1.language_id=attrvalue.language_id
and attrvalue.attribute_id in
(select attribute_id from attribute
where name = 'Color')
and attrvalue.language_id=-1
and attrvalue.catentry_id in
(select catentry_id from catgpenrel
where catgroup_id=1))
where language_id=-1"
db2 "update ictdesc1 set F_Size =
(select integervalue from attrvalue
where ictdesc1.prrfnbr=attrvalue.catentry_id
and ictdesc1.language_id=attrvalue.language_id
and attrvalue.attribute_id in
(select attribute_id from attribute
where name = 'Talla')
and attrvalue.language_id=-1
and attrvalue.catentry_id in
(select catentry_id from catgpenrel
where catgroup_id=1))
where language_id=-1"
db2 "insert into ictprices(storeid, catentry_id,setccurr,ppprc)
select storeent_id, catentry_id, currency, price
from storeent, offer, offerprice,tradeposcn
where storeent_id=0
and tradeposcn_id=offer.tradeposcn_id
and offer.offer_id=offerprice.offer_id
and tradeposcn.type='S'"
![]() |