Selbsterstelltes Plugin funktioniert nicht

Hallo liebe Community,

ich habe gerade das Tutorial „Example Plugin“ beendet und kann nun weder den Plugin-Manager starten, noch den Cache leeren. Falls es sich um ein Syntaxfehler handelt kann ich ihn leider nicht finden oder habe ich vielleicht falsche Dateipfade verwendet?

 

bearbeitete Quellen in 

+ /engine/Shopware/Plugins/Local/Frontend/SystemPlugin/

 

  • Bootstrap.php

    subscribeEvent(
    „Enlight_Bootstrap_InitResource_shopware_frontend.seo_category_service“,
    „registerSeoCategoryService“
    );

      	$this->subscribeEvent(
      		"Enlight_Bootstrap_AfterInitResource_shopware_frontend.list_product_service",
      		"registerListProductService"
      	);
      	
      	$this->subscribeEvent(
      		"Enlight_Contoller_Action_PostDispatchSecure_Frontend",
      		"addTemplateDir"
      	);
      	
      	$this->subscribeEvent(
      		"Enlight_Contoller_Action_PostDispatchSecure_Widgets",
      		"addTemplateDir"
      	);
      	
      	$this->subscribeEvent(
      		"Theme_Compiler_Collect_Plugin_Less",
      		"onCollectLessFiles"
      	);
      	
      	return true;
      }
      
      public function afterInit(){
      	$this->get("Loader")->registerNamespace("ShopwarePlugins\SystemPlugin", $this->Path());
      }
      
      # @return \Shopware\Components\Theme\LessDefinition
      public function onCollectLessFiles(){
      	return new \Shopware\Components\Theme\LessDefinition([], [__DIR__. "/Views/frontend/_public/src/less/all.less]");
      }
      
      public function addTemplateDir(){
      	Shopware()->Container()->get("template")->addTemplateDir($this->Path() . "Views/");
      }
      
      public function registerSeoCategoryService(){
      	$seoCategoryService = new SeoCategoryService(
      		Shopware()->Container()->get("dbal_connection"),
      		Shopware()->Container()->get("shopware_storefront.category_service")
      	);
      	Shopware()->Container()->set("shopware_storefront.seo_category_service", $seoCategoryService);
      }
      
      public function registerListProductService(){
      	Shopware()->Container()->set(
      		"shopware_storefront.list_product_service",
      		new ListProductService(
      			Shopware()->Container()->get("shopware_storefront.list_product_service"),
      			Shopware()->Container()->get("shopware_storefront.seo_category_service")
      		)
      	);
      }
    

    }

    ?>

 

  • StoreFrontBundle/ListProductService.php

    service = $service;
    $this->seoCategoryService = $seoCategoryService;
    }

      # @inheritdoc
      public function getList(array $numbers, Struct\ProductContextInterface $context){
      	$products = $this->service->getList($numbers, $context);
      	$categories = $this->seoCategoryService->getList($products, $context);
      	
      	# @var $product Struct\ListProduct*\
      	foreach($products as $product){
      		$productId = $product->getId();
      		if(!isset($categories[$productId])){
      			continue;
      		}
      		$attribute = new Struct\Attribute(["category" => $categories[$productId]]);
      		$product->addAttribute("system_plugin", $attribute);
      	}
      	return $products;
      }
      
      # @inheritdoc
      public function get($number, Struct\ProductContextInterface $context){
      	$products = $this->getList([$number], $context);
      	return array_shift($products);
      }
    

    }

    ?>

 

- StoreFrontBundle/SeoCategoryService.php

