941-685-8851

‘Magento Commerce’

Magento 1.6 category thumbnails on home page

It is often desirable to display categories on the home page opposed to products, then display the products on the respective category page. To add categories along with thumbnaile images on the homepage paste the following code into your homepage from the Magento Admin: CMS > Pages > Home.
{{block type=”catalog/navigation” name=”catalog.category” template=”catalog/category/list.phtml”}}

Create a list.phtml file in your Magento template files at: /app/design/frontend/default/default/template/catalog/category/list.phtml .
Paste the following code into this new list.phtml page:

<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php $open = $this->isCategoryActive($_category); ?>
<?php
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
if ($immagine = $this->getCurrentCategory()->
getThumbnailUrl()):
?> <div style="float: left; padding-right: 30px; text-align: center;">
<div class="linkimage">
<p>
<a href="<?php echo $this->getCategoryUrl($_category)?>">
<img src="<?php echo $immagine ?>" alt="<?php echo $this->htmlEscape($this->getCurrentCategory()->getName()) ?>" width="135" height="135" />
<?php echo $_category->getName()?>
</a>
</p>
</div>
</div> <?php endif; ?>
<?php endforeach; ?>
Now create a getThumbnailUrl function at App/Code/Core/Mage/Catalog/Model/category.php line 490, after getImageUrl() :

public function getThumbnailUrl()
{
$url = false;
if ($image = $this->getThumbnail()) {
$url = Mage::getBaseUrl('media').'catalog/category/.$image;
}
return $url;
}

Then upload a thumbnail image at Catalog > Manage Categories >
Share
 

Magento sidebar category navigation 1 level reversed order

I needed to create a left sidebar category navigation which display only the top level categories. The category display order in this navigation needed to be reverse that of the default category display order. For example, here is a screen capture of the Manage Categories interface in the Magento administration.

Magento Ecommerce web design

Below is a screen capture of the Magento shopping cart website frontend. Sorting the category order in the Manage Categories administration (shown above) will determine how the categories are sorted on the frontend.

Magento Ecommerce shopping cart website design

The code to create this Magento vertical category navigation is:

<ul id=”category-nav”>
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php if($_category->name!=””):  ?>
<ul id=”category-nav”><?php foreach ($this->getStoreCategories() as $_category): ?><?php if($_category->name!=””):  ?><li><?php echo $this->drawItem($_category) ?></li><?php endif?><?php endforeach ?></ul>
<?php endif?>
<?php endforeach ?>
</ul>

But in the case of this particular ecommerce shopping cart web design, I need the top horizontal navigation to retain the sort order defined in Manage Categories, and the left sidebar vertical navigation to display a reverse order of that defined in Manage categories.

Magento Ecommerce shopping cart website development

The code to create this Magento vertical category navigation with a reverse sort order is:

<ul id=”category-nav”>
<?php $helper = Mage::helper(‘catalog/category’);
$categoryCollection = $helper->getStoreCategories(false,true,false);
$categoryCollection->addAttributeToSort(‘level’, ‘asc’)
->addAttributeToSort(‘position’, ‘desc’)
->addAttributeToFIlter(‘level’, array(‘eq’ => ’2′));  //Added to limit to only level 1 categories.; ?>

