magento

warning: Creating default object from empty value in /data/web/1/000/027/003/273448/htdocs/panticz.de/modules/taxonomy/taxonomy.pages.inc on line 33.

Magento: Customize Recently Viewed Products block

Move block from right to bottom
http://panticz.de/sites/default/files/magento/recently-viewed/recently-viewed.xml

<?xml version="1.0" encoding="UTF-8"?>


	
		
		

		
			
            css/recently-viewed.css
		
	

	
		
			
			
		
	

	
		
			
			
		
	

1

Fix design
http://panticz.de/sites/default/files/magento/recently-viewed/recently-viewed.css

/* recently viewed block */
.category-products,
.product-view {
    margin-bottom:15px;
}

#recently-viewed-items .product-image {
    height:127px;
    text-align: center;
}
1

Patch product_viewed.phtml
mkdir -p ./app/design/frontend/default/default/template/reports/
cp ./app/design/frontend/base/default/template/reports/product_viewed.phtml ./app/design/frontend/default/default/template/reports/product_viewed.phtml
wget -nv http://dl.dropbox.com/u/4170695/magento/recently-viewed/product_viewed.phtml.diff -O /tmp/product_viewed.phtml.diff
patch -p2 ./app/design/frontend/default/default/template/reports/product_viewed.phtml < /tmp/product_viewed.phtml.diff
http://panticz.de/sites/default/files/magento/recently-viewed/product_viewed.phtml.diff

--- ./app/design/frontend/base/default/template/reports/product_viewed.phtml	2011-01-12 13:26:26.000000000 +0100
+++ ./app/design/frontend/default/default/template/reports/product_viewed.phtml	2011-01-12 15:54:07.000000000 +0100
@@ -31,10 +31,13 @@
         <?php echo $this->__('Recently Viewed Products') ?>
     

Change item count to 4
Go Admin > System > Configuration > Catatlog > Catalog
Recently Viewed/Compared Products
Default Recently Viewed Products count: 4

or run this SQL command:
UPDATE core_config_data SET value = '4' WHERE path = 'catalog/recently_products/viewed_count';

Links
http://svn.magentocommerce.com/source/branches/1.3/app/design/frontend/default/default/template/reports/home_product_viewed.phtml

Magento: customize footer

customize footer
http://panticz.de/sites/default/files/magento/footer/footer.phtml.diff

--- ./app/design/frontend/default/default/template/page/html/footer.phtml.org	2010-12-23 12:02:22.000000000 +0100
+++ ./app/design/frontend/default/default/template/page/html/footer.phtml	2010-12-23 12:02:28.000000000 +0100
@@ -26,7 +26,7 @@
 ?>
 
1

remove footer links
http://panticz.de/sites/default/files/magento/footer/local.xml

<?xml version="1.0" encoding="UTF-8"?>


	
		
	

1

Links
http://www.matthias-zeis.com/archiv/footer-links-magento-anpassen

Magento: Search by Category

http://panticz.de/sites/default/files/magento/catalogsearch/form.mini.phtml

helper('catalogsearch')->getResultUrl() ?>" method="get">
    
helper('catalogsearch')->getQueryParamName() ?>" value="<?php echo $this->helper('catalogsearch')->getEscapedQueryText() ?>" class="input-text" /> <?php $startCategory = 2227; ?> ">Alle Kategorien <?php $searchCategory = Mage::app()->getRequest()->getParam('cat'); $cats = Mage::getModel('catalog/category')->load($startCategory)->getChildren(); $catIds = explode(',', $cats); $categories = array(); foreach($catIds as $catId) { $category = Mage::getModel('catalog/category')->load($catId); $categories[$category->getName()] = $catId; } ksort($categories, SORT_STRING); ?> <?php foreach($categories as $name => $catId): ?> " <?php if($catId == $searchCategory) echo "selected"?>><?php echo $name; ?> <?php endforeach; ?> __('Search') ?>" class="button"><?php echo $this->__('Search') ?>
//__('') ?>'); searchForm.initAutocomplete('<?php echo $this->helper('catalogsearch')->getSuggestUrl() ?>', 'search_autocomplete'); //]]>
<?php /* old version $categories = Mage::getModel('catalog/category')->load(2227)->getChildren(); $catIds = explode(',',$categories); foreach($catIds as $catId) { $category = Mage::getModel('catalog/category')->load($catId); $categoryName = $category->getName(); echo "$categoryName\n"; } */ ?> 1

http://panticz.de/sites/default/files/magento/catalogsearch/catalogsearch.xml.diff

