Page 1 of 1

Put price in header file

Posted: Tue May 01, 2012 3:35 am
by dom44
Hi,

I want to put the price a particular product in the template header file (ie. /catalog/view/theme/default/template/common/header.tpl) so that this price is displayed on all pages. Does anyone know how I could do this?

In addition I would also like this price displayed on a separate html page is there some way this could be done?

Thank you

Re: Put price in header file

Posted: Tue May 01, 2012 5:36 am
by inactiveaccount9912
the price of a single chosen product on all pages, or on each product page, the price of that specific product to be displayed in header?

Re: Put price in header file

Posted: Tue May 01, 2012 10:40 am
by dom44
Hi,

I want to display the price of a chosen (one) product on the header of all pages.
For example beside the logo it would say "Home of the $x phone).
So now I want this $x to change when I change the price of the product on the control panel.

Re: Put price in header file

Posted: Tue May 01, 2012 6:49 pm
by inactiveaccount9912
In header.tpl, before the line:

Code: Select all

<div id="welcome">
add the code:

Code: Select all

 <div id="header-price">
  <?php 
  $this->load->model('catalog/product');
  $product_header = $this->model_catalog_product->getProduct(x);
  $header_price = $this->currency->format($this->tax->calculate($product_header['price'], $product_header['tax_class_id'], $this->config->get('config_tax')));
  echo $header_price;
  ?>
  </div>
from the following line in the code above:
$product_header = $this->model_catalog_product->getProduct(X);
replace the highlighted x with the id of the product you want to display the price for.

The in stylesheet.css arange the div #header-price as you wish

Re: Put price in header file

Posted: Wed May 02, 2012 12:21 am
by dom44
Thank you so much florinsith it worked perfectly! :)

Any idea how I could include this information in a stand alone html file.

I was thinking if I could make a php file that would just display the price. I could use: <!--#include file="price.php" --> in any html file I wanted the price to be displayed in.

My question would be what do I put in the price.php file to get it to display the price?

Thank you