Banner - Blog zu den Themen Programmierung, SEO, SEM, Social Media, Internet Marketing, Webdesign, IT-Service und Mehr - SEO Hannover - IT-Dienstleistungen und SEO Agentur Fly2Mars-Media.de

Archiv

Autor Archiv

Linux: Dateien mit ls sortiert anzeigen

14. September 2011 Keine Kommentare

Mit dem Linux-Bash-Tool ls kann man in diversen Variationen Dateien & Ordner sortieren, hier eine Übersicht der wichtigsten Kommandos:

  • ls -trl
    Dateien nach Zeit der Dateierzeugung anzeigen lassen
  • ls -turl
    Zeigt die Dateien an, auf die zuletzt zugegriffen wurde
  • ls -c
    Dateien nach Datum der letzten Änderung der Satusinformationen anzeigen lassen
  • ls -f
    Deaktiviert die Standardsortierung und Zeigt auch . und .. an
  • ls -S
    Sortiert nach Dateigröße
  • ls -t
    Sortiert nach dem Datum der letzten Änderung
  • ls -U
    Keine Sortierung
  • ls -u
    Sortiert nach Zugriffszeit
  • ls -X
    Sortiert nach Dateierweiterung
KategorienLinux Tags: , , ,

Magento: delete an system attribute

13. September 2011 Keine Kommentare

To delete a system attribute in Magento, you must first have to make it user defined.

- Go to phpmyadmin
- Go to your magento installation database
- Go to eav_attribute table
- Browse table with attribute_code ‘YOUR_ATTRIBUTE_CODE’ OR browse the table with the attribute_id of your    attribute (‘your attribute’ means the attribute which you want to remove as system attribute)
- Edit the table row of your attribute
- Find the field “is_user_defined” and set the value to 1
- save the attribute

 

Now your attribute no longer remains System Attribute
Now you can delete it from Attribute manager

KategorienMagento Tags: , , ,

Magento: Mail versenden

8. September 2011 Keine Kommentare

send email in magento (php-code) :

$template_var_array = array(
'var_1' => 'value 1',
'var_2' => 'value 2'
);
$sender = array('name' => 'name', 'email' => 'email@adresse.com');
$translate = Mage::getSingleton('core/translate');
$translate->setTranslateInline(false);
$emailTemplate = Mage::getModel('core/email_template');
$emailTemplate->setDesignConfig(array('area' => 'backend'))
->sendTransactional(
Mage::getStoreConfig('core/email_template'),
Mage::getStoreConfig('general'), // alternate $sender
Mage::getStoreConfig('general'), // absender
null,
$template_var_array;
}
}
KategorienMagento, PHP, Programmierung Tags: , ,

Magento: Parent Role id ‘G4′ does not exist (or other ids)

2. September 2011 Keine Kommentare

Magento reads the rows from the database table admin_role in the wrong” order. That is it reads the user entry before the parent group (the role) is loaded. This happends because the user rows has a tree_level = 1, when they should have tree_level = 2 or more.

Solution:

To fix a broken admin-interface, run the following query in the magento database:
UPDATE admin_role SET tree_level = 2 WHERE role_type = “U”;

To prevent the error from happening again:
Open up the file app/code/core/Mage/Admin/Model/Mysql4/User.php

On line 162 (or close to that line) you find a row that says:
‘tree_level’ => $row[’tree_level’] + 1,

change this line to:
‘tree_level’ => $row[’tree_level’] + 2,

KategorienMagento, PHP, Programmierung Tags: , ,

redirect mobile clients with mod_rewrite

If you want redirect mobile clients to an own domain, you can do this about the .htaccess file with the following code:

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{HTTP_HOST} !^.mobile\.domain\.de$
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|play|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "up.browser|up.link|windowssce|iemobile|mini|mmp" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|mobile|pda|psp" [NC]
 RewriteCond %{HTTP_USER_AGENT} "!(macintosh|ipad)" [NC]
 RewriteRule ^(.*)$ http://mobile.domain.de/ [L,R=302]
