Load normal product price instead of indexed product price

Would you like to ignore the indexed product price in the templates (for example in catalog/product/list.phtml where the indexed price is used)?

Then go to: catalog/product/list.phtml


getPriceHtml($product) ?>


load($_product->getId()); ?>
getPriceHtml($product) ?>

There are two occurrences in list.phtml, so don’t forget to replace it twice. Only do this when it’s the only solution of displaying right prices, since loading the product takes extra time, compared to loading the indexed product price.

Magento Contact Form Attachment Functionality

Would you like to have attachments in your contact form in Magento?

Do the following:

  1. Clone the zip of this github: https://github.com/yogisfunda/magento-contact-form-attachment
  2. Upload (merge) the files into the public_html directory
  3. Recompile/flush cache
  4. Go to your-site.com/contacts
  5. If the form does not changes or there’s a blank page, move the contents of the frontend/default part to frontend/base.

You can insert the form as a widget on a cms page by adding the following code:

{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="eurowsport/customform/customform.phtml"}}

Magento admin category tree shows no sub categories

Ever had that the category tree does not show specific subcategories that are present though?

Than follow these steps:

1. Make a backup for if anything goes wrong (running all the steps is on your own risk of course).

2. Run this query

SELECT c.entity_id, c.children_count as original_children_count, COUNT(c2.children_count) as `children_count`, c.level as original_level, (LENGTH(c.path)-LENGTH(REPLACE(c.path,'/',''))) as `level`
FROM catalog_category_entity c
LEFT JOIN catalog_category_entity c2 ON c2.path like CONCAT(c.path,'/%')
GROUP BY c.path

3. Check if there are still minus children_count categories with:

SELECT c.entity_id, c.children_count as original_children_count, COUNT(c2.children_count) as `children_count`, c.level as original_level, (LENGTH(c.path)-LENGTH(REPLACE(c.path,'/',''))) as `level`
FROM catalog_category_entity c
LEFT JOIN catalog_category_entity c2 ON c2.path like CONCAT(c.path,'/%')
GROUP BY c.path

If anything went right, it should show a + sign before the category in the category tree in the Magento admin again. Good luck

This error is likely caused by a category copy/duplicate plugin.

Thanks to: http://magento.stackexchange.com/questions/34730/not-showing-sub-categories-in-category-tree-in-manage-products-page

Magento A/B testing or Multivariate testing – Php script

Split test A/B PHP Script

Magento is quite limited in tools like conversion optimalisation like A/B testing or multivariate testing. That is why I created a very simple php script that you can put directly into a phtml file. It’s a bit hacky, that it’s not via the core, but it works though and is fast. This script has its limitation, see the note on the bottom.

If you want to variate the text of a button on the product page and go to a file like /app/design/frontend/default/default/catalog/product/view.phtml and insert this into the header (in the php-code):


$var = array();
$var[1]['name'] = 'direct';
$var[1]['value'] = 'Buy direct';
$var[2]['name'] = 'purchase';
$var[2]['value'] = 'Purchase product';
$var[3]['name'] = 'invest';
$var[3]['value'] = 'Invest in product';

$choice = cookieCheck($var);

function cookieCheck($var)
	$cookie = Mage::getSingleton('core/cookie');
	$cookievalue = $cookie->get('variation_test');
	if (isset($cookievalue) && ($cookievalue > 0))
		$choice = $cookievalue;
		$choice = rand(1,count($var));
		$cookie->set('variation_test', $choice ,time()+30*86400,'/');
	return $choice;

Then create a piece of text like a link or a button. That is where the variation takes place:

<? echo $var[$choice]['value']; ?>

If you want to track the variable in Google Analytics, you can edit the template file /app/design/frontend/default/default/googleanalytics/ga.phtml , so it gets like:


$var = array();
$var[1]['name'] = 'direct';
$var[1]['value'] = 'Buy direct';
$var[2]['name'] = 'purchase';
$var[2]['value'] = 'Purchase product';
$var[3]['name'] = 'invest';
$var[3]['value'] = 'Invest in product';

$choice = cookieCheck();

function cookieCheck()
	$cookie = Mage::getSingleton('core/cookie');
	$cookievalue = $cookie->get('variation_test');
	if (isset($cookievalue) && ($cookievalue > 0))
		$choice = $cookievalue;
		$choice = rand(1,count($var));
		$cookie->set('variation_test', $choice ,time()+30*86400,'/');
	return $choice;
isUserNotAllowSaveCookie()): ?>


Note: This script could not work properly if you’re using Full Page Cache. Also it could not work with the page block html cache. So, work in progress …

Lesti::Fpc and layered navigation (Vinagento and Amasty)

How to let Lesti::FPC Full page caching work with Vinagento Layered Navigation in Ajax mode?

I just tried some random settings and this seemed to work:

In System->Configuration->Sytem->Lesti FPC add the following to Session Params:

