oh phpStorm ist so eben in Version 3.0 erschienen, daher gleich mal installiert.
Hier die Änderungen im Überblick:
Hello from JetBrains!
Great news of the day: PhpStorm 3.0 — a major upgrade of our PHP IDE — is out!
It brings many new features and improvements, reflecting several hundred of your votes in our issue tracker:
- Smart Duplicated Code Detector to help you quickly find similar blocks of code through your entire code base and securely get rid of them without losing the intended functionality.
- A new integrated UML tool allows you to quickly get a bird’s-eye view of your project structure, or even a semantic view of the changes in the recent VCS commits made by your colleagues.
- To ensure that your code works fast and doesn’t cause any performance bottlenecks, the IDE now includes a profiler.
The key new functionality in PhpStorm 3.0 includes:
- Smart Duplicated Code Detector
- PHP UML diagrams
- Profiling results browser for Xdebug and Zend Debugger engines
- PhpUnit test runner is now fully compatible with PhpUnit 3.6
- CoffeeScript support
- Significant improvements to FTP/SFTP Sync
- TFS support and revision graph for GIT
- Streamlined UI across all operating systems
Read more about what’s new and download PhpStorm 3.0.
Also coming soon: WebStorm 3.0 – a lightweight, smart IDE for JavaScript, HTML and CSS! Expect CoffeeScript, Node.JS and JSLint.
Develop with pleasure!
JetBrains Team
Bei neuen Attributen welche im Admin-Backend konfigurierbar sind, ist es bei Text-Feldern des Öfteren gewünscht ein WYSIWYG-Editor zu aktivieren.
Das geht wie folgt:
// Zu erst die Funktion <em>prepareLayout</em>der Elternklasse überschreiben
/**
* Loads the wysiwyg editor on demand, if enabled.
*
* @return Mage_Adminhtml_Block_Widget_Form
*/
protected function _prepareLayout() {
parent::_prepareLayout();
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
}
}
// danach die addField Methode des fieldset erweitern mit
/* 'wysiwyg' => true,
'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig()
*/
// Das Ergebnis sollte dann wie folgt aussehen:
$fieldset->addField('feld_name_text, 'editor', array(
'name' => 'feld_name_text',
'label' => Mage::helper('cms')->__('Name des Feldes'),
'title' => Mage::helper('cms')->__('Name des Feldes'),
'wysiwyg' => true,
'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig()
));
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
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;
}
}
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,
geht über die Server-Variable “HTTP_X_FORWARDED_FOR” wie folgt:
echo $_SERVER["HTTP_X_FORWARDED_FOR"];
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)
));
}
Zwar 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::
- Login auf der Benutzeroberfläche: http://localhost/ZendServer
- zum Reiter Server Setup wechseln
- Den Zend Debugger durch Klick auf den Button Turn off deaktivieren
- 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!
Folgende Typen / Möglichkeiten gibt es in Magento um im Backend Datums-Typen Anzuzeigen (weg über system.xml):
<use_calendar translate="label">
<label>Use JavaScript Calendar</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</use_calendar>
<date_fields_order translate="label">
<label>Date Fields Order</label>
<frontend_type>select</frontend_type>
<frontend_model>adminhtml/catalog_form_renderer_config_dateFieldsOrder</frontend_model>
<sort_order>2</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</date_fields_order>
<time_format translate="label">
<label>Time Format</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_catalog_timeFormat</source_model>
<sort_order>3</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</time_format>
<year_range translate="label comment">
<label>Year Range</label>
<comment>Use four-digit year format.</comment>
<frontend_type>text</frontend_type>
<frontend_model>adminhtml/catalog_form_renderer_config_yearRange</frontend_model>
<sort_order>4</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</year_range>
Nach der Installation von Zend Server CE ist PEAR erst mal nicht einsatzbereit.
Konfigurieren lässt sich PEAR ganz einfach über den Aufruf der Datei …\ZendServer\bin\go-pear.bat (mit Admin-Rechten ausführen).
Startet die PEAR_ENV.reg (liegt ebenfalls unter …\ZendServer\bin\)!
Danach könnt ihr PHPUnit direkt über PEAR nach installieren, einfach im selben Ordner mit den Kommandos:
pear upgrade pear
pear channel-discover components.ez.no
pear channel-discover pear.phpunit.de
pear channel-discover pear.symfony-project.com
pear install –alldeps phpunit/PHPUnit
Taucht eine Fehlermeldung ähnlich:
Failed to download pear/HTTP_Request2 within preferred state “stable”, latest re
lease is version 2.0.0RC1, stability “beta”, use “channel://pear.php.net/HTTP_Request2-2.0.0RC1″ to install
install failed
so wechselt den Status mit pear config-set preferred_state beta und start die installation erneut!
Taucht ein Fehler ähnlich dem folgenden auf:
C:\Program Files\Zend\ZendServer\bin>pear install pear/XML_RPC2
SECURITY ERROR: Will not write to C:\Users\User\AppData\Local\Temp\pear\cache\
b521f99a31e9c4ca2b11faa4b5f31ef5rest.cacheid as it is symlinked to C:\Users\dani
el\AppData\Local\Temp\pear\cache\b521f99a31e9c4ca2b11faa4b5f31ef5rest.cacheid -
Possible symlink attack
install failed
Löscht einfach den Cache-Ordner!