Ecommerce Developer
 
 

Platforms & Shopping Carts

Excerpt: Magento 1.3 Sales Tactics Cookbook, Chapter 10 Create a Wholesale Store

 

cover image from Magento 1.3 Sales Tactics Cookbook William Rice's Magento 1.3 Sales Tactics Cookbook from Packt Publishing describes in detail how to implement a number of merchandising features, including describing changes to .phtml template files.

This excerpt comes from page 246 to page 251 of chapter 10, Create a Wholesale Store, and is republished here with permission. The book is written in a recipe style, so don't be surprised by the bulleted lists.

Creating a Static Block, and Adding It To Your Catalog Pages

A static block is a portable piece of HTML code that you can place anywhere in a page or site. You can put anything in a static block that you can put on a web page, if it fits the small space. Usually, you place a static block in the left or right column of a page. Sometimes you place it in a footer or header.

In our example, we will create a static block to inform shoppers of our wholesale program. However, you can use a static block for many other purposes such as to advertise sales, announce contests, feature products, and more.

  1. First, let's create the new theme. Assuming that you are using the default Magento theme, find the file: \app\design\frontend\default\default\layout\wishlist\catalog.xml. You don't need to do anything with it yet. Just find it and make sure that you have access to it.
  2. Create a new directory to hold the new theme. In our example store, we use a theme called coffee. So, we created this directory structure: \app\design\frontend\default\coffee\layout. Notice that we needed to create an entire directory structure. Under \app\design\frontend\default, we created a new directory with our theme name coffee. Then, under coffee, we created the directory layout.
  3. Copy the file catalog.xml from the directory you looked at in Step 1, to the directory that you just created.

Now, we create a new static block.

  1. Log in to your site's backend or Administrative Panel.
  2. Select CMS | Static Blocks. The Manage Pages page displays. A list of the CMS pages (or "static pages") in your store should appear on this page.
  3. Select the Add New Block button. The New Block page will display.
  4. In the Block Title field, enter a title for the block. Your customers will not see this title. However, you will see it in the list of static blocks.
  5. In the Identifier field, enter a name for the block that consists of only letters, numbers, hyphens, and underscores. You will use this identifier later, when you modify the catalog.xml file that you copied in the previous part. If needed, write down this identifier so you remember it.
  6. Select the Store View(s) for which this block is available. For this block to appear, it will need to be available to the store view, and it will need to be in the XML file for that store.
  7. For Status, select Enabled.
  8. In the Content field, enter the HTML code that will be displayed in the block. This can be text only or include a graphic. Remember that the block is small, so keep any graphics small and your text brief. In our example, we include a link to the CMS page that we created [earlier in the chapter] called, "How to Become a Wholesale Customer?"
  9. Save the block.

shows example from Magento backend

Now, we edit the layout file so that it displays our static block.

shows three code hints are are covered in the code below

  1. Open catalog.xml in a text editor or an HTML editor.
  2. Scroll down to the section of the file that controls the layout for the type of page that you want to modify.
  3. To place the block in the left column, look for this code: . To place it in the right column, look for .
  4. Add the code to display the static block. In our example, we have made the code we added bold. The name of our block is areyouwholesale. Replace that with the name of the block that you created.
  5. Save the file.
  6. Select System | Cache Management.
  7. From the All Cache drop-down menu, select Disable.
  8. Save the cache settings.

[Here is the code for step 4:]

<default>
<!-- Mage_Catalog -->
<reference name="top.menu">
<block type="catalog/navigation" name="catalog.topnav"
template="catalog/navigation/top.phtml"/>
</reference>
<reference name="left">
<block type="core/template" name="left.permanent.callout"
template="callouts/left_col.phtml">
<action method="setImgSrc"><src>images/media/col_left_callout.jpg</src></action>
<action method="setImgAlt" translate="alt"
module="catalog"><alt>Not sure what to order?. Call us at
(555) 555-1212.</alt></action>
<action method="setLinkUrl"><url>contacts</url></action>
</block>
</reference>
<reference name="right">
<block type="cms/block" name="are_you_wholesale">
<action method="setBlockId"><block_id>are_you_wholesale </block_id></action>
</block>
<block type="core/template" before="cart_sidebar"
name="catalog.compare.sidebar"
template="catalog/product/compare/sidebar.phtml"/>
<block type="core/template" name="right.permanent.callout"
template="callouts/right_col.phtml"/>
</reference>
<reference name="footer_links">
<action method="addLink" translate="label title" module="catalog"
ifconfig="catalog/seo/site_map"><label>Site Map</label><url
helper="catalog/map/getCategoryUrl" /><title>Site
Map</title></action>
</reference>
</default>

Shows block on example site

Related Articles

0 Comments

Rss-sm