Magento: Add new container block

You can create a basic “container” as is done with the “right, left, and content” blocks by just adding something like

<block type="core/text_list" name="myblock" as="myblock"></block>

to page.xml. From there you can populate it with content blocks via the layout files as normal.
(more…)

Magento: How to add a new block?

If you want to reference a static block from inside of a CMS page or another static block use this syntax:

{{block  type="cms/block" block_id="my-new-block"}}

If you want to reference a static block from Layout Update XML use this syntax:

<block type="cms/block" name="position-9">
<action method="setBlockId"><block_id>position-9</block_id></action>
</block>

If you want to reference a static block from a PHTML file use this syntax:

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('my-new-block')->toHtml() ?>

Name and Email auto hide/show

To make Name and Email auto hide/show like this:






use this code:

<form method="post" name="Dateform">
  <input  name="nameTrip" value="Name" onfocus="if(this.value == 'Name') this.value =''" onblur="if (this.value == '') this.value='Name'" type="text">
  <input  name="emailTrip" value="E-mail" onfocus="if(this.value == 'E-mail') this.value =''" onblur="if (this.value=='') this.value='E-mail'" type="text">
  <textarea autocomplete="off"  name="textarea" onfocus="if(this.value == 'Details') this.value =''" onblur="if (this.value=='') this.value='Details'">Details</textarea>
</form>

Bookmark your site

Step 1: Add the below code to the section of your page:

<script type="text/javascript">

/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
}
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}
</script>

Step 2: Create either an image or text link that will be used as the Bookmark Site link. For the href attribute, use the following code:

<a href="javascript:bookmarksite('Site Nmae', 'http://www.sitename.com')">Bookmark this site!</a>

Moving Magento site To Another Server

MySQL Dump.

backup all files (make sure to archive on a .zip file).

Now you need to create a blank database and import the MySQL dump file to it.
Note: load the SQL dump into Editplus or something similar and search and replace the URLs before importing for example: “http://www.domain.com/test/” replace with “http://www.test.com/”.
(more…)

Getting and Using Categories and Sub Categories

Magento ver: 1.3.2.4
——————–
The code below does a couple of things, first it will get all the store’s categories – it then checks to see if they are active before continuing.
Also – it might be helpful to have the sub categories displayed, right? Well, in my case, I only wanted the subcategory for the current category displayed – so I put a check in to do so.
(more…)

Magento: Print Labels

A quick fix to add a pop up print label print window in the orders page. Uses the default admin template, so you need to refresh on Magento upgrade. Have left red css border so you can use to position the label. (EDITORS PLEASE NOTE: if you edit this make sure to use 3 backslashes to get one output when using before the “n” character in code section.()
Edit info.phtml
(more…)

Pin It on Pinterest