Post by dom44 » Tue May 01, 2012 3:35 am

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

New member

Posts

Joined
Thu Jul 16, 2009 6:54 am

Post by florinsith » Tue May 01, 2012 5:36 am

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?

Image
My Extensions - SuperTheme - Opencart templates - Opencart modules


User avatar
Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am


Post by dom44 » Tue May 01, 2012 10:40 am

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.

New member

Posts

Joined
Thu Jul 16, 2009 6:54 am

Post by florinsith » Tue May 01, 2012 6:49 pm

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

Image
My Extensions - SuperTheme - Opencart templates - Opencart modules


User avatar
Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am


Post by dom44 » Wed May 02, 2012 12:21 am

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

New member

Posts

Joined
Thu Jul 16, 2009 6:54 am
Who is online

Users browsing this forum: No registered users and 49 guests