Magento: Session Success or Failure Message after redirect – Magento HowTo

27. April 2011 at 10:14

Add a Success, Info or Error Message to the session and save this for re-direction in Magento

//A Success Message
 Mage::getSingleton('checkout/session')->addSuccess("Your cart has been updated successfully!");
 //A Error Message
 Mage::getSingleton('checkout/session')->addError("Your cart has been updated successfully!");
 //A Info Message (See link below)
 Mage::getSingleton('checkout/session')->addNotice("This is just a FYI message...");
 //These two lines are required to get it to work
 session_write_close(); //THIS LINE IS VERY IMPORTANT!
 $this->_redirect('checkout/cart');

WARNUNG: Finger Weg vom Facebook Profil-Stalker – der Facebook-Wurm / Virus

26. April 2011 at 20:40

Facebook LogoDa ich langsam echt genervt bin, aktuell wird man fast alle 5 Minuten bei Facebook damit zugespammt … trotz Hinweise, Warnungen und teilweise öffentlicher Aufklärung fallen ständig Leute auf diesen „Facebook Profil-Stalker“ Wurm/Virus rein fallen, dieser Warn-Artikel für alle Facebook-Benutzer.

Diese Facebook-Anwendung postet unter dem Titel „Meine Top Profil-Stalker“ wahllos vier Namen aus der Freundesliste auf der Facebook-Wall und ordnet diesen einen Wert zu, wie oft diese angeblich auf dem jeweiligen Profil des Nutzers waren. Wirkt als wäre es eine nette Idee, ist es aber nicht, denn:

