Hi all,
I have some code i use for overall best sellers i now want to break it down per section and i have written the SQL to do this but the Perl code isnt working how i want it to. I want the items to be on one row but instead its printing 5 rows. Can anyone help?
Here is my code:-
#######################################################################
# ste_prod_dispbestww #
#######################################################################
sub ste_prod_dispbestww {
&initialize_sub_add('sub ste_prod_dispbestww');
$sql_statement = "
SELECT TOP 5 *
from
VIEWBestSellerHold
WHERE product_GMC_Cat = 'WW'
Order by countitems desc
";
my @newdisp = database_call('product','SELECT',$sql_statement);
foreach $row(@newdisp) {
($product_id,$product_name) = @$row;
$seo_item_url = ste_seo_make_url('item', $product_name, $product_id);
print <<ENDOFTEXT;
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="pickhwood" colspan="6"> Woodworking Best Sellers</td>
</tr>
<tr>
<td class="pickwoodmagl"><a href="$seo_item_url"><img src="/test_ccp51/media/images/product_category/$product_id.jpg" width="105" border="0" alt="Woodworking"></a><br>
<a href="$seo_item_url" class="mainmenu"><b>$product_name</b></a></td>
<td class="pickwoodmag"><a href="$seo_item_url"><img src="/test_ccp51/media/images/product_category/$product_id.jpg" width="105" border="0" alt="Woodworking"></a>
<a href="$seo_item_url" class="mainmenu"><b>$product_name</b><br><br></a></td>
<td colspan="2" class="pickwoodmag"><a href="$seo_item_url"><img src="/test_ccp51/media/images/product_category/$product_id.jpg" width="105" border="0" alt="Woodworking"></a>
<a href="$seo_item_url" class="mainmenu"><b>$product_name</b><br><br></a></td>
<td class="pickwoodmag"><a href="$seo_item_url"><img src="/test_ccp51/media/images/product_category/$product_id.jpg" width="105" border="0" alt="Woodworking"></a>
<a href="$seo_item_url" class="mainmenu"><b>$product_name</b><br><br></a></td>
<td class="pickwoodmagr"><a href="$seo_item_url"><img src="/test_ccp51/media/images/product_category/$product_id.jpg" width="105" border="0" alt="Woodworking"></a>
<a href="$seo_item_url" class="mainmenu"><b>$product_name</b><br><br></a></td>
</tr>
</table>
ENDOFTEXT
} ######### End of foreach statement.
&initialize_sub_remove('sub ste_prod_dispbestww');
} ######### End of subroutine.
I have some code i use for overall best sellers i now want to break it down per section and i have written the SQL to do this but the Perl code isnt working how i want it to. I want the items to be on one row but instead its printing 5 rows. Can anyone help?
Here is my code:-
#######################################################################
# ste_prod_dispbestww #
#######################################################################
sub ste_prod_dispbestww {
&initialize_sub_add('sub ste_prod_dispbestww');
$sql_statement = "
SELECT TOP 5 *
from
VIEWBestSellerHold
WHERE product_GMC_Cat = 'WW'
Order by countitems desc
";
my @newdisp = database_call('product','SELECT',$sql_statement);
foreach $row(@newdisp) {
($product_id,$product_name) = @$row;
$seo_item_url = ste_seo_make_url('item', $product_name, $product_id);
print <<ENDOFTEXT;
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="pickhwood" colspan="6"> Woodworking Best Sellers</td>
</tr>
<tr>
<td class="pickwoodmagl"><a href="$seo_item_url"><img src="/test_ccp51/media/images/product_category/$product_id.jpg" width="105" border="0" alt="Woodworking"></a><br>
<a href="$seo_item_url" class="mainmenu"><b>$product_name</b></a></td>
<td class="pickwoodmag"><a href="$seo_item_url"><img src="/test_ccp51/media/images/product_category/$product_id.jpg" width="105" border="0" alt="Woodworking"></a>
<a href="$seo_item_url" class="mainmenu"><b>$product_name</b><br><br></a></td>
<td colspan="2" class="pickwoodmag"><a href="$seo_item_url"><img src="/test_ccp51/media/images/product_category/$product_id.jpg" width="105" border="0" alt="Woodworking"></a>
<a href="$seo_item_url" class="mainmenu"><b>$product_name</b><br><br></a></td>
<td class="pickwoodmag"><a href="$seo_item_url"><img src="/test_ccp51/media/images/product_category/$product_id.jpg" width="105" border="0" alt="Woodworking"></a>
<a href="$seo_item_url" class="mainmenu"><b>$product_name</b><br><br></a></td>
<td class="pickwoodmagr"><a href="$seo_item_url"><img src="/test_ccp51/media/images/product_category/$product_id.jpg" width="105" border="0" alt="Woodworking"></a>
<a href="$seo_item_url" class="mainmenu"><b>$product_name</b><br><br></a></td>
</tr>
</table>
ENDOFTEXT
} ######### End of foreach statement.
&initialize_sub_remove('sub ste_prod_dispbestww');
} ######### End of subroutine.