lt635

Show category in portfolio list

24 posts in this topic

Hello,

I have a portfolio list with three different categories. I need to separate the list with the category heading so it lists like this:

Category name 1

listing

listing

listing

Category name 2

listing

listing

listing

Category name 3

listing

listing

listing

Also, I have been subscribing to your extensions for quite some time now. It has been a while since there has been any changes/improvements made to components like the portfolio, a component I like using. It would be good to see some more flexibility in menu options and also some new/different views for list and especially detailed view.

Thank you

Kind regards

Lene

Share this post


Link to post
Share on other sites

Hi Lene

I'm appreciate if you can give us your idea to improve BT Portfolio component.

With your requirement, let me give my solution.

First, open your current layout file, for example /components/com_bt_portfolio/themes/default/layout/list/default.php

you will see this code block


<?php if ($this->params->get('show_portcat', 1)): ?>
<div class="btp-list">
<?php
$i = 0;
$total = count($this->items);
if ($total) {
foreach ($this->items as $item) {
.....
}
}
....
[/CODE]

We will change this block to

[CODE]

<?php if ($this->params->get('show_portcat', 1)): ?>
<div class="btp-list">
<?php
$i = 0;
$total = count($this->items);
if ($total) {
$tmp = array();
foreach($this->items as $item){
if(!array_key_exists($item->category_id, $tmp)){
$tmp[$item->category_id] = new stdClass();
$tmp[$item->category_id]->name = $item->category_name;
$tmp[$item->category_id]->items = array();
}
$tmp[$item->category_id]->items[] = $item;
}
foreach($tmp as $category){
echo '<h4>' . $category->name . '</h4>';
foreach ($category->items as $item) {
.....
}
}
}
....

[/CODE]

You can see my sample file for detail.

default.zip

Share this post


Link to post
Share on other sites

Hi Trong,

Thanks for getting back to me.

I just copied in the file you attached. On the page I can see the line where the category header should be but it gives the following error and no category name is showing:

Notice: Undefined property: stdClass::$category_name in C:\xampp\htdocs\Websites\DavidOwens\ROI-Properties\roiproperties\components\com_bt_portfolio\themes\default\layout\list\default.php on line 90

Regarding the portfolio options, some other layouts would be great, it would make it a bit more flexible. Even adding the option to show category title in list view. I have applied to your email with a sample layout options that I think would be a great addition.

Your portfolio, media gallery and slideshow-pro are some of your extenstions that I use often, they are great.

Thank you

Kind regards

Lene

Share this post


Link to post
Share on other sites

Oh.

I'm stupid.

Please change category_name to category_title

$tmp[$item->category_id]->name = $item->category_name;

Correct:

$tmp[$item->category_id]->name = $item->category_title;

Share this post


Link to post
Share on other sites

Hi Trong,

One more... is there a way to change the 'back to list' link to take you back to the menu link that lists all categories and not just to the list in one of the categories?

Kind regards

Lene

Share this post


Link to post
Share on other sites

Hi Lene.

I'm sorry i don't know why i don't see your last requirement.

Please open file /components/com_bt_portfolio/themes/{current themes}/layout/detail/detail.php

Find this line

<a class="back" href="<?php echo JRoute::_("index.php?option=com_bt_portfolio&view=portfolios&catid=" . $this->category->id.':'.$this->category->alias) ?>"><?php echo JText::_('COM_BT_PORTFOLIO_BACK'); ?></a>

and change it to

<a class="back" href="<?php echo JRoute::_("index.php?option=com_bt_portfolio&view=portfolios") ?>"><?php echo JText::_('COM_BT_PORTFOLIO_BACK'); ?></a>

Share this post


Link to post
Share on other sites

Hi Trong,

Thank you for getting back to me.

I just tried this and at first I could not get it to work, then I turned off the 'search friendly url' and I got it working. Problem is, when I turn the 'search friendly url' back on it does not work anymore. Is there a way around this? I do need search friendly urls.

Thanks

Kind regards

Lene

Share this post


Link to post
Share on other sites

Hi Trong,

Sorry for taking so long to reply to this, the website is moving a bit slow....

I tried adding the actual page link from index.php but it still does the same. Maybe just wait until I get the site uploaded to a server so you can have a look at the actual link. I am still waiting for content so not sure when, I will get back in touch.

Thank you

Kind regards

Lene

Share this post


Link to post
Share on other sites

Hi Trong,

No, I have not solved it. I am waiting for some more information from my client before I finalise the website and upload it to a server. Once it is uploaded I will get back in touch. Probably easier to solve when you can see the pages and links. I will get back in touch once I have it uploaded.

Thank you

Kind regards

Lene

Share this post


Link to post
Share on other sites

Hello Trong,

I have been trying to work this link issue out. After trying this and that I think the issue is the Search Engine Friendly URLs. I set that to 'no' and it worked, but I really do need it to work with the Search Engine Friendly URLs.

We are just about to go live with this website so the url will then change to http://www.roiproperties.com.au/. When writing this message the url is: http://101.0.115.185/~roiprope/index.php/properties-projects

Thank you

Kind regards

Lene

Share this post


Link to post
Share on other sites

Hi Lene

I'm sorry for not supporting you in a long time.

Please use this solution to solve problem with Back to List button

Open file /com_bt_portfolio/themes/theme_name/layout/detail/detail.php

Find this line

<a class="back" href="<?php echo JRoute::_("index.php?option=com_bt_portfolio&view=portfolios&catid=" . $this->category->id . ':' . $this->category->alias) ?>"><?php echo JText::_('COM_BT_PORTFOLIO_BACK'); ?></a>\

change it to

<a class="back" href="<?php echo JRoute::_("index.php?option=com_bt_portfolio&view=portfolios") ?>"><?php echo JText::_('COM_BT_PORTFOLIO_BACK'); ?></a>

The link will redirect visitor to main list page instead of category's portfolio list page

Share this post


Link to post
Share on other sites

Hello Trong,

Thank you for getting back to me.

That is what I have in place but it only works if I have the search engine friendly url's turned off, it does not work with it on.

I need a solution that works with search engine friendly url's.

Kind regards

Lene

Share this post


Link to post
Share on other sites

Hi Lene,

I replied you on ticket, let me copy my message to here for everyone who has same problem

With first problem, It is a jquery conflict, please try this option

Open file components/com_bt_portfolio/helpers/helper.php, find this code

$loadJquery = true;

foreach ($header['scripts'] as $scriptName => $scriptData) {

if (substr_count($scriptName, '/jquery')) {

$loadJquery = false;

break;

}

}

if ($loadJquery) {

$document->addScript(JURI::root() . 'components/com_bt_portfolio/assets/js/jquery.min.js');

}

and change it to

if(version_compare(JVERSION, '3.0', 'ge')){

JHtml::_('jquery.framework');

}else {

//put old code to here

}

2. I have a question, what type do you set for your menu item "Properties and Projects"

Please try to copy it pure link and use it to replace the url in the code i gave you.

http://prntscr.com/8dho6s

Share this post


Link to post
Share on other sites