Jump to content

Looking for a "package content" and "product features" module


Recommended Posts

Hi,

 

Out of box, PrestaShop allows me to add product short and long description very easily. Apart from description I also need to sometimes add product features, package contents and technical specification of the given product. In the screenshot below I showed how I would like the module to work from back end. 

 

I searched google but I couldn't find good solution. I found module called "Project page content blocks" which technically would work but is very impractical in my case.

 

Thanks for help.

post-254463-0-18595400-1394668759_thumb.png

post-254463-0-84012300-1394669058_thumb.png

Link to comment
Share on other sites

there is no module like that, it's because to achieve this you have to modify controllers and admin + front office templates related to product & product edit page.

 

if you're still interested in this, you will have to define new fields in database (alter table ps_product_lang).

Then you have to extend product ObjectModel definition (add these new fields to Product.php class)
And last step Modify admin controller to display this field, and template to display textbox with tinymce editor to enter own data.

Link to comment
Share on other sites

if you're still interested in this, you will have to define new fields in database (alter table ps_product_lang).

Then you have to extend product ObjectModel definition (add these new fields to Product.php class)

And last step Modify admin controller to display this field, and template to display textbox with tinymce editor to enter own data.

 

After I update PrestaShop, all changes would be lost, is that right?

Link to comment
Share on other sites

I defined new fields in table - easy bit.

 

For the "Product.php class" I believe you are referring to the "classes/product.php" file and the "admin controller" would be "controllers/admin/AdminProductsController.php"?

 

 

Thanks for help.

Link to comment
Share on other sites

I actually only edited file below and everything works:

classes/product.php

admin111/themes/default/template/controllers/products/informations.tpl

themes/default/product.tpl

 

Would you mind telling more about what exactly I had to edit in AdminProductsController.php

Link to comment
Share on other sites

1. Added new columns to the table. Columns named product_featuresbox_contents and product_technical_specs.

 

2. classes/product.php

- declared global variables

/** @var string Product features*/
public $product_features;
	
/** @var string Box contents*/
public $box_contents;
	
/** @var string Product technical specs*/
public $product_technical_specs;

- edited Lang fields in the $definition array

/* Lang fields */
'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
'link_rewrite' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isLinkRewrite', 'required' => true, 'size' => 128),
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 128),
'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
'description_short' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
'product_features' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
'box_contents' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
'product_technical_specs' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
'available_now' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
'available_later' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'IsGenericName', 'size' => 255), 

3. admin111/themes/default/template/controllers/products/informations.tpl

- added three more rows to the table and coded that displays text editor in admin

<tr><!-- Added by Matthew - Product features -->
	<td class="col-left">
		{include file="controllers/products/multishop/checkbox.tpl" field="product_features" type="tinymce" multilang="true"}
		<label>{l s='Product features:'}<br /></label>
		<p class="product_description">({l s='Appears in the body of the product page'})</p>
	</td>
	<td style="padding-bottom:5px;">
		{include file="controllers/products/textarea_lang.tpl" languages=$languages
		input_name='product_features'
		input_value=$product->product_features
		}
		<p class="clear"></p>
	</td>
</tr>
<tr> <!-- Added by Matthew - Box contents -->
	<td class="col-left">
		{include file="controllers/products/multishop/checkbox.tpl" field="box_contents" type="tinymce" multilang="true"}
		<label>{l s='Box contents:'}<br /></label>
		<p class="product_description">({l s='Appears in the body of the product page'})</p>
	</td>
	<td style="padding-bottom:5px;">
		{include file="controllers/products/textarea_lang.tpl" languages=$languages
		input_name='box_contents'
		input_value=$product->box_contents
		}
		<p class="clear"></p>
	</td>
</tr>
<tr> <!-- Added by Matthew - Product technical specs -->
	<td class="col-left">
		{include file="controllers/products/multishop/checkbox.tpl" field="product_technical_specs" type="tinymce" multilang="true"}
		<label>{l s='Product technical specs:'}<br /></label>
		<p class="product_description">({l s='Appears in the body of the product page'})</p>
	</td>
	<td style="padding-bottom:5px;">
		{include file="controllers/products/textarea_lang.tpl" languages=$languages
		input_name='product_technical_specs'
		input_value=$product->product_technical_specs
		}
		<p class="clear"></p>
	</td>
/tr>

4. themes/default/product.tpl

- added code to the template to display data

{if isset($product) && $product->product_features}<h2 class="product_header">Product features</h2>{$product->product_features}{/if}
{if isset($product) && $product->box_contents}<h2 class="product_header">Contents</h2>{$product->box_contents}{/if}
{if isset($product) && $product->product_technical_specs}<h2 class="product_header">Technical specification</h2>{$product->product_technical_specs}{/if}
Edited by neoh (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...