Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

  • Index
  •  » ClickCartPro 6
  •  » want to change query behaviour of 'Related Items' from id to keyword

#1 01-26-2011 18:25:38

CrownRoyal
Member
Registered: 01-10-2009
Posts: 716

want to change query behaviour of 'Related Items' from id to keyword

So far as I can tell, the query that runs the Related Items on a product page uses 'ccp0_prod.xprod'. I'd like to be able to change the behaviour of the query, rather than manually typing in id's I just want to use a keyword, or keyword phrase. This saves having to initially insert,edit and delete ids when required. Something that resembles;
where xprod=$string

Code:

SELECT 
 *
FROM 
 ccp0_prod 
WHERE 
 name LIKE '%$string%' 
 OR 
  keywords LIKE '%$string%' 
  OR 
  desclong LIKE '%$string%'

...;

Where would I find the query to do this? Thanks.

Offline

 

#2 01-27-2011 15:20:16

Design_Wholesale
Member
From: England!
Registered: 11-21-2008
Posts: 1104
Website

Re: want to change query behaviour of 'Related Items' from id to keyword

All the queries of that sort will be in the  file.

Offline

 

#3 01-27-2011 15:26:48

CrownRoyal
Member
Registered: 01-10-2009
Posts: 716

Re: want to change query behaviour of 'Related Items' from id to keyword

Pretty sure this is it but I'm a little bit in the dark as to what to do with it. I used to working with actual queries "SELECT ..."

Code:

// +--
// | NAMESPACE: prodshow (Related Product)
// +--

} elseif ($ns == 'prodshow') {

     $prod  = $this->globals('ecom.prod_proddetail');
     $xprod = $prod['xprod'];

     $xprod = $this->make_list($xprod);

     if (empty($xprod)) {return 1;}

     $xwhere = '(';

     foreach ($xprod as $num => $xid) {

          $xwhere .= 'id=' . $this->KHXC_DB->quote($xid) . ' OR ';

     } // End of foreach statement.

     if (preg_match('/ OR $/',$xwhere)) {$xwhere = rtrim($xwhere,' OR ');}

     $xwhere .= ') ';

     if (!(empty($where))) {$where .= 'AND ';}
     $where .= $xwhere;

     $prodnum  = $prod['reldispnum'];
     $prodtype = $prod['reldisptype'];

     if (empty($prodnum))  {$prodnum   = $this->globals('khxc_settings.' . $this->app . '.splashprodnum');}
     if (empty($prodtype)) {$prodtype  = $this->globals('khxc_settings.' . $this->app . '.splashprodtype');}

// +--

Offline

 

#4 01-27-2011 15:34:00

Design_Wholesale
Member
From: England!
Registered: 11-21-2008
Posts: 1104
Website

Re: want to change query behaviour of 'Related Items' from id to keyword

Everything in the file is built in stages. - Earlier on in the file there is the following section (which is deliberately constructed the way it is so it does not have to be re-declared for each and every required instance):

Code:

// +--
// | Build out our SQL.
// +--

$table = $this->app . '_prod';

$colstring = $this->KHXC_DB->table_column_string($table);

if (($this->IsError($colstring)) || (empty($colstring))) {return 1;}

$sql  = "SELECT {$colstring} FROM {$table} WHERE ";

$where = '';

Offline

 

#5 01-27-2011 15:38:56

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: want to change query behaviour of 'Related Items' from id to keyword

The "where" statement (for product display) is being built from a quite a few code lines before it gets to this point, your not going to be able to tell what its looking for from the lines you have displayed.

John

Offline

 

#6 01-27-2011 15:57:22

CrownRoyal
Member
Registered: 01-10-2009
Posts: 716

Re: want to change query behaviour of 'Related Items' from id to keyword

Which is why I've submitted a quote request. Not sure how long it will take. I'm still waiting to hear from them on a quote we spoke about on Nov 7th last year.

Offline

 
  • Index
  •  » ClickCartPro 6
  •  » want to change query behaviour of 'Related Items' from id to keyword

Board footer