--- ./app/design/frontend/base/default/layout/catalogsearch.xml	2010-11-29 15:05:49.000000000 +0100
+++ ./app/design/frontend/default/default/layout/catalogsearch.xml	2010-11-29 15:29:58.000000000 +0100
@@ -51,7 +51,7 @@
         
         
         
-            page/3columns.phtml
+            page/2columns-left.phtml
         
         
             
@@ -69,6 +69,7 @@
                     two_columns_right4
                     three_columns3
                     product_list_toolbar
+                    4
                 
                 
                 
@@ -85,7 +86,7 @@
         Advanced Search Form
         
         
-            page/2columns-right.phtml
+            page/2columns-left.phtml
         
         
             js_csscalendar/calendar-win2k-1.css
@@ -107,16 +108,21 @@
         
         
         
-            page/2columns-right.phtml
+            page/2columns-left.phtml
         
         
             
                 
+                    
+                        
+                    
                     empty6
                     one_column5
                     two_columns_left4
                     two_columns_right4
                     three_columns3
+                    product_list_toolbar
+                    4
                 
                 
                 
@@ -131,7 +137,7 @@
         
 
         
-            page/1column.phtml
+            page/2columns-left.phtml
         
         
             
1

http://panticz.de/sites/default/files/magento/catalogsearch/Query.php.diff

--- ./app/code/core/Mage/CatalogSearch/Model/Mysql4/Query.php.org	2010-12-15 16:32:26.000000000 +0100
+++ ./app/code/core/Mage/CatalogSearch/Model/Mysql4/Query.php	2010-12-15 16:34:40.000000000 +0100
@@ -64,6 +64,9 @@
      */
     public function loadByQuery(Mage_Core_Model_Abstract $object, $value)
     {
+        $startCategory = 2227;
+        $searchCategory = Mage::app()->getRequest()->getParam('cat');
+        if($searchCategory == $startCategory) {
         $select = $this->_getReadAdapter()->select()
             ->from($this->getMainTable())
             ->where('synonym_for=?', $value)
@@ -74,6 +77,7 @@
             $object->setData($data);
             $this->_afterLoad($object);
         }
+        }
 
         return $this;
     }
1

Links:
http://stackoverflow.com/questions/4273898/how-to-sort-a-category-list-array-alphabetically-in-magento

Magento: GoogleAnalytics fix

http://panticz.de/sites/default/files/magento/GoogleAnalytics/Ga.php.diff

--- ./app/code/core/Mage/GoogleAnalytics/Block/Ga.php.org	2010-12-01 16:30:16.000000000 +0100
+++ ./app/code/core/Mage/GoogleAnalytics/Block/Ga.php	2010-12-01 16:33:05.000000000 +0100
@@ -177,6 +177,7 @@
         (document.getElementsByTagName(\'head\')[0] || document.getElementsByTagName(\'body\')[0]).appendChild(ga);
     })();
 
+    var _gaq = _gaq || [];
     _gaq.push(["_setAccount", "' . $this->getAccount() . '"]);
     _gaq.push(["_trackPageview", "'.$this->getPageName().'"]);
 //]]>
1

wget http://www.panticz.de/sites/default/files/magento/GoogleAnalytics/Ga.php.diff -O /tmp/Ga.php.diff
patch -p2 ./app/code/core/Mage/GoogleAnalytics/Block/Ga.php < /tmp/Ga.php.diff

#
# TEST
#
# get source code
cd /tmp/
svn checkout http://svn.magentocommerce.com/source/branches/1.4-trunk

# trunk
cd /tmp/1.4-trunk/

# pack
tar cjf GoogleAnalytics.tar.bz2 app/code/core/Mage/GoogleAnalytics/ app/design/frontend/base/default/layout/googleanalytics.xml app/locale/en_US/Mage_GoogleAnalytics.csv --exclude=.svn

# transfer archive to your magento machine
scp /tmp/1.4-trunk/GoogleAnalytics.tar.bz2 root@YOUR_MAGENTO_IP:/tmp

# extract
diff app/code/core/Mage/GoogleAnalytics/ /var/www/app/code/core/Mage/GoogleAnalytics/ -r

# Links
http://www.magentocommerce.com/boards/viewthread/23325/P45/
http://www.magentocommerce.com/boards/viewthread/77774/#t215469

Magento customized "Shop by" Navigation

http://panticz.de/sites/default/files/magento/customized-shop-by/local.xml

<?xml version="1.0" encoding="UTF-8"?>


	
	
		
		
			
			css/local.css
		
	


	
	
		
			4
		

		
            
			

            
			
				category_filter
			
		
	


1

http://panticz.de/sites/default/files/magento/customized-shop-by/layer_view.css

/*
* /skin/frontend/default/default/css/local.css
*/

/* layer_view custom css */
.block-layered-nav-filter {
    clear:both;
}

.block-layered-nav-filter-name,
.block-layered-nav-filter-value {
    float:left;
}

.block-layered-nav-filter-value li {
    float:left;
    padding-top:4px;
    padding-left:14px;
}
1

http://panticz.de/sites/default/files/magento/customized-shop-by/my.view.phtml

<?php
/**
 * Category layered navigation
 *
 * @see Mage_Catalog_Block_Layer_View
 * http://docs.magentocommerce.com/Mage_Catalog/Mage_Catalog_Block_Layer_View.html
 *
 * customized layered navigation
 * ./app/design/frontend/default/default/template/catalog/layer/my.view.phtml
 * based on
 * ./app/design/frontend/base/default/template/catalog/layer/view.phtml
 *
 * v2011-02-08 by panticz
 */
?>

<?php
function is_filter($_filters, $_content = "") {
    if(strlen($_content) > 0) {
       return true;
    } else {
        foreach ($_filters as $_filter) {
            if($_filter->getItemsCount() > 1) {
                return true;    
            }
        }
    }

    return false;
}

/* overide this function to disable filter on some category */
function checkAttribute($_filter) {
    return true;

    /* example: show this filter only in this category
    $category = array(
        "diagonal" => array("TV", "LCD", "Plasma"),
        "resolution" => array("Beamer")
    );

    $currentCategory = Mage::registry('current_category');

    if($_filter->getAttributeModel() != null) {
        $attributeCode = $_filter->getAttributeModel()->getAttributeCode();

        // check if filter for attribute exists
        if (array_key_exists($attributeCode, $filter)) {
            // find top category name
            while($currentCategory->getLevel() > 3) {
                $currentCategory = $currentCategory->getParentCategory();
            }

            // check if top category in filter
            if(in_array($currentCategory->getName(), $filter[$attributeCode])) {
                return true;
            } else {
                return false;
            }
        }
    }
        
    return true;
    */
}

/* overide this function to disable filter on some pages */
function showFilter() {
    return true;

    /* example: dont show filter in root category
    if(Mage::registry('current_category')->getUrlPath() == "shop.html") {
        return false;
    } else {
        return true;
    }
    */
}
?>

<?php if($this->canShowBlock() && showFilter()): ?>
    <?php $_filters = $this->getFilters() ?>
    <?php if(is_filter($_filters, $this->getStateHtml())): ?>
        
<?php echo $this->getStateHtml() ?> <?php if($this->canShowOptions()): ?> <?php if(is_filter($_filters)): ?> <?php echo $this->__('Shopping Options') ?> <?php foreach ($_filters as $_filter): ?> <?php if($_filter->getItemsCount() > 1 && checkAttribute($_filter)): ?>
  1. <?php echo $this->__($_filter->getName()) ?>:
<?php echo $_filter->getHtml() ?>
<?php endif; ?> <?php endforeach; ?> <?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?> 1

http://panticz.de/sites/default/files/magento/customized-shop-by/filter.phtml

<?php
    if (strrpos($this->helper('core/url')->getCurrentUrl(), "catalogsearch")) {
        include($_SERVER["DOCUMENT_ROOT"] . "/app/design/frontend/base/default/template/catalog/layer/filter.phtml");
    } else {
        include("filter.select.phtml");
    }
?>

1

http://panticz.de/sites/default/files/magento/customized-shop-by/filter.select.phtml

<?php
/**
 * Template for filter items block
 *
 * @see Mage_Catalog_Block_Layer_Filter
 * http://docs.magentocommerce.com/Mage_Catalog/Mage_Catalog_Block_Layer_Filter_Attribute.html
 *
 * ./app/design/frontend/default/default/template/catalog/layer/filter.phtml
 * based on
 * ./app/design/frontend/base/default/template/catalog/layer/filter.phtml
 */
?>






    <?php echo $this->__('All') ?>
    <?php foreach ($this->getItems() as $_item): ?>
    urlEscape($_item->getUrl()) ?>"><?php echo $_item->getLabel() ?> (<?php echo $_item->getCount() ?>)
    <?php endforeach ?>

1

http://panticz.de/sites/default/files/magento/customized-shop-by/state.phtml

<?php
    if (strrpos($this->helper('core/url')->getCurrentUrl(), "catalogsearch")) {
        echo "";
        //include($_SERVER["DOCUMENT_ROOT"] . "/app/design/frontend/base/default/template/catalog/layer/state.phtml");
    } else {
        include("state.select.phtml");
    }
?>

1

http://panticz.de/sites/default/files/magento/customized-shop-by/state.select.phtml

<?php 
/**
 * Category layered navigation state
 *
 * @see Mage_Catalog_Block_Layer_State
 * http://docs.magentocommerce.com/Mage_Catalog/Mage_Catalog_Block_Layer_State.html
 *
 * ./app/design/frontend/default/default/template/catalog/layer/state.phtml
 * based on
 * ./app/design/frontend/base/default/template/catalog/layer/state.phtml
 *
 * v2011-02-08 by panticz
 *
 */
?>

<?php $_filters = $this->getActiveFilters() ?>
<?php if(!empty($_filters)): ?>
    
    
    

    <?php echo $this->__('Currently Shopping by') ?>
        getClearUrl() ?>" class="btn-remove" title="<?php echo $this->__('Clear All') ?>"><?php echo $this->__('Clear All') ?>
    
    <?php foreach ($_filters as $_filter): ?>
        
  1. <?php echo $this->__($_filter->getName()) ?>:
<?php echo $_filter->getLabel() ?> getRemoveUrl() ?>"><?php echo $this->__('All') ?> <?php endforeach; ?> <?php endif; ?> 1

OPTIONAL: state.phtml with filter
ToDo: HowTo get avaiable options in a category for a filter?
http://panticz.de/sites/default/files/magento/customized-shop-by/state.phtml.with.filter.dev

<?php 
/**
 * Category layered navigation state
 *
 * @see Mage_Catalog_Block_Layer_State
 * http://docs.magentocommerce.com/Mage_Catalog/Mage_Catalog_Block_Layer_State.html
 *
 * ./app/design/frontend/default/default/template/catalog/layer/state.phtml
 * based on
 * ./app/design/frontend/base/default/template/catalog/layer/state.phtml
 */
?>

<?php $_filters = $this->getActiveFilters() ?>
<?php if(!empty($_filters)): ?>
    
    
    

    <?php echo $this->__('Currently Shopping by') ?>getClearUrl() ?>" class="btn-remove" title="<?php echo $this->__('Clear All') ?>"><?php echo $this->__('Clear All') ?>
    <?php foreach ($_filters as $_filter): ?>
        
  1. <?php echo $this->__($_filter->getName()) ?>:
getRemoveUrl() ?>"><?php echo $this->__('All') ?> <?php $attributeCode = $_filter->getFilter()->getRequestVar(); $product = Mage::getModel('catalog/product'); $collection = Mage::getResourceModel('eav/entity_attribute_collection')->setCodeFilter($attributeCode); // ->setEntityTypeFilter($product->getResource()->getTypeId()) $_attribute = $collection->getFirstItem()->setEntity($product->getResource()); $attribute_options = $_attribute->getSource()->getAllOptions(false); /* $layer = Mage::getModel("catalog/layer"); //foreach($categories as $categoryid) { // $category = Mage::getModel("catalog/category")->load($categoryid); $category = Mage::registry('current_category'); $layer->setCurrentCategory($category); $attributes = $layer->getFilterableAttributes(); echo "xxxxxxxxxxxx" . print_r($attributes); //} //$_activefilters = Mage::getSingleton(’Mage_Catalog_Block_Layer_State’)->getActiveFilters(); */ ?> <?php foreach($attribute_options as $option): ?> <?php $optionLabel = $option['label']; ?> <?php $optionValue = $option['value']; ?> <?php if(strrpos($_filter->getRemoveUrl(), "?")) $token = "&"; else $token = "?"; ?> <?php $link = $token . $attributeCode . "=" . $optionValue; echo $link; ?> getRemoveUrl()) . $link; ?>" <?php if($optionLabel == $_filter->getLabel()) echo " selected"; ?>><?php echo $optionLabel // $_filter->getLabel() ?> <?php endforeach; ?> <?php endforeach; ?> <?php endif; ?> 1

other files
./app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php
./app/design/frontend/default/default/layout/catalogsearch.xml

Links
http://classyllama.com/development/magento-development/the-better-way-to-modify-magento-layout/
http://docs.magentocommerce.com/Mage_Catalog/Mage_Catalog_Block_Layer_Filter_Attribute.html
http://www.mageintern.de/magento-shop-design/magento-navigation/filternavigation-layered-nav-mit-drop-down-auswahl.html
http://www.magentocommerce.com/boards/viewthread/28220/

