Magento – Show Firstname or Lastname Only In Welcome Message

Post Image

If you would like to change the default welcome message in magento from “Welcome, Paul Donnelly” to “Hi Paul” or “Hello Mr Donnelly”, use the following snippets within
app\design\frontend\default\default\template\page\html\header.phtml

Magento – Display Address Fields on Create an Account

Post Image

By default Magento doesnt show the address fields within “Create an Account”. To make the sign up process more user friendly you can enable the address fields by adding the following:
Open app/design/frontend/default/default/template/customer/form/register.phtml
Around line 78
Before

<?php if($this->getShowAddressFields()): ?>

Add

<?php $this->setShowAddressFields(true); ?>

PHP Snippet – Simple Random Password Script

<?php
 
//set length of password
$length = 12;
function randompass($length)
{
 
$chars = "1234567890abcdefGHIJKLMNOPQRSTUVWxyzABCDEFghijklmnopqrstuvwXYZ1234567890";
 
$thepassword = ”;
 
for($i=0;$i<$length;$i++)
 
{
 
$thepassword .= $chars{rand() % 39};
 
}
 
return $thepassword;
 
}
 
//to use the function
$password=randompass($length);
echo "<strong>Your $length character password is:</strong><br> $password";
 
?>

Magento – Display Sale Icon If Special Price

Post Image

Open app/design/frontend/YourTheme/default/template/catalog/list.phtml
Find (around line 96)

<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, ‘small_image’), null, true) ?>" class="product-image"><img src="<?php echo $this->helper(’catalog/image’)->init($_product, ‘small_image’)->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, ‘small_image’), null, true) ?>" /></a>

change to

<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, ‘small_image’), null, true) ?>" class="product-image"><img src="<?php echo $this->helper(’catalog/image’)->init($_product, ‘small_image’)->resize(135); ?>" …

Magento – Display New Products on Homepage

Post Image

If you would like to show the newest products on your homepage add the following code to your CMS homepage.
Go to “CMS” > “Pages” > select “Home Page” (URL Key: home).
Click on “Design”
Paste the following XML update into the field provided:

<reference name="content">
<block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms_page">
<action method="addPriceBlockType"><type>bundle</type><block>bundle/catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action>
<action method="setColumnCount"><columns>4</columns></action>
<action method="setProductsCount"><count>4</count></action> …

Force PDF Download Instead Of Opening in Browser

With the following snippet, you will force your browser to save and open PDF files instead of opening within the browser.
Open your .htaccess file and place the following code within it:

<Files *.pdf>
ForceType application/octet-stream
Header set Content-Disposition attachment
</Files>

 Page 2 of 8 « 1  2  3  4  5 » ...  Last »