Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Products appearing in a single column


dremhmrk2

Recommended Posts

Posted

I was poking about in stylesheet.css and modules/new_products.php in order to adjust the coloring and spacing of some fonts and the photos.

 

I succsefully made my spacing and font changes but somehow made a big error.

 

When I load up any category page, aside from the home page, the products appear in a single column instead of in a grid layout.

 

What have I done?

 

Here's the stylesheet info:

/*
 $Id: stylesheet.css 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

.boxText { font-family: Verdana, Arial, sans-serif; font-size: 12px;}
.errorBox { font-family : Verdana, Arial, sans-serif; font-size : 10px; background: #ffb3b5; font-weight: bold; }
.stockWarning { font-family : Verdana, Arial, sans-serif; font-size : 10px; color: #990000; }
.productsNotifications { background: #f2fff7; }
.orderEdit { font-family : Myriad Web Pro; font-size : 11px; color: #990000; text-decoration: underline; }

/*BODY {
 background: #ffcc00;
 color: #000000;
 margin: 0px;
}

A {
 color: #000000;
 text-decoration: none;
}

A:hover {
 color: #000000;
 text-decoration: underline;
}*/

FORM {
display: inline;
}

TR.header {
 background: #ffffff;
}

TR.headerNavigation {
 background: #ffcc00;
 height:25px;
}

TD.headerNavigation {
 font-family: Verdana, Arial, sans-serif;
 font-size: 15px;
 background: #ffcc00;
 color: #ffffff;
 font-weight : bold;
}

A.headerNavigation { 
 color: #000099; 
}

A.headerNavigation:hover {
 color: #ffffff;
}

TR.headerError {
 background: #ff0000;
}

TD.headerError {
 font-family: Tahoma, Verdana, Arial, sans-serif;
 font-size: 12px;
 background: #ff0000;
 color: #ffffff;
 font-weight : bold;
 text-align : center;
}

TR.headerInfo {
 background: #00ff00;
}

TD.headerInfo {
 font-family: Tahoma, Verdana, Arial, sans-serif;
 font-size: 12px;
 background: #00ff00;
 color: #ffffff;
 font-weight: bold;
 text-align: center;
}

TR.footer {
 background: #bbc3d3;
}

TD.footer {
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
 background: #bbc3d3;
 color: #034E8A;
 font-weight: bold;
}

.infoBox {
 background: #223861;
}

.infoBoxWhite {
 background: #ffffff;
}

.infoBoxContents {
 /*background: #f8f8f9;*/
 background: #ffffff;
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
}

.infoBoxContentsWhite {
 background: #ffffff;
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
}

.infoBoxNotice {
 background: #FF8E90;
}

.infoBoxNoticeContents {
 background: #FFE6E6;
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
}

TD.infoBoxHeading {
 font-family: Arial;
 font-size: 12px;
 font-weight: bold;
 background: #223861;
 color: #000000;
}

TD.infoBox, SPAN.infoBox {
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
}

TR.accountHistory-odd, TR.addressBook-odd, TR.alsoPurchased-odd, TR.payment-odd, TR.productListing-odd, TR.productReviews-odd, TR.upcomingProducts-odd, TR.shippingOptions-odd {
 background: #f8f8f9;
}

TR.accountHistory-even, TR.addressBook-even, TR.alsoPurchased-even, TR.payment-even, TR.productListing-even, TR.productReviews-even, TR.upcomingProducts-even, TR.shippingOptions-even {
 background: #f8f8f9;
}

TABLE.productListing {
 border: 1px;
 border-style: solid;
 border-color: #b6b7cb;
 border-spacing: 1px;
}

.productListing-heading {
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
 background: #223861;
 color: #FFCC33;
 font-weight: bold;
}

TD.productListing-data {
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
}

A.pageResults {
 color: #223861;
}

A.pageResults:hover {
 color: #FFCC33;
 background: #223861;
}

