Magento Resource | E-Commerce Generation Explorer

CAT | cms

Here is an example for how to add magento form validation to a custom form:

1
2
3
4
5
6
7
8
9
10
<form action="samepage.php" method="post" id="form_to_validate">
<input id="name" name="name" type="text" class="input-text required-entry"/>
<input id="email" name="email" type="text"  class="input-text required-entry validate-email"/>
</form>
 
<script type="text/javascript">
//< ![CDATA[
var form_to_validate = new VarienForm('form_to_validate',true);
//]]>
</script>

Notes:
– For the form to be validate you need to add the appropriate classes to your input fields.
You will notice all of the input fields have one common class name, required-entry.
To find available class names, try going to One page checkout page, where you have checkout form, then simply view source and look for class names next to input, radio select and other fields.
– Also you must add the Javascript code at the bottom of your custom form. It is quite important!

· ·

If you need to change the footer copyright notification use the next instruction:

1. Open the Magento admin panel
2. Select the “System” tab
3. Click the “Configuration” menu item
4. Select the “Design” menu item
5. Click the “Footer” tab. Here you can change the copyright notification
6. With that done, click the “Save Configure” button.

· ·

Here is a quickly reference for how to remove the “My Downloadable Products” on Customer Account Dashboard.

In app/design/frontend/default/default/layout/downloadable.xml, remove this in the beginning of the file:

1
2
3
4
5
6
7
8
9
<customer_account>
<reference name="customer_account_navigation">
<action method="addLink" translate="label" module="downloadable">
<name>downloadable_products</name>
<path>downloadable/customer/products</path>
<label>My Downloadable Products</label>
</action>
</reference>
</customer_account>

OK, We done it.

· ·

You’ll probably know by now that the transactional email templates in Magento are a bit, with respect, “naff”. To edit through the admin will take forever and a day so here’s a couple of useful solutions to help make things easier.

1. Locate the email templates

The Magento email templates are located in (note: “en_US” may change depending on language).
magento\app\locale\en_US\template\email\account_new.html”:
magento\app\locale\en_US\template\email\admin_password_new.html”:
magento\app\locale\en_US\template\email\newsletter_subscr_confirm.html”:
magento\app\locale\en_US\template\email\order_creditmemo.html”:
magento\app\locale\en_US\template\email\order_creditmemo.html”:
magento\app\locale\en_US\template\email\order_invoice.html”:
magento\app\locale\en_US\template\email\order_invoice.html”:
magento\app\locale\en_US\template\email\order_new.html”:
magento\app\locale\en_US\template\email\order_new.html”:
magento\app\locale\en_US\template\email\order_shipment.html”:
magento\app\locale\en_US\template\email\order_shipment.html”:
magento\app\locale\en_US\template\email\order_update.html”:
magento\app\locale\en_US\template\email\password_new.html”:
magento\app\locale\en_US\template\email\wishlist_share.html”:
(more…)

· ·

Here are codes which you can put on the block to show your best seller products.

Bestseller.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
//bestseller module - grabs from all products, returns in order of total quantity ordered
class Mage_Catalog_Block_Product_Bestseller extends Mage_Catalog_Block_Product_Abstract
{
public function __construct()
{
parent::__construct();
$storeId = Mage::app()->getStore()->getId();
$products = Mage::getResourceModel(’reports/product_collection’)
->addOrderedQty()
->addAttributeToSelect(array(’name’, ‘price’, ’small_image’, ’short_description’, ‘description’, ‘author’))
->setStoreId($storeId)
->addStoreFilter($storeId)
->setOrder(’ordered_qty’, ‘desc’);
Mage::getSingleton(’catalog/product_status’)->addVisibleFilterToCollection($products);
Mage::getSingleton(’catalog/product_visibility’)->addVisibleInCatalogFilterToCollection($products);
//$products->setPageSize(6)->setCurPage(1);
$this->setProductCollection($products);
}
}
?>

These blocks do not represent all there is to making use of them. These should all work with “List.phtml” in the Catalog module design files, but you might want to create your own template.

The easiest way to implement these and make them usable is to add them to a Mage folder within the Local code folder (rather than core):
app/code/local/Mage/Catalog/Block/Product/Bestseller.php

This lets you skip the step of creating a custom module in order to use a simple block who’s only purpose is to list a category of products (or bestsellers in this case).

Codes from http://www.exploremagento.com

·

From the default MAGENTO template, you always can see the call out images on the left/right side.

We can easily turn on Template Path hints in the admin section:
1.Admin > System > Configuration
2.Switch your “Current Configuration Scope” to your store
3.Click on the Developer Tab (bottom left) and find the Debug area
4.Template Path Hints: Yes
5.Then refresh your debugging page, you will see all the paths on the screen
(more…)

· ·

You need to edit the following file:
/app/design/your_interface/your_theme/layout/catalogsearch.xml

Search for setTemplate. It’s located in 4 places in the page. (catalogsearch_result_index, catalogsearch_advanced_index, catalogsearch_advanced_result and catalogsearch_term_popular)

For example:

1
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>

Update the name of the template you wish to use in between the tags

After update:

1
<action method="setTemplate"><template>page/newtemplate.phtml</template></action>

All Done!

· ·

Adding and removing javascript / css when and where you need it

Adding and removing Javascript and CSS is handled separately within Magento.

CSS is added in the usual like . But any included javascript (unless linked to “by hand” from a theme’s skin) is pulled via a php files which reads through the “js” folder in the root directory (root/js/index.php is responsible for this).

That is all well and good for Magento. The real question is how we, as developers, add these items when we need them.
In this post, we will show how to add and remove Javascript and CSS to a CMS page (and anywhere else) that you may need.
(more…)

· · ·

Here it goes.

1. Step One
/app/design/frontend/default/default/template/page/html

copy header.phtml to something like header2.html

2. Step Two
/app/design/frontend/default/default/layout
edit page.xml

you can just copy existing Block and change type and name only.

1
2
3
4
5
<block type="page/html_header2" name="header2" as="header2">
<block type="page/template_links" name="top.links" as="topLinks"></block>
<block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"></block>
<block type="core/text_list" name="top.menu" as="topMenu"></block>
</block>

(more…)

No tags

Magento already had a built-in contact form that can be used for general contacts.

But we can not find this form on the ADMIN => CMS section. So if we want to edit text in that default contact form, we will need to edit back-end file.

If you are a developer, editing your contact form HTML is a piece cake, the path for the file is:
app/design/frontend/default/[yourtheme]/template/contacts/form.phtml

But, if there are cases when you would like to let your client/customer to edit some intro text, phone numbers, edit text behind the form.
(more…)

· ·

Older posts >>

Theme Design by devolux.nh2.me