In System->Configuration->Sytem->Lesti FPC add the following to Uri Params:

How to let Lesti::FPC Full page caching work with Amasty Layered Navigation in Ajax mode?

The parameters for Amasty will follow shortly.

Ebay Store SEO and optimisation

With a Magento blog it’s quite easy exporting your products to an Ebay store with free plugins like M2EPro. That is a free plugin, bought by Ebay, that’s able to export your full shop to other languages. When you have an Ebay store, it doesn’t run by itself mostly. Here are some optimisation tips (Ebay SEO tips) in order to get more visitors and get more orders.

1. Set up the store

In order to set up the store, make sure you use the documentation of M2EPro. If you’re stuck, send them a mail. Their support is great!

When the store is set up, make sure you have set shipping cost for all countries, which are reasonable. Also communicate your pro’s in the product’s description template.

2. Get reviews for good SEO effort

Ebay is all about trust. In order to getting a get reputation, get enough reviews. The more reviews the better

3. Enter meta information in Ebay (meta title and meta description)

Just like regular SEO, with your Ebay Store meta description and meta title is very important. Set up your keywords here: http://cgi6.ebay.com/ws/eBayISAPI.dll?StoreMgmtViewCustomKeywords . Don’t use to much keywords, as it will be used in the meta title, which shouldn’t be too long as you know as a SEO expert.

4. Use enough content in your home store page

Like almost every site, the homepage has the most link value. So use this power of the homepage. Create some content in the header text and state all the keywords you want to use.

5. Build links to your store

Make sure you get found in Google as well with enough links to your Ebay Store. Make use of linkbuilding. Use your own site (maybe it has some value) and link to your Ebay Store.

6. Use one Ebay tld

Ebay has the strange behaviour that it’s store functionality has many different tld’s. Like stores.ebay.co.uk and stores.ebay.com . If you use SEO and you only use one language and one region, build links mostly on one tld (like .co.uk) in order to maximise the potential of one domain, so it gets all the link value. An example of such a Ebay Store is QSP Products.

Module error message: MediabrowserUtility is not defined

If you install a custom module in Magento it could lack the TinyMce Mediabrowser. You get the following message then:

error: error in [unknown object].fireEvent():

event name: open_browser_callback

error message: MediabrowserUtility is not defined

How to fix this?

Quick fix

In /app/design/adminhtml/default/default/layout/YOURMODULE.xml add:


Or change to

Long solution (may not work)

In your /YOURMODULE/etc/config.xml you have:



In Block/Adminhtml/YOURMODULE/Edit.php

protected function _prepareLayout() {
    if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {

Then in the top of Block/Adminhtml/YOURMODULE/Edit/Tab/Form.php

 protected function _prepareForm() {
            $form = new Varien_Data_Form();
            $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('add_variables' => false,
         'add_widgets' => false,
          'add_images' => true,
          'files_browser_window_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index'),
          'files_browser_window_width' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width'),
          'files_browser_window_height'=> (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height')

Further down:

$fieldset->addField('not-called-content', 'editor', array(
                                    'name'      => 'not-called-content',
                                    'label'     => Mage::helper('WHATEVER')->__('Content'),
                                    'title'     => Mage::helper('WHATEVER')->__('Content'),
                                    'style'     => 'width:550px; height:300px;',
                                    'required'  => false,
                                    'config'    => $wysiwygConfig,
                                    'wysiwyg'   => true

With thanks to Theodores

Add an image field in your admin plugin (by example AW Blog)

Schermafbeelding 2013-07-03 om 14.28.17

Add an image field to plugins like AW Blog

Edit in /app/code/community/AW/Blog/Block/Manage/Blog/Edit/Tab/Form.php

$fieldset->addField('filename', 'file', array(
'label' => Mage::helper('blog')->__('Image'),
'required' => false,
'name' => 'filename',
'after_element_html' => 'Formaat 125 x 118 pixels',

Edit in /app/code/community/AW/Blog/controllers/Manage/BlogController.php after:

public function saveAction() {

if ($data = $this->getRequest()->getPost()) {


if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
try {
/* Starting upload */
$uploader = new Varien_File_Uploader('filename');

// Any extention would work

// Set the file upload mode
// false -> get the file directly in the specified folder
// true -> get the file in the product like folders
// (file.jpg will go in something like /media/f/i/file.jpg)

// We set media as the upload dir
$path = Mage::getBaseDir('media') . DS ;
$uploader->save($path, $_FILES['filename']['name'] );

} catch (Exception $e) {


//this way the name is saved in DB
$data['filename'] = $_FILES['filename']['name'];

Further add an field ‘filename’ in your db (table ‘aw_blog’).

And finally in /app/code/community/AW/Blog/Block/Blog/Edit/Form.php make sure that $form variable is defined as follows, so it works with multipart/form-data:

$form = new Varien_Data_Form(array(
'id' => 'edit_form',
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
'method' => 'post',
'enctype' => 'multipart/form-data',