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 / Add2Cart_within_listing.tpl
Last active March 1, 2022 08:07
shopware 5 Add2Cart within listing
{if !$sArticle.sConfigurator && !$sArticle.variants && !$sArticle.sVariantArticle}
<a href="{url controller=checkout action=addArticle sAdd=$sArticle.ordernumber sQuantity=1}"
data-add-article="true"
data-showModal="false"
data-addArticleUrl="{url controller=checkout action=ajaxAddArticleCart sAdd=$sArticle.ordernumber sQuantity=1}"
data-text="{s name="ListingBoxLinkCart"}In den Warenkorb{/s}"
title="{s name="ListingBoxLinkCart"}In den Warenkorb{/s}"
class="product--action action--add tooltip">
@maxout
maxout / delete duplicate order numbers.sql
Last active March 1, 2022 08:06
delete duplicate order numbers from shopware s_order
DELETE FROM s_order USING s_order, s_order as Dup WHERE NOT s_order.`id` = Dup.`id` AND s_order.`id` <> Dup.`id` AND s_order.`ordernumber` = Dup.`ordernumber`
@maxout
maxout / find duplicate ordernumbers.sql
Last active March 1, 2022 08:05
find duplicate order numbers in shopware s_order
SELECT `id`, `ordernumber` FROM s_order WHERE EXISTS ( SELECT `id` FROM s_order dub WHERE s_order.`ordernumber` = dub.`ordernumber` AND s_order.`id` <> dub.`id`) ORDER BY `ordernumber`
@maxout
maxout / change_ordernumbers_incrementally.sql
Last active March 1, 2022 08:07
Shopware change ordernumbers incrementally with prefix
select @i := 200000;
update s_articles_details set `ordernumber` = CONCAT('STM-',(select @i := @i + 1));
@maxout
maxout / basketItem.xml
Created November 6, 2015 11:50
Sprd:basketItem
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<basketItem xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://api.spreadshirt.net">
<links>
<link type="edit" xlink:href="http://shopware-sprd.maxout.de/"/>
<link type="continueShopping" xlink:href="http://shopware-sprd.maxout.de"/>
</links>
<quantity>1</quantity>
<element type="sprd:product" xlink:href="http://api.spreadshirt.net/api/v1/shops/436258/product/134011849">
<properties>
<property key="appearance">4</property>
@maxout
maxout / getCheckoutUrl.php
Created November 6, 2015 11:48
Sprd:getCheckoutUrl
<?php
/**
* Retrieve Basket Checkout URL
* Returns the checkout URL for the current basket that will used in the iFrame on shop checkout.
* @param $basketUrl
* @param $namespaces
* @return string
*/
private function getCheckoutUrl($basketUrl, $namespaces)
{
@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">
@maxout
maxout / jQuery sorting clothing sizes
Last active April 8, 2026 08:26
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 / 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 / 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");