Exemplo n.º 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'));
 }
Exemplo n.º 2
0
 /**
  * Maps the category IDs into category names
  */
 protected function _mapCategories($categoryIds, $categories)
 {
     // Get all the categories
     $allCategories = \Creatuity\Magento\Util\CategoryUtil::getCategories();
     // If we had null for the categoryIds, we're going to grab all of them
     // This is to support random generator's default behavior of all,
     // where the simple and sequence generators default to none
     if ($categoryIds == null) {
         $categoryIds = array_keys($allCategories);
     }
     foreach ($categoryIds as $catId) {
         $catPath = isset($allCategories[$catId]) ? $allCategories[$catId]['path'] : null;
         if ($catPath && !in_array($catPath, $categories)) {
             $categories[] = $catPath;
         }
     }
     return $categories;
 }