Skip to content

Instantly share code, notes, and snippets.

View roman204's full-sized avatar
🎯
Focusing

Roman Hutterer roman204

🎯
Focusing
View GitHub Profile
@roman204
roman204 / config.xml
Created April 30, 2014 06:49
magento allow other filetypes in wysiwyg in config.xml
<adminhtml>
<cms>
<browser>
<extensions>
<allowed>
<pdf>1</pdf>
</allowed>
<image_allowed>
<pdf>1</pdf>
</image_allowed>
@roman204
roman204 / mysql4-upgrade-0.0.1-0.0.2.php
Created June 26, 2014 09:15
magento modify attribute in setup-script
$installer = $this;
$installer->startSetup();
$model = Mage::getModel('catalog/resource_eav_attribute');
$model->loadByCode('catalog_product', 'visibility');
$model->setIsGlobal(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL);
$installer->endSetup();
@roman204
roman204 / Data.php
Last active August 29, 2015 14:03
Magento load widget by title
private function getWidgetByTitleFilter($filter)
{
$collection = Mage::getModel('widget/widget_instance')->getCollection();
$collection->addStoreFilter(Mage::app()->getStore()->getId(), false)
->addFieldToFilter('title', $filter)->load();
$widget = $collection->getFirstItem();
if($widget && is_numeric($widget->getId())) {
$widgetBlock = Mage::app()->getLayout()
@roman204
roman204 / install-magento-1.9
Last active August 29, 2015 14:03 — forked from RasdyCute/gist:8929851
shell script for install a new magento 1.9
mkdir demo
cd demo
sudo wget http://www.magentocommerce.com/downloads/assets/1.9.0.1/magento-1.9.0.1.tar.gz
sudo wget http://www.magentocommerce.com/downloads/assets/1.9.0.0/magento-sample-data-1.9.0.0.tar.gz
tar -zxvf magento-1.9.0.1.tar.gz
tar -zxvf magento-sample-data-1.9.0.0.tar.gz
rsync -a magento-sample-data-1.9.0.0/media/* magento/media/
mv magento-sample-data-1.9.0.0/magento_sample_data_for_1.9.0.0.sql magento/data.sql
mv magento/* magento/.htaccess .
chmod o+w var var/.htaccess app/etc
@roman204
roman204 / directsale_setup_mysql4-install-0.1.0.php
Created July 2, 2014 09:06
installscript to create website/storegroup/store + root-category
<?php
/**
* Created by PhpStorm.
* User: rhutterer
* Date: 02.07.14
* Time: 08:55
*/
$this->startSetup();
//#addWebsite
/** @var $website Mage_Core_Model_Website */
@roman204
roman204 / mysql4-upgrade-0.2.0-0.3.0.php
Created July 18, 2014 08:26
create cms/block in installscript
<?php
/**
* Created by PhpStorm.
* User: rhutterer
* Date: 18.07.14
* Time: 09:21
*/
$installer = $this;
//installer for footer cms-blocks
@roman204
roman204 / composer.json
Created July 31, 2014 12:58
composer.json for magento setup with modman and symlinks
{
"minimum-stability": "dev",
"require": {
"magento-hackathon/magento-composer-installer": "*",
"integer-net/magento-localized-de": "dev-master",
"riconeitzel/german-localepack-de-de": "dev-preview",
"firegento/magesetup": "dev-feature/revocation_product_types#b5f50cdef0c588377f97cecf34442680e67076a4",
"firegento/pdf": "dev-master",
"magento-hackathon/localefallback": "dev-master",
<?php
$attribute_value = Mage::getResourceSingleton('catalog/product')->getAttributeRawValue($productId, 'attribute_code', Mage::app()->getStore());
echo $attribute_value;
rsync \
--verbose \
--progress \
--stats \
--compress \
--rsh=/usr/bin/ssh \
--recursive \
--times \
--perms \
--links \
@roman204
roman204 / addthis.phtml
Last active August 29, 2015 14:06
addthis widget with click to enable
<?php
/**
* Created by PhpStorm.
* User: rhutterer
* Date: 10.09.14
* Time: 12:24
*/
?>
<div class="addthis-icons clearfix">
<span><?php echo $this->__('Share:') ?></span>