Jump to content

Add a database field in the product.tpl


kinling

Recommended Posts

Hi, I am using prestashop sinca a wek or so, very nice!
I want to change the product.tpl:
I have several features, like ISB, Author and so on...
I want to show the content of this field not in the Data sheet, but in the<!-- center infos --> of the tpl, under short description and before quantity.

What I found out = the value is stored in the database 'ps_feature_value_lang'.
I also know that it should ad code in the product.tpl before <!-- number of item in stock -->

But so sorry, thats all I know.
Is there someone out there who can tell me the code to show the id_feature?
I have:

id_feature
id_lang
id_name

 

Would be fantastic if someone could give me a hint:-) 

 

1000 Thank u!
klaus

German, living in Malaysia

Link to comment
Share on other sites

Hi,

 

If you look in to the line ~463 of product.tpl file. You will see smarty variable :

{$features}

If you print the array variable you will see the result:

Array
(
    [0] => Array
        (
            [name] => Compositions
            [value] => Cotton
            [id_feature] => 5
        )

    [1] => Array
        (
            [name] => Styles
            [value] => Casual
            [id_feature] => 6
        )

    [2] => Array
        (
            [name] => Properties
            [value] => Short Sleeve
            [id_feature] => 7
        )

)

I'm talking this line

		{if isset($features) && $features}
			<!-- Data sheet -->
			<section class="page-product-box">
				<h3 class="page-product-heading">{l s='Data sheet'}</h3>
				<table class="table-data-sheet">feature
                    <pre>{print_r($features)}</pre>
					{foreach from=$features item=feature}
					<tr class="{cycle values="odd,even"}">
						{if isset($feature.value)}
						<td>{$feature.name|escape:'html':'UTF-8'}</td>
						<td>{$feature.value|escape:'html':'UTF-8'}</td>
						{/if}
					</tr>
					{/foreach}
				</table>
			</section>
			<!--end Data sheet -->
		{/if}

Good luck!

  • Like 1
Link to comment
Share on other sites

ha!

very good I see! so just now I have all references in the center infos!

looks  like I will be successful  with your great help.

 

Now need to find a way to show only one of my features, and need to format it nicely:-)

Thanks

Klaus

Link to comment
Share on other sites

mhhh, ok I understand so far.. if I copy this to the centerinfos it will show all features. But how if I only want to show :

This is the the field ISBN in the table ps_feature_lang:
[name] => ISBN
[value] =>
[id_feature] => 12

 

should be something like:
 <p itemprop="ISBN"> {$feature.value->ISBN|escape:'html':'UTF-8'} </p>

 

But doesnt show anything.

 

Sorry if I disturb u with this beginner questions, but I am learning...

 

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