The Official Website of AgoraCart and Agora.cgi
AgoraCart.com Demos Download AgoraCart User Manuals & Wiki Gold Members Forum Go Gold Now! Gold Version Memberships

AgoraCart.com

About
Features
Download
Payment Gateways
Send a Donation
Founders Club
BLOG: News & Updates

Showcases & Demos

AgoraCart Demos
Shop Live Stores

Downloads & Add-ons

Gold Version Downloads
DBwizz Database Mgr.
AgoraCart.com Store

Help & Support

User Manuals
Gold Version Users Forum
Gold Version Chat
Tech Support
Certified Agora Pros
Certified Designers
Hire a Freelancer

Gold Version Members

Member Benefits
Join Today!
Gold Members Home
Gold Version Users Forum
Gold Version Chat Rooms
Gold Version Downloads

For Store Owners

Merchant Accounts
Cool Resources
Advertise Here
"Powered by" Logos
Web Hosting Search

Misc.

Contact Us
MEET's Talking Guide
The Ancient Greek Agora






AgoraCart Free User Forums

This is the official FAQ and Cool Tips guide For the AgoraCart shopping Cart software


Official Sponsors of the AgoraCart Project:

       


RegisterSearchFAQLog in
Reply to topic Page 1 of 1
Problem with productpage.inc and custom table
Author Message
Reply with quote
Post Problem with productpage.inc and custom table 
I have a problem with my productpage.inc file. I created my own table but when you click add to cart it add's every product on that page to the cart.


Here is the productpage.inc file:

Thanks,

Code:

<!--agorascript-pre
{ #Start of controller code, probably should leave this alone ;-)
local ($myans)="";
if ($rowCount == (1+$minCount)) { #first one
  $ags_row_item=0;
  $ags_tot_item=0;
  $myans .= '<tr><td colspan=3><table width="100%" border=1>'."\n";
 }
$ags_row_item++;
$ags_tot_item++;
if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
 { # very last one, need to join these two cells, no border
  if ($ags_row_item == 1) { # first and only one
    $myans .= '<td width="100%" colspan=2><table width=100% border=0>'."\n";
    $myans .= '<tr>'."\n";
   }
 }
if ($ags_row_item == 2) { # second one
  $ags_row_item=0; #reset counter
  $myans .= '<td width="50%"><table width=100% border=0>'."\n";
 } else { #first one
  $myans .= '<tr><td width="50%"><table width=100% border=0>'."\n";
 }
return $myans;
} # end of controller code
-->

<FORM METHOD = "post" ACTION = "%%scriptURL%%">
%%make_hidden_fields%%
            

            <table border="0" bgcolor="#000000" cellpadding="3" cellspacing="1">
               
               <tr>
                  <td align="center" bgcolor="white"><i>Image</i></td>
                  <td align="center" bgcolor="white"><i>Qty</i></td>
                                    <td align="center" bgcolor="white"><i>Add to Cart</i></td>
                                    <td align="center" bgcolor="white"><i>Make</i></td>
                  <td align="center" bgcolor="white"><i>Model</i></td>
                  <td align="center" bgcolor="white"><i>Years</i></td>
                  <td align="center" bgcolor="white"><i>Description</i></td>
                                    <td align="center" bgcolor="white"><i>OEM #</i></td>
                                    <td align="center" bgcolor="white"><i>Price</i></td>
                  </tr>               
               
         <script>
         <!-- // hide
         function open_window(url,w,h) {
               var status_string = "resizable=yes,location=no,status=no,toolbar=no,scrollbars=yes,left=10,top=10,width="+w+",height="+h;
               open(url, "_blank", status_string);
         }
         // -->
         </script>
      
               
               
               <tr>
                  <td bgcolor="white">%%image%%</td>
                  <td bgcolor="white">%%QtyBox%%</td>
                  <td bgcolor="white"><INPUT TYPE="IMAGE"
 NAME="add_to_cart_button" VALUE="Add To Cart"
 SRC="%%URLofImages%%/add_to_cart.gif" BORDER="0">
</td>
<!--agorascript-pre
{ # more controller code
local ($myans)="";
if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
 { # very last one
  if ($ags_row_item == 1) { # first and only one
    $myans .= '</table></td>'."\n";
    $myans .= '<td width="50%"><table width=100%>'."\n";
   }
 }
return $myans;
} # end controller code
-->

                                    <td bgcolor="white">%%name%%</td>
                  <td bgcolor="white">%%user2%%</td>
                  <td bgcolor="white">%%description%%</td>
                                    <td bgcolor="white">%%user1%%</td>
                  <td bgcolor="white">%%user3%%</td>
                  <td bgcolor="white">%%price%%</td>
                  
               </tr>

<A HREF="%%scripturl%%?dc=1&%%href_fields%%">
<FONT FACE=ARIAL>Check Out</FONT></A>


<A HREF='%%StepOneURL%%?order_form_button.x=1&%%href_fields%%'><FONT
FACE=ARIAL>Check Out2</FONT>

