Jump to content


Photo
- - - - -

Favorite template

favorite

Best Answer atulvin , 25 February 2014 - 11:32

Hi SmetDenis,

 

Wow! that was great. Now this appears perfect and the mail is sent as it should.

 

Thanks a lot.

 

Atul

Go to the full post


  • This topic is locked This topic is locked
7 replies to this topic

#1 atulvin

atulvin
  • JBZoo User
  • User rate: 0
  • posts: 10
  • topics: 5

Posted 18 February 2014 - 16:18

Hi,

 

I am using the "Table item" type for listing a database. I am using its teaser template for front page view. What is the method to recreate the "Teaser" format for "Favorite" view?

 

Thanks

 

Atul


Edited by atulvin, 18 February 2014 - 16:19.

  • 0

#2 Kess

Kess
  • JBZoo User (rus)
  • User rate: 11.9
  • posts: 406
  • topics: 40

Posted 20 February 2014 - 02:51

Hello,

 

First, I think it will be helpful to read the topics about adding layouts and customization.

 

I'll describe an example of making this for the "Table or Database" section of the demo website.

 

The alias of that application is "database" and the aliases of its items is "dbrecord". 

 

I'll make the favorite view almost the same as teaser but with a button to remove from favorites.

 

So I made a copy of media/zoo/applications/jbuniversal/templates/catalog/renderer/favorite/_default.php and named it database.php. I edited this new file by adding table there and replacing div with tr. Also I wrapped "remove" button in a td:

<?php
/**
 * JBZoo App is universal Joomla CCK, application for YooTheme Zoo component
 *
 * @package     jbzoo
 * @version     2.x Pro
 * @author      JBZoo App http://jbzoo.com
 * @copyright   Copyright (C) JBZoo.com,  All rights reserved.
 * @license     http://jbzoo.com/license-pro.php JBZoo Licence
 * @coder       Denis Smetannikov <denis@jbzoo.com>
 */

// no direct access
defined('_JEXEC') or die('Restricted access');


$view = $this->getView();

$this->app->jbassets->initJBFavorite();

if (count($vars['objects'])) {
echo '<table>';
echo '<tbody>';
    foreach ($vars['objects'] as $id => $item) {

        $layout = $this->app->jblayout->_getItemLayout($item, 'favorite');

        echo '<tr class="jsJBZooFavorite favorite-item-wrapper rborder item-' . $item->id . '">';

        echo $view->renderer->render($layout, array(
            'view' => $view,
            'item' => $item
        ));

        echo '<td><a class="jbbutton jsJBZooFavoriteRemove" href="' . $this->app->jbrouter->favoriteRemoveItem($item->id) . '" '
            . ' title="' . JText::_('JBZOO_FAVORITE_REMOVE_ITEM') . '">' . JText::_('JBZOO_FAVORITE_REMOVE') . '</a></td>';

        echo '</tr>';
    }
echo '</table>';
echo '</tbody>';
} else {
    echo JText::_('JBZOO_FAVORITE_EMPTY');
}

Then I made a "favorite" layout for the "table item" type. You can read about this in a topic I linked above. I copied positions settings and the template file from the "teaser" layout. But now we need to modify this new media/zoo/applications/jbuniversal/templates/catalog/renderer/item/dbrecord/favorite.php by removing tr:

<?php
/**
 * JBZoo App is universal Joomla CCK, application for YooTheme Zoo component
 *
 * @package     jbzoo
 * @version     2.x Pro
 * @author      JBZoo App http://jbzoo.com
 * @copyright   Copyright (C) JBZoo.com,  All rights reserved.
 * @license     http://jbzoo.com/license-pro.php JBZoo Licence
 * @coder       Denis Smetannikov <denis@jbzoo.com>
 */

// no direct access
defined('_JEXEC') or die('Restricted access');