TD.pageHeading, DIV.pageHeading {
 font-family: Arial, Helvetica, Microsoft Sans Serif; /*Myriad Web Pro;*/
 font-size: 17px;
 font-weight: bold;
 color: #000000;
}

TR.subBar {
 background: #f4f7fd;
}

TD.subBar {
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
 color: #000000;
}

TD.main, P.main {
 font-family: Arial, Helvetica, Microsoft Sans Serif; /*Myriad Web Pro;*/
 font-size: 12px;
 /*line-height: 1.5;*/
}


TD.smallText, SPAN.smallText, P.smallText {
 font-family: Arial;
 font-size: 12px;
 color: #000000;
}

TD.accountCategory {
 font-family: Verdana, Arial, sans-serif;
 font-size: 13px;
 color: #aabbdd;
}

TD.fieldKey {
 font-family: Verdana, Arial, sans-serif;
 font-size: 12px;
 font-weight: bold;
}

TD.fieldValue {
 font-family: Verdana, Arial, sans-serif;
 font-size: 12px;
}

TD.tableHeading {
 font-family: Verdana, Arial, sans-serif;
 font-size: 12px;
 font-weight: bold;
}

SPAN.newItemInCart {
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
 color: #ff0000;
}

CHECKBOX, INPUT, RADIO, SELECT {
 font-family: Verdana, Arial, sans-serif;
 font-size: 11px;
}

TEXTAREA {
 /*width: 100%;*/
 font-family: Verdana, Arial, sans-serif;
 font-size: 11px;
}

SPAN.greetUser {
 font-family: Myriad Web Pro;
 font-size: 13px;
 color: #000000;
 font-weight: bold;
}

TABLE.formArea {
 background: #f1f9fe;
 border-color: #7b9ebd;
 border-style: solid;
 border-width: 1px;
}

TD.formAreaTitle {
 font-family: Tahoma, Verdana, Arial, sans-serif;
 font-size: 12px;
 font-weight: bold;
}

SPAN.markProductOutOfStock {
 font-family: Tahoma, Verdana, Arial, sans-serif;
 font-size: 12px;
 color: #990000;
 font-weight: bold;
}

SPAN.productSpecialPrice {
 font-family: Verdana, Arial, sans-serif;
 color: #ff0000;
}

SPAN.errorText {
 font-family: Verdana, Arial, sans-serif;
 color: #ff0000;
}

.moduleRow { }
.moduleRowOver { background-color: #D7E9F7; cursor: pointer; cursor: hand; }
.moduleRowSelected { background-color: #E9F4FC; }

.checkoutBarFrom, .checkoutBarTo { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #8c8c8c; }
.checkoutBarCurrent { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #000000; }

/* message box */

.messageBox { font-family: Verdana, Arial, sans-serif; font-size: 10px; }
.messageStackError, .messageStackWarning { font-family: Verdana, Arial, sans-serif; font-size: 10px; background-color: #FFCC33; }
.messageStackSuccess { font-family: Verdana, Arial, sans-serif; font-size: 10px; background-color: #FFCC33; }

/* input requirement */

.inputRequirement { font-family: Arial; font-size: 11px; color: #990000; }


/* CSS added by SDEI 
** CSS Starts here 
*/
/* CSS Document */

body{
font-family:Arial, Helvetica, Microsoft Sans Serif;
/*font-size:13px;*/
color:#000000;
margin:0;
padding:0;
background:url(images/body_bg.jpg) repeat-x top;
}
ul, li, p, h1, h2, h3, h4, h5, select, input {
margin:0;
padding:0;
}
a{
color: #000000;
text-decoration:none;
outline:none;

}
a:hover{
color: #FFCC33;
text-decoration: underline;
}
ul, li{
list-style-type:none;
}
img{
border:none;		
}
/*h2{
font-family:Myriad Pro;
font-size:18px;
font-weight:bold;
color:#000000;	
padding:5px 0 5px 10px;
}*/
.right{
float:right;
}
.left{
float:left;
}
.clear{
clear:both;
}
.alignmiddle{
vertical-align:middle;
}
.cartbtn{
margin:10px 0 0 10px;
float:left;
}
#wrapper{
width:982px;
/*background:url(images/body_bg.jpg) repeat-x bottom;*/
margin:0 auto;
}
#maintable{
	width:982px;
	/*width:97%;*/
	/*margin:0 auto;*/
	margin-left:20px;
}
#header{
height:211px;
/*background:url(images/header_bg.gif) repeat-x top;*/
}
.datetime{
padding-left:200px; 
font-size:13px;	
}
#menubar{
list-style:none;
margin:30px 0 0 0;
//margin:25px 0 0 0;
padding:0;
color:#070205;
font-size:12px;
float:left;
}
@media screen and (-webkit-min-device-pixel-ratio:0) 
{
#menubar{
list-style:none;
margin:31px 0 0 0;
padding:0;
color:#070205;
font-size:12px;
float:left;
}
}
/*html > body #menubar{
list-style:none;
padding:0;
color:#070205;
font-size:12px;
float:left;
*margin:27px 0 0 0;
}*/
#menubar li{
float:left;
background:url(images/li_bg.gif) no-repeat;
text-align:center;
}

#menubar li a{
color:#0b0b0b;
padding:12px 0 0 0;
text-decoration:none;
display:block;
width:90px;
height:22px;
//height:35px;
font-weight:bold;
}
#menubar li a:hover, #menubar li a:active, #menubar li a.active{
background:url(images/li_hover.gif);
}


.categories{
font-size:12px;
font-weight:bold;
}
.categories li{
background:url(images/right_lnk_bg.gif) no-repeat;
text-align:left;

}
.categories li a{
color:#000000;
padding:6px 0 0 25px;
padding:6px 0 0 25px;
text-decoration:none;
display:block;
width:122px;
height:20px;
//height:26px;
}
.categories li a:hover, .categories li a:active, .categories li a.active{
background:url(images/right_lnk_hover.gif);
//width:147px;
//color:#000000;
//text-decoration:none;
}	
.subcategories{
/*border:1px solid #cecece;
background:#cfe6fc;
width:145px;
padding:0 0 5px 0;*/
padding:0;
}
.subcategories li{	
font-size:12px;
font-weight:normal;
background:none;
}
.subcategories li a{
/*background:url(images/sub_li_bg_2.gif) no-repeat center bottom;
text-decoration:none;
color:#1b3769;
height:13px;
padding:2px 0 5px 30px;
display:block;*/
background:url(images/sub_li_bg_11.gif) no-repeat center bottom;
text-decoration:none;
color:#000000;
height:15px;
padding:5px 0 5px 30px;
display:block;
width:118px;
//width:150px;
}
.subcategories li a:hover, .subcategories li a:active, .subcategories li a.active {
/*text-decoration:none;
background:none;
color:#000000;*/
text-decoration:none;
background:url(images/sub_li_bg_hover.gif) no-repeat center bottom;
color:#04183d;	
}
.inactive{
}

/* new css for 	sunglass page */
.subcategories_sunglass{
/*border:1px solid #cecece;
background:#cfe6fc;
width:145px;
padding:0 0 5px 0;*/
padding:0;
}
.subcategories_sunglass li{	
font-size:12px;
font-weight:normal;
background:none;
margin:0 5px;
//float:left;
}
.subcategories_sunglass li a{
background:url(images/sub_li_bg_11.gif) no-repeat center bottom;
text-decoration:none;
color:#000000;
display:block;
float:left;
text-align:center;
font-size:13px;
font-weight:bold;
height:15px;
margin:4px 10px;
//margin:5px 0;
padding:5px 0;
width:150px;

}
.subcategories_sunglass li a:hover, .subcategories_sunglass li a:active, .subcategories_sunglass li a.active {
text-decoration:none;
background:url(images/sub_li_bg_hover.gif) no-repeat center bottom;
color:#04183d;
}
.sunglass_txt{
font-size:12px;
font-weight:bold;
}
.sunglass_txt a{
text-decoration:underline;
}

