# Problem mit Sperrgut

**URL:** <https://forum.shopware.com/t/problem-mit-sperrgut/45038>\
**Category:** Allgemein\
**Created:** [6. April 2017 um 07:59 UTC](https://forum.shopware.com/t/problem-mit-sperrgut/45038 "2017-04-06T07:59:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TeTeDi](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@TeTeDi](https://forum.shopware.com/u/TeTeDi)\
**Post date:** [6. April 2017 um 07:59 UTC](https://forum.shopware.com/t/problem-mit-sperrgut/45038/1 "2017-04-06T07:59:20Z")

</div>

Hi, wir haben versucht einen Perrgutzuschlag in unser Shopware zu integrieren, wie in diesem Video erläutert:

> **[Shopware Tutorial - Versandart Sperrgut](https://www.youtube.com/watch?v=Jh38XSg53RM)**
>
> Mittels Freitextfeld können Produkte als Sperrgut gekennzeichnet werden und in weiterer Folge mit Versandkostenaufschlag bestellt werden. Dadurch lassen sich...

Leider funktioniert nun der Warenkobrb nicht und wir erhalten folgende Fehler:

```
exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' MAX(at.attr16="true") AS sperrgut, ('') as calculation_value_20
            FRO' at line 15' in shopware/engine/Library/Zend/Db/Statement/Pdo.php:228

#0 shopware/engine/Library/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 shopware/engine/Library/Zend/Db/Statement.php(303): Zend_Db_Statement_Pdo->_execute(Array)
#2 shopware/engine/Library/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 shopware/engine/Library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('\n SE...', Array)
#4 shopware/engine/Library/Enlight/Components/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->query('\n SE...', Array)
#5 shopware/engine/Library/Zend/Db/Adapter/Abstract.php(756): Enlight_Components_Db_Adapter_Pdo_Mysql->query('\n SE...', Array)
#6 shopware/engine/Shopware/Core/sAdmin.php(2636): Zend_Db_Adapter_Abstract->fetchRow('\n SE...', Array)
#7 shopware/engine/Shopware/Core/sAdmin.php(3064): sAdmin->sGetDispatchBasket('2')
#8 shopware/engine/Shopware/Controllers/Frontend/Checkout.php(945): sAdmin->sGetPremiumShippingcosts(Array)
#9 shopware/engine/Shopware/Controllers/Frontend/Checkout.php(959): Shopware_Controllers_Frontend_Checkout->getShippingCosts()
#10 shopware/engine/Shopware/Controllers/Frontend/Checkout.php(1509): Shopware_Controllers_Frontend_Checkout->getBasket()
#11 shopware/engine/Library/Enlight/Controller/Action.php(159): Shopware_Controllers_Frontend_Checkout->ajaxCartAction()
#12 shopware/engine/Library/Enlight/Controller/Dispatcher/Default.php(523): Enlight_Controller_Action->dispatch('ajaxCartAction')
#13 shopware/engine/Library/Enlight/Controller/Front.php(223): Enlight_Controller_Dispatcher_Default->dispatch(Object(Enlight_Controller_Request_RequestHttp), Object(Enlight_Controller_Response_ResponseHttp))
#14 shopware/engine/Shopware/Kernel.php(180): Enlight_Controller_Front->dispatch()
#15 shopware/vendor/symfony/http-kernel/HttpCache/HttpCache.php(487): Shopware\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 shopware/engine/Shopware/Components/HttpCache/AppCache.php(255): Symfony\Component\HttpKernel\HttpCache\HttpCache->forward(Object(Symfony\Component\HttpFoundation\Request), true, NULL)
#17 shopware/vendor/symfony/http-kernel/HttpCache/HttpCache.php(444): Shopware\Components\HttpCache\AppCache->forward(Object(Symfony\Component\HttpFoundation\Request), true)
#18 shopware/vendor/symfony/http-kernel/HttpCache/HttpCache.php(344): Symfony\Component\HttpKernel\HttpCache\HttpCache->fetch(Object(Symfony\Component\HttpFoundation\Request), true)
#19 shopware/engine/Shopware/Components/HttpCache/AppCache.php(178): Symfony\Component\HttpKernel\HttpCache\HttpCache->lookup(Object(Symfony\Component\HttpFoundation\Request), true)
#20 shopware/vendor/symfony/http-kernel/HttpCache/HttpCache.php(210): Shopware\Components\HttpCache\AppCache->lookup(Object(Symfony\Component\HttpFoundation\Request), true)
#21 shopware/engine/Shopware/Components/HttpCache/AppCache.php(114): Symfony\Component\HttpKernel\HttpCache\HttpCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 shopware/shopware.php(117): Shopware\Components\HttpCache\AppCache->handle(Object(Symfony\Component\HttpFoundation\Request))
#23 {main}

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' MAX(at.attr16="true") AS sperrgut, ('') as calculation_value_20, ('') as calcul' at line 15' in shopware/engine/Library/Zend/Db/Statement/Pdo.php:234
Stack trace:
#0 shopware/engine/Library/Zend/Db/Statement.php(303): Zend_Db_Statement_Pdo->_execute(Array)
#1 shopware/engine/Library/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#2 shopware/engine/Library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('\n SE...', Array)
#3 shopware/engine/Library/Enlight/Components/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->query('\n SE...', Array)
#4 shopware/engine/Library/Zend/Db/Adapter/Abstract.php(756): Enlight_Components_Db_Adapter_Pdo_Mysql->query('\n SE...', Array)
#5 shopware/engine/Shopware/Core/sAdmin.php(2636): Zend_Db_Adapter_Abstract->fetchRow('\n SE...', Array)
#6 shopware/engine/Shopware/Core/sAdmin.php(3064): sAdmin->sGetDispatchBasket('2')
#7 shopware/engine/Shopware/Controllers/Frontend/Checkout.php(945): sAdmin->sGetPremiumShippingcosts(Array)
#8 shopware/engine/Shopware/Controllers/Frontend/Checkout.php(959): Shopware_Controllers_Frontend_Checkout->getShippingCosts()
#9 shopware/engine/Shopware/Controllers/Frontend/Checkout.php(1509): Shopware_Controllers_Frontend_Checkout->getBasket()
#10 shopware/engine/Library/Enlight/Controller/Action.php(159): Shopware_Controllers_Frontend_Checkout->ajaxCartAction()
#11 shopware/engine/Library/Enlight/Controller/Dispatcher/Default.php(523): Enlight_Controller_Action->dispatch('ajaxCartAction')
#12 shopware/engine/Library/Enlight/Controller/Front.php(223): Enlight_Controller_Dispatcher_Default->dispatch(Object(Enlight_Controller_Request_RequestHttp), Object(Enlight_Controller_Response_ResponseHttp))
#13 shopware/engine/Shopware/Kernel.php(180): Enlight_Controller_Front->dispatch()
#14 shopware/vendor/symfony/http-kernel/HttpCache/HttpCache.php(487): Shopware\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 shopware/engine/Shopware/Components/HttpCache/AppCache.php(255): Symfony\Component\HttpKernel\HttpCache\HttpCache->forward(Object(Symfony\Component\HttpFoundation\Request), true, NULL)
#16 shopware/vendor/symfony/http-kernel/HttpCache/HttpCache.php(444): Shopware\Components\HttpCache\AppCache->forward(Object(Symfony\Component\HttpFoundation\Request), true)
#17 shopware/vendor/symfony/http-kernel/HttpCache/HttpCache.php(344): Symfony\Component\HttpKernel\HttpCache\HttpCache->fetch(Object(Symfony\Component\HttpFoundation\Request), true)
#18 shopware/engine/Shopware/Components/HttpCache/AppCache.php(178): Symfony\Component\HttpKernel\HttpCache\HttpCache->lookup(Object(Symfony\Component\HttpFoundation\Request), true)
#19 shopware/vendor/symfony/http-kernel/HttpCache/HttpCache.php(210): Shopware\Components\HttpCache\AppCache->lookup(Object(Symfony\Component\HttpFoundation\Request), true)
#20 shopware/engine/Shopware/Components/HttpCache/AppCache.php(114): Symfony\Component\HttpKernel\HttpCache\HttpCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 shopware/shopware.php(117): Shopware\Components\HttpCache\AppCache->handle(Object(Symfony\Component\HttpFoundation\Request))
#22 {main}

```

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![sschreier](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/sschreier/32/23296_2.png) [@sschreier](https://forum.shopware.com/u/sschreier)\
**Post date:** [6. April 2017 um 08:10 UTC](https://forum.shopware.com/t/problem-mit-sperrgut/45038/2 "2017-04-06T08:10:12Z")

</div>

Hallo,

ich würde dir eher die offiziellen Dokumentationen von Shopware empfehlen anstatt die von Drittanbietern: [http://community.shopware.com/\_detail\_1933.html#Einfache\_Bedingung\_anhand\_von\_Freitextfeld\_1](http://community.shopware.com/_detail_1933.html#Einfache_Bedingung_anhand_von_Freitextfeld_1) . So wie es in der offiziellen Dokumentationen von Shopware beschrieben ist, funktioniert es auch. Dort steht nämlich auch, das man ab Shopware 5.2 statt MAX(at.attr16=„true“) eher MAX(at.attr16=„1“) nutzen muss.

Ebenso ist der Wert „(’’) as calculation\_value\_20“ auch nicht im Standard von Shopware enthalten und wird wohl den Fehler verursachen.

Beste Grüße

Sebastian

---

<div class="post-metadata">

**Author:** ![TeTeDi](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@TeTeDi](https://forum.shopware.com/u/TeTeDi)\
**Post date:** [6. April 2017 um 08:16 UTC](https://forum.shopware.com/t/problem-mit-sperrgut/45038/3 "2017-04-06T08:16:53Z")

</div>

Hallo Sebastian, Danke&nbsp; ![Thumb-Up](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/7fcda44f782696668a3d093569d15e88105769e1.png "Thumb-Up")
