kodal.de

it´s all about music, design and coding

Im Magento-Backend (1.4) gibt es keine Möglichkeit, einmal erstellte Rechnungen wieder zu löschen. Um eine einzelne Rechnung zu eliminieren, ist dieser MySQL-Query hilfreich:

delete from `sales_order_entity_datetime` where `entity_id`='$entityId' and `entity_type_id` IN (17,18,19);
delete from `sales_order_entity_decimal` where `entity_id`='$entityId' and `entity_type_id` IN (17,18,19);
delete from `sales_order_entity_int` where `entity_id`='$entityId' and `entity_type_id` IN (17,18,19);
delete from `sales_order_entity_text` where `entity_id`='$entityId' and `entity_type_id` IN (17,18,19);
delete from `sales_order_entity_varchar` where `entity_id`='$entityId' and `entity_type_id` IN (17,18,19);
delete from `sales_order_entity` where `parent_id`='$entityId' and `entity_type_id`='20';
delete from `sales_order_entity` where `entity_id`='$entityId' and `entity_type_id`='18';

Dahinter verbirgt sich folgende Logik:

"sales_order_entity_*":
delete from `$table` where `entity_id`='$entityId' and `entity_type_id` IN (17,18,19);

"sales_order_entity":
delete from `$table` where `parent_id`='$entityId' and `entity_type_id`='20';
delete from `$table` where `entity_id`='$entityId' and `entity_type_id`='18';

Popularity: 17% [?]

Leider gibt es in Magento keine Möglichkeit, einmal erstelle Orders wieder zu löschen. Was aus buchhalterischer Sicht durchaus sinnvoll sein mag, erweist sich in der Praxis oftmals als Stolperfalle. Denn insbesondere in der Entwicklungsphase eines eCommerce-Projekts kommt man um das testweise Anlegen von Bestellungen kaum herum, um die Abrechnungs- und Fulfillment-Funktionalität von Magento und eventuell zusätzlich installierter Extensions auf Herz und Nieren zu prüfen.

Diese Bestellungen und Rechnungen liegen, wenn sie erst einmal erstellt worden sind, in der Datenbank vor, obwohl sie nie für die weitere Bearbeitung vorgesehen waren. Das ist besonders ärgerlich bei Bestellungen, die nur testweise angelegt wurden, um zB die Funktionalität des Shops oder einzelner Extensions zu überprüfen. Werden diese Testorders zB versehentlich bei der Erfassung des Steueraufkommens im Zuge der Umsatzermittlung mitberücksichtigt, ist Ärger vorprogrammiert.

Derartige Testorders, aber natürlich auch alle übrigen Bestellungen und Rechnungen, können zwar nicht über das Magento-Backend direkt, wohl aber über einen SQL-Inject gelöscht werden.
Für Magento 1.4.1 sieht diese SQL-Anweisung wie folgt aus:


SET FOREIGN_KEY_CHECKS=0;

TRUNCATE `sales_order`;
TRUNCATE `sales_order_datetime`;
TRUNCATE `sales_order_decimal`;
TRUNCATE `sales_order_entity`;
TRUNCATE `sales_order_entity_datetime`;
TRUNCATE `sales_order_entity_decimal`;
TRUNCATE `sales_order_entity_int`;
TRUNCATE `sales_order_entity_text`;
TRUNCATE `sales_order_entity_varchar`;
TRUNCATE `sales_order_int`;
TRUNCATE `sales_order_text`;
TRUNCATE `sales_order_varchar`;
TRUNCATE `sales_flat_quote`;
TRUNCATE `sales_flat_quote_address`;
TRUNCATE `sales_flat_quote_address_item`;
TRUNCATE `sales_flat_quote_item`;
TRUNCATE `sales_flat_quote_item_option`;
TRUNCATE `sales_flat_order_item`;
TRUNCATE `sendfriend_log`;
TRUNCATE `tag`;
TRUNCATE `tag_relation`;
TRUNCATE `tag_summary`;
TRUNCATE `wishlist`;
TRUNCATE `log_quote`;
TRUNCATE `report_event`;