.img_link{
margin-bottom:10px;
}
.truckimg{
background:#ffffff none repeat scroll 0 0;
border-color:#ffffff;
}
h6{
margin:0;
padding:10px 0;
font-size:16px;
font-weight:bold;
}
/* Sunglas page end here */
.pageHeadingnew{
font-size:12px;
}
.listings{
padding:0 0 0 20px;
text-align:center;
}
.listings2{
padding:0;	
}

.list{
color:#000000;
font-size:13px;
font-weight:bold;
width:200px;
border-top:0px solid #223861;
border-left:0px solid #223861;
border-right:0px solid #223861;
border-bottom:1px solid #223861;
float:center;
text-align:center;
height:220px;
}
.list2{
color:#666666;
font-size:10px;
font-weight:bold;
width:270px;

border-bottom:1px dashed #cecece;
float:left;
text-align:left;
}
.productimg{
/*width:94px;*/
color:#000000;
float:center;
text-align:center;
/*padding:5px 5px 5px 5px;*/
}
td.productimg{
/*width:94px;*/
float:center;
text-align:center;
color:#000000;
/*padding:5px 5px 5px 5px;*/
}
.productimgnew{	
text-align:left;	
}
.leftpad{
/*padding-left:30px;*/
text-align : center;
float:center;
}
.centerMe{
text-align : center;
float:center;
}
.btn_img{
padding:5px 0 0 5px;
}
.rightpad{
/*padding-right:40px;*/
font-size: 11px;
/*padding: 0px 10px;*/
padding:0 0 0 0;
}
.leftpad h2 {	
font-family:Arial;
font-size:12px;
font-weight:Bold;
color:#000000;	
padding:0 0 0 0;
float:center;
text-align:center;
}
.leftpad h2 a {
color:#000000;	
}

.toppad{
padding-top:30px;
}
.size35{
font-family:Myriad Web Pro;
font-size:18px;
color:#223861;
}	
.size12{
font-family:Myriad Web Pro;
font-size:14px;
color:#000000;
}	
.size22{
font-family:Arial Black;
font-size:20px;
color:#000000;
}		
.red{
font-size:17px;
color:#b13947;
}

.productinfo {
 border-top: 1px #cccccc;
 border-right: 1px #cccccc;
 border-style: solid;
 /*border-color: #cccccc;*/
 border-spacing: 1px;
}	

.productinfo td{
 border-left: 1px #cccccc;
 border-bottom: 1px #cccccc;
 border-style: solid;
 /*border-color: #cccccc;*/
 border-spacing: 1px;
}	

.prductinfotxt{
background: #f1f1f1;
}
.smallicon{
margin:0;
padding:0;
}	
.smallicon a{
margin:0 2px;
padding:0;
}	
#footer{
background:url(/images/footer_bg.jpg) repeat-x top;
height:116px;
padding:20px 0 0 0;
}

#footer p{
padding-bottom:42px;
font-size:14px;
}

#footer p a{
color:#223860;
margin:8px;
}
#footer h1{
font-size:12px;
}
.footertxt{
font-size:10px;
padding: 0 20px;
color:#333333;
}

.redsmall{
font-family:"Arial Black";
font-size:13px;
color:#b13947;
margin:5px 0;
}	
.smallproducts{
width:150px;
margin:20px 0 0 0;
float:left;
}

.smallproducts h2 a{
font-size:12px;
}
.forget {
z-index: 101;
}
.warehouse{
background:url(/images/werwhouse.jpg) no-repeat;
}
.toplogin {  
 height:35px;
}
.top_new {  
 height:20px;
}
/* CSS added by SDEI 
** CSS Ends here 
*/

 

Here's the new_products.php info:

<style>
a {
border: none;
border-top-style: none;
color:#000000;


}



</style>

<?php  
   $info_box_contents = array();  
   $i = 0;
   $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));  

   //new contentBoxHeading($info_box_contents);  

  /*if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {  
     $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);  
   } else {  */
    $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by rand() limit " . MAX_DISPLAY_NEW_PRODUCTS);  
  // }  

   $row = 0;  
   $col = 0;  
  $info_box_contents = array();  
   while ($new_products = tep_db_fetch_array($new_products_query)) {  
     $new_products['products_name'] = tep_get_products_name($new_products['products_id']);  
     $info_box_contents[$row][$col] = array('align' => 'center',  
                                            'params' => 'class="" width="" valign="top"',
                                            'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a>',
									   'text1' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>',
									   'text2' => $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])),
									   'text3' => $new_products['products_id']);

    $col ++;  
     if ($col > 2) {  
       $col = 0;  
       $row ++;  
     }  
  }  
?>
<table  class="" border="0" cellspacing="0" cellpadding="0">
<tr>
<?php
foreach($info_box_contents as $contents)
{
//print_r($contents);
foreach($contents as $newCont) :
/*print_r($contents[0]['text']); 
print_r($contents[1]['text']); 
print_r($contents[2]['text']);
print_r($contents[3]['text']); die;*/

// START: Extra Fields Contribution v2.0b - mintpeel display fix
	  $extra_field_value = "";
                     $extra_fields_query = tep_db_query("
                     SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value
                     FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef
            LEFT JOIN  ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf
           ON ptf.products_extra_fields_id=pef.products_extra_fields_id
           WHERE ptf.products_id=". (int)$newCont['text3']." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".(int)$languages_id."')
           ORDER BY products_extra_fields_order");
$extra_fields = tep_db_fetch_array($extra_fields_query);

 $extra_field_name = $extra_fields['name'];
 if($extra_fields['value'] != "")
 $extra_field_value = stripslashes($extra_fields['value']);
?><td>
<!-- products table starts here --><table  class="list" border="0" cellspacing="0" cellpadding="0">
	<tr>
	  <td colspan='2' class="leftpad"><h2>
	  <?php echo htmlspecialchars_decode(stripslashes($newCont['text'])); ?>
	  </h2></td></tr>
	<tr>
	  <td rowspan="2" valign="top"  class="productimg">
	  <?php echo $newCont['text1']; ?>
	  <?php echo '<br/><font size="2" color="#000000"><b>' . $extra_field_value .'</b></font>';?></td>
	<td align="left" class="rightpad">  
	 </td>  
	</tr>
	<tr>
	  <td valign="bottom" align="right" class="rightpad"><br /> <br />
		   <span class="red"> </span></td>
	</tr>
	<tr>
	  <td align="left"  colspan='2' class="leftpad"><span class="btn_img">
	 </span><span style="padding:0 35px 0 45px"><span class="size22"> </span>
	 <?php if(substr($newCont['text2'],0,1) != "$"){ ?>
	 <span class="size12"><?php echo $newCont['text2']; ?></span> <?php } else{ ?>
	 <span class="size35"><?php echo $newCont['text2']; ?></span><?php } ?><span class="size22"></span></span></td>
	</tr>
	</table><!-- products table ends here --></td>
<?php
$i++;		
if($i % 4 == 0)
echo "</tr><tr>";
endforeach;
}
?>
</table>
<?php   
 //new contentBox($info_box_contents);  
 ?>  

 

How did I do this and how can I fix it?

Posted

Here's the code from my product_listing.php as well.

 

<?php
/*
 $Id: product_listing.php 1739 2007-12-20 00:52:16Z hpdl $
 adapted for Separate Pricing Per Customer v4 2005/02/26
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

 if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
   <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
   <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }

 $list_box_contents = array();

 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
   switch ($column_list[$col]) {
     case 'PRODUCT_LIST_MODEL':
       $lc_text = TABLE_HEADING_MODEL;
       $lc_align = '';
       break;
     case 'PRODUCT_LIST_NAME':
       $lc_text = TABLE_HEADING_PRODUCTS;
       $lc_align = '';
       break;
     case 'PRODUCT_LIST_MANUFACTURER':
       $lc_text = TABLE_HEADING_MANUFACTURER;
       $lc_align = '';
       break;
     case 'PRODUCT_LIST_PRICE':
       $lc_text = TABLE_HEADING_PRICE;
       $lc_align = 'right';
       break;
     case 'PRODUCT_LIST_QUANTITY':
       $lc_text = TABLE_HEADING_QUANTITY;
       $lc_align = 'right';
       break;
     case 'PRODUCT_LIST_WEIGHT':
       $lc_text = TABLE_HEADING_WEIGHT;
       $lc_align = 'right';
       break;
     case 'PRODUCT_LIST_IMAGE':
       $lc_text = TABLE_HEADING_IMAGE;
       $lc_align = 'center';
       break;
     case 'PRODUCT_LIST_BUY_NOW':
       $lc_text = TABLE_HEADING_BUY_NOW;
       $lc_align = 'center';
       break;
   }

   if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
     $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
   }

   /*$list_box_contents[0][] = array('align' => $lc_align,
                                   'params' => 'class="productListing-heading"',
                                   'text' => ' ' . $lc_text . ' ');*/
 }
