hisapon Posted April 26 Share Posted April 26 Hello. I am building a store with Prestashop 8.2.1 I would like to add a description below the product description, depending on the category to which the product belongs. Example ProductA (category-A) Product description ++product description(A:Unified description by category) Product Tabs ProductA (category-B) Product description ++product description(B:Unified description by category) Product Tabs Can I achieve this with the standard features of Prestashop? If anyone has achieved this with Addon Module, please let me know. Link to comment Share on other sites More sharing options...
ps8modules Posted April 26 Share Posted April 26 Hi. There is a short and a long description. Where do you want to embed it? Rather than text, a screen will help us see where the category text should be placed. Link to comment Share on other sites More sharing options...
hisapon Posted April 26 Author Share Posted April 26 >ps8modules Thank you for reply. I've attached a picture. Please check it out. I'm looking for a way to add default descriptions for each category in position A or B. Link to comment Share on other sites More sharing options...
ps8modules Posted April 26 Share Posted April 26 (edited) Hi. There are several solutions. One of the simplest is to create an override of Product.php and add your own static function + to that, insert a static function call into your product.tpl template. Another option is to program a mini module and connect it to hooks. On the product page, you could use the displayReassurance hook (before the product tabs) or the displayFooterProduct hook (at the end of the product detail page), or create your own hook in the module and insert it into the product tpl template. Override Product.php and override product.tpl: Product.php + static function (sample) public static function getProductCategoryDescription($idProduct, $idLang, $idShop = '1') { $db = Db::getInstance(); $product = new Product((int)$idProduct); $context = Context::getContext(); $idCategoryDefault = $product->id_category_default; $getDecription = $db->getValue('SELECT description FROM '._DB_PREFIX_.'category_lang WHERE id_category = '.$idCategoryDefault.' AND id_lang = '.$idLang.' AND id_shop = '.$idShop); return $getDecription; } product.tpl (sample ./themes/classic/templates/catalog/product.tpl) {block name='display_category_description'} {if Product::getProductCategoryDescription($product.id, $language.id) != ''} <div id="category-description" class="text-muted">{Product::getProductCategoryDescription($product.id, $language.id) nofilter}</div> {/if} {/block} Edited April 26 by ps8modules (see edit history) 1 Link to comment Share on other sites More sharing options...
hisapon Posted April 26 Author Share Posted April 26 (edited) Thank you for including the sample code. I guess this problem can't be solved with Prestashop's standard functions. It's a bit difficult for me, so I'll look for an add-on on the Marketplace. I appreciate your advice. Edited April 26 by hisapon (see edit history) 1 Link to comment Share on other sites More sharing options...
ps8modules Posted April 26 Share Posted April 26 (edited) Okay. If you can't find anything, I have a similar module that you need 😉 The image of the module shows hooks where you can insert a category description. Module: Add a category description to the product page Edited April 27 by ps8modules (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now