Jump to content
Sign in to follow this  
acidvertigo

Pricelist HTML enhancement

Recommended Posts

;) Hi all.

 

I downloaded and installed this contrib:

 

http://www.oscommerce.com/community/contributions,1705

 

Here a demo Pricelist

 

And modified to show category images and to take the result for the default language.

 

Here the code:

 

<?php

define('TITLE_PRICE', 'List Price'); 
//define('TITLE_PRICE', 'Price list');

define('SHOW_QUANTITY',false); // true - show, false - hide quantity
define('SHOW_MARKED_OUT_STOCK',true); // show marked out of stock (true - show, false - hide)
define('TAX_INCREASE', 0); // 0 - No increase, 1 - Add 1%, 5 - Add 5%, Any number - add number%
define('SHOW_MODEL',true); // true - show model, false - hide model

require('includes/application_top.php');
// the following cPath references come from application_top.php
$category_depth = 'top';
if (isset($cPath) && tep_not_null($cPath)) {
 $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
 $cateqories_products = tep_db_fetch_array($categories_products_query);
 if ($cateqories_products['total'] > 0) {
	 $category_depth = 'products'; // display products
 } else {
	 $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
	 $category_parent = tep_db_fetch_array($category_parent_query);
	 if ($category_parent['total'] > 0) {
   $category_depth = 'nested'; // navigate through the categories
	 } else {
   $category_depth = 'products'; // category has no products, but display the 'no products' message
	 }
 }
}
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);
$breadcrumb->add(TITLE_PRICE, tep_href_link("price.php", '', 'SSL')); 
?>

<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
 <?php require(DIR_WS_INCLUDES . 'header.php');?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">

 <!-- body_text //-->
 <td valign="top">
	 <table border="0" cellspacing="0" cellpadding="2">
    <tr>
       <td class="pageHeading"><? echo TITLE_PRICE ?></td>
  	 
     </tr>
   <tr>
   <td class="headerNavigation">I prezzi sono IVA esclusa e possono variare senza preavviso</td>
   </tr>
     <tr>
       <td>
<?
// ???? ? ?????? ?????????
// group have products?
function check_products($id_group){
$products_price_query = tep_db_query("select products_to_categories.products_id FROM products_to_categories where products_to_categories.categories_id = ".$id_group." LIMIT 0,1");
if($products_price = tep_db_fetch_array($products_price_query)){
 return true;	
}
return false;
}

// ??????? ?????? ????????? ???????????? ?????? $id_group
// list products determined group
function get_products($id_group){
global $currencies;
$query = "";

$products_price_query = tep_db_query("SELECT products_description.products_name, products.products_quantity, products.products_price, products.products_model, products_to_categories.products_id, products_to_categories.categories_id
FROM products, products_description, products_to_categories
WHERE products.products_id = products_description.products_id AND products_description.language_id =2".$query." and products.products_id = products_to_categories.products_id and products_to_categories.categories_id = ".$id_group);
$x=0;
while ($products_price = tep_db_fetch_array($products_price_query)){
 $cell = tep_get_products_special_price($products_price['products_id']);
 if($cell == 0)
	 $cell = $products_price['products_price'];
 if($x==1) {
	 $col = "#F8F8F9";
	 $x = 0;	
 }else{
	 $col = "#FFFFFF";
	 $x++;
 }
 $quantity = "";
 $model = "";
 if(SHOW_QUANTITY)
	 $quantity = "<td width=\"100\" align=\"right\" class=\"productListing-data\">(".$products_price['products_quantity'].")</td>";
 if(SHOW_MODEL)
	 $model = "<td width=\"100\" align=\"left\" class=\"productListing-data\">[".$products_price['products_model']."]</td>";
 print "<tr bgcolor=\"".$col."\" align = \"left\">".$model."<td width=\"1000\" class=\"productListing-data\" align=\"left\">        <a href=\"" . tep_href_link(FILENAME_PRODUCT_INFO, "products_id=" . $products_price['products_id']) . "\"<a>".$products_price['products_name']."</td>".$quantity."<td width=\"150\" align=\"left\" class=\"productListing-data\">".$currencies->display_price($cell,TAX_INCREASE)."</td></tr>";
}
}


// ??????????? ???????, ???????? ?????? ?? ???????
// get all groups
function get_group($id_parent,$position){
$groups_price_query = tep_db_query("select categories.categories_id,categories_image,categories_description.categories_name from categories, categories_description where categories.categories_id = categories_description.categories_id and categories.parent_id = ".$id_parent." and categories_description.language_id = 2 order by categories_description.categories_name");
while ($groups_price = tep_db_fetch_array($groups_price_query)){
 $str = "";
 for($i = 0; $i < $position; $i++){
	 $str = $str . "        ";
 }
 $class = "productListing-heading";
 if($position == 0) {
	 $class = "headerNavigation";
	 print "<tr><td colspan=\"4\" width=\"1000\" class=\"productListing-data\"> </td></tr>"; // ?????? ??????
 }
 if(check_products($groups_price['categories_id']) || $position == 0){
	 print "<br<tr><td colspan=\"4\" width=\"1000\" class=\"".$class."\"><img src= \"/public/".$groups_price['categories_image']."\" height=\"64\" width=\"84\"><strong><font color=\"#FFFFFF\" size=\"3\"><u>".$str.$groups_price['categories_name']."</font></u></strong></td></tr>";
	 get_products($groups_price['categories_id']);
 }
 get_group($groups_price['categories_id'],$position+1); // ????????? ??????
}
}

?>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<?
// Content is in $site 

 get_group(0,0);

?>

</table>
       </td>
     </tr>
	 </table>
 </td>
 <!-- body_text_eof //-->
 
</tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

 

How i can split the result by page with a navigation bar?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×