<!--agorascript-pre
{ # more controller code
local ($myans)="";
if ($ags_row_item == 1) { # first one
  $myans .= '</table></td>'."\n";
 } else { # second one
  $myans .= '</table></td></tr>'."\n";
 }
if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
 { # very last one, need to join these two cells, no border
  if ($ags_row_item == 1) { # first and only one
    $myans .= '</tr></table></td>'."\n";
   }
 }
if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
 { # very last one
#  if ($ags_row_item == 1) { # finished first one, add a blank dummy
#second
#    $myans .= '<td>&nbsp;</td></tr>'."\n";
#   }
  $myans .= '</table></td></tr>'."\n";
 }
return $myans;
} # end controller code
-->


View user's profile Send private message
Reply with quote
Post  
hell-o

Code:


<!--agorascript-pre
{ #Start of controller code, probably should leave this alone ;-)
local ($myans)="";
if ($rowCount == (1+$minCount)) { #first one
  $ags_row_item=0;
  $ags_tot_item=0;
  $myans .= '<tr><td colspan=3><table width="100%" border=1>'."\n";
 }
$ags_row_item++;
$ags_tot_item++;
if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
 { # very last one, need to join these two cells, no border
  if ($ags_row_item == 1) { # first and only one
    $myans .= '<td width="100%" colspan=2><table width=100% border=0>'."\n";
    $myans .= '<tr>'."\n";
   }
 }
if ($ags_row_item == 2) { # second one
  $ags_row_item=0; #reset counter
  $myans .= '<td width="50%"><table width=100% border=0>'."\n";
 } else { #first one
  $myans .= '<tr><td width="50%"><table width=100% border=0>'."\n";
 }
return $myans;
} # end of controller code
-->

<FORM METHOD = "post" ACTION = "%%scriptURL%%">
%%make_hidden_fields%%
           

            <table border="0" bgcolor="#000000" cellpadding="3" cellspacing="1">
               
               <tr>
                  <td align="center" bgcolor="white"><i>Image</i></td>
                  <td align="center" bgcolor="white"><i>Qty</i></td>
                                    <td align="center" bgcolor="white"><i>Add to Cart</i></td>
                                    <td align="center" bgcolor="white"><i>Make</i></td>
                  <td align="center" bgcolor="white"><i>Model</i></td>
                  <td align="center" bgcolor="white"><i>Years</i></td>
                  <td align="center" bgcolor="white"><i>Description</i></td>
                                    <td align="center" bgcolor="white"><i>OEM #</i></td>
                                    <td align="center" bgcolor="white"><i>Price</i></td>
                  </tr>               
               
         <script>
         <!-- // hide
         function open_window(url,w,h) {
               var status_string = "resizable=yes,location=no,status=no,toolbar=no,scrollbars=yes,left=10,top=10,width="+w+",height="+h;
               open(url, "_blank", status_string);
         }
         // -->
         </script>
     
               
               
               <tr>
                  <td bgcolor="white">%%image%%</td>
                  <td bgcolor="white">%%QtyBox%%</td>
                  <td bgcolor="white"><INPUT TYPE="IMAGE"
 NAME="add_to_cart_button" VALUE="Add To Cart"
 SRC="%%URLofImages%%/add_to_cart.gif" BORDER="0">
</td>
<!--agorascript-pre
{ # more controller code
local ($myans)="";
if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
 { # very last one
  if ($ags_row_item == 1) { # first and only one
    $myans .= '</table></td>'."\n";
    $myans .= '<td width="50%"><table width=100%>'."\n";
   }
 }
return $myans;
} # end controller code
-->

                                    <td bgcolor="white">%%name%%</td>
                  <td bgcolor="white">%%user2%%</td>
                  <td bgcolor="white">%%description%%</td>
                                    <td bgcolor="white">%%user1%%</td>
                  <td bgcolor="white">%%user3%%</td>
                  <td bgcolor="white">%%price%%</td>
                 
               </tr></FORM>

<A HREF="%%scripturl%%?dc=1&%%href_fields%%">
<FONT FACE=ARIAL>Check Out</FONT></A>


<A HREF='%%StepOneURL%%?order_form_button.x=1&%%href_fields%%'><FONT
FACE=ARIAL>Check Out2</FONT>

<!--agorascript-pre
{ # more controller code
local ($myans)="";
if ($ags_row_item == 1) { # first one
  $myans .= '</table></td>'."\n";
 } else { # second one
  $myans .= '</table></td></tr>'."\n";
 }
if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
 { # very last one, need to join these two cells, no border
  if ($ags_row_item == 1) { # first and only one
    $myans .= '</tr></table></td>'."\n";
   }
 }
if (($rowCount == ($maxCount)) || ($rowCount == ($num_returned)))
 { # very last one
#  if ($ags_row_item == 1) { # finished first one, add a blank dummy
#second
#    $myans .= '<td>&nbsp;</td></tr>'."\n";
#   }
  $myans .= '</table></td></tr>'."\n";
 }
return $myans;
} # end controller code
-->


notice i inserted the </FORM> tag. i didn't see one. also i did notice you have an </tr> tag then content following apparently outside of a cell...


Quote:

<td bgcolor="white">%%price%%</td>

</tr></FORM>

<A HREF="%%scripturl%%?dc=1&%%href_fields%%">
<FONT FACE=ARIAL>Check Out</FONT></A>


<A HREF='%%StepOneURL%%?order_form_button.x=1&%%href_fields%%'><FONT
FACE=ARIAL>Check Out2</FONT>

<!--agorascript-pre


not sure if this is a legal thingie but if it isn't there will be some unexpected displays or function with your code.

regards,
dan

Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum