Warning: The magic method Math_Captcha::__wakeup() must have public visibility in /usr/www/users/seowme/siekiera-online.de/wp-content/plugins/wp-math-captcha/wp-math-captcha.php on line 87

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/seowme/siekiera-online.de/wp-content/plugins/wp-math-captcha/wp-math-captcha.php:87) in /usr/www/users/seowme/siekiera-online.de/wp-content/plugins/wp-math-captcha/includes/class-cookie-session.php on line 46

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/seowme/siekiera-online.de/wp-content/plugins/wp-math-captcha/wp-math-captcha.php:87) in /usr/www/users/seowme/siekiera-online.de/wp-content/plugins/wp-math-captcha/includes/class-cookie-session.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/seowme/siekiera-online.de/wp-content/plugins/wp-math-captcha/wp-math-captcha.php:87) in /usr/www/users/seowme/siekiera-online.de/wp-content/plugins/wp-math-captcha/includes/class-cookie-session.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/seowme/siekiera-online.de/wp-content/plugins/wp-math-captcha/wp-math-captcha.php:87) in /usr/www/users/seowme/siekiera-online.de/wp-content/plugins/wp-math-captcha/includes/class-cookie-session.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/seowme/siekiera-online.de/wp-content/plugins/wp-math-captcha/wp-math-captcha.php:87) in /usr/www/users/seowme/siekiera-online.de/wp-content/plugins/wp-math-captcha/includes/class-cookie-session.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/seowme/siekiera-online.de/wp-content/plugins/wp-math-captcha/wp-math-captcha.php:87) in /usr/www/users/seowme/siekiera-online.de/wp-content/plugins/wp-math-captcha/includes/class-cookie-session.php on line 49
Shopware – Blog Einträge manipulieren – vom entwickler für entwickler

Shopware – Blog Einträge manipulieren

Mal wieder ein Auftrag bei dem ähnlich wie im WordPress mit Shortcodes innerhalb des Shopware-Blogs gearbeitet werden soll.

Eigentlich nicht das Problem wenn nur die Shopware Doku so schlecht wäre.
Also wie kommt man im Plugin an den Detail-Eintrag eines Blog, so:

Im nicht in eine Exception zu laufen muss man natürlich sicher stellen das man sich auch in der Dateilansicht eines Blogeintrages ist:


/** @var \Shopware_Controllers_Frontend_Listing $controller */
$controller = $arguments->getSubject();
		
/**
* @var $request Zend_Controller_Request_Http
*/
$request = $controller->Request();
		
$modelController= $request->getControllerName();
$action = $request->getActionName();

$context = Shopware()->Container()->get('shopware_storefront.context_service')->getShopContext();

// wenn Blog Detailseite
if($modelController == 'blog' && $action == 'detail'){
.
.

Innerhalb der if kann nun auf den Blog-Service zugegriffen werden, in meinem Beispiel möchte ich den Content (description) bearbeiten:


$_id = $_GET['blogArticle'];
			
$_blog_service = Shopware()->Container()->get('shopware_storefront.blog_service')->getList([$_id], $context);
$_desc = $_blog_service[$_id]->getDescription();

Das $_desc kann man nun verhunepupeln wie man möchte und zurück in das $view-Objekt geben.

Scroll to Top