?>


    <td><?php echo $this->renderPosition('cell1'); ?></td>
    <td><?php
        if ($html = $this->renderPosition('cell2')) {
            echo $html;
        } else {
            echo ' - ';
        }
        ?></td>
    <td><?php echo $this->renderPosition('cell3'); ?></td>
    <td><?php echo $this->renderPosition('cell4'); ?></td>
    <td><?php echo $this->renderPosition('cell5'); ?></td>
    <td><?php echo $this->renderPosition('cell6'); ?></td>
    <td><?php echo $this->renderPosition('cell7'); ?></td>
    <td><?php echo $this->renderPosition('cell8'); ?></td>

So now the structure of the favorites view is almost the same as the teaser view. Some minor CSS changes might be needed depending on your website template.


Edited by Kess, 20 February 2014 - 02:52.

  • 0

#3 atulvin

atulvin
  • Topic Starter
  • JBZoo User
  • User rate: 0
  • posts: 10
  • topics: 5

Posted 21 February 2014 - 03:49

Hi Kess,

 

Thanks a lot. That was just great. You made it so simple. Though I am just a beginner in PHP it took me less than 30 min. to set it along with proper css. Actually it's almost the last stage of the project and really saved my day. My next issue pertaining to this is that the same page has to be emailed with just a button saying SEND this favorite list to Admin. I had achieved this with the component flexicontent favorites as seen in the attached file using output buffering. But am unable to achieve the same in this case.

 

Attached is the jbzoo file which includes the form code.

 

The path is media/zoo/applications/jbuniversal/templates/catalog/renderer/favorite/database.php

 

Any help on this is greatly appreciated or you can suggest another method that I can try.

 

Thanks again.

 

Atul

 

 

 

 

Attached Files


  • 0

#4 atulvin

atulvin
  • Topic Starter
  • JBZoo User
  • User rate: 0
  • posts: 10
  • topics: 5

Posted 24 February 2014 - 10:20

Hi Kess,

 

For your reference : the path for flexicontent file mentioned herein is

 

components/com_flexicontent/views/favourites/tmpl/default.php

 

 

Thanks

 

Atul


  • 0

#5 SmetDenis

SmetDenis
  • Administrators
  • User rate: 139.4
  • posts: 16232
  • topics: 200

Posted 24 February 2014 - 19:50

Hi , atulvin

 

I saw your files for submit favorite table, and I didn't find any errors there.

Could you tell me, please. What is error appeared when you try to submit the form?

 

Thanks.


  • 0
JBZoo v4.0 и новый чудный мир Open Source GPL
Отключайте проверку лицензий как можно скорее!



— Есть два типа людей: Кто еще не делает бекапы и кто уже делает бекапы.


#6 atulvin

atulvin
  • Topic Starter
  • JBZoo User
  • User rate: 0
  • posts: 10
  • topics: 5

Posted 25 February 2014 - 02:50

Hi,

 

Thanks for the update.

 

When the form code is applied, the template breaks and the list is shown without the form submit button etc.

I have attached the screen shot of the jbzoo file without and with the form code in place.

 

 

Thanks and Regards,

 

Atul

Attached Thumbnails

  • error_when_form_code-_is_applied.jpg
  • with-the-original-jbzoo-file--without-the-form-code.jpg

  • 0

#7 SmetDenis

SmetDenis
  • Administrators
  • User rate: 139.4
  • posts: 16232
  • topics: 200

Posted 25 February 2014 - 06:49

Hi

Try to replace this code
c27_200x0.png

to
$config = new JConfig();
$sender = array($config->mailfrom, $config->fromname);

  • 0
JBZoo v4.0 и новый чудный мир Open Source GPL
Отключайте проверку лицензий как можно скорее!



— Есть два типа людей: Кто еще не делает бекапы и кто уже делает бекапы.


#8 atulvin

atulvin
  • Topic Starter
  • JBZoo User
  • User rate: 0
  • posts: 10
  • topics: 5

Posted 25 February 2014 - 11:32   Best Answer

Hi SmetDenis,

 

Wow! that was great. Now this appears perfect and the mail is sent as it should.

 

Thanks a lot.

 

Atul


  • 0





Click to return to top of page in style!