Jump to content

Category name in product page


pavoo

Recommended Posts

Hi

 

Can someone hint how to do that in the title of the product automatically was added category in which it is

 

Maybe something like this:

 

{assign var='categories' value=Product::getProductCategoriesFull($product->id, $cookie->id_lang)}
{foreach from=$categories key='categoryId' item='category' name='categories'}
 Category ID: {$categoryId}<br />
 Name: {$category['name']}<br />
 Link rewrite: {$category['link_rewrite']}
{/foreach}

 

I haven't tested it, but it should work!

  • Like 1
Link to comment
Share on other sites

you misunderstood me. The idea is to automatically display a category on the product being in <title> product - category </ title>

I know I need to change the entry in the file classes / Tools.php

In 'Products specifics meta tags' added entry

if (empty ($ row ['meta_title']))

$ row ['meta_title'] = $ title. $ row ['meta_title']. '- '.????? ('? ');

? = What to add here

Probably the 90% I have to edit a MySQL query

Link to comment
Share on other sites

Please help I have a question but I need to improve MySQL syntax. Unfortunately, it's not my league.

The question is:

SELECT distinct ps_product_lang.name as name, meta_title, meta_description, meta_keywords, description_short, ps_category_lang.name as category,

FROM ps_product_lang, ps_category_lang, ps_product

WHERE ps_product_lang.id_lang = 6 AND ps_product_lang.id_product = 21630 AND

ps_product_lang.id_product = ps_product.id_product AND

ps_category_lang.id_category = ps_product.id_category_default LIMIT 1

 

Submission of PrestaShop are:

SELECT distinct '. _DB_PREFIX_.' Product_lang.name as name, meta_title, meta_description, meta_keywords, description_short, '. _DB_PREFIX_.' Category_lang.name as category,

FROM '. _DB_PREFIX_.' Product_lang, '. _DB_PREFIX_.' Category_lang, '. _DB_PREFIX_.' Product

WHERE '. _DB_PREFIX_.' Product_lang.id_lang = '. Intval ($ id_lang).' AND '. _DB_PREFIX_.' Product_lang.id_product = '. Intval ($ id_product).' AND

'. _DB_PREFIX_.' Product_lang.id_product = '. _DB_PREFIX_.' Product.id_product AND

'. _DB_PREFIX_.' Category_lang.id_category = '. _DB_PREFIX_.' Product.id_category_default ');

 

The purpose of the question is put in the name of the product category. MySQL question is in the file classes/Tools.php

Link to comment
Share on other sites

  • 2 months later...

i have try this code throught mysql query

 

$query =mysql_query("INSERT INTO `ebg_category_lang` (id_category,id_lang , name,link_rewrite)

VALUES ('".$id_cat."','1', '".$category."', '".$category."')");

 

its work try this and add that category id into your product tbl category id field !

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...