ALTER TABLE `sales_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_datetime` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_decimal` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_varchar` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_int` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_text` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_varchar` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item_option` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_item` AUTO_INCREMENT=1;
ALTER TABLE `sendfriend_log` AUTO_INCREMENT=1;
ALTER TABLE `tag` AUTO_INCREMENT=1;
ALTER TABLE `tag_relation` AUTO_INCREMENT=1;
ALTER TABLE `tag_summary` AUTO_INCREMENT=1;
ALTER TABLE `wishlist` AUTO_INCREMENT=1;
ALTER TABLE `log_quote` AUTO_INCREMENT=1;
ALTER TABLE `report_event` AUTO_INCREMENT=1;

-- reset customers
TRUNCATE `customer_address_entity`;
TRUNCATE `customer_address_entity_datetime`;
TRUNCATE `customer_address_entity_decimal`;
TRUNCATE `customer_address_entity_int`;
TRUNCATE `customer_address_entity_text`;
TRUNCATE `customer_address_entity_varchar`;
TRUNCATE `customer_entity`;
TRUNCATE `customer_entity_datetime`;
TRUNCATE `customer_entity_decimal`;
TRUNCATE `customer_entity_int`;
TRUNCATE `customer_entity_text`;
TRUNCATE `customer_entity_varchar`;
TRUNCATE `log_customer`;
TRUNCATE `log_visitor`;
TRUNCATE `log_visitor_info`;

ALTER TABLE `customer_address_entity` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_varchar` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_varchar` AUTO_INCREMENT=1;
ALTER TABLE `log_customer` AUTO_INCREMENT=1;
ALTER TABLE `log_visitor` AUTO_INCREMENT=1;
ALTER TABLE `log_visitor_info` AUTO_INCREMENT=1;

-- Reset all ID counters
TRUNCATE `eav_entity_store`;
ALTER TABLE `eav_entity_store` AUTO_INCREMENT=1;

SET FOREIGN_KEY_CHECKS=1;

Popularity: 18% [?]

Unter Windows7 gibt es einen Bug, der bisweilen bestimmte Fenster unerreichbar werden lässt, wenn man einen zweiten Monitor angeschlossen hatte, während man eine Applikation geöffnet hat, und dieser Zweitmonitor beim nächsten Start von Windows nicht mehr verfügbar ist, die Fensterposition der betreffenden Applikation allerdings gespeichert und beim nächsten Start der Anwendung somit wiederhergestellt wurde.

Mit folgender Herangehensweise können derartig “verschollene” Fenster wieder in den sichtbaren Bereich der Arbeitsfläche zurückgeholt werden:

  • [ALT]+[SPACE] gleichzeitig betätigen und den Menüpunkt “Verschieben” anwählen
  • [SHIFT]+[V] gleichzeitig drücken
  • Mit Hilfe der [CURSORTASTEN] lässt sich nun das unsichtbare Fenster wieder in den sichtbaren Bereich zurückverschieben

Popularity: 32% [?]

Unlike in ActionScript2, we cannot use a MovieClip´s or Sprites´ z-Property to arrange objects on the z-axis. However, the new ActionScript3-handling provides a solution which comes in even handier..

Bring object to front

function moveUpfront( clip:DisplayObject ):void {
    clip.parent.setChildIndex(clip, clip.parent.numChildren-1);
}

Send object to back

function moveToBack( clip:DisplayObject ):void {
    clip.parent.setChildIndex(clip, 0);
}

Move one up

function moveForward( clip:DisplayObject ): void {
   var currentDepth = clip.parent.getChildIndex(clip);
   if(currentDepth<clip.parent.numChildren-1){
      clip.parent.setChildIndex(clip, currentDepth+1);
   }
}

Move one down

function moveBackward( clip:DisplayObject ): void {
   var currentDepth = clip.parent.getChildIndex(clip);
   if(currentDepth>0){
      clip.parent.setChildIndex(clip, currentDepth-1);
   }
}

Popularity: 28% [?]

Problems with Product Visibility in Magento

When first setting up a Magento-eCommerce-site, almost everyone wonders why products are not being shown on the actual site, even though everything seems to be filled out correctly. In this little article, I’d like to explain how to make sure a product is shown on the site after it has been created via the Magento-backend.

Here goes a little checklist of what to do in order to have your products being shown in your Magento-eCommerce-Shop..

Checklist

  • in Catalog/Manage Products : fil out all required fields in each tab and click “save and continue edit” when finished
  • in Catalog/Manage Products/General : make sure “Status” is set to “Enabled”
  • in Catalog/Manage Products/General : set “Visibility” to “Catalog”, “Search” or “Catalog, Search”
  • in Catalog/Manage Products/Inventory : set “Qty” to a value greater than 0
  • in Catalog/Manage Products/Inventory : set “Stock Availability” to “In Stock”
  • in Catalog/Catgories : assign your product to at least one category (you might have to create one first)
  • in CMS/Pages : select “Home Page”, then switch to the “Content”-tab and enter {{block type=”catalog/product_list” category_id=”21″ template=”catalog/product/list.phtml”}} into the large content-textarea (you might have to adjust the category_id if your newly created category_id differs from the one in this example.

Popularity: 31% [?]

Customizing Magento by overwriting core-classes

There are several possibilities of overwriting single magento-methods or whole classes. Of course you could be just altering the core-classes themselves in a quick and dirty approach. however, you should avoid this practice under all circumstances, because it corrupts the update-facilities of your eCommerce-site. Once you are upgrading your magento-copy to a newer version, all your changes would get lost.

Luckily, overwriting native magento-classes is pretty straight-forward, and therefore there is no reason not to do it the right way.

In this example, we are overwriting the core method of the block-class “Onepage_Billing” of the Mage_Checkout-core module to add another default address. This is just an example to show how you actually add new functionality by inheriting from a Magento-coreclass and overwriting particular methods.

Extend Magento Core-Class

app/code/local/Test/Checkout/Block/Onepage/Billing.php

First we derive from the class that we actually want to overrule. In our example, we are simply overwriting the core Onepage_Billing-class of the Mage_Checkout-core-module with an inherited class called

Test_Checkout_Block_Onepage_Billing

, which declares and therfore overrules the method

getAddressesHtmlSelect

. In this method we can add and/or alter all the functionality that we actually need.

<?php
class Test_Checkout_Block_Onepage_Billing extends Mage_Checkout_Block_Onepage_Billing
{
    public function getAddressesHtmlSelect($type)
    {
        if ($this->isCustomerLoggedIn()) {
            $options = array();
            foreach ($this->getCustomer()->getAddresses() as $address) {
                $options[] = array(
                    'value' => $address->getId(),
                    'label' => $address->format('oneline')
                );
            }

            $addressId = $this->getAddress()->getCustomerAddressId();
            if (empty($addressId)) {
                if ($type=='billing') {
                    $address = $this->getCustomer()->getPrimaryBillingAddress();
                } else {
                    $address = $this->getCustomer()->getPrimaryShippingAddress();
                }
                if ($address) {
                    $addressId = $address->getId();
                }
            }

            $select = $this->getLayout()->createBlock('core/html_select')
                ->setName($type.'_address_id')
                ->setId($type.'-address-select')
                ->setClass('address-select')
                ->setExtraParams('onchange="'.$type.'.newAddress(!this.value)"')
                ->setValue($addressId)
                ->setOptions($options);

            return $select->getHtml();
        }
        return '';
    }
}

Activate Module

app/etc/modules/Test_All.xml

Now it’s time to tell Magento that there is a module (in our example we have named it “Test”) which adds customized functionality to the Magento-core-functionality.

<?xml version="1.0"?>
<config>
    <!-- Please add items in alphabetic order. -->
    <modules>
        <Test_Checkout>
            <active>true</active>
            <codePool>local</codePool>
        </Test_Checkout>
     </modules>
</config>

Actual Overwrite

app/code/local/Test/Checkout/etc/config.xml

Now this is where the Magento-rewrite-magic pops in. By providing a rewrite-directive in the Test_Checkout-config.xml, Magento’s default behaviour can be overruled for certain pages, and we can make sure that our derived class is being loaded instead of the core Checkout-module from Magento.

<?xml version="1.0"?>
<config>
    <modules>
         <Test_Checkout>
            <version>0.1.0</version>
        </Test_Checkout>
    </modules>
    <global>
	    <blocks>
		    <checkout>
		        <rewrite>
		            <onepage_billing>Test_Checkout_Block_Onepage_Billing</onepage_billing>
		        </rewrite>
		    </checkout>
		</blocks>
   </global>
</config>

Clear Cache

Whenever we are changing Magento-settings by adding or modifying the underlying xml-configuration-files, we have to empty the cache (residing at app/var/cache) in order to have the changes come into effect. So before going wild because your changes don’t show, rather empty Magento’s file-cache.

Popularity: 75% [?]

Das Problem:
Wenn ein dynamisches Textfeld auf der obersten Ebene einer Schaltfläche liegt, erscheint beim Darüberfahren mit der Maus nicht wie beim Rest der Schaltfläche der Hand-Cursor, sondern der normale Mauszeiger, auch wenn die akive Fläche des Buttons weiterhin bestehen bleibt.

Im Klartext: Ein Button mit oben aufliegendem dynamischen Textfeld bleibt klickbar, aber der Mauszeiger wechselt über der betreffenden Textfläche nicht wie gewünscht zum Hand-Cursor.

Abhilfe:
Unter ActionScript 2 beheben wir dieses Phänomen, indem wir das “selectable”-Attribut des betreffenden Textfeldes auf false setzen. Die Möglichkeit, den Inhalt eines Textfeldes auszuwählen, steht nämlich bei AS2 in Konkurrenz zu den MouseEvents, die bei auswählbaren Textfeldern unter AS2 nicht an die dahinter liegende aktive Fläche eines Buttons weitergereicht (und somit ausgewertet) werden können.

Unter AS2 hilft uns diese Anweisung, um den Mauszeigerwechsel auch über Textfeldern zu bewirken:

Textfeld.selectable = false;

Dies hilft uns allerdings unter ActionScript3 nicht weiter. Auch wenn ein Textfeld nicht auswählbar ist, fängt es trotzdem etwaige MouseEvents ab, die dann nicht mehr für darunterliegende Schaltflächen zur Verfügung stehen.

Wir schaffen für dieses Problem Abhilfe, indem wir das “mouseEnabled”-Attribut heranziehen, das seit AS3 auch für alle Textfelder bereitsteht. Wenn wir mit Hilfe von

Textfeld.mouseEnabled = false;

verhindern, dass das Textfeld selbst auf Mausevents reagiert, halten wir so gleichzeitig auch den “Luftraum” über der aktiven Schaltfläche frei. Anschließend wird nicht mehr das Textfeld, sondern wie gewünscht die dahinterliegende Schaltfläche für MouseEvents empfänglich..

Popularity: 80% [?]

Im Zuge des Relaunches mehrerer Produktserien aus dem Bereich Autopflege und Polituren erfolgte im Auftrag der Firma Franz Billich die Umsetzung eines Logo- und Labeldesigns für das Autopflegeprodukt “Car Love”.

CarLoveCarLove High Finish Polish

Erstellt und umgesetzt mit Illustrator. Logo-Entwicklung und Illustration: Timor Kodal

Popularity: 49% [?]

Im Zuge der Organisation eines Festivals vor den Toren Berlins habe ich einen doppelseitigen 4/4 – Flyer erstellt.

Weitere Infos zur Veranstaltung findet man unter http://sommerlandung.pulsar.cc

Barfuss Sommerlandung 2010

Barfuss Sommerlandung 2010

Erstellt und umgesetzt mit Illustrator. Illustration: Timor Kodal

Popularity: 37% [?]

Seit 21. Mai läuft in der FH Potsdam die Seminarreihe “Urban Sounds”, im Rahmen derer ich eine kleine Einführung in die Grundlagen der Anwendung von Apple Logic und Ableton Live (beides Programme zum Aufnehmen, Arrangieren und (Post)Produzieren von Sound und Musik) geben werde. Zwischen den Terminen sind die teilnehmenden Studenten im Rahmen einer Projektarbeit zum Thema “Berlin Wall of Sound” aufgerufen, eigene Fieldrecordings zu erstellen und diese zum nächsten Seminartermin mitzubringen.

Dann werden die gesammelten Audiodaten gemeinsam bearbeitet und stehen für eine weitere kreative Verwendung zur Verfügung.

So wird im Verlauf des zweiten Blockseminar-Termins mit Hilfe von Flash eine rudimentäre Visualisierung der Audiofiles während der Wiedergabe realisiert und den Studenten die hierfür erforderlichen Kenntnisse von “Adobe Flash” vermittelt.

Die Ergebnisse des Seminars werden am 21. Juni im Rahmen eines Vortrags im Fachbereich “Kulturarbeit” der FH vorgestellt und weitere Anwendungsmöglichkeiten dieses Themenkomplexes diskutiert.

Eine das Seminar begleitende Website ist unter dieser URL abrufbar:

stadtakustik.kodal.de

Popularity: 35% [?]