Skip to content

Instantly share code, notes, and snippets.

@KristianH
KristianH / Acceptance.php
Created April 9, 2020 15:08 — forked from SimonEast/Acceptance.php
Codeception - how to test for redirects
<?php
// Simply place the following two functions in _support/Helper/Acceptance.php
// Then you can call $I->verifyRedirect(...) inside your tests
namespace Helper;
class Acceptance extends \Codeception\Module
{
/**
* Ensure that a particular URL does NOT contain a 301/302
<?php
//this file requires a oxid shop V6.0.0 or higher!
// put this file in source folder and open via web url: https://www.myshop.de/...
define(OX_IS_ADMIN, true);
include('bootstrap.php');
$shopconfvar = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopConfVar("aModulePaths");
$moduleId = "d3modcfg_lib";
if (isset($shopconfvar[$moduleId])) {
unset($shopconfvar[$moduleId]);
@KristianH
KristianH / IntelliSenseHelperCreator.php
Last active February 7, 2018 09:22
IntelliSenseHelper for module chain in oxid eShop
<?php
/**
* @author D3 Data Development <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
class IntelliSenseHelperCreator
{
/**
@KristianH
KristianH / d3_oxutilsview_modulename.php
Created January 4, 2018 15:34
Override oxid eshop standard smarty plugins
<?php
use OxidEsales\Eshop\Core\Registry;
// fill d3/modulename/Core/Smarty/Plugin/ with plugins like function.oxprice.php, function.oxcontent.php etc.
class d3_oxutilsview_modulename extends d3_oxutilsview_modulename_parent
{
/**
* @param Smarty $oSmarty
*
* @return null|void
@KristianH
KristianH / testTransactions.php
Last active November 30, 2017 11:25
test mysql transactions in a oxid eShop v6.0.x
<?php
/**
* place this gist in a file in folder source/ of a oxid-esales v6.0.0
*/
use OxidEsales\Eshop\Core\DatabaseProvider;
require_once dirname(__FILE__) . "/bootstrap.php";
// tldr: 1. uncommitted MySQL transactions, will not commit queries with warning.
// 2. auto_increment will always be set (even in a rollback)
@KristianH
KristianH / d3OxidIniSetTest.php
Created August 13, 2015 09:46
oxid ini_set systemrequirements test
<?php
/**
* this snippet checks if ini_set settings can be set
* @link http://wiki.oxidforge.org/Installation#ini_set_allowed
*/
$oxidRequirements = array(
"session.name" => 'test',
"session.use_cookies" => "0",
"session.use_trans_sid" => "0",
@KristianH
KristianH / setDefaultUserGroupsInOxidShop.php
Created January 13, 2015 13:00
setDefaultUserGroups.php set usergroups 'oxidforeigncustomer' and 'oxidnewcustomer' based on the country(oxuser)
<?php
//WARNING: this file change DB data! be careful!
// Use this in a oxid e-sales shop 4.7.0 or higher
//if you are aware of the risks, remove or comment the next line:
die('Please read the comments!');
define('OX_IS_ADMIN', true);
include('bootstrap.php');
$sGetRestUserQuery = 'SELECT `oxobjectid` AS `oxobjectid` FROM `oxobject2group` `o2g`
LEFT JOIN `oxuser` ON `oxuser`.`oxid` = `o2g`.`oxobjectid`
@KristianH
KristianH / switchLanguageInOxidShop.php
Last active August 29, 2015 14:11
switchLanguageInOxidShop
<?php
//Use this in a oxid e-sales shop 4.7.0 or higher
//if you understand, remove or comment the next line:
die('Please read the comments!');
include('bootstrap.php');
$oConfig = oxRegistry::getConfig();
$sDatabaseName = "NameOfDataBase";
<?php
//WARNING: this file deletes content from DB! be careful!
// Use this in a oxid e-sales shop 4.7.0 or higher
//if you are aware of the risks, remove or comment the next line:
die('Please read the comments!');
include('bootstrap.php');
$aDeletes = array(
'oxcategory',
'oxvendor',
'oxmanufacturer',