Page 1 of 1

Display list of categories ?

Posted: 19 Jul 2017, 12:12
by Zaheer Abbas
I had created a html template and now i am going to convert it in laravel with your package .
I want to display a list of categories in menu but when add below code to display categories in app.blade.php it shows an error that

(4/4) ErrorException
Undefined variable: enc (View: D:\xampp\htdocs\myproject\resources\views\app.blade.php) (View: D:\xampp\htdocs\myproject\resources\views\app.blade.php) (View: D:\xampp\htdocs\myproject\resources\views\app.blade.php)


<ul class="level-<?= $enc->attr( $level ); ?>">
<?php foreach( $this->get( 'nodes', [] ) as $item ) : ?>
<?php if( $item->getStatus() > 0 ) : ?>

<?php $id = $item->getId(); $config = $item->getConfig(); ?>
<?php $params['f_name'] = $item->getName( 'url' ); $params['f_catid'] = $id; ?>
<?php $class = ( $item->hasChildren() ? ' withchild' : ' nochild' ) . ( isset( $path[$id] ) ? ' active' : '' ); ?>
<?php $class .= ' catcode-' . $item->getCode() . ( isset( $config['css-class'] ) ? ' ' . $config['css-class'] : '' ); ?>

<li class="cat-item catid-<?= $enc->attr( $id . $class ); ?>" data-id="<?= $id; ?>" >

<a class="cat-item" href="<?= $enc->attr( $this->url( ( $item->getTarget() ?: $target ), $controller, $action, $params, [], $config ) ); ?>"><!--
--><div class="media-list"><!--

<?php foreach( $item->getListItems( 'media', 'icon' ) as $listItem ) : ?>
<?php if( ( $mediaItem = $listItem->getRefItem() ) !== null ) : ?>
<?= '-->' . $this->partial(
$this->config( 'client/html/common/partials/media', 'common/partials/media-default.php' ),
array( 'item' => $mediaItem, 'boxAttributes' => array( 'class' => 'media-item' ) )
) . '<!--'; ?>
<?php endif; ?>
<?php endforeach; ?>

--></div><!--
--><span class="cat-name"><?= $enc->html( $item->getName(), $enc::TRUST ); ?></span><!--
--></a>

<?php if( count( $item->getChildren() ) > 0 ) : ?>
<?php $values = array( 'nodes' => $item->getChildren(), 'path' => $path, 'params' => $params, 'level' => $level + 1 ); ?>
<?= $this->partial( $this->config( 'client/html/catalog/filter/partials/tree', 'catalog/filter/tree-default.php' ), $values ); ?>
<?php endif; ?>

</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>

In short i want to display categories , products in with my own design template. :|

Re: Display list of categories ?

Posted: 19 Jul 2017, 14:49
by aimeos
The easiest way is to add the output of "catalog/filter" inside your menu (no the whole code that generates the tree) and configure to display only the categories section only.

Code: Select all

<?= $aibody['catalog/filter'] ?>

Re: Display list of categories ?

Posted: 27 Dec 2018, 07:40
by hihaider196
Hi All,
I am using header footer in your package, i am having problem in dropdown categories in my header, i have categories in my database which i have added through admin UI. Can you please tell me, to get that what should i include or exclude from which file along with path. I am new in Laravel so i need your help in Detail(as soon as possible), I shall be very thankful to you for this favor and AIMEOS IS GREAT.

Thankyou.

Re: Display list of categories ?

Posted: 27 Dec 2018, 12:42
by aimeos
It's unclear what you want to achieve. Can you please go into more details maybe with an example?

Re: Display list of categories ?

Posted: 31 Dec 2018, 06:07
by hihaider196
Hi
Can't see pictures of products on my live website,
Can you please tell me how to remove Public from live URLs
and Please tell me where to edit the admin portal?

Re: Display list of categories ?

Posted: 01 Jan 2019, 11:08
by aimeos
The Laravel "public" directory has to be the document root of your web site