Пример #1
0
 /**
  * @param \Magento\Catalog\Api\Data\ProductInterface $product
  * @return \Magento\Bundle\Api\Data\OptionInterface[]
  */
 public function getItems(\Magento\Catalog\Api\Data\ProductInterface $product)
 {
     $optionCollection = $this->type->getOptionsCollection($product);
     $optionList = [];
     /** @var \Magento\Bundle\Model\Option $option */
     foreach ($optionCollection as $option) {
         $productLinks = $this->linkList->getItems($product, $option->getOptionId());
         /** @var \Magento\Bundle\Api\Data\OptionInterface $optionDataObject */
         $optionDataObject = $this->optionFactory->create();
         $this->dataObjectHelper->populateWithArray($optionDataObject, $option->getData(), '\\Magento\\Bundle\\Api\\Data\\OptionInterface');
         $optionDataObject->setOptionId($option->getOptionId())->setTitle($option->getTitle() === null ? $option->getDefaultTitle() : $option->getTitle())->setSku($product->getSku())->setProductLinks($productLinks);
         $optionList[] = $optionDataObject;
     }
     return $optionList;
 }
Пример #2
0
 public function testLinksList()
 {
     $optionId = 665;
     $this->productTypeMock->expects($this->once())->method('getSelectionsCollection')->with([$optionId], $this->productMock)->willReturn([$this->selectionMock]);
     $this->productMock->expects($this->exactly(2))->method('getPriceType')->willReturn('price_type');
     $this->selectionMock->expects($this->once())->method('getSelectionPriceType')->willReturn('selection_price_type');
     $this->selectionMock->expects($this->once())->method('getSelectionPriceValue')->willReturn(12);
     $this->selectionMock->expects($this->once())->method('getData')->willReturn(['some data']);
     $this->selectionMock->expects($this->once())->method('getIsDefault')->willReturn(true);
     $this->selectionMock->expects($this->once())->method('getSelectionQty')->willReturn(66);
     $this->selectionMock->expects($this->once())->method('getSelectionCanChangeQty')->willReturn(22);
     $this->linkBuilderMock->expects($this->once())->method('populateWithArray')->with(['some data'])->willReturnSelf();
     $this->linkBuilderMock->expects($this->once())->method('setIsDefault')->with(true)->willReturnSelf();
     $this->linkBuilderMock->expects($this->once())->method('setQty')->with(66)->willReturnSelf();
     $this->linkBuilderMock->expects($this->once())->method('setIsDefined')->with(22)->willReturnSelf();
     $this->linkBuilderMock->expects($this->once())->method('setPrice')->with(12)->willReturnSelf();
     $this->linkBuilderMock->expects($this->once())->method('setPriceType')->with('selection_price_type')->willReturnSelf();
     $this->linkBuilderMock->expects($this->once())->method('create')->willReturnSelf();
     $this->assertEquals([$this->linkBuilderMock], $this->model->getItems($this->productMock, $optionId));
 }
Пример #3
0
<?php

$smarty->assign("TEXT_VAR", $this->_out["text"]);
$smarty->assign("TITLE", $this->_out["title"]);
$menu = new LinksList($this->_arr["id"]);
$smarty->assign("MENU", $menu->makeMenu());
$smarty->assign("CHILDREN_MENU", $menu->getMenuChildren());
$smarty->assign("PATH", $menu->getPath());
$subSections = $menu->getSubSection();
$smarty->assign("SUB_SECTIONS", $subSections);
Пример #4
0
 /**
  * Отображает сайт на главном шаблоне
  * 
  * @param Sring $templatePath Выводимый модуль в папке engine/templates
  */
 public function view($templatePath)
 {
     $smarty = new SmartyExst();
     //$smarty->caching=true;
     //$smarty->debugging=true;
     //var_dump($out);
     $smarty->assign("TEXT_VAR", $this->_out["text"]);
     $smarty->assign("TITLE", $this->_out["title"]);
     $menu = new LinksList($this->_arr["id"]);
     $smarty->assign("MENU", $menu->makeMenu());
     $smarty->assign("CHILDREN_MENU", $menu->getMenuChildren());
     $smarty->assign("PATH", $menu->getPath());
     $subSections = $menu->getSubSection();
     $smarty->assign("SUB_SECTIONS", $subSections);
     try {
         $smarty->display($templatePath);
     } catch (Exception $ex) {
         echo "PROBLEM SMARTY >> KERNEL >> Can't load {$templatePath}";
     }
 }