Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Shopware 4
* Copyright © shopware AG
*
* According to our dual licensing model, this program can be used either
* under the terms of the GNU Affero General Public License, version 3,
* or under a proprietary license.
*
* The texts of the GNU Affero General Public License with an additional
@sthamann
sthamann / gist:5668095
Created May 29, 2013 05:08
Usage doctrine sql logger
$logger = new \Doctrine\DBAL\Logging\DebugStack();
$logger->enabled;
Shopware()->Models()->getConfiguration()->setSQLLogger($logger);
// Shopware Doctrine Queries
//get access on the customer repository
$query = $this->getRepository()->getListQuery($filter, $customerGroup, $sort, $limit, $offset);
//returns the total count of the query
$totalResult = $this->getManager()->getQueryCount($query);
@sthamann
sthamann / gist:5538405
Created May 8, 2013 05:24
Modify cart to determine tax depends on the basket value
<?php
// Replace Hook auf engine/core/class/sBasket::getMaxTax
public function getMaxTax(){
$sql = "
SELECT
SUM(price * quantity) as amount_per_tax, tax
FROM s_order_basket b
WHERE b.sessionID=? AND b.modus=0
GROUP BY tax_rate
@sthamann
sthamann / SwagCustomCategories.php
Created April 12, 2013 05:30
Modification of community store plugin SwagCustomCategories to allow more then one condition
<?php
/**
* Plugin-Controller to display the special article-groups in the frontend
*
* @link http://www.shopware.de
* @copyright Copyright (c) 2011, shopware AG
* @author Patrick Stahl
* @package Plugins
* @subpackage Frontend_Controller
*/
@sthamann
sthamann / OrderMod_Bootstrap.php
Last active March 19, 2021 12:14
Advanced Example how to create 2 custom fields, fill them in order process, display them in backend order list as new columns and make them editable in order detail view
<?php
class Shopware_Plugins_Frontend_OrderMod_Bootstrap extends Shopware_Components_Plugin_Bootstrap
{
/**
* (non-PHPdoc)
* @see Shopware_Components_Plugin_Bootstrap::install()
*/
public function install()
{
@sthamann
sthamann / Bootstrap.php
Last active October 19, 2017 00:39
Shopware 4 - Add 2 new colums to Order-Model & fill them through order process
<?php
/**
* Shopware 4.0
* Copyright © 2012 shopware AG
*
* According to our dual licensing model, this program can be used either
* under the terms of the GNU Affero General Public License, version 3,
* or under a proprietary license.
*
* The texts of the GNU Affero General Public License with an additional