![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Mar 2006
Posts: 1
Rep Power: 0
![]() |
CGI Script - change product display
Hi,
My webstore has a mod that allows affiliates to design their own pages to display on my site. If you go here you will see an example. I had an idea that it would be great to make these pages printer friendly so that the affiliates could print them out to give to their customers. I did figure most of the details in making that work, but I need to have their product choices (up to 12) show up all on one page. I think I could do that if the products were in two columns instead of one, but I can't seem to modify the code for this page to get it to work (I am REALLY not a programmer). I feel like this is probably simple and I was hoping that someone would be kind enough to point me in the right direction. Here is the current code for the page, I'm not sure which portions are significant so I'm sorry I can't trim out more: #
# usage: (CGIGET TYPE="SUB" VALUE="ste_expertPageProducts")
#
sub ste_expertPageProducts {
## WHERE affacct_id ='$fd_affiliate'
($table_width, $border_color, $border_width) = @_;
$sql_statement = "
SELECT *
FROM affacct
WHERE affacct_id LIKE '$common_expert_id'
";
my @disp1 = database_call('affacct','SELECT',$sql_statement);
@products;
## get selected products for affiliate from database
foreach $value (@disp1) {
for ($i = 32; $i < 44; $i++)
{
push(@products, @$value[$i]);
} ## End for.
} ## End foreach.
foreach $line(@products)
{
if(length($line) > 3)
{
# split database var into category & product description
($c_id, $p_id, $p_xcat, $p_name) = split(/\^/, $line);
# build product link suffix
$prod_link = $common_url . '&pg=prod&ref=' . $p_id . '&cat=' . $c_id . '&catstr=HOME:' . $c_id;
# lets display the product
display_product($p_id, $dbh, $prod_link);
} ## End if.
} ## End foreach.
} ## End ste_expertPageProducts.
sub display_product {
($prod_id, $dbh, $prodlink) = @_;
$sql_statement = "
SELECT product_name, product_pricestatus, product_regprice, product_saleprice, product_imgsm, product_descshort
FROM product
WHERE product_id = '$prod_id'
";
my @disp1 = database_call('product','SELECT',$sql_statement);
foreach $value (@disp1) {
($name, $status, $price, $saleprice, $imgurl, $desc) = @$value;
} ## End foreach.
$image_path = 'http://www.petexpertise.com/product_images/' . $imgurl . '.jpg';
$desc_col_width = $table_width - $store_small_image_width;
print "<div style='border: " . $border_width . "px " . $border_color . " solid; width:" . $table_width . "px'>";
print "<table width='" . $table_width . "' cellpadding='8' bgcolor='#fff7ef'>\n<tr>\n";
print "<td width='" . $desc_col_width . "' valign='top'>";
print <<HTML;
<a href='$prodlink'>
<font size='$html_base_font_size' face='$html_base_font_face'><b>
$name
</b></font>
</a><p />
<font size='$html_small_font_size' face='$html_small_font_face' color='$html_small_font_color'>
$desc
</font> <br />
<font size='$html_small_font_size' face='$html_base_font_face'>
HTML
if($price eq '0' || $price eq '0.00')
{
} else {
print 'Price: $' . $price;
}
if($status eq 'S')
{
print '<br /><b>On Sale: $' . $saleprice . '</b>';
}
print <<HTML;
</font>
</td>
<td width='*'>
<a href='$prodlink'>
<!--
<img border='0' src='$image_path' width='$store_small_image_width' height='$store_small_image_width' align='center' alt='No image'>
-->
<img border='0' src='$image_path' align='center' alt='No image'>
</a>
</td>
</tr>
</table>
</div>
<br />
HTML
} ## End display product.
1;Thanks in advance for any advice you can offer me. Jess |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
I would suggest building a .pdf document from a 'print' button.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Professional Programmer
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 317
Rep Power: 4
![]() |
SELECT * FROM affacct WHERE affacct_id LIKE '$common_expert_id' Holy hell, if I wrote a SQL query like this I'd get my ass kicked and be on coffee duty for a week. (Maybe there's a good reason, but that was my gut reaction.)
__________________
"I'm not a genius. Why do I have to suffer?" |
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Prolly did get his ass kicked. Ain' seen hide nor hair of 'im in 4 months....
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|