$pro_ids = array();
$ids = 0;
 if ($listing_split->number_of_rows > 0) {

   $rows = 0;
   $listing_query = tep_db_query($listing_split->sql_query);
// BOF Separate Pricing per Customer
   $no_of_listings = tep_db_num_rows($listing_query);
// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

 if(!tep_session_is_registered('sppc_customer_group_id')) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }

while ($_listing = tep_db_fetch_array($listing_query)) {
$listing[] = $_listing;
$list_of_prdct_ids[] = $_listing['products_id'];
}
// next part is a debug feature, when uncommented it will print the info that this module receives
/*
  echo '<pre>';
  print_r($listing);
  echo '</pre>';
*/
 $select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";
 if ($no_of_listings > 1) {
  for ($n = 1 ; $n < count($list_of_prdct_ids) ; $n++) {
  $select_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' ";
  }
}

// get all product prices for products with the particular customer_group_id
// however not necessary for customer_group_id = 0
if ($customer_group_id != '0') {
 $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where (".$select_list_of_prdct_ids.") and pg.customers_group_id = '".$customer_group_id."' ");
//   $no_of_pg_products = tep_db_num_rows($pg_query) ;
while ($pg_array = tep_db_fetch_array($pg_query)) {
$new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '', 'final_price' => $pg_array['price']);
}
  for ($x = 0; $x < $no_of_listings; $x++) {
// replace products prices with those from customers_group table
     if(!empty($new_prices)) {
        for ($i = 0; $i < count($new_prices); $i++) {
    if( $listing[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
	$listing[$x]['products_price'] = $new_prices[$i]['products_price'];
	$listing[$x]['final_price'] = $new_prices[$i]['final_price'];
	}
    }
} // end if(!empty($new_prices)
$listing[$x]['specials_new_products_price'] = ''; // makes sure that a retail specials price doesn't carry over to another customer group
$listing[$x]['final_price'] = $listing[$x]['products_price']; // final price should not be the retail special price
  } // end for ($x = 0; $x < $no_of_listings; $x++)
} // end if ($customer_group_id != '0')

// an extra query is needed for all the specials

$specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where (".$select_list_of_prdct_ids.") and status = '1' and customers_group_id = '" .$customer_group_id. "'");
while ($specials_array = tep_db_fetch_array($specials_query)) {
$new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price'] , 'final_price' => $specials_array['specials_new_products_price']);
}