connection = $connection;
		$this->categoryService = $categoryService;
	}
	
	# @param ListProduct[] $listProducts
	# @param ShopContextInterface $context
	# @return Category[] $indexed by product id
	public function getList($listProducts, ShopContextInterface $context){
		$ids = array_map(function(ListProduct $product){
			return $product->getId();
		}, $listProducts);
		
		# select all SEO category ids, indexed by product id
		$ids = $this->getCategoryIds($ids, $context);
		
		# now select all category data for the selected ids
		$categories = $this->categoryService->getList($ids, $context);
		
		$result = [];
		foreach($ids as $productId => $categoryId){
			if(!isset($categories[$categoryId])){
				continue;
			}
			$result[$productId] = $categories[$categoryId];
		}
		
		return $result;
	}
	
	# @param ids
	# @param $context
	public function getCategoryIds($ids, ShopContextInterface $context){
		$query = $this->connection->createQueryBuilder();
		$query
			->select('seoCategories.article_id', 'seoCategories.category_id')
			->from('s_articles_categories_seo', 'seoCategories')
			->andWhere('seoCategories.article_id IN (:productIds)')
			->andWhere('seoCategories.shop_id = :shopId')
			->setParameter(':shopId', $context->getShop()->getId())
			->setParameter('_productIds', $ids, Connection::PARAM_INT_ARRAY);
		return $query->execute()->fetchAll(\PDO::FETCH_KEY_PAIR);
	}
}

?>

 

  • Views/frontend/detail/actions.tpl

    {extends file=„parent:frontend/detail/actions.tpl“}

    {block name=‚frontend_detail_actions_voucher‘ append}
    {if $sArticle.attributes.system_plugin}
    {$seoAttribute = $sArticle.attributes.system_plugin}
    {include file=„frontend/system_plugin/detail-link.tpl“ seoCategory=$seoAttribute->get(‚category‘)}
    {/if}
    {/block}

 

  • Views/frontend/listing/product-box/product-badges.tpl

    {extends file=„parent:frontend/listing/product-box/product-badges.tpl“}

    {block name=„frontend_listing_box_article_new“ append}
    {if $sArticle.attributes.system_plugin}
    {$seoAttribute = $sArticle.attributes.system_plugin}

          {include file="frontend/system_plugin/listing-badge.tpl" seoCategory=$seoAttribute->get('category')}
      {/if}
    

    {/block}

 

  • Views/frontend/system_plugin/detail-link.tpl

    {block name=„frontend_system_plugin_detail_link“}

          {block name="frontend_system_plugin_detail_link_icon"}
              
          {/block}
    
          {block name="frontend_system_plugin_detail_link_text"}
              {$seoCategory->getName()}
          {/block}
    

    {/block}

 

  • Views/frontend/system_plugin/listing-badge.tpl

    {block name=„frontend_system_plugin_listing_badge“}

          {block name="frontend_system_plugin_listing_badge_category"}
              {$seoCategory->getName()}
          {/block}
    

    {/block}

 

  • Views/frontend/_public/src/less/all.less

    .badge–seo-category {
    color: #fff;
    background: #000;
    }

 

+ /theme/Frontend/Theme/

  • Theme.php

    createTab(‘ecomai_theme’, ‘ecomai theme’);
    $container->addTab($tab);

          $fieldSet = $this->createFieldSet('ecomai_theme_field_set', 'Badge configuration');
    
          $fieldSet->addElement(
              $this->createColorPickerField('badge-seo-category-bg', 'Background seo category badge', '#e74c3c')
          );
          $fieldSet->addElement(
              $this->createColorPickerField('badge-seo-category-color', 'Color seo category badge', '#fff')
          );
    
          $tab->addElement($fieldSet);
      }
    

    }

    ?>

 

  • frontend/system_plugin/detail-link.tpl

    {extends file=“parent:frontend/system_plugin/detail-link.tpl”}

    {block name=“frontend_system_plugin_detail_link_icon” extends}

    {/block}

 

  • frontend/system_plugin/listing-badge.tpl

    {extends file=“parent:frontend/system_plugin/listing-badge.tpl”}

    {block name=“frontend_system_plugin_listing_badge_category”}
    From {$seoCategory->getName()}
    {/block}

 

  • frontend/_public/src/less/all.less

    .badge–seo-category {
    color: @badge-seo-category-color;
    background: @badge-seo-category-bg;
    }

 

 

Ich würde mich sehr über eine Antwort freuen, denn ich weiß ehrlich nicht woran es scheitert.

Freundliche Grüße,
​Julian