2020-04-27, 00:52:33
Hi Bigin,
Thanks a lot for your reply and clear explanation about the difference between
"Item" object and "SimpleItem" object.
I followed your instruction and replaced my code with:
And immediately I have my code working here:
Thanks again, I start to understand it better now
Although I used $itemMapper->init(2);
instead of
$itemMapper->alloc(2);
Is there a difference between init and alloc ?
Thanks a lot for your reply and clear explanation about the difference between
"Item" object and "SimpleItem" object.
I followed your instruction and replaced my code with:
Code:
echo $item->fields->text->value
And immediately I have my code working here:
Code:
<?php
$imanager = imanager();
$itemMapper = $imanager->getItemMapper();
$itemMapper->init(2); // Category: 2 | Item: 2147483647 an Item can have a name number and an id number ?
$items = $itemMapper->items;
foreach($items as $item) {
echo $item->name . "<br>"; // $item->name = item name or id Category 2 has 1 item with name = 3052675811 and id = 2147483647 ?
echo $item->fields->text->value . "<br>"; // $item->name = category name or id
}
echo "<br>";
$my_item = $itemMapper->getItem('name= 3052675811'); // search for a specific item
echo $my_item->fields->text->value . "<br>";
?>
Thanks again, I start to understand it better now
Although I used $itemMapper->init(2);
instead of
$itemMapper->alloc(2);
Is there a difference between init and alloc ?