Versandkostenberechnung nach Kategorie

Hallo,

die ganze Zeit funktionierte folgendendes im Versandkostenmodul: … , MIN((SELECT 100 FROM s_articles_categories WHERE articleID=a.id AND NOT categoryID=12)) AS kategorie

 

Jetzt auf einmal nicht mehr, es kommt immer zu dieses Fehler:

PDOException: SQLSTATE(21000): Cardinality violation: 1242 Subquery returns more than 1 row in /vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:907 Stack trace:
#0 /vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(907): PDOStatement->execute()
#1 /vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(206): Doctrine\DBAL\Connection->executeQuery('SELECT MIN(d.in...', Array, Array)
#2 /engine/Shopware/Core/sAdmin.php(2594): Doctrine\DBAL\Query\QueryBuilder->execute()
#3 /www/htdocs/meinshop/var/cache/production_201911280851/proxies/sAdminProxy.php(79): sAdmin->sGetDispatchBasket(2, NULL, 0)
#4 /engine/Library/Enlight/Hook/HookExecutionContext.php(137): Shopware_Proxies_sAdminProxy->__executeOriginalMethod('sGetDispatchBas...', Array)
#5 /engine/Library/Enlight/Hook/HookExecutionContext.php(103): Enlight_Hook_HookExecutionContext->executeReplaceChain(Array)
#6 /engine/Library/Enlight/Hook/HookManager.php(180): Enlight_Hook_HookExecutionContext->execute()
#7 /www/htdocs/meinshop/var/cache/production_201911280851/proxies/sAdminProxy.php(90): Enlight_Hook_HookManager->executeHooks(Object(Shopware_Proxies_sAdminProxy), 'sGetDispatchBas...', Array)
#8 /engine/Shopware/Core/sAdmin.php(2693): Shopware_Proxies_sAdminProxy->sGetDispatchBasket(2, NULL, 0)
#9 /engine/Shopware/Controllers/Frontend/Checkout.php(1555): sAdmin->sGetPremiumDispatches(2, NULL, 0)
#10 /engine/Shopware/Controllers/Frontend/Checkout.php(150): Shopware_Controllers_Frontend_Checkout->getSelectedDispatch()
#11 /engine/Library/Enlight/Controller/Action.php(192): Shopware_Controllers_Frontend_Checkout->cartAction()
#12 /engine/Library/Enlight/Controller/Dispatcher/Default.php(478): Enlight_Controller_Action->dispatch('cartAction')
#13 /engine/Library/Enlight/Controller/Front.php(228): Enlight_Controller_Dispatcher_Default->dispatch(Object(Enlight_Controller_Request_RequestHttp), Object(Enlight_Controller_Response_ResponseHttp))
#14 /engine/Shopware/Kernel.php(186): Enlight_Controller_Front->dispatch()
#15 /vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php(102): Shopware\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(447): Symfony\Component\HttpKernel\HttpCache\SubRequestHandler::handle(Object(Shopware\Kernel), Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /engine/Shopware/Components/HttpCache/AppCache.php(256): Symfony\Component\HttpKernel\HttpCache\HttpCache->forward(Object(Symfony\Component\HttpFoundation\Request), true, NULL)
#18 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(420): Shopware\Components\HttpCache\AppCache->forward(Object(Symfony\Component\HttpFoundation\Request), true)
#19 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(317): Symfony\Component\HttpKernel\HttpCache\HttpCache->fetch(Object(Symfony\Component\HttpFoundation\Request), true)
#20 /engine/Shopware/Components/HttpCache/AppCache.php(183): Symfony\Component\HttpKernel\HttpCache\HttpCache->lookup(Object(Symfony\Component\HttpFoundation\Request), true)
#21 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(192): Shopware\Components\HttpCache\AppCache->lookup(Object(Symfony\Component\HttpFoundation\Request), true)
#22 /engine/Shopware/Components/HttpCache/AppCache.php(110): Symfony\Component\HttpKernel\HttpCache\HttpCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /www/htdocs/meinshop/shopware.php(122): Shopware\Components\HttpCache\AppCache->handle(Object(Symfony\Component\HttpFoundation\Request))
#24

An exception occurred while executing 'SELECT MIN(d.instock>=b.quantity) as instock, MIN(d.instock>=(b.quantity+d.stockmin)) as stockmin, MIN(a.laststock) as laststock, SUM(d.weight*b.quantity) as weight, SUM(IF(a.id,b.quantity,0)) as count_article, MAX(b.shippingfree) as shippingfree, SUM(IF(b.modus=0,b.quantity*CAST(b.price as DECIMAL(10,2))/b.currencyFactor,0)) as amount, SUM(IF(b.modus=0,b.quantity*ROUND(CAST(b.price as DECIMAL(10,2))/(100+t.tax)*100,2)/b.currencyFactor,0)) as amount_net, SUM(CAST(b.price as DECIMAL(10,2))*b.quantity) as amount_display, MAX(d.length) as `length`, MAX(d.height) as height, MAX(d.width) as width, u.id as userID, MAX(a.topseller) as has_topseller, MAX(at.attr3) as has_comment, MAX(b.esdarticle) as has_esd, MIN((SELECT 100 FROM s_articles_categories WHERE articleID=a.id AND NOT categoryID=12)) AS kategorie, (MIN((SELECT 1 FROM s_articles_categories WHERE articleID=a.id AND categoryID=10))) as calculation_value_16 FROM s_order_basket b LEFT JOIN s_articles a ON b.articleID = a.id AND b.modus = 0 AND b.esdarticle = 0 LEFT JOIN s_user u ON u.id = ? AND u.active = 1 LEFT JOIN s_articles_details d ON (d.ordernumber = b.ordernumber) AND d.articleID = a.id LEFT JOIN s_core_tax t ON t.id = a.taxID LEFT JOIN s_articles_attributes at ON at.articledetailsID = d.id LEFT JOIN s_user_addresses ub ON ub.user_id = u.id AND ub.id = ? LEFT JOIN s_user_addresses us ON us.user_id = u.id AND us.id = ? WHERE b.sessionID = ? GROUP BY b.sessionID' with params (null, 0, 0, "2e6815c22000e596b94af1390039d7b6"): SQLSTATE(21000): Cardinality violation: 1242 Subquery returns more than 1 row

 

Bin gerade am verzweifeln wieso das nicht mehr geht :frowning:

 

Liebe Grüße

mach:

MIN((SELECT 100 FROM s_articles_categories WHERE articleID=a.id AND NOT categoryID=12 LIMIT 1))

Also LIMIT 1 rein.

Er findet sonst zu viele Einträge.

Gruß Heiner

 

1 „Gefällt mir“

Super Vielen Dank :slight_smile: