PDA

View Full Version : smarty code for sub category links



Pete Young
February 23, 2013, 01:08 PM
Is there a way i can grab some smarty code for sub categories ? and add it to a box please

if so how would I write the smarty for a category then say for a sub category ?

category = pets
sub category = pets / dogs & Cats

Viktor
February 25, 2013, 05:24 AM
Hello Pete,

DO you want to show subcategories for pets only?
And where do you want to show subcategories? I mean what page home or may be on other pages too?

Pete Young
February 25, 2013, 10:27 AM
Hello Pete,

DO you want to show subcategories for pets only?
And where do you want to show subcategories? I mean what page home or may be on other pages too?

Pets was an example, it could be any category or subcategory and i want to add it to a box, / i want to crete left sided boxes not top and bottom and i do not want all of the uppercase stuff as well just like it shown on the home page but in a box that i can place on the side or anywhere I want, I can do it the slow manual way but if there was a way to add some code to a box i would rather do that.

Thanks
Pete

2kiran Vinjamuri
May 8, 2013, 03:22 AM
I have a similar requirement, can anyone please share how this is done?

Thanks
Surya

Viktor
May 8, 2013, 04:37 AM
Hello all,

I show you example on general script. I take categories from Books parent category.

go to ftp://includes>>controllers>>common.inc.php

find code:



/* get listing type key (on listing type pages only) */
if ( false !== strpos($page_info['Key'], 'lt_') )
{
$listing_type_key = str_replace('lt_', '', $page_info['Key']);
}


and after it add new:



if(array_key_exists('my_new_block_key_for_categori es', $block_keys))
{
$new_custom_categories = $rlCategories -> getCategories(1, 'listings');
print_r($new_custom_categories);
$rlSmarty -> assign_by_ref('new_custom_categories', $new_custom_categories);
}


where 'my_new_block_key_for_categories' - it will be our new block with this key. (you ay write any like you want but block key and this key should be same)
'getCategories(1, 'listings'); 1- it's ID for Books category you can find ID for your category in DB -> fl_categories table
'listings' - it's category type you can see it in DB -> fl_categories table too.

Then go to Admin Panel >> Content Boxes click add new content box button.

Key - my_new_block_key_for_categories
Name - like you want
Position like you want
Type - Smarty
Content - {include file='blocks'|cat:$smarty.const.RL_DS|cat:'categor ies.tpl' categories=$new_custom_categories}
Show on pages - like you want
Enable a box style - no; because categories.tpl already exist box style.
and click save

then you can check it in Front end :) Good luck.