// add the correct specials_new_products_price and replace final_price
for ($x = 0; $x < $no_of_listings; $x++) {

       if(!empty($new_s_prices)) {
    for ($i = 0; $i < count($new_s_prices); $i++) {
	 if( $listing[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) {
	   $listing[$x]['specials_new_products_price'] = $new_s_prices[$i]['specials_new_products_price'];
	   $listing[$x]['final_price'] = $new_s_prices[$i]['final_price'];
	 }
       }
   } // end if(!empty($new_s_prices)
} // end for ($x = 0; $x < $no_of_listings; $x++)

//    while ($listing = tep_db_fetch_array($listing_query)) { (was original code)
for ($x = 0; $x < $no_of_listings; $x++) {

     $rows++;
// $ii++;
     if (($rows/2) == floor($rows/2)) {
       //$list_box_contents[] = array('params' => 'class="productListing-even"');
	$list_box_contents[] = array('params' => 'class=""');
     } else {
       //$list_box_contents[] = array('params' => 'class="productListing-odd"');
	$list_box_contents[] = array('params' => 'class=""');
     }

     $cur_row = sizeof($list_box_contents) - 1;

     for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

       $lc_align = '';		
	switch ($column_list[$col]) {
         case 'PRODUCT_LIST_MODEL':
           $lc_align = '';
           $lc_text = ' ' . $listing[$x]['products_model'] . ' ';
           break;
         case 'PRODUCT_LIST_NAME':
           $lc_align = '';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a>';
           } else {
             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a> ';
           }
           break;
         case 'PRODUCT_LIST_MANUFACTURER':
           $lc_align = '';
           $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing[$x]['manufacturers_id']) . '">' . $listing[$x]['manufacturers_name'] . '</a> ';
           break;
         case 'PRODUCT_LIST_PRICE':
           $lc_align = 'right';

           if (tep_not_null($listing[$x]['specials_new_products_price'])) {
             $lc_text = ' <s>' .  $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span> ';
           } else {
             $lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';
           }
           break;
         case 'PRODUCT_LIST_QUANTITY':
           $lc_align = 'right';
           $lc_text = ' ' . $listing[$x]['products_quantity'] . ' ';
           break;
         case 'PRODUCT_LIST_WEIGHT':
           $lc_align = 'right';
           $lc_text = ' ' . $listing[$x]['products_weight'] . ' ';
           break;
         case 'PRODUCT_LIST_IMAGE':
           $lc_align = 'center';
		array_push($pro_ids, $listing[$x]['products_id']);
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
           } else {
             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
           }
           break; // EOF Separate Pricing per Customer
         /*case 'PRODUCT_LIST_BUY_NOW':
           $lc_align = 'center';
           $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('cart_btn.jpg', IMAGE_BUTTON_BUY_NOW) . '</a> ';*/
		case 'PRODUCT_LIST_BUY_NOW':
		$lc_align = 'center';
		if ($listing[$x]['products_price']== '0'){ //fix for call for price
		$lc_text = ' ';
		} 
		elseif ($listing['products_free_shipping'] && FREE_SHIPPING_TO_ALL_COUNTRIES == "true") {
		  $lc_text = '<form name="buy_now_' . $listing[$x]['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now', 'NONSSL') . '"><input type="hidden" name="products_id" value="' . $listing[$x]['products_id'] . '">' . tep_image_submit('cart_btn.jpg', "Buy " . $listing[$x]['products_name']) . '</form>  ' . FREE_SHIPPING_FOR_THIS_PRODUCT . '</b> '; 			  

		} elseif ($listing['products_free_shipping'] && FREE_SHIPPING_TO_ALL_COUNTRIES == "false") {
		$lc_text = '<form name="buy_now_' . $listing[$x]['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now', 'NONSSL') . '"><input type="hidden" name="products_id" value="' . $listing[$x]['products_id'] . '">' . tep_image_submit('cart_btn.jpg', "Buy " . $listing[$x]['products_name']) . '</form>  ' . FREE_SHIPPING_FOR_THIS_PRODUCT . '</b> '; 				 		
		}
		else {
		/*$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' .
		tep_image_button('cart_btn.jpg', IMAGE_BUTTON_BUY_NOW) . '</a> ';*/
		$lc_text = '<form name="buy_now_' . $listing[$x]['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now', 'NONSSL') . '"><input type="hidden" name="products_id" value="' . $listing[$x]['products_id'] . '">' . tep_image_submit('cart_btn.jpg', "Buy " . $listing[$x]['products_name']) . '</form> '; 
		}
		break;
		}
		//$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF),tep_get_all_get_params(array('action')).'action=buy_now &products_id='.$listing['products_id']).'">' .tep_image_button('cart_btn.gif', IMAGE_BUTTON_BUY_NOW).'</a> '.getTaf(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']),addslashes($listing['products_name'])).'  ';
           //break;
       //}

       $list_box_contents[$cur_row][] = array('align' => $lc_align,
                                              'params' => 'class="productListing-data"',
                                              'text'  => $lc_text,											   	  'pro_ids' => $pro_ids);
     }	  
   }
