Skip to content

Instantly share code, notes, and snippets.

View maxout's full-sized avatar
🏠
Working from home

Heiko Bee maxout

🏠
Working from home
View GitHub Profile
@maxout
maxout / Shopware: export and import s_user_debit Db-Table
Last active December 22, 2015 19:39
Shopware: export and import s_user_debit Db-Table
-- --------------------------------------------------------
--
-- Create View in export-DB to get data by customernumber and export it to a tmp table into the import-DB
--
-- --------------------------------------------------------
DROP VIEW IF EXISTS `v_user_debit_by_customernumber`;
CREATE VIEW `v_user_debit_by_customernumber` AS select `s_user_billingaddress`.`customernumber` AS `customernumber`,`s_user_debit`.`account` AS `account`,`s_user_debit`.`bankcode` AS `bankcode`,`s_user_debit`.`bankname` AS `bankname`,`s_user_debit`.`bankholder` AS `bankholder` from (`s_user_billingaddress` join `s_user_debit`) where (`s_user_billingaddress`.`userID` = `s_user_debit`.`userID`);
-- --------------------------------------------------------
@maxout
maxout / build multidimensional array from string
Last active December 28, 2015 12:59
build multidimensional array from string
$ret = array_map (
function ($_) {return explode (':', $_);},
explode (';', $data)
);
@maxout
maxout / Parse HTML-Body
Created January 16, 2014 13:49
Parse HTML-Body
<?php
$d = new DOMDocument;
$mock = new DOMDocument;
$d->loadHTML(file_get_contents('http://www.telekom-stiftung.de/dts-cms/de/mobile-newsarchiv'));
$body = $d->getElementsByTagName('body')->item(0);
foreach ($body->childNodes as $child){
$mock->appendChild($mock->importNode($child, true));
}
echo $mock->saveHTML();
@maxout
maxout / Shopware Folder Permissions
Last active June 5, 2024 08:11
Set the correct directory permissions for Shopware installation
chmod 777 config.php
chmod 777 -R cache
chmod 777 -R files
chmod 777 -R media
chmod 777 -R engine/Shopware/Plugins/Community
chmod 777 -R logs
chmod 777 -R engine/Shopware/Plugins/Default
chmod 777 -R web/cache/
chmod 777 -R recovery/
chmod 777 -R themes/Frontend
@maxout
maxout / unzip
Last active August 29, 2015 13:57
unzip file
$zip = new ZipArchive;
$res = $zip->open('sw.zip');
if ($res === TRUE) {
$zip->extractTo('./');
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
@maxout
maxout / unlink.php
Created March 19, 2014 20:21
unlink all Files and Folders in current folder
@maxout
maxout / usortSize
Created December 10, 2014 22:53
Sorting sizes
function usortFunction($g1, $g2) {
$sortierung = Array("XXXS" => 1, "XXS" => 2, "XS" => 3, "S" => 4, "M" => 5, "L" => 6, "XL" => 7, "XXL" => 8, "XXXL" => 9, "XXXXL" => 10);
$index1 = $sortierung[strtoupper($g1)];
$index2 = $sortierung[strtoupper($g2)];
return ($index1 < $index2) ? -1 : 1;
}
usort($groessen, "usortFunction");
@maxout
maxout / deleteEmptyCategories.php
Last active November 6, 2015 12:25
Shopware delete all empty Categories
<?php
/**
* Delete all empty Categories
* @return int
*/
public function deleteEmptyCategories()
{
$acSql = "select * from s_categories
left join s_articles_categories_ro ro
on ro.categoryID = s_categories.id
@maxout
maxout / jQuery sorting clothing sizes
Last active November 13, 2023 09:24
jQuery sort clothing sizes in select box for shopware configurator articles
$(function() {
var sizes = ["XS", "S", "M", "L", "XL", "2XL", "3XL", "4XL"],
select = $('.configurator--form select[name="group[2]"]');
$('option', select).sort(function (a, b) {
if(isNaN($(a).text().trim())){
return sizes.indexOf($(a).text().trim()) - sizes.indexOf($(b).text().trim());
}else{
return $(a).text() > $(b).text() ? 1 : $(a).text() < $(b).text() ? -1 : 0;
@maxout
maxout / createBasket.php
Last active November 6, 2015 11:46
Sprd:createBasket
<?php
/**
* Creates a new Spreadshirt basket
* @param $shop
* @param $namespaces
* @return array
*/
private function createBasket($shop, $namespaces)
{
$basket = new \SimpleXmlElement('<basket xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://api.spreadshirt.net">