Пример #1
0
 /**
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @return int|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->detectMagento($output, true);
     if ($input->getOption('format') === null) {
         $this->writeSection($output, 'Magento Categories');
     }
     $this->initMagento();
     $table = array();
     $table = \Creatuity\Magento\Util\CategoryUtil::getCategories();
     ksort($table);
     $this->getHelper('table')->setHeaders(array('Id', 'ParentId', 'Name', 'URL Key', 'URL', 'Path'))->renderByFormat($output, $table, $input->getOption('format'));
 }
Пример #2
0
 /**
  * Maps the category names into IDs
  */
 protected function _mapCategoryIds($categories, $categoryIds)
 {
     foreach ($categories as $catPath) {
         $catId = \Creatuity\Magento\Util\CategoryUtil::getCategoryIdByPath($catPath);
         if ($catId && !in_array($catId, $categoryIds)) {
             $categoryIds[] = $catId;
         }
     }
     return $categoryIds;
 }