Weird problem with product catalog

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
danf_1979
Forum Commoner
Posts: 72
Joined: Sun Feb 20, 2005 9:46 pm

Weird problem with product catalog

Post by danf_1979 »

From some time now I cant browse my product catalog... because when i click the "Go" button (in this code "Ver") nothing happens. I got no clue to what the problem is so if anybody can check this code to see any problems i would appreciate the help. This is a modified version of CCart.

Code: Select all

<?php
/**************************************************************************/
/* PHP-NUKE: Web Portal System                                            */
/* ===========================                                            */
/*                                                                        */
/* Copyright (c) 2003 by Francisco Burzi                                  */
/* http://phpnuke.org                                                     */
/*                                                                        */
/* Calloway's Cart Pro version 2.0b  - Paypal Shopping Cart Module        */  
/* BY: Brian Calloway  (http://www.theguitarfiles.com)                           */ 
/* Calloway's Cart Pro is not Freeware                                    */
/* Copyrighted 2003 All Rights reserved                                   */
/* View Demo,Forums etc. @ http://www.theguitarfiles.com/CC/CallowaysCart */
///////////////////////////////////////////////////////////////////////////
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
include("header.php");
include("config.php");
include("admin/modules/CCart/pager.inc"); 
$sql1 = mysql_query("SELECT * FROM CCart_config WHERE id=1");
list($cfgid, $paypalid ,$logourl ,$returnurl, $cancelurl, $itemimg, $subscriptionimg, $cartimg, $addcartimg, $viewcart, $vlayout, $nuke_admin, $rtsidebar, $vernum, $images,$ccolumns,$subcolumns,$specialcolumns,$whatsnewcolumns,$showcasecolumns,$csymbol,$cartcolor,$ppimg,$note,$inn,$productpage,$specialbox,$whatsnewbox,$showcasebox,$bphone,$bemail,$bhours,$bfax,$cafepress,$cpid,$prefn) = mysql_fetch_array($sql1);
if (!$sql1){
echo("$sql1");
echo("<P>Error getting config details: " .
mysql_error() . "</P>");
}
//Display How Many Products Per Page:
if($productpage== 5) 
{	
$searchrows = 5;
} 
elseif($productpage== 10)
{
$searchrows = 10;
}else{
$searchrows = 15;
}
if (empty($offset)) 
// If no offset set to 0
$offset=0;
//Get Product Info for limit per page
$result = sql_query("SELECT * FROM CCart_products WHERE catid='$id' ", $dbi);
$numresults = sql_num_rows($result, $dbi);
// RIGHT SIDE BAR ON/OFF
if ($rtsidebar==on) {
$index = 1;
}
//////////
If (!$id) {
/////////

//Display Search Function:
echo "<center>";
?>
<form name="form" action="ccsearch.php" method="get">
<input type="text" name="results" />
<input type="submit" name="Submit" value="Buscar marca" />
</form>
<?
echo "</center>";

// ACA ESTA LA TABLITA DE ARRIBA QUE DICE "CATEGORIAS DE PRODUCTOS:"*****************************************************************
OpenTable();
echo "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">";

// ACA CONFIGURA EL TEXTO DE LA TABLA ANTERIOR **************************************************************************************

echo "<td bgcolor=\"$bgcolor2\"><font class=\"tituloccart\">Categorías de productos (catálogo en construción)</font></td>";
echo "</table>";
$query = "SELECT * FROM CCart_categories WHERE pid='0'  ORDER BY cat";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
$rows = ceil($num_rows/$ccolumns);
while($row = mysql_fetch_array($result)) {
$data[] = $row['image'];
$data2[] = $row['cat'];
$data3[] = $row['catdes'];
$data4[] = $row['cid'];
$data5[] = $row['pid'];
}
CloseTable();

//ACA ESTA LA MODIFICACION MAESTRA DEL DROPBOX****************************************************************************************
echo "<br>";
echo "<center>";
echo "<TABLE BGCOLOR=\"$bgcolor3\" cellpadding=\"0\" cellspacing=\"0\" BORDER=\"0\">\n";
echo "<tr>";

// LENTES DE SOL
echo "<td align=\"left\" valign=\"top\"><img src=\"modules/CCart/images/check2.gif\" border=\"0\">";
echo "<font class=\"option2\"><align=\"center\" valign=\"top\">&nbsp;Lentes de sol&nbsp;&nbsp;&nbsp;&nbsp;";
echo "</td><td align=\"center\" valign=\"top\">";
echo "<form action=\"dummy\" method=\"post\"><select name=\"choice\" size=\"1\">";
$sql = sql_query("select cid,cat,pid from CCart_categories Where pid='33' ORDER BY cat", $dbi);
while(list($sid, $scat) = sql_fetch_row($sql, $dbi)) {
if ($sid == $cat) {
$sel = "selected ";
}
echo "<option $sel value=\"modules.php?op=modload&name=CCart&id=$sid\">$scat</option>";
$sel = "";
}
echo "<OPTION value=>------------------------------</OPTION>";
echo "</td><td align=\"left\" valign=\"top\" /select>
<input TYPE=\"button\" VALUE=\"Ver\" onClick=\"jump(this.form)\"></form>";


//FIN LENTES DE SOL
echo "</td></tr><tr>";
//ARMAZONES

echo "<td align=\"left\" valign=\"top\"><img src=\"modules/CCart/images/check2.gif\" border=\"0\">";
echo "<font class=\"option2\"><align=\"center\" valign=\"top\">&nbsp;Armazones&nbsp;&nbsp;&nbsp;&nbsp;";
echo "</td><td align=\"center\" valign=\"top\">";
echo "<form action=\"dummy\" method=\"post\"><select name=\"choice\" size=\"1\">";
$sql = sql_query("select cid,cat,pid from CCart_categories Where pid='27' ORDER BY cat", $dbi);
while(list($sid, $scat) = sql_fetch_row($sql, $dbi)) {
if ($sid == $cat) {
$sel = "selected ";
}
echo "<option $sel value=\"modules.php?op=modload&name=CCart&id=$sid\">$scat</option>";
$sel = "";
}
echo "<OPTION value=>------------------------------</OPTION>";
echo "</td><td align=\"left\" valign=\"top\" /select>
<input TYPE=\"button\" VALUE=\"Ver\" onClick=\"jump(this.form)\"></form>";

//FIN ARMAZONES
echo "</td></tr><tr>";

//LENTES DE CONTACTO
echo "<td align=\"left\" valign=\"top\"><img src=\"modules/CCart/images/check2.gif\" border=\"0\">";
echo "<font class=\"option2\"><align=\"center\" valign=\"top\">&nbsp;Lentes de contacto&nbsp;&nbsp;&nbsp;&nbsp;";
echo "</td><td align=\"center\" valign=\"top\">";
echo "<form action=\"dummy\" method=\"post\"><select name=\"choice\" size=\"1\">";
$sql = sql_query("select cid,cat,pid from CCart_categories Where pid='56' ORDER BY cat", $dbi);
while(list($sid, $scat) = sql_fetch_row($sql, $dbi)) {
if ($sid == $cat) {
$sel = "selected ";
}
echo "<option $sel value=\"modules.php?op=modload&name=CCart&id=$sid\">$scat</option>";
$sel = "";
}
echo "<OPTION value=>------------------------------</OPTION>";
echo "</td><td align=\"left\" valign=\"top\" /select>
<input TYPE=\"button\" VALUE=\"Ver\" onClick=\"jump(this.form)\"></form>";

//FIN LENTES DE CONTACTO
echo "</td></tr><tr>";
//AUDIFONOS
echo "<td align=\"left\" valign=\"top\"><img src=\"modules/CCart/images/check2.gif\" border=\"0\">";
echo "<font class=\"option2\"><align=\"center\" valign=\"top\">&nbsp;Audífonos&nbsp;&nbsp;&nbsp;&nbsp;";
echo "</td><td align=\"center\" valign=\"top\">";
echo "<form action=\"dummy\" method=\"post\"><select name=\"choice\" size=\"1\">";
$sql = sql_query("select cid,cat,pid from CCart_categories Where pid='51' ORDER BY cat", $dbi);
while(list($sid, $scat) = sql_fetch_row($sql, $dbi)) {
if ($sid == $cat) {
$sel = "selected ";
}
echo "<option $sel value=\"modules.php?op=modload&name=CCart&id=$sid\">$scat</option>";
$sel = "";
}
echo "<OPTION value=>------------------------------</OPTION>";
echo "</td><td align=\"left\" valign=\"top\" /select>
<input TYPE=\"button\" VALUE=\"Ver\" onClick=\"jump(this.form)\"></form>";

//FIN AUDIFONOS

echo "</td></tr><tr>";

//LENTES DE SEGURIDAD

echo "<td align=\"left\" valign=\"top\"><img src=\"modules/CCart/images/check2.gif\" border=\"0\">";
echo "<font class=\"option2\"><align=\"center\" valign=\"top\">&nbsp;Lentes de seguridad&nbsp;&nbsp;&nbsp;&nbsp;";
echo "</td><td align=\"center\" valign=\"top\">";
echo "<form action=\"dummy\" method=\"post\"><select name=\"choice\" size=\"1\">";
$sql = sql_query("select cid,cat,pid from CCart_categories Where pid='29' ORDER BY cat", $dbi);
while(list($sid, $scat) = sql_fetch_row($sql, $dbi)) {
if ($sid == $cat) {
$sel = "selected ";
}
echo "<option $sel value=\"modules.php?op=modload&name=CCart&id=$sid\">$scat</option>";
$sel = "";
}
echo "<OPTION value=>------------------------------</OPTION>";
echo "</td><td align=\"left\" valign=\"top\" /select>
<input TYPE=\"button\" VALUE=\"Ver\" onClick=\"jump(this.form)\"></form>";
//FIN LENTES DE SEGURIDAD

echo "</td></tr></tr></table>";
echo "</center>";
echo "<br>";
/////////List Products
}else{
/////////
//Sub Cat-ID
$sql2 = mysql_query("SELECT cat, pid FROM CCart_categories WHERE cid=$id" );
list($subcat) = mysql_fetch_array($sql2);
if (!$sql2){
echo("$sql2");
echo("<P>Error Getting Category Name: " .
mysql_error() . "</P>");
}
//Main Cat
$sql6 = mysql_query("SELECT maincat FROM CCart_categories WHERE cid='$id'" );
list($maincat) = mysql_fetch_array($sql6);
if (!$sql6){
echo("$sql6");
echo("<P>Error Getting Category Name: " .
mysql_error() . "</P>");
}
//Main Cat-ID
$sql7 = mysql_query("SELECT pid,cid FROM CCart_categories WHERE cid ='$id' ");
list($maincid) = mysql_fetch_array($sql7);
if (!$sql7){
echo("$sql7");
echo("<P>Error: " .
mysql_error() . "</P>");
}

//Display Search Function:
echo "<center>";
?>
<form name="form" action="ccsearch.php" method="get">
<input type="text" name="results" />
<input type="submit" name="Submit" value="Buscar marca" />
</form>
<?
echo "</center>";

$result = mysql_query("SELECT * FROM CCart_products WHERE catid='$id' ORDER by name  ");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}
//Include Product Next and Back Buttons at top of page
If (!$id) {
echo "";
}else{
If ($id==$id) {
search_display($offset,$numresults,$id);
}
}
///////////////////////////////////////////////ACA SE BUSCAN LOS PRODUCTOS EN LA TABLA DE PRODUCTOS////////////////////////////////////
$result = mysql_query(
"SELECT * FROM CCart_products WHERE catid='$id'  LIMIT $offset,$searchrows");
if (!$result) {
echo("<P>Error getting product names: " .
mysql_error() . "</P>");
exit();
}
echo "<center><a href=\"modules.php?op=modload&name=CCart\">Ir al menú principal</a><center>";
//Request Product Data:
while ( $row = mysql_fetch_array($result) ) {
$sid=$row["pid"];
$sname=$row["name"];
$sdes=$row["des"];
$pidnum=$row["pnum"];
$scatid=$row["catid"];
$catname=$row["catname"];
$simageloc=$row["imageloc"];
$simgw=$row["imgw"];
$simgh=$row["imgh"];
$sialt=$row["ialt"];
$sptype=$row["ptype"];
$sa1=$row["a1"];
$sper=$row["per"];
$sp1=$row["p1"];
$sp3=$row["p3"];
$sextra=$row["extra"];
$tnail=$row["tnail"];


//ACA ESTA LA MODIFICACION MAESTRA DE LA TABLA DE PRODUCTOS***************************************************************************************	

//Tabla separador
echo "<table align=\"center\" border=\"0\" width=\"80%\" cellspacing=\"0\" cellpading=\"0\">";
echo "<TR>";
echo "<td><align=\"left\"><IMG SRC=\"themes/Freeezze/images/lineazul.gif\" WIDTH=\"460\" HEIGHT=\"2\" BORDER=0 ALT=\"\"></td>";	
echo "</TR>";
echo "</table>";

// Tabla General
echo "<table align=\"center\" border=\"0\" width=\"80%\" cellspacing=\"0\" cellpading=\"0\">";
// SI SOY ADMIN ENTONCES ME APARECEN LOS BOTONES PARA EDITAR Y BORRAR
echo "<TR>";
if (is_admin($admin)) {
echo "<td><center><a href=\"admin.php?op=editprod&id=$sid\">Editar</a> | <a href=\"admin.php?op=editprod&id=$sid&delete=true\">Borrar</a></center></td>";
} else {
echo "";
}
echo "</TR>";

//IMAGEN de producto
echo "<td>";
If( ($images == off) || ($simageloc=="") ) {
echo ("<td><align=\"right\" valign=\"center\">");
}else{
If( ($images == on) || ($simageloc=="$simageloc") ) {
echo "<td ROWSPAN='5' align=\"right\" valign=\"center\"><a href='$simageloc' width='$simgw' height='$simgh' alt='$sialt' Target=\"_Blank\"><img src='$simageloc' width='$simgw' height='$simgh' alt='$sialt'></a></td>";
}
}
if ((!mani)||(!$mann)){
echo "";
}else{
echo "<img src=\"$mani\" alt=\"$mann\" border=\"0\">";
}
echo "</td>";

//Nombre y su icono
echo "<TR>";
echo "<td><img src=\"modules/CCart/images/check2.gif\" border=\"0\">";
echo "<font class=\"option2\"><align=\"left\">&nbsp;Marca&nbsp;<font class=\"option4\"><align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp;$sname<br>";
echo "</td></TR>";

//Codigo y su icono

echo "<TR>";
echo "<td><img src=\"modules/CCart/images/check2.gif\" border=\"0\">";
echo "<font class=\"option2\"><align=\"left\">&nbsp;Código&nbsp;<font class=\"option4\"><align=\"left\">&nbsp;&nbsp;$pidnum<br>";
echo "</td></TR>";

//Precio y su icono
echo "<TR>";
echo "<td><img src=\"modules/CCart/images/check.gif\" border=\"0\">";
echo "<font class=\"option2\"><align=\"left\">&nbsp;Precio&nbsp;&nbsp;&nbsp;<font class=\"option4\"><align=\"left\">&nbsp;&nbsp;$cschar$sa1<br>";
echo "</td></TR>";

//Descripción y su icono

echo "<TR>";
echo "<td><img src=\"modules/CCart/images/magniglass.gif\" border=\"0\">";
echo "<font class=\"tiny\"><align=\"left\">&nbsp;$sdes";
echo "</td></TR>";


//Fin de la tabla
echo "</table>";

//Tabla separador


///////
}
//////
/////
////
//Include Product Next and Back Buttons at Button of Page
search_display($offset,$numresults,$id);
echo "<br>";
//Include Product Showcase
echo "<br>";
//INCLUYE EL FOOTER
}
include ("footer.php");
?>
the page is http://www.opticasqueirolo.cl/modules.php?name=CCart
thanks in advance

Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting. Review   [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
danf_1979
Forum Commoner
Posts: 72
Joined: Sun Feb 20, 2005 9:46 pm

Post by danf_1979 »

The search function is OK...
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

use

Code: Select all

tags...makes it much easier to read.

it looks like you're missing the "jump()" function in your js.
Post Reply