$ui = $_GET[filter]; daar ben je zowiezo nog quotes vergeten
Link gekopieerd
Teun Hesseling op 05/11/2010 10:11:53
$ui = $_GET[filter]; daar ben je zowiezo nog quotes vergeten
Ik heb ze er bij gezet maar krijg nog steeds het probleem
ik gebruik deze code om de producten uit te lezen
static function getList($siteID = 0, $languageID = 0, $frontEnd = false, $parentID = false, $currencyID = 0, $offset = 0, $count = 30, $orderBy = '', $orderDir = '', $where = '', $options='loadprices,loadoldprices,loadkeywords,loadproperties,loadsites,loadimages,loadaccessoires,loadsuggestions,loadtax,loadoptions')
{
$options = Product::parseOptions($options);
//print_r($where);
if (!checkInt($siteID) || !checkInt($languageID) || !checkBool($frontEnd) || !checkInt($currencyID) || !checkInt($count) || !checkInt($offset))
return false;
// $query = 'SELECT *, UNIX_TIMESTAMP(`dateadded`) as `dateadded`, UNIX_TIMESTAMP(`datemodified`) as `datemodified`, UNIX_TIMESTAMP(`dateexpected`) as `dateexpected`, UNIX_TIMESTAMP(`dateactive`) as `dateactive` FROM `'. TABLE_PREFIX .'product` WHERE 1';
$query = '
SELECT DISTINCT
p.*,
' . ((checkOption('loadprices', $options)) ? 'pp.price,' : ''). '
' . ((checkOption('loadoldprices', $options)) ? 'pop.oldprice,' : ''). '
UNIX_TIMESTAMP(p.`dateadded`) as `dateadded`,
UNIX_TIMESTAMP(p.`datemodified`) as `datemodified`,
UNIX_TIMESTAMP(p.`dateexpected`) as `dateexpected`,
UNIX_TIMESTAMP(p.`dateactive`) as `dateactive`
FROM
`'.TABLE_PREFIX.'product` `p`
';
if(checkOption('loadprices', $options)){
$query .= '
LEFT JOIN
`'.TABLE_PREFIX.'productprice` `pp`
ON
p.id = pp.product_id AND pp.site_id = ' . $siteID . ' AND pp.currency_id = ' . $currencyID. '
';
}
if(checkOption('loadoldprices', $options)){
$query .= '
LEFT JOIN
`'.TABLE_PREFIX.'productoldprice` `pop`
ON
p.id = pop.product_id AND pop.site_id = ' . $siteID . ' AND pop.currency_id = ' . $currencyID. '
';
}
if(checkOption('loadproperties', $options)){
$query .= '
LEFT JOIN
`'.TABLE_PREFIX.'propertyvalue` `pprop`
ON
p.id = pprop.product_id
';
}
if(checkOption('loadoptions', $options)){
$query .= '
LEFT JOIN
`'.TABLE_PREFIX.'optionvalue` `popt`
ON
p.id = popt.product_id
';
}
if(checkOption('loadkeywords', $options)){
$query .= '
LEFT JOIN
`'.TABLE_PREFIX.'keywordlink` `k`
ON
p.id = k.link_id AND k.type = \'product\'
';
}
$query .= '
WHERE
(`p`.`site_id` = "'.SITE_ID.'" OR `p`.`omnipresent` = "1")
';
if (checkInt($parentID))
$query .= ' AND `p`.`category_id` = "'.$parentID.'"';
if ($frontEnd)
$query .= ' AND `p`.`active` = "1"';
if ($languageID)
$query .= ' AND `p`.`language_id` = "'.$languageID.'"';
if (checkString($where))
$query .= ' AND ('.$where . ')';
$query .= ' ORDER BY ';
if (checkString($orderBy))
{
$query .= '`'.$orderBy.'` ';
if (checkOrderDir($orderDir))
$query .= $orderDir;
$query .= ', ';
}
$query .= '`order` ASC';
if ($count > 0)
$query .= ' LIMIT '.$offset.', '.$count;
$db = new DB;
if (!$db->query($query) || $db->num_rows() == 0)
return array();
$list = array();
$product = false;
$previousID = false;
$order_array = array();
$order = 0;
while($row = $db->next_record())
{
$error = false;
$order ++;
if (empty($list[$row['id']]))
$list[$row['id']] = new Product($siteID, $row['id'], $languageID, $currencyID, $frontEnd, $row);
if (empty($order_array[$row['id']]))
$order_array[$row['id']] = $order;
if (checkOption('loadprices', $options) && !$list[$row['id']]->loadPrices())
$error = 2;
if (checkOption('loadoldprices', $options) && !$list[$row['id']]->loadOldPrices())
$error = 3;
if (checkOption('loadkeywords', $options) && !$list[$row['id']]->loadKeywords())
$error = 4;
if (checkOption('loadproperties', $options) && !$list[$row['id']]->loadProperties())
$error = 5;
if (checkOption('loadsites', $options) && !$list[$row['id']]->loadSites())
$error = 6;
if (checkOption('loadimages', $options) && !$list[$row['id']]->loadImages())
$error = 7;
if (checkOption('loadaccessoires', $options) && !$list[$row['id']]->loadAccessoires())
$error = 8;
if (checkOption('loadsuggestions', $options) && !$list[$row['id']]->loadSuggestions())
$error = 9;
if (checkOption('loadtax', $options) && !$list[$row['id']]->loadTax())
$error = 10;
if (checkOption('loadoptions', $options) && !$list[$row['id']]->loadOptions())
$error = 11;
if (!$list[$row['id']]->loadSubscriptionPrices())
$error = 12;
$list[$row['id']]->currentTitle = (isset($row['title']) ?urldecode($row['title']) :null);
$list[$row['id']]->currentDescription = (isset($row['description']) ?urldecode($row['description']) :null);
$list[$row['id']]->currentShortDescription = (isset($row['shortdescription']) ?urldecode($row['shortdescription']):null);
$list[$row['id']]->languages[$row['language_id']]['title'] = (isset($row['title']) ?urldecode($row['title']) :null);
$list[$row['id']]->languages[$row['language_id']]['description'] = (isset($row['description']) ?urldecode($row['description']) :null);
$list[$row['id']]->languages[$row['language_id']]['shortDescription'] = (isset($row['shortdescription']) ?urldecode($row['shortdescription']):null);
$list[$row['id']]->languages[$row['language_id']]['meta_description'] = (isset($row['meta_description']) ?urldecode($row['meta_description']) :null);
$list[$row['id']]->languages[$row['language_id']]['meta_keyword'] = (isset($row['meta_keyword']) ?urldecode($row['meta_keyword']) :null);
$list[$row['id']]->languages[$row['language_id']]['window_title'] = (isset($row['window_title']) ?urldecode($row['window_title']) :null);
$list[$row['id']]->languages[$row['language_id']]['url_rewrite'] = (isset($row['url_rewrite']) ?urldecode($row['url_rewrite']) :null);
}
$sorted_list = array();
foreach($order_array as $key => $order)
$sorted_list[$order] = $list[$key];
return $sorted_list; // Success (list with Product instances)
}
Link gekopieerd
je gaat er vanuit dat de informatie die je via je GET binnenkrijg een array is.
Ik denk dat daar je probleem zit. Wat stuur je door naar je GET bij meerdere id's?
Tevens kan ik je aanraden om duidelijke variabelen namen te kiezen en dus niet $a en $b daardoor raak je snel het overzicht kwijt.
je hebt ook boven in je script staan: $a=1; verderop heb je een if statement met daarin if($a==1) en een elseif en else maar die worden natuurlijk nooit bereikt omdat $a altijd 1 is in dit script.
succes
Link gekopieerd
ik stuur dit mee in me GET :
http://dc.iteeuwen.nl/page/980/products.html?filter[0]=1&filter[10]=11
die lees ik uit via het script (staat bovenaan) en geef die mee aan de query die word opgebouwd.
Zolang ik er maar 1 selecteerd gaat alles goed maar zijn het er meerdere dan laat die niks meer zien.
ik denk dat er iets iets niet goed staat in de query.
Link gekopieerd