Exemple #1
0
 /**
  * Adds the data from the given object to the item
  *
  * @param \Aimeos\MShop\Common\Manager\Iface $manager Manager object
  * @param \Aimeos\MShop\Common\Item\Iface $item Item object to add the data to
  * @param \stdClass $data Object with "attributes" property
  * @param string $domain Domain of the type item
  * @return \Aimeos\MShop\Common\Item\Iface Item including the data
  */
 protected function addItemData(\Aimeos\MShop\Common\Manager\Iface $manager, \Aimeos\MShop\Common\Item\Iface $item, \stdClass $data, $domain)
 {
     if (isset($data->attributes)) {
         $attr = (array) $data->attributes;
         $key = str_replace('/', '.', $item->getResourceType());
         if (isset($attr[$key . '.type'])) {
             $typeItem = $manager->getSubManager('type')->findItem($attr[$key . '.type'], array(), $domain);
             $attr[$key . '.typeid'] = $typeItem->getId();
         }
         $item->fromArray($attr);
     }
     return $item;
 }
Exemple #2
0
 /**
  * Adds expire date and tags for a single item.
  *
  * @param \Aimeos\MShop\Common\Item\Iface $item Item, maybe with associated list items
  * @param array &$expires Will contain the list of expiration dates
  * @param array &$tags List of tags the new tags will be added to
  * @param boolean $tagAll True of tags for all items should be added, false if only for the main item
  */
 private function addMetaItemSingle(\Aimeos\MShop\Common\Item\Iface $item, array &$expires, array &$tags, $tagAll)
 {
     $domain = str_replace('/', '_', $item->getResourceType());
     // maximum compatiblity
     if ($tagAll === true) {
         $tags[] = $domain . '-' . $item->getId();
     } else {
         $tags[] = $domain;
     }
     if ($item instanceof \Aimeos\MShop\Common\Item\Time\Iface && ($date = $item->getDateEnd()) !== null) {
         $expires[] = $date;
     }
 }