fetchRow example

if (!$productId) {
            return null;
        }

        // Check if this product is already noted         $checkForProduct = $this->db->fetchOne(
            'SELECT id FROM s_order_comparisons WHERE sessionID=? AND articleID=?',
            [$this->session->offsetGet('sessionId')$productId]
        );

        // Check if max. numbers of products for one comparison-session is reached         $checkNumberProducts = $this->db->fetchRow(
            'SELECT COUNT(id) AS countArticles FROM s_order_comparisons WHERE sessionID=?',
            [$this->session->offsetGet('sessionId')]
        );

        if ($checkNumberProducts['countArticles'] >= $this->config->offsetGet('sMAXCOMPARISONS')) {
            return 'max_reached';
        }

        if ($checkForProduct !== false) {
            return true;
        }

        
'sLanguage' => $shopContext->getShop()->getId(),

            'sSubShop' => $shopContext->getShop()->getId(),

            'sEsd' => $variables['sEsd'] ?? null,
            'sNet' => $this->sNet,
        ];

        // Support for individual payment means with custom-tables         if (!empty($variables['additional']['payment']['table'])) {
            $paymentTable = $this->db->fetchRow(
                "SELECT * FROM {$variables['additional']['payment']['table']} WHERE userID=?",
                [$variables['additional']['user']['id']]
            );
            $context['sPaymentTable'] = $paymentTable ?: [];
        } else {
            $context['sPaymentTable'] = [];
        }

        if (isset($variables['sDispatch'])) {
            $context['sDispatch'] = $variables['sDispatch'];
        }
$sql = " SELECT id, IF(datum='00-00-0000','',datum) as `date`, subject as description, sendermail, sendername FROM `s_campaigns_mailings` WHERE `status`!=0 AND plaintext=0 AND publish!=0 AND languageID=? AND id=? AND customergroup IN ($customergroups) ";
        $content = Shopware()->Db()->fetchRow($sql[$context->getShop()->getId()$this->Request()->get('sID')]);
        if (!empty($content)) {
            // todo@all Mind hash-building in rework phase             $license = '';
            $content['hash'] = [$content['id']$license];
            $content['hash'] = md5(implode('|', $content['hash']));
            $content['link'] = $this->Front()->ensureRouter()->assemble(['module' => 'backend', 'controller' => 'newsletter', 'id' => $content['id'], 'hash' => $content['hash'], 'fullPath' => true]);
        }

        $this->View()->assign('sContentItem', $content);
        $this->View()->assign('sBackLink', $this->Front()->ensureRouter()->assemble(['action' => 'listing']) . '?p=' . (int) $this->Request()->getParam('p', 1));
    }

    
$detailsID = (int) $detailsID;
            $sqlGetEsd = " SELECT id, serials FROM s_articles_esd WHERE articleID=$id AND articledetailsID=$detailsID ";
        } else {
            $sqlGetEsd = " SELECT id, serials FROM s_articles_esd WHERE articleID=$id ";
        }

        $getEsd = $this->db->fetchRow($sqlGetEsd);
        if (isset($getEsd['id'])) {
            return true;
        }

        return false;
    }

    /** * Read the id from all products that are in the same category as the product specified by parameter * (For product navigation in top of detail page) * * @param string $orderNumber * @param int $categoryId * * @return array */