Magento product back button

http://www.panticz.de/sites/default/files/magento/back-button/styles.css

/*
* add to ./skin/frontend/default/default/css/styles.css
*/
.add-to-box .back-button {
    padding: 180px 0 0;
}

.back-button {
    float: right
    padding: 8px 0 0;
}
1

http://www.panticz.de/sites/default/files/magento/back-button/back-button.view.phtml

// ./app/design/frontend/default/default/template/catalog/product/view.phtml
// add to 
block after this line // <?php echo $this->getChildHtml('addto') ?> <?php if ($_category = $_product->getCategory()): ?>
__('Back') ?>" type="button"> <?php echo $this->__('Back') ?>
<?php endif;?> 1

mkdir -p ./app/design/frontend/default/default/template/catalogsearch/
cp ./app/design/frontend/base/default/template/catalogsearch/result.phtml ./app/design/frontend/default/default/template/catalogsearch/result.phtml
http://www.panticz.de/sites/default/files/magento/back-button/result.phtml.diff

--- ./app/design/frontend/base/default/template/catalogsearch/result.phtml	2011-02-09 16:24:16.000000000 +0100
+++ ./app/design/frontend/default/default/template/catalogsearch/result.phtml	2011-02-09 16:33:45.000000000 +0100
@@ -53,3 +53,11 @@
     <?php endif; ?>
 
 <?php endif; ?>
+
+
+ __('Back') ?>" type="button"> + + <?php echo $this->__('Back') ?> + + +
1

mkdir -p ./app/design/frontend/default/default/template/page/
cp ./app/design/frontend/base/default/template/page/1column.phtml ./app/design/frontend/default/default/template/page/
http://www.panticz.de/sites/default/files/magento/back-button/1column.phtml.diff

--- ./app/design/frontend/base/default/template/page/1column.phtml	2011-02-09 17:24:38.000000000 +0100
+++ ./app/design/frontend/default/default/template/page/1column.phtml	2011-02-09 17:25:45.000000000 +0100
@@ -47,6 +47,13 @@
                     <?php echo $this->getChildHtml('global_messages') ?>
                     <?php echo $this->getChildHtml('content') ?>
                 
+
+ __('Back') ?>" type="button"> + + <?php echo $this->__('Back') ?> + + +
<?php echo $this->getChildHtml('footer') ?> 1

Links
http://www.mxperts.de/zuruck-button-fur-die-produktansicht/

Increase session timeout to one day (API and SESSION)

Session SQL
INSERT INTO core_config_data(path, value)
VALUES ('web/cookie/cookie_lifetime', 86400)
ON DUPLICATE KEY UPDATE value = 86400;

or manual:
System -> Configuration
General > Web
Session Cookie management
Cookie Lifetime: 86400

API SQL
INSERT INTO core_config_data(path, value)
VALUES ('api/config/session_timeout', 86400)
ON DUPLICATE KEY UPDATE value = 86400;

or manual:
System -> Configuration
General > Services
Magento Core Api
General Settings
Client Session timeout (sec.): 86400

NoRegion

http://www.magentocommerce.com/extension/1826/mxperts--noregion
/var/www/pear install magento-community/Mxperts_NoRegion

Disable telephone as required in customer/address

--- app/design/frontend/default/default/template/noregion/customer/address/edit.phtml.org	2011-03-16 12:07:11.000000000 +0100
+++ app/design/frontend/default/default/template/noregion/customer/address/edit.phtml	2011-03-16 12:06:40.000000000 +0100
@@ -210,9 +210,9 @@
             
             
  • - *<?php echo $this->__('Telephone') ?> + <?php echo $this->__('Telephone') ?>
    - htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" id="telephone" /> + htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text" id="telephone" />
    1
  • Links
    http://www.magentocommerce.com/boards/viewthread/9081/P45/

    Change Magento Default Theme

    # Modern
    cd /var/www
    /var/www/pear mage-setup /var/www
    /var/www/pear install magento-core/Interface_Frontend_Default_Modern

    System > Configuration > Design > Themes
    Default: modern

    # Blank
    cd /var/www
    /var/www/pear mage-setup /var/www
    /var/www/pear install magento-core/Interface_Frontend_Default_Modern

    System > Configuration
    General > Design > Themes
    Default: blank

    # Links
    http://www.magentocommerce.com/design_guide/articles/working-with-magento-themes#head-say-hello-to-multiple

    Syndicate content