Skip to content

Instantly share code, notes, and snippets.

View proudcommerce's full-sized avatar

ProudCommerce proudcommerce

View GitHub Profile
@proudcommerce
proudcommerce / OXID eShop - check if column exists
Created January 8, 2015 10:53
this function checks if a given column in a given database table exists. thanks to tim from shoptimax for this snippet.
protected function _dbColumnExist($sTable, $sColumn)
{
$sDbName = oxRegistry::getConfig()->getConfigParam('dbName');
$sSql = sprintf("SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s' "
. " AND COLUMN_NAME = '%s'",
$sDbName, $sTable, $sColumn);
return oxDb::getDb()->getOne($sSql);
}
@proudcommerce
proudcommerce / OXID eShop - gets first subcategory and redirect to this
Last active August 29, 2015 14:04
gets first subcategory of a main category and redirect to this.uses an array, which main categories should be checked.
<?php
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @copyright (c) Proud Sourcing GmbH | 2014
* @link https://gist.github.com/proudcommerce
* @link http://www.proudcommerce.com