/**
  * Prepare page object
  *
  * @param array $data
  * @return \Magento\Framework\DataObject
  */
 protected function _prepareObject(array $data)
 {
     $object = new \Magento\Framework\DataObject();
     $object->setId($data[$this->getIdFieldName()]);
     $object->setUrl($data['url']);
     $object->setUpdatedAt($data['updated_at']);
     return $object;
 }
 /**
  * Add new massaction item
  *
  * Item array to be passed in looks like:
  * $item = array(
  *      'label'    => string,
  *      'complete' => string, // Only for ajax enabled grid (optional)
  *      'url'      => string,
  *      'confirm'  => string, // text of confirmation of this action (optional)
  *      'additional' => string // (optional)
  * );
  *
  * @param string $itemId
  * @param array|\Magento\Framework\DataObject $item
  * @return $this
  */
 public function addItem($itemId, $item)
 {
     if (is_array($item)) {
         $item = new \Magento\Framework\DataObject($item);
     }
     if ($item instanceof \Magento\Framework\DataObject) {
         $item->setId($itemId);
         $item->setUrl($this->getUrl($item->getUrl()));
         $this->_items[$itemId] = $item;
     }
     return $this;
 }
Beispiel #3
0
 /**
  * Returns special download params (if needed) for custom option with type = 'file'.
  * Needed to implement \Magento\Catalog\Model\Product\Configuration\Item\Interface.
  *
  * We have to customize only controller url, so return it.
  *
  * @return null|\Magento\Framework\DataObject
  */
 public function getFileDownloadParams()
 {
     $params = new \Magento\Framework\DataObject();
     $params->setUrl($this->_customOptionDownloadUrl);
     return $params;
 }
Beispiel #4
0
 /**
  * Prepare category
  *
  * @param array $categoryRow
  * @return \Magento\Framework\DataObject
  */
 protected function _prepareCategory(array $categoryRow)
 {
     $category = new \Magento\Framework\DataObject();
     $category->setId($categoryRow[$this->getIdFieldName()]);
     $categoryUrl = !empty($categoryRow['url']) ? $categoryRow['url'] : 'catalog/category/view/id/' . $category->getId();
     $category->setUrl($categoryUrl);
     $category->setUpdatedAt($categoryRow['updated_at']);
     return $category;
 }
 protected function _parseResponse()
 {
     if ($this->isResponseParsed) {
         return;
     }
     $response = $this->_getResponse();
     if (!isset($response->QwiserSearchResults->QueryConcepts)) {
         $this->isResponseParsed = true;
         return;
     }
     foreach ($response->QwiserSearchResults->QueryConcepts->children() as $concept) {
         if (!isset($concept->DynamicProperties)) {
             continue;
         }
         $params = new \Magento\Framework\DataObject();
         foreach ($concept->DynamicProperties->children() as $property) {
             $value = $property->getAttribute('value');
             switch ($property->getAttribute('name')) {
                 case 'banner image':
                     $params->setImageUrl($value);
                     $this->bannerImage = $params;
                     break;
                 case 'banner landing page':
                     $params->setUrl($value);
                     $this->bannerImage = $params;
                     break;
                 case 'start datetime':
                     $params->setStartDatetime($value);
                     break;
                 case 'end datetime':
                     $params->setEndDatetime($value);
                     break;
             }
         }
     }
     $this->isResponseParsed = true;
 }