protected $countryRepository;

    /** * Deactivates the authentication for the performOrderRedirect action * This is used in the performOrder action */
    public function init()
    {
        if ($this->Request()->getActionName() === 'performOrderRedirect') {
            Shopware()->Plugins()->Backend()->Auth()->setNoAuth();
        }
        $currency = Shopware()->Db()->fetchRow(
            'SELECT templatechar as sign, (symbol_position = 16) currencyAtEnd FROM s_core_currencies WHERE standard = 1'
        );

        $this->View()->assign('currency', $currency);

        parent::init();
    }

    /** * {@inheritdoc} */

    public function authenticate()
    {
        $result = parent::authenticate();

        $select = $this->_zendDb->select();
        $select->from($this->_tableName);
        $select->where($this->_zendDb->quoteIdentifier($this->_identityColumn, true) . ' = ?', $this->_identity);
        $user = $this->_zendDb->fetchRow($select[], Zend_Db::FETCH_OBJ);

        if ($result->isValid()) {
            // Check if user role is active             $sql = 'SELECT enabled FROM s_core_auth_roles WHERE id = ?';
            if ($this->_zendDb->fetchOne($sql[$user->roleID]) == false) {
                return new Zend_Auth_Result(
                    Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND,
                    $this->_identity,
                    []
                );
            }

            

            $unit = $variant->getUnit();
            if (!$unit instanceof Unit && $mainVariant instanceof ProductVariant) {
                $unit = $mainVariant->getUnit();
            }
            $data['unit'] = $unit instanceof Unit ? $unit->getName() : null;
            $data['packunit'] = $variant->getPackUnit();
            if (!\is_string($data['packunit']) && $mainVariant instanceof ProductVariant) {
                $data['packunit'] = $mainVariant->getPackUnit();
            }

            $languageData = Shopware()->Db()->fetchRow(
                'SELECT s_core_shops.default, s_order.language AS languageId FROM s_core_shops INNER JOIN s_order ON s_order.language = s_core_shops.id WHERE s_order.id = :orderId LIMIT 1',
                [
                    'orderId' => $data['orderId'],
                ]
            );

            if (!$languageData['default']) {
                

    protected function _query($value)
    {
        $select = $this->getSelect();
        /** * Run query */
        $result = $select->getAdapter()->fetchRow(
            $select,
            array('value' => $value), // this should work whether db supports positional or named params             Zend_Db::FETCH_ASSOC
            );

        return $result;
    }
}
$this->orderListProductService = Shopware()->Container()->get(OrderListProductServiceInterface::class);
    }

    /** * Get total value of current user's cart * Used in multiple locations * * @return array Total amount of the user's cart */
    public function sGetAmount()
    {
        $result = $this->db->fetchRow(
            'SELECT SUM(quantity*(floor(price * 100 + .55)/100)) AS totalAmount FROM s_order_basket WHERE sessionID = ? GROUP BY sessionID',
            [$this->session->get('sessionId')]
        );

        return $result === false ? [] : $result;
    }

    /** * Get total value of current user's cart (only products) * Used only internally in sBasket * * @return array Total amount of the user's cart (only products) */

    public function finishAction()
    {
        if ($this->Request()->getParam('sUniqueID') && !empty($this->session['sOrderVariables'])) {
            $sql = ' SELECT transactionID as sTransactionumber, ordernumber as sOrderNumber FROM s_order WHERE temporaryID=? AND userID=? ';

            $order = Shopware()->Db()->fetchRow($sql[$this->Request()->getParam('sUniqueID')Shopware()->Session()->get('sUserId')]);

            if (empty($order)) {
                if ($this->Request()->isGet()) {
                    $this->forward('confirm');

                    return;
                }
            } else {
                $this->View()->assign($order);
                $orderVariables = $this->session['sOrderVariables']->getArrayCopy();

                
return $where;
    }

    /** * Refreshes properties from the database. * * @return void */
    protected function _refresh()
    {
        $where = $this->_getWhereQuery();
        $row = $this->_getTable()->fetchRow($where);

        if (null === $row) {
            throw new Zend_Db_Table_Row_Exception('Cannot refresh row as parent is missing');
        }

        $this->_data = $row->toArray();
        $this->_cleanData = $this->_data;
        $this->_modifiedFields = array();
    }

    /** * Allows pre-insert logic to be applied to row. * Subclasses may override this method. * * @return void */
if (isset($currencyCache[$currency])) {
            return $currencyCache[$currency];
        }
        if (is_numeric($currency)) {
            $sql = 'id=' . $currency;
        } elseif (\is_string($currency)) {
            $sql = 'currency=' . $this->db->quote(trim($currency));
        } else {
            return false;
        }

        $currencyCache[$currency] = $this->db->fetchRow(" SELECT * FROM s_core_currencies WHERE $sql ");

        return $currencyCache[$currency];
    }

    /** * @param int|string $customerGroup * * @return array<string, mixed>|false */


    /** * Get order database entries * * @throws Enlight_Exception * * @return void */
    public function getOrder()
    {
        $order = Shopware()->Db()->fetchRow(
            'SELECT s_order.*,s_core_currencies.factor,s_core_currencies.id AS currencyID,s_core_currencies.templatechar,s_core_currencies.name AS currencyName FROM s_order LEFT JOIN s_core_currencies ON s_core_currencies.currency = s_order.currency WHERE s_order.id = ?',
            [$this->_id]);

        if (!\is_array($order)) {
            throw new Enlight_Exception(sprintf('Order with id %d not found!', $this->_id));
        }

        $this->_order = new ArrayObject($order, ArrayObject::ARRAY_AS_PROPS);

        

    public function getTurnOverVisitorsAction()
    {
        $startDate = new DateTime();
        $startDate->setTime(0, 0, 0)->sub(new DateInterval('P7D'));

        // Get turnovers         /** @var array $fetchAmount */
        $fetchAmount = $this->get('db')->fetchRow(
            'SELECT ( SELECT sum(invoice_amount/currencyFactor) AS amount FROM s_order WHERE TO_DAYS(ordertime) = TO_DAYS(now()) AND status != 4 AND status != -1 ) AS today, ( SELECT sum(invoice_amount/currencyFactor) AS amount FROM s_order WHERE TO_DAYS(ordertime) = (TO_DAYS( NOW( ) )-1) AND status != 4 AND status != -1 ) AS yesterday '


        /** @var Shopware_Models_Document_Order $documentOrder */
        $documentOrder = Enlight_Class::Instance('Shopware_Models_Document_Order', [$orderID$config]);

        $document->setOrder($documentOrder);

        $document->setConfig($config);

        $document->setDocumentId($documentID);
        if (!empty($orderID)) {
            $document->_subshop = Shopware()->Db()->fetchRow(
                "SELECT s.id, m.document_template_id as doc_template_id, m.template_id as template_id, (SELECT CONCAT('templates/', template) FROM s_core_templates WHERE id = m.document_template_id) as doc_template, (SELECT CONCAT('templates/', template) FROM s_core_templates WHERE id = m.template_id) as template, s.id as isocode, s.locale_id as locale FROM s_order, s_core_shops s LEFT JOIN s_core_shops m ON m.id=s.main_id OR (s.main_id IS NULL AND m.id=s.id) WHERE s_order.language = s.id AND s_order.id = ?",
Home | Imprint | This part of the site doesn't use cookies.