1. Facebook unterbindet es dass Facebook-Anwendungen (oder Externe) diese Daten auslesen können.
2. Grundsätzlich sind es fast immer die selben Zahlen welche gepostet werden.
3. der Ober-Hammer: Der Anwender wird aufgefordert einen JavaScript-Code in die Adresszeile seines Web-Browsers zu kopieren und auszuführen. Nur Anwender mit nicht vorhandenen Internet-Affinität fallen auf so etwas rein (Stichwort: Internet-Führerschein 😉
Irgend welch Schad-JavaScript-Code direkt in die Browser-Addresszeile seines Browsers zu kopieren ist mehr als Leichtsinnig, vor allem wenn nicht klar ist von wem dieser genau stammt (also nicht machen)!

Also bitte kopiert nicht irgend welch Links oder Schadcode aus unbekannter Quelle bei/von Facebook in eure Browser-Addresszeile.

Andere Benutzer werden euch danken, da sie weniger Spam bekommen, ihr selbst gefährdet die Sicherheit eures Computers nicht, und alles ist schön! 🙂

Ihr seit schon hereingefallen? Was könnt ihr nun machen?

Unter anderem hilft euch folgendes Browserplugin: webgraph.com/resources/facebookblocker welches diesen Facebook-SPAM-Script blockiert.

Auch das löschen eures Browser-Caches sowie Cookies ist zu empfehlen!

Das Verwenden von kostenlosen Anti-Spy-Scannern wie z.B. Adaware ist ebenfalls nützlich!

Überprüft auch mal eine Privatsphären-Einstellungen bei Facebook ob diese Anwendung dort gelistet wird, falls ja löscht/entfernt/blockiert sie!

Magento: PHP-Code in Content-Seiten (CMS) einbinden – HowTo

26. April 2011 at 18:00

Aus Sicherheitsgründen ist es nicht gestattet in Magento-CMS-Pages direkt PHP-Code einzubinden.

Über dem folgenden Weg ist dies möglich:

Im Template Ordner muss dazu eine Datei zum einbinden vorhanden oder angelegt werden. Z.B. die test.phtml welche im Ordner  /app/design/frontend/default/default/test/test.phtml abgelegt wird.

In dieser Datei kann, wie in den phtml-template-files üblich, php-code aufgerufen werden, z.b.:

<strong><?php echo "Hello World"; ?></strong>

In der CMS-Page ruft ihr diese Template-Datei wie folgt auf:

{{block type="core/template" template="test/test.phtml"}}

Windows 7: zeitgesteuert herunterfahren/neustart (CMD-Befehle)

20. April 2011 at 09:27

auto-shutdown-windows-7-info-fenster

Zeit gesteuertes herunter fahren oder neustart des Systems ist unter Windows wie folgt möglich:

  1. Kommandozeile öffnen ([Windows-Taste]+[R] drücken und CMD eingeben)
  2. Folgende Befehle / Parameter sind möglich (Eingeben und mit [Enter] bestätigen):

shutdown /s (Fährt den Rechner sofort herunter)
shutdown /s /t 600 (Rechner wird in 10 Minuten runtergefahren)
shutdown /r (Neustart des Rechners)
shutdown /f (Erzwingt das Schließen ausgeführter Anwendungen)
shutdown /a
(Bricht das Herunterfahren des Systems ab)

Overview: svn status codes / svn stat

18. April 2011 at 18:09

Overview about svn status codes (after typing of svn stat):

Name

svn status — Print the status of working copy files and directories.

Synopsis

svn status [PATH...]

Description

Print the status of working copy files and directories. With no arguments, it prints only locally modified items (no repository access). With --show-updates, add working revision and server out-of-date information. With --verbose, print full revision information on every item.

The first five columns in the output are each one character wide, and each column gives you information about different aspects of each working copy item.

The first column indicates that an item was added, deleted, or otherwise changed.

‚ ‚
No modifications.

‚A‘
Item is scheduled for Addition.

‚D‘
Item is scheduled for Deletion.

‚M‘
Item has been modified.

‚C‘
Item is in conflict with updates received from the repository.

‚X‘
Item is related to an externals definition.

‚I‘
Item is being ignored (e.g. with the svn:ignore property).

‚?‘
Item is not under version control.

‚!‘
Item is missing (e.g. you moved or deleted it without using svn). This also indicates that a directory is incomplete (a checkout or update was interrupted).

‚~‘
Item is versioned as a directory, but has been replaced by a file, or vice versa.

The second column tells the status of a file’s or directory’s properties.

‚ ‚
No modifications.

‚M‘
Properties for this item have been modified.

‚C‘
Properties for this item are in conflict with property updates received from the repository.

The third column is populated only if the working copy directory is locked.

‚ ‚
Item is not locked.

‚L‘
Item is locked.

The fourth column is populated only if the item is scheduled for addition-with-history.

‚ ‚
No history scheduled with commit.

‚+‘
History scheduled with commit.

The fifth column is populated only if the item is switched relative to its parent (see the section called “Switching a Working Copy”).

‚ ‚
Item is a child of its parent directory.

‚S‘
Item is switched.

The out-of-date information appears in the eighth column (only if you pass the --show-updates switch).

‚ ‚
The item in your working copy is up-to-date.

‚*‘
A newer revision of the item exists on the server.

The remaining fields are variable width and delimited by spaces. The working revision is the next field if the --show-updates or --verbose switches are passed.

If the --verbose switch is passed, the last committed revision and last committed author are displayed next.

The working copy path is always the final field, so it can include spaces.

Alternate Names

stat, st

Magento: Attribute zur Checkout-Quote hinzufügen

14. April 2011 at 17:01

Zuerst muss in der Datenbank die Quote Tabelle entsprechend mit dem neuen Attribute erweitert werden, dies geht wie gewohnt über die setup-scripte (z.B. mysql4-install-0.0.X.php):

$installer = $this;
$installer->startSetup();
$installer->addAttribute('quote', 'new_attribute', array(
 'label'                        => 'New Attribute',
 'type'                        => 'varchar',
));
$installer->endSetup();

Danach könnt ihr, z.b. im OnepageController.php dieses Attribute wie folgt mit Werten füllen:

Mage::getSingleton('checkout/session')->getQuote()->setNewAttribute('value');
 Mage::getSingleton('checkout/session')->getQuote()->collectTotals();
 Mage::getSingleton('checkout/session')->getQuote()->save();

Be careful on input and type. Input means the input type of the attribute. And type means the input type in database.

For textfield it will be:
'input' => 'text',
'type' => 'text',

For textarea it will be:
'input' => 'textarea',
'type' => 'text',

For date field it will be:
'input' => 'date',
'type' => 'datetime',

For select list it will be:
'input' => 'select',
'type' => 'text',

For boolean select it will be:
'input' => 'boolean',
'type' => 'int',

Magento: Admin URL für Admin-Backend-Bereich ändern – Anleitung / HowTo

13. April 2011 at 16:42

Den Pfad in der URL zum Magento Admin-Backend-Bereich könnt ihrin der local.xml unter app/etc/ im folgenden Bereich ändern:

<admin>
 <routers>
 <adminhtml>
 <args>
 <frontName><![CDATA[admin]]></frontName>
 </args>
 </adminhtml>
 </routers>
 </admin>

 

 

Wichtig ist dabei der Teil wo „Admin“ steht bei <frontName><![CDATA[admin]]></frontName>, soll der neue path lauten „admin-admin“ ändert den Part wie folgt: <frontName><![CDATA[admin-admin]]></frontName>

PHP: Funktion um Sonderzeichen / Umlaute zu mappen

13. April 2011 at 11:48

Mit der folgenden Funktion könnt ihr Sonderzeichen bzw. Ausländische Buchstaben (ISO8859-1 & ISO8859-2) in  deutschen Standard-Buchstaben konvertieren.

Mapping of special characters (ISO8859-1 & ISO8859-2) to German standard characters.

function _char_mapping($string)
 {
 $table = array(
 'À'=>'A',
 'Á'=>'A',
 'Â'=>'A',
 'Ã'=>'A',
 'Å'=>'A',
 'Æ'=>'A',
 'Ç'=>'C',
 'È'=>'E',
 'É'=>'E',
 'Ê'=>'E',
 'Ì'=>'I',
 'Î'=>'I',
 'Ï'=>'I',
 'Ð'=>'D',
 'Ñ'=>'N',
 'Ò'=>'O',
 'Ó'=>'O',
 'Ô'=>'O',
 'Õ'=>'O',
 '×'=>'x',
 'Ø'=>'OE',
 'Ù'=>'U',
 'Ú'=>'U',
 'Û'=>'U',
 'Ý'=>'Y',
 'à'=>'a',
 'á'=>'a',
 'â'=>'a',
 'ã'=>'a',
 'å'=>'o',
 'æ'=>'a',
 'ç'=>'c',
 'è'=>'e',
 'é'=>'e',
 'ê'=>'e',
 'ë'=>'e',
 'ì'=>'i',
 'í'=>'i',
 'î'=>'i',
 'ï'=>'i',
 'ð'=>'d',
 'ñ'=>'n',
 'ò'=>'o',
 'ó'=>'o',
 'ô'=>'o',
 'õ'=>'o',
 'ø'=>'oe',
 'ù'=>'u',
 'ú'=>'u',
 'û'=>'u',
 'ý'=>'y',
 'ÿ'=>'y',
 'A'=>'A',
 'L'=>'L',
 'L'=>'L',
 'S'=>'S',
 'Š'=>'S',
 'S'=>'S',
 'T'=>'T',
 'Z'=>'Z',
 'Ž'=>'Z',
 'Z'=>'Z',
 'a'=>'a',
 'l'=>'I',
 'l'=>'I',
 's'=>'s',
 'š'=>'s',
 's'=>'s',
 't'=>'t',
 'z'=>'z',
 'ž'=>'z',
 'z'=>'z',
 'R'=>'R',
 'Á'=>'A',
 'Â'=>'A',
 'A'=>'A',
 'L'=>'L',
 'C'=>'C',
 'Ç'=>'C',
 'C'=>'C',
 'É'=>'E',
 'E'=>'E',
 'Ë'=>'E',
 'E'=>'E',
 'Í'=>'I',
 'Î'=>'I',
 'D'=>'D',
 'Ð'=>'D',
 'N'=>'N',
 'N'=>'N',
 'R'=>'R',
 'U'=>'U',
 'Ô'=>'O',
 'O'=>'O',
 'r'=>'r',
 'd'=>'d',
 'u'=>'u',
 'e'=>'e'
 );
 return strtr($string, $table);
 }

 

 

Magento: IE9 fix

1. April 2011 at 10:56

magento ecommerce logo

Nach der Veröffentlichung es neuen Internet-Explorer 9 (kurz: IE9), berichten einige Benutzer über Probleme mit Magento und JavaScript. Die Ursache ist ein geändertes DOM-Handling im IE9, die in Magento verwendete Ajax-Bibliothek Prototype berücksichtigt dies noch nicht berücksichtigt. In der aktuellen Prototype Version 1.7 ist dieser Fehler bereits behoben. Allerdings setzen die meisten Magento-Installationen noch ältere Prototype-Bibliotheken ein.

Durch hinzufügen folgender Meta-Tags könnt ihr diesen Fehler temporär umgehen:

<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />