Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

need bit of php and mysql help


Guest

Recommended Posts

I have created a new field in the products table in the database and want to display it on the products listing page

 

in the table in the database it is called products_before_vat

 

How do I display it in the products listing page

 

Thank you in advance

Link to comment
Share on other sites

Hi Mark, thank you for the reply, is that in index.php or theproduct_listing.php as I think both files deal with what is displayed in the product listing page

Link to comment
Share on other sites

in index.php I found the following

 

$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
					 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
					 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
					 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
					 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
					 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
					 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
					 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);

 

switch ($column_list[$sort_col-1]) {
    case 'PRODUCT_LIST_MODEL':
	  $listing_sql .= " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
    case 'PRODUCT_LIST_NAME':
	  $listing_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
	  break;
    case 'PRODUCT_LIST_MANUFACTURER':
	  $listing_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
    case 'PRODUCT_LIST_QUANTITY':
	  $listing_sql .= " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
    case 'PRODUCT_LIST_IMAGE':
	  $listing_sql .= " order by pd.products_name";
	  break;
    case 'PRODUCT_LIST_WEIGHT':
	  $listing_sql .= " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
    case 'PRODUCT_LIST_PRICE':
	  $listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
  }
   }

 

In includes/modules/product_listing.php I found the following

 

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;
   }

 

case 'PRODUCT_LIST_PRICE':
	    if (tep_not_null($listing['specials_new_products_price'])) {
		  $prod_list_contents .= '	    <td align="right"><del>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</del>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span></td>';
	    } else {
		  $prod_list_contents .= '	    <td align="right">' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</td>';
	    }
	    break;

Link to comment
Share on other sites

Just to be curious, why have you added a new table to the database to show a price with taxes. Its already there if you enter a product with taxes. There are also addons to display prices with and without taxes, or are you trying to reinvent the wheel.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

Hi Steve thank you for the add on link, that one worked perfect, just a couple of things with it

 

How do I get a heading in the table to say price before VAT and Price after VAT as at the moment its got Price - see link below

 

http://www.musclemerchants.com/index.php?cPath=22&osCsid=rtj11ebbc8qlfiso1d3ip4bfg4

 

The only other one is the price on the left displays the price including VAT as well but need that price to display the price before VAT so would be £39.99 for the mass explosion product

 

again see link below http://www.musclemerchants.com/index.php?cPath=22&osCsid=rtj11ebbc8qlfiso1d3ip4bfg4

 

Thank you again Steve

Link to comment
Share on other sites

I have got the title displaying Price Excl VAT so that is all good but need a title to say Price Incl VAT, how do I do that and need the prices in the Excl VAT column to display the price before VAT as at the moment it is displaying the price including VAT, how do I do that, for example the mass explosion should be £39.99 in the price excl VAT column and not £47.99

Link to comment
Share on other sites

Just spotted this error as well

 

I get it when I click on the product that has the VAT included, the mass explosion product

 

 

 

Fatal error: Call to undefined method currencies::display_price_ex() in /customers/4/d/f/musclemerchants.com/httpd.www/product_info.php on line 47

 

On line 47 in the php file is below

 

$products_price_ex = $currencies->display_price_ex($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...