Whispar1 Posted January 25, 2013 Share Posted January 25, 2013 (edited) For 1.5.3.1, is there a way to add a short description to sub category items? In other words have the short description for the sub-category on the category page and a longer description for the actual sub-category page? Edited April 10, 2013 by Whispar1 (see edit history) 1 Link to comment Share on other sites More sharing options...
Whispar1 Posted January 26, 2013 Author Share Posted January 26, 2013 To clarify - I would like to have the option to add a short description to (category and sub-category items) like you can with product descriptions... if that helps. Link to comment Share on other sites More sharing options...
PotionsFactory Posted January 28, 2013 Share Posted January 28, 2013 Inherently, no. I'd like to see this feature added, but, from the looks of it, PrestaShop doesn't seem to offer the ability natively. That said, this shouldn't be too hard to achieve. You would need to use overrides, namely AdminCategoryContoller and the Category Class. Within AdminCategoryController, you could target the __contruct method and renderForm to get the Short Description option to show while editing/creating a category. Obviously, you'd need to alter the database a bit to compensate for the new field. Assign the variable to Smarty and you should be able to call it in your template. I'll try to work on the overrides sometime this week. If I get this working, I'll post the code here for you. Cheers. 2 Link to comment Share on other sites More sharing options...
Whispar1 Posted January 28, 2013 Author Share Posted January 28, 2013 Thanks for the heads up - I can't spell PHP but I'll do some digging too. Link to comment Share on other sites More sharing options...
PotionsFactory Posted January 28, 2013 Share Posted January 28, 2013 I've started working on the module. You can see it here https://github.com/michaelkmartin/blockcategoryshortdesc I've got the override in place, but it still needs some cleanup. I should have it done later today or tomorrow morning. I'll let you know as soon as it done. Cheers 1 Link to comment Share on other sites More sharing options...
PotionsFactory Posted January 29, 2013 Share Posted January 29, 2013 So the Override Installation is having an issue, so you'll need to manually drop in /overrides/controllers/admin/AdminCategoriesController.php And /overrides/classes/Category.php To their respective override folders. The rest of the install should go smoothly, though. If you have SSH access/Git installed on your server, it'd be easier to CD to your modules directory and use git clone https://github.com/michaelkmartin/blockcategoryshortdesc.git I plan on making changes to the module as I clean it up, so it'd be easier for you to update. Once you've cloned and installed it, you'll see a new Short Description field in the Category Form. You can retrieve the data by using {$category->short_description} in your TPL file. That should be it, let me know if you run into any issues. 2 Link to comment Share on other sites More sharing options...
Whispar1 Posted January 29, 2013 Author Share Posted January 29, 2013 Thanks for the work you put into this. Because I don't know the back end stuff very well, do I just add module through the back office and manually ftp the override files into the folders as indicated above? Link to comment Share on other sites More sharing options...
PotionsFactory Posted January 29, 2013 Share Posted January 29, 2013 Right, the overrides will have to be uploaded manually. So the process should look like this. 1. Upload the blockcategoryshortdesc directory into your modules directory. 2. Log in to your Back Office and go to Modules. 3. Search for Category Short Descriptions and install the module. 4. Once installed, manually move the two override files into their respective directories in /override Once all of that is done, you can go into your BackOffice and see the new field at the bottom of the category form. Keep in mind, the override files probably already exist in your build. Assuming that you've never changed those files, you can simple overwrite them. Good luck and feel free to send me a PM if you run into any issues. I built that out a bit quickly so I may have missed something. 1 Link to comment Share on other sites More sharing options...
Krystian Podemski Posted January 30, 2013 Share Posted January 30, 2013 (edited) @PotionsFactory You can simplify Category class, like that: <?php class Category extends CategoryCore { public $short_description; public function __construct($id_category = null, $id_lang = null, $id_shop = null) { parent::__construct($id_category, $id_lang, $id_shop); self::$definition['fields']['short_description'] = array('type' => self::TYPE_HTML, 'shop' => false, 'validate' => 'isString'); } } Edited January 30, 2013 by Krystian Podemski (see edit history) Link to comment Share on other sites More sharing options...
PotionsFactory Posted January 30, 2013 Share Posted January 30, 2013 Awesome, thank you Krystian. I'll update the file on the next merge. Link to comment Share on other sites More sharing options...
Whispar1 Posted March 19, 2013 Author Share Posted March 19, 2013 Since PotionsFactory was kind enough to put this together for me, I have since launched the new site. The original module was written for the default theme and I could use a few pointers on how to implement it into the new live theme. Any direction would be appreciated Link to comment Share on other sites More sharing options...
Whispar1 Posted April 10, 2013 Author Share Posted April 10, 2013 Bump just in case someone else might see this =) I got the module working and displaying properly in the BO - just need to implement in FO category pages. Link to comment Share on other sites More sharing options...
Whispar1 Posted April 10, 2013 Author Share Posted April 10, 2013 Maybe a fresh set set of eyes will help My mod to category.tpl is as follows: {if $subcategory.short_description} <p class="cat_desc">{$subcategory.short_description}</p> {elseif $subcategory.description} <p class="cat_desc">{$subcategory.description}</p> {/if} Both overrides are in place. What am I missing?? Link to comment Share on other sites More sharing options...
projects Posted June 19, 2013 Share Posted June 19, 2013 (edited) Hey guys thanks for the module provided above, works perfectly and amazing that it's free. Just one question, at the same spot as Whispar1 above, if I use {$subcategory.short_description}it doesn't work but {$category->short_description}works great. I'm trying to get subcategory.short_description to work in category.tpl under subcategory for each list item so I can display some content before user clicks on the category link. Any ideas? Thanks again for the great solution. Edited June 19, 2013 by projects (see edit history) Link to comment Share on other sites More sharing options...
vatzyaya Posted March 5, 2016 Share Posted March 5, 2016 Hello! I tried to install this plugin on Prestashop 1.6.0.1 (Automatic install and manual install). With automatic install, Prestashop says "module installed" but I don't find the module in modules list. I'm very interested by this module Is this plugin not ready for 1.6? @PotionsFactory, do you want to install it on my website? I'll pay you of course. Regards. Link to comment Share on other sites More sharing options...
annaoomph Posted October 12, 2016 Share Posted October 12, 2016 (edited) If anyone's still interested in this module, I'll add a couple of words. Make sure you've done the following things: 1. Deleted the folder overrides/ from the module folder. 2. Deleted the file cache/classes-index.php after copying your overrides. 3. Copied the code of the functions you override from core classes and controllers since it can be changed already. Just don't forget to replace the necessary code. In Category.php file the necessary lines are: 'short_description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isString'), and public $short_description; In AdminCategoriesController they are $this->fields_form['input'][] = array('type' => 'textarea', 'label' => 'Short Description:', 'name' => 'short_description', 'lang' => true, 'rows' => 5, 'cols' => 100, ); return AdminController::renderForm(); Actually you can add the array definition a little bit earlier if you want the field to be displayed right after the Description field. Edited October 12, 2016 by annaoomph (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