2016-01-31, 23:53:28
(This post was last modified: 2016-01-31, 23:56:52 by xrmarcis.
Edit Reason: add more details
)
(2016-01-31, 17:23:56)Bigin Wrote: Hi xrmarcis,
Try following:
PHP Code:$manager = new IManager();
$item = $manager->getItemClass();
// Initialize all the items of category 2
$item->init(2);
// To get your items on single field
$items = $item->getItems("single=1");
if($items)
{
foreach($items as $myitems)
{
echo '
<div class="row bottom-border">
<div class="c4"><strong>' .$myitems->name . '</strong><br />' .$myitems->fields->descr->value . '</div>
<div class="c2 text-center">$' .$myitems->fields->small->value . '</div>
<div class="c2 text-center">$' .$myitems->fields->medium->value . '</div>
<div class="c2 text-center">$' .$myitems->fields->large->value . '</div>
<div class="c2 text-center">$' .$myitems->fields->xlarge->value . '</div>
</div>
';
};
};
That should do the trick.
if you use $item->getItems() method, in case it's important that you use just $myitems, not $myitems->items. Because $item->getItems() returns an array of the item objects
That worked perfect i have an issue though with the not operator. I've tried != and <> but it does not seem to work. single is a checkbox field. Any suggestions?
PHP Code:
<?php
$manager = new IManager();
$catItems = $manager->getItemClass();
// Initialize all the items of category 2
$catItems->init(2);
$filteredCatItems = $catItems->getItems("single<>1");
if($filteredCatItems)
{
foreach($filteredCatItems as $menuItem)
{
echo'
<div class="row bottom-border">
<div class="c4"><strong>' .$menuItem->name . '</strong><br />' .$menuItem->fields->descr->value . '</div>
<div class="c2 text-center">$' .$menuItem->fields->small->value . '</div>
<div class="c2 text-center">$' .$menuItem->fields->medium->value . '</div>
<div class="c2 text-center">$' .$menuItem->fields->large->value . '</div>
<div class="c2 text-center">$' .$menuItem->fields->xlarge->value . '</div>
</div>
';
};
};
?>
Keeping it simple means making progress!!