</IfModule>

Iphone / Ipad Emulator – Platformunabhängig – GPL/Kostenlos

Ein kostenlosen (GPL) Plattformunabhängigen (auf Adobe Air Basis) Ipad Emulator könnt ihr bei Google Code laden unter:

http://code.google.com/p/ibbdemo2/downloads/list

KategorienInternet Tags: , , , ,

PHP: In PHP den Referer Forwarded Client / IP anzeigen, auch hinter einem Load-Balancer

geht über die Server-Variable “HTTP_X_FORWARDED_FOR” wie folgt:

echo $_SERVER["HTTP_X_FORWARDED_FOR"];
KategorienPHP, Programmierung Tags: , ,

Magento: Page Cache anpassen

Das Caching könnt ihr in Magento wie folgt beeinflussen:

protected function _construct()
{
$this->addData(array(
'cache_lifetime'    => 900,
'cache_tags'        => array(Mage_Catalog_Model_Product::CACHE_TAG),
'cache_key'            => $this->getCacheKey()
));
}
public function getCacheKey()
{
return $this->getRequest()->getRequestUri().$this->getCacheCurrencyCode();
}
//retreive current currency code
public function getCacheCurrencyCode()
{
return Mage::app()->getStore()->getCurrentCurrencyCode();
}

De-Aktivieren könnt ihr das Caching wie folgt:

protected function _construct()
{
$this->addData(array(
'cache_lifetime'    => null,
'cache_tags'        => array(Mage_Catalog_Model_Product::CACHE_TAG)
));
}
KategorienMagento, PHP, Programmierung Tags: , ,

Linux or UNIX – Find and remove file command – bash

Find and remove file (about name)

find . -name "FILE-TO-FIND"-exec rm -rf {} \;

Find and remove file (about file type)

find . -type f -name "FILE-TO-FIND" -exec rm -f {} \;

Find all *.bak files in current directory and removes them with confirmation from user:

$ find . -type f -name "*.bak" -exec rm -i {} \;

Find all core files and remove them:

find / -name core -exec rm -f {} \;
KategorienLinux Tags: ,

XDebug auf Zend Server CE (Community Edition) unter Windows einrichten (mit PHP 5.2)

zend logoZwar ist ZendDebugger beim Zend-Server integriert, allerdings habe ich ihn mit phpStorm nicht zum laufen bekommen, von d.h. hier ein kurzes HowTo wie ihr xDebug in ZendServer integrieren könnt:

Ladet die Datei php_xdebug-2.1.1-5.2-vc6-nts.dll (ggf. höhere Version, nts-version ist für die non-thread-saved apache – version … phpinfo erkennt ihr welche Version ihr benötigt, alternativ testen ;-) von http://xdebug.org/files/ und packt sie in das entsprechende Verzeichnis, z.b. C:\Program Files\Zend\ZendServer\lib\phpext

Wenn ihr XDebug einsetzt, müsst ihr vorher den Zend Debugger deaktiviert, das geht über die Zend-Server Adminoberfläche wie folgt::

  1. Login auf der Benutzeroberfläche: http://localhost/ZendServer
  2. zum Reiter Server Setup wechseln
  3. Den Zend Debugger durch Klick auf den Button Turn off deaktivieren
  4. PHP neu starten (Button rechts unten)

Jetzt noch in der php.ini xdebug einbinden (liegt unter C:\Programme\Zend\ZendServer\etc):

zend_extension=”C:\Program Files\Zend\ZendServer\lib\phpext\php_xdebug-2.1.1-5.2-vc6-nts.dll”
zend_extension=”C:\Program Files\Zend\ZendServer\lib\ZendExtensionManager.dll”

Achtung: ZendExtensionManager.dll darf nur nach der php_xdebug.dll eingebunden werden!

Jetzt noch Server neu starten und xdebug sollte verfügbar sein. Prüft dazu die phpinfo ob xdebug dort auftaucht!