<?php foreach ($categoryCollection as $_category): ?>
<?php if($_category->name!=”"):  ?>
<li><a href=”<?php echo $this->getCategoryUrl($_category); ?>”title=”<?php echo $this->htmlEscape($_category->getName(‘position’, ‘desc’)); ?>”>
<?php echo $this->htmlEscape($_category->getName()); ?></a></li>
<?php endif?><?php endforeach ?>
</ul>

Share
 

Magento Category navigation top level only

Sometimes ecommerce websites can have a lot of sub-categories. The Magento shopping cart provides an extremely flexible and powerful toolset to organize ecommerce shopping cart products and their respective category and sub-category parent child assignments.

But sometimes numerous sub-category levels can be overwhelming for the average shopping cart website consumer. There is a method in the Magento shopping cart administration to limit category levels globally for the whole ecommerce website. But what if you want to limit category levels for just one custom navigation menu. Here is how to do it.

Edit the template file, usually located in: app > design > frontend > default > your_theme > template > catalog > navigation >

The Magento category navigation code looks like this:

<ul id=”category-nav”>
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php if($_category->name!=”"):  ?>
<li><?php echo $this->drawItem($_category) ?></li>
<?php endif?>
<?php endforeach ?>
</ul>
Replace the following line:
<li><?php echo $this->drawItem($_category) ?></li>
with this line:

<ul id=”category-nav”><?php foreach ($this->getStoreCategories() as $_category): ?><?php if($_category->name!=”"):  ?><li><?php echo $this->drawItem($_category) ?></li><?php endif?><?php endforeach ?></ul>

Your Magento category navigation will now display only the top level category.

Share
 

Magento remove discount coupon code

Magento offers a built in coupon code feature to provide shopping cart customers with discounts when shopping on their ecommerce website. You can post discount codes in emails, blogs and social networks to generate more traffic and entice paying customers to your ecommerce website. But often, website owners don’t want to offer discount codes on their shopping cart.  Fortunately for ecommerce web designers, it is quite easy to disable the discount coupon code function on a Magento shopping cart website.

Edit your checkout.xml layout file. The default file in Magento 1.6 would be located in app/design/frontend/base/default/layout/checkout.xml

Remove the following block:

<block type=”checkout/cart_coupon” name=”checkout.cart.coupon” as=”coupon” template=”checkout/cart/coupon.phtml”/>

This block can be found within <reference name=”content”>

Refresh the Magento cache and the discount coupon code menu will be removed.

Share
 

Magento remove Try Magento Go for Free

In the Magento admin to the right of the top navigation menu bar, there is a “Try Magento Go for Free” link, which links to the magentocommerce website. This is great for someone who is installing, developing and administrating a Magento ecommerce website themselves. However, what if you are a Magento shopping cart web designer developing an ecommerce website for a client. When the client tries to administer the shopping cart website,  such a link can prove to be quite confusing. To avoid this client confusion, it is best to simply remove the link. Here is how to  remove the “Try Magento Go for Free” link in the Magento admin.

Edit the following file:

/app/design/adminhtml/default/default/template/page/header.phtml

Delete the following:

<a href=”http://golinks.magento.com/CE15″ onclick=”this.target=’_blank’” class=”go-try”><?php echo $this->__(‘Try Magento Go for Free’) ?></a><span class=”separator”>|</span>

The ”Try Magento Go for Free” link will now be removed from the Magento admin.

Share
 

Magento remove Get help for this page

In the Magento admin to the right of the top navigation menu bar, there is a “Get help for this page” link, which links to the magentocommerce website. This is great for someone who is installing, developing and administrating a Magento ecommerce website themselves. However, what if you are a Magento shopping cart web designer developing an ecommerce website for a client. When the client tries to administer the shopping cart website,  such a link can prove to be quite confusing. To avoid this client confusion, it is best to simply remove the link. Here is how to  remove the “Get help for this page” link in the Magento admin.

Edit the following file:

/app/design/adminhtml/default/default/template/page/menu.phtml

Delete the following:

<a id=”page-help-link” href=”<?php echo Mage::helper(‘adminhtml’)->getPageHelpUrl() ?>”><?php echo $this->__(‘Get help for this page’) ?></a>
<script type=”text/javascript”>$(‘page-help-link’).target = ‘magento_page_help’</script>

<a id=”page-help-link” href=”<?php echo Mage::helper(‘adminhtml’)->getPageHelpUrl() ?>”><?php echo $this->__(‘Get help for this page’) ?></a>    <script type=”text/javascript”>$(‘page-help-link’).target = ‘magento_page_help’</script>

The ”Get help for this page” link will now be removed from the Magento admin.

Share
 

Magento remove Estimate Shipping and Tax

Magento offers a built in Estimate Shipping and Tax feature to provide shopping cart customers with realtime feedback of tax and shipping estimation when shopping on an ecommerce website. But often, website owners don’t want to display the Estimate Shipping and Tax function on their shopping cart website. For example, some shopping cart website owners will offer free shipping or flat rate shipping, which makes shipping estimation irrelevant, not to mention confusing and distracting to ecommerce customers.  Fortunately for ecommerce web designers, it is quite easy to disable the Estimate Shipping and Tax function on a Magento shopping cart website.

Edit your checkout.xml layout file. The default file in Magento 1.6 would be located in app/design/frontend/base/default/layout/checkout.xml

Remove the following block:

<block type=”checkout/cart_shipping” name=”checkout.cart.shipping” as=”shipping” template=”checkout/cart/shipping.phtml”/>

This block can be found within <reference name=”content”>

Refresh the Magento cache and the Estimate Shipping and Tax menu will be removed.

Share
 

Manually Change Base URL

When moving a Magento ecommerce website to a new server, you may need to access the shopping cart website and backend administration on a temporary development url. To manually change the Magento Commerce base url to the new development url:

  • open the magento ecommerce database in PHPMyAdmin
  • browse the database table ‘core_config_data’
  • locate the field ‘web/unsecure/base_url’ and click ‘Edit’ to open it for editing
  • change the ‘value’ field to the new development domain url
  • click ‘Go’
  • Close PHPMyAdmin
  • Open the ‘Var>Cache’ with FTP, file manager or SSH
  • Delete all the content

Your Magento ecommerce website will now work on the new development url.

Share
 

Magento Tax per state

Internet Ecommerce shipping transactions typically require tax only if the product sold is being shipped to the merchant’s state of residence. Here is how to set up tax by state in Magento.

System>Configuration>Sales>Tax>Tax Classes> Tax Class for Shipping> select ‘Taxable Goods’ from dropdown menu

- Default Tax Destination Calculation>Default State> select the Merchant’s state of residence from dropdown menu
- Default Tax Destination Calculation>Default Post Code> wildcard asterisk will include all postal codes in the state

- Shopping Cart Display settings>Display Prices> set to Excluding Tax
- Shopping Cart Display settings>Display Subtotal> set to Excluding Tax
- Shopping Cart Display settings>Display Shipping Amount> set to Excluding Tax
- Shopping Cart Display settings>Include Tax In Grand Total> set to No
- Shopping Cart Display settings>Display full tax summary> set to No
- Shopping Cart Display settings>Display Zero Tax Subtotal> set to Yes

- Orders, Invoices, Creditmemos Display Settings> same as Shopping Cart Display Settings

- Sales>Tax>Manage Tax Zones & Rates> add new tax rate or edit the current tax rate>Tax Rate information> set to the Merchant’s state criteria, use wildcard asterisk for Zip/Post Code

- Catalog>Manage Products>[edit product]>Prices>Tax Class> set to Taxable Goods

Share
 

Magento Left Callout Image

The Magento default left callout image has a link to checkout/cart and alt content of “Our customer service is available 24/7….”

To change this go to app/design/frontend/default/client/layout/catalog.xml.

Find the following block:

<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>Our customer service is available 24/7. Call us at (555) 555-0123.</alt></action>
<action method=”setLinkUrl”><url>checkout/cart</url></action>
</block>
</reference>

Change the aforementioned items as needed:

<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>Call us at 941-685-8851 or click here to email us.</alt></action>
<action method=”setLinkUrl”><url>contacts</url></action>
</block>
</reference>

Share