//echo '<pre>';
//print_r($list_box_contents);
//echo '</pre>'; die;	
foreach($list_box_contents as $contents)
{
	$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.enable_credit_card, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . $pro_ids[$ids] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");	
   $product_info = tep_db_fetch_array($product_info_query);
//print_r($product_info); 


//echo '<pre>';
//print_r($contents);
//echo '</pre>'; die;	

/*print_r($contents[0]['text']); 
print_r($contents[1]['text']); 
print_r($contents[2]['text']);
print_r($contents[3]['text']); die;*/

// START: Extra Fields Contribution v2.0b - mintpeel display fix
	  $extra_field_value = "";
                     $extra_fields_query = tep_db_query("
                     SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value
                     FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef
            LEFT JOIN  ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf
           ON ptf.products_extra_fields_id=pef.products_extra_fields_id
           WHERE ptf.products_id=". (int)$pro_ids[$ids]." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".(int)$languages_id."')
           ORDER BY products_extra_fields_order");
$extra_fields = tep_db_fetch_array($extra_fields_query);

 $extra_field_name = $extra_fields['name'];
 if($extra_fields['value'] != "")
 $extra_field_value = stripslashes($extra_fields['value']);
 	$ids++;
$price_actual = substr($contents[2]['text'],7);
$int_part	  = substr($price_actual, 0, strpos($price_actual, "."));
$decimal_part = substr($price_actual, strpos($price_actual, ".")+1,2);

?>
<!-- products table starts here --><table  class="list" border="0" cellspacing="0" cellpadding="0">
<tr>
 <td colspan='2' class="leftpad"><h2>
 <?php echo htmlspecialchars_decode(stripslashes($contents[1]['text'])); ?>
 </h2></td></tr>
<tr>
 <td rowspan="2" valign="top"  class="productimg">
 <?php echo $contents[0]['text']; ?> <!--p align="left" class="rightpad">
<?php //echo stripslashes($product_info['products_description']); ?></p-->
<?php echo '<br/><font size="2" color="#000000"><b>' . $extra_field_value .'</b></font>';?>
</td>  
</tr>
<tr>
 <td valign="bottom" align="right" class="rightpad"><br /><br />
   <span class="red"></span></td>
</tr>
<tr>
 <td align='top' align="left"  colspan='2' class="leftpad"><span class='cartbtn'>
<?php if($product_info['enable_credit_card'] == 1) echo $contents[3]['text']; ?></span><span style="margin:10px 10px; float:right;" class="size35"><?php echo $contents[2]['text']; ?></span></td>
</tr>
</table><!-- products table ends here -->
<?php }		
  // new productListingBox($list_box_contents);
 } else {
   $list_box_contents = array();

   $list_box_contents[0] = array('params' => 'class="productListing-odd"');
   $list_box_contents[0][] = array('params' => 'class="productListing-data"',
                                  'text' => TEXT_NO_PRODUCTS);

   new productListingBox($list_box_contents);
 }

 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<table border="0" width="100%" cellspacing="0" style="clear:both;" cellpadding="2">
 <tr>
   <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
   <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...