Jump to content

manufacture contact number on product page


arjundass
 Share

Recommended Posts

Do you mean the phone number?

 

Try this:

edit file controllers/front/ProductController.php (make a backup first!)

 

Find:

  // Pack management
  $pack_items = $this->product->cache_is_pack ? Pack::getItemTable($this->product->id, $this->context->language->id, true) : array();
  $this->context->smarty->assign('packItems', $pack_items);
  $this->context->smarty->assign('packs', Pack::getPacksTable($this->product->id, $this->context->language->id, true, 1));
  if (isset($this->category->id) && $this->category->id)
$return_link = Tools::safeOutput($this->context->link->getCategoryLink($this->category));
  else
$return_link = 'javascript: history.back();';
  $this->context->smarty->assign(array(
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
'customizationFields' => ($this->product->customizable) ? $this->product->getCustomizationFields($this->context->language->id) : false,
'accessories' => $this->product->getAccessories($this->context->language->id),
'return_link' => $return_link,
'product' => $this->product,
'product_manufacturer' => new Manufacturer((int)$this->product->id_manufacturer, $this->context->language->id),
'token' => Tools::getToken(false),

 

Change into (add red text):

 

  // Pack management
  $pack_items = $this->product->cache_is_pack ? Pack::getItemTable($this->product->id, $this->context->language->id, true) : array();
  $this->context->smarty->assign('packItems', $pack_items);
  $this->context->smarty->assign('packs', Pack::getPacksTable($this->product->id, $this->context->language->id, true, 1));
  if (isset($this->category->id) && $this->category->id)
$return_link = Tools::safeOutput($this->context->link->getCategoryLink($this->category));
  else
$return_link = 'javascript: history.back();';

 

$tmp_manufacturer = new Manufacturer((int)$this->product->id_manufacturer,

$this->context->language->id);

if (isset($tmp_manufacturer))

{

$tmp_addresses = $tmp_manufacturer->getAddresses($this->context->language->id);

$tmp_manufacturer_phone = $tmp_addresses[0]['phone'];

}

else

$tmp_manufacturer_phone = '-';

  
$this->context->smarty->assign(array(
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
'customizationFields' => ($this->product->customizable) ? $this->product->getCustomizationFields($this->context->language->id) : false,
'accessories' => $this->product->getAccessories($this->context->language->id),
'return_link' => $return_link,
'product' => $this->product,

'product_manufacturer' => $tmp_manufacturer,

'manufacturer_contact_phone' => $tmp_manufacturer_phone,

'token' => Tools::getToken(false),

 

 

And save the file.

 

Then edit file themes/,your theme folder>/product.tpl (make a backup first!)

Find and add red text:

 

  <!-- Out of stock hook -->
  <div id="oosHook"{if $product->quantity > 0} style="display: none;"{/if}>
{$HOOK_PRODUCT_OOS}
  </div>
  <p class="warning_inline" id="last_quantities"{if ($product->quantity > $last_qties OR $product->quantity <= 0) OR $allow_oosp OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none"{/if} >{l s='Warning: Last items in stock!'}</p>

<div class="product_detail_manufacturer_contact">

<label id="product_manufacturer_phone_label">{l s="Manufacturer phone:"}</label>

<span id="product_manufacturer_phone">{$manufacturer_contact_phone}</span>

</div>

 </div>
 <div class="content_prices clearfix">
  <!-- prices -->

 

And save the file.

Go to the product detail page and reload. Should be something like:

post-455771-0-39726800-1377977730_thumb.jpg

 

 

Hope this helps,

pascal

 

N.B. I didn't test for indeed availability of address with manufacturer. Didn't check for either phone or mobile phone.

So requirements are:

- IF a manufacturer given with product then :

--- address MUST be available

--- phone number MUST be available

 

You should add more checks if

- not all manufacturers have an address

- sometimes the mobile number is used instead of phone number.

Edited by PascalVG
: Added restrictions-text (see edit history)
  • Like 1

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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More