Jump to content

Add manufacturer part number to product page


Recommended Posts

I tried that, but I don't think it will do. It just doesn't cut it. "Reference:  XXXXXXX". Some people might be able to look at that and figure out it is the part number, but the majority I don't think will. I need it to say "MPN: XXXXXX".

 

KLSHpah.jpg

I know I could probably just find out which .tpl that "Reference" is in and change it to "MPN, but I feel like it should be it's own field, like there should be a field in the product details page called MPN or something. I just went through a lot of the various places that I buy from online and every single one of them has at minimum a manufacturer part number listed and most also have a manufacturer listed, both in that same spot where Reference is.

 

If there is no easy way to to accomplish that, does anybody know what .tpl that "Reference" is in?

Edited by sscardefield (see edit history)
Link to comment
Share on other sites

in this case you have to extend product object and define new fields in database.

 

(1)

in ps_product table create field named "mpn"

i9pGp9d.png

 

 

(2)

in file: ADMIN/themes/default/template/controllers/products/informations.tpl right after code:

<tr>
			<td class="col-left"><label>{$bullet_common_field} {l s='Reference:'}</label></td>
			<td style="padding-bottom:5px;">
				<input size="55" type="text" name="reference" value="{$product->reference|htmlentitiesUTF8}" style="width: 130px; margin-right: 44px;" />
				<span class="hint" name="help_box">{l s='Special characters allowed:'}.-_#\<span class="hint-pointer"> </span></span>
			</td>
		</tr>

add code:

<tr>
<td class="col-left"><label>{$bullet_common_field} {l s='Part number:'}</label></td>
<td style="padding-bottom:5px;">
<input size="55" type="text" name="mpn" value="{$product->mpn|htmlentitiesUTF8}" style="width: 130px; margin-right: 44px;" />
</span>
</td>
</tr>

effect:

5CqZrdm.png

 

 

(3)

open classes/Product.tpl file

 

right after:

class ProductCore extends ObjectModel
{
	/** @var string Tax name */
	public $tax_name;

add:

 

 

public $mpn;

 

 

then right after:

public static $definition = array(
		'table' => 'product',
		'primary' => 'id_product',
		'multilang' => true,
		'multilang_shop' => true,
		'fields' => array(
			// Classic fields
			'id_shop_default' => 			array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
			'id_manufacturer' => 			array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
			'id_supplier' => 				array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
			'reference' => 					array('type' => self::TYPE_STRING, 'validate' => 'isReference', 'size' => 32),

add:

'mpn' => 					array('type' => self::TYPE_STRING, 'validate' => 'isReference', 'size' => 32),

(4) now your field works in back office well.

Just modify product.tpl file and add code to display your new variable somewhere {$product->mpn}

  • Like 3
Link to comment
Share on other sites

  • 1 month later...

Hi,

 

I am a prestashop developer as well as I run an online mobile shop. Usually products have lot of attributes. It is not required to add those attributes as separate fields unless you want them to be indexed. For example in mobiles we have so many attributes, technical specifications, etc. The best way to achieve them is to add them in product description (or short description if you want). I do that all the time . Like this :

 

https://www.diigo.com/item/image/4h50p/91ak

 

If you do not know HTML, you can simply use word document to create a table and use "Paste from Word" option in the Product Description editor to paste the table. (or if you know HTML you can simply create HTML tables)

 

 

Hope this helps.

Edited by ibndawood (see edit history)
Link to comment
Share on other sites

Hello vekia,

I try to find a solution for 3 days now to add a field in prestashop 1.5.5, the category page with override imposiible but I tried everything but it does not work ... Is anyone can us help give us the steps please?

 

what you exactly expect? i don't understand, guide above allows to create new field for product. you want to category? or what?

Link to comment
Share on other sites

  • 2 years later...

This was the only mod that actually worked. Thanks a lot. I know that PS 1.6 comes already with a "Supplier Reference" field, but never managed to get it on the Frontend because is on a diferent table.

 

 

 

in this case you have to extend product object and define new fields in database.

 

(1)

in ps_product table create field named "mpn"

i9pGp9d.png

 

 

(2)

in file: ADMIN/themes/default/template/controllers/products/informations.tpl right after code:

<tr>
			<td class="col-left"><label>{$bullet_common_field} {l s='Reference:'}</label></td>
			<td style="padding-bottom:5px;">
				<input size="55" type="text" name="reference" value="{$product->reference|htmlentitiesUTF8}" style="width: 130px; margin-right: 44px;" />
				<span class="hint" name="help_box">{l s='Special characters allowed:'}.-_#\<span class="hint-pointer"> </span></span>
			</td>
		</tr>

add code:

<tr>
<td class="col-left"><label>{$bullet_common_field} {l s='Part number:'}</label></td>
<td style="padding-bottom:5px;">
<input size="55" type="text" name="mpn" value="{$product->mpn|htmlentitiesUTF8}" style="width: 130px; margin-right: 44px;" />
</span>
</td>
</tr>

effect:

5CqZrdm.png

 

 

(3)

open classes/Product.tpl file

 

right after:

class ProductCore extends ObjectModel
{
	/** @var string Tax name */
	public $tax_name;

add:

 

 

 

then right after:

public static $definition = array(
		'table' => 'product',
		'primary' => 'id_product',
		'multilang' => true,
		'multilang_shop' => true,
		'fields' => array(
			// Classic fields
			'id_shop_default' => 			array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
			'id_manufacturer' => 			array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
			'id_supplier' => 				array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
			'reference' => 					array('type' => self::TYPE_STRING, 'validate' => 'isReference', 'size' => 32),

add:

'mpn' => 					array('type' => self::TYPE_STRING, 'validate' => 'isReference', 'size' => 32),

(4) now your field works in back office well.

Just modify product.tpl file and add code to display your new variable somewhere {$product->mpn}

Link to comment
Share on other sites

  • 6 months later...
  • 3 months later...
  • 3 years later...
  • 5 months later...
  • 1 year later...

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
×
×
  • Create New...