How to remove unwanted items from Magento 1.x shopping cart landing page

I decided to write this post, because it’s quite a challenge to do this for Magento start-up Front-end developers.

First of all, I advise to find magento extension for shopping cart that already have this option. You can use this link and find “cart” with ctrl+f. Pretty neat, huh?  You can also search on official Magento Connect site.

What comes in mind is Instant Cart by Mageworx, Ajax Cart Pro by aheadWorks and Ajax Shopping Cart by Amasty (I’m not affiliate to any of this).

Anyway, if you don’t want to use and test any extensions or you couldn’t find one with needed option, here is one way to do it (another way is try to do it via XML).

This is quite tricky since Magento using html table for outputting data elements in shopping cart landing page. For example, if they used html div tags, it’s really easy and we just need to add a css class and then need to add “display: none; ” or “visibility: hidden” css property to remove unwanted items. So unfortunately we can’t use css to hide or remove.

So only solution is, modifying pthml files. You can refer following image to know how Magento output values in the shopping cart landing page.

how to remove magento shopping cart items

Figure 1: Magento output values in shopping cart landing page

To remove table headers, just open following phtml file in your Magento installation and uncomment table data tags as you wish.

Step 1


<?php //if ($this->helper('wishlist')->isAllowInCart()) : ?>
<!-- Removed table date for wishlist-->
<td class="a-center">
 <?php //if ($isVisibleProduct): ?>
 <a href="<?php //echo $this->helper('wishlist')->getMoveFromCartUrl($_item->getId()); ?>" class="link-wishlist use-ajax"><?php //echo $this->__('Move'); ?></a>
 <?php //endif ?>
<?php //endif ?>

And then open following file and remove html table data tags.

Step 2


<?php //if ($this->helper('wishlist')->isAllowInCart()) : ?>
 <!-- Removed table date for wishlist-->
 <td class="a-center">
 <?php //if ($isVisibleProduct): ?>
 <a href="<?php //echo $this->helper('wishlist')->getMoveFromCartUrl($_item->getId()); ?>" class="link-wishlist use-ajax"><?php //echo $this->__('Move'); ?></a>
 <?php //endif ?>
 <?php //endif ?>

By commenting out php and html lines as above, you will be able to remove “Move to wishlist” link from Magento shopping cart landing page.

Hope this post help for you. Please comment your ideas.

How to protect development server by setting up http password in Magento

Step 1 

Create .htpasswd file in your magento root directory

Step 2

Go to following URL and generate the encrypted password for your .htpasswd file:
Note: after generating your username and password should be looks like as follows:

Step 3

Copy this line and paste in your created .htpasswd file.

Step 4

Open your .htaccess file in magento root and paste following piece of code bottom of the file:

AuthType Basic
AuthName "Restricted Area"
AuthUserFile /var/www/PATH_TO_YOUR_MAGENTO_INSTALLATION_PATH/.htpasswd #this should be full path to your previously created .htpasswd file.
require valid-user

That’s it. Now when you open your pre-production server URL, you will prompt to entering your http password. If you forget your encrypted password then again regenerate new password and paste it your .htpasswd file in your Magento root.

Please note that sometimes you may need to clear your Magento cache, your web browser cache to view that password popup dialog box. Also you may need to restart your web server. To restart your apache in Linux box you can use following command:

sudo /etc/init.d/apache2 restart


sudo service apache2 restart

If you use nginx, the command is:

sudo service nginx restart

(This list can help in case of problems).

Enter your root password when asked.

How to enable terms and conditions checkbox in checkout step page in your Magento 1.x store

If you need to enable terms and conditions statement in Magento 1.x here is the quick guide.

If you want customers in your Magento store to acknowledge special terms or conditions before purchasing products, you can enable a Terms and Conditions checkbox that they must check before completing checkout. The Terms and Conditions message and checkbox is positioned between the Totals section and the Place Order button, and appears during Order Review. The transaction cannot be finalized unless the customer agrees to the conditions of the sale by selecting the Terms and Conditions checkbox.

Here is the steps you need to follow.

Step 1

Login to your Magento backend.

Step 2

Navigate to System -> Configuration -> Checkout-> Enable Terms and Conditions and select “Yes” in dropdown box.


Figure 1: Magento Enable Terms and Conditions

Step 3

Now you need to create your terms and condition text. You need to navigate Sales -> Terms and condition -> Add New Condition then enter your “Checkbox Text” and “Content”.


Figure 2: Magento Terms and Condition Information

Pretty much completed. You will see your terms and condition statement in bottom of the one-step checkout page now.


Figure 3: Magento Enable Terms and Conditions, Frontend View (Checkout step page)

How to change doctype declarations in Magento 1.x

If you ever experience following w3c ( html validating errors? Solution is checking your Magento 1.x template files and set valid document type specified by W3C.

W3C DOCTYPE validating errors

  1.  “DOCTYPE” declaration not allowed in instance
  2. no document type declaration; will parse without validation
  3. document type does not allow element “HTML” here

Here is correct W3C reference for valid doctype.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" lang="en" xml:lang="en">
<!-- ... body of document ... -->


  1. Open your template files located in magento installation directory located at /app/design/frontend/YOUR-TEMPLATE-FOLDER/template/page
  2. Open following files in your favourite editor.
  3. Check the following code before starting <head> section. You shouldn’t place any php codes or any other script tags before starting <!DOCTYPE tags. In Magento there should be only DISCLAIMER notice top of the <!DOCTYPE.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">

Magento replace “xml:lang” and “lang=” section with php echo statements. It’s normal behaviour in Magento and you don’t need to change this.
Hope this article help you to avoid W3C validation errors for Magento stores.
Please check W3C valid DTD list at

How to create dynamic static blocks for multiple store views in Magento 1.x

If you ever wanted to create dynamic static blocks for multiple store views in Magento e-commerce platform here is the quick help.

Step 1

  1. Create your static blocks in magento.
  2. Login to your Magento admin panel
  3. Select CMS menu
  4. Click on Static Blocks
  5. Click on Create New Static Block and then compose your content.

Step 2 

  1. Open your folder structure in Magento root directory
  2. Locate this directory , /app/design/frontend/YOUR-THEME-FOLDER/template/page
  3. Create phtml file name as, yourphtml.phtml
  4. Copy paste following code.
  5. Change $storecode ($storeCode==”austria”) according your settings. (Please note that you can find your store codes from, Login to Magento Admin->System->Manage Store>Click on your store view and copy and paste store view code)
  6. Copy and paste your static block ids setBlockId(‘your-static-block-id-austria’)

<!--Adding dynamic static block for multiple store view-->
$storeCode = Mage::app()->getStore()->getCode();
<?php if ($storeCode=="austria"): { ?>
<!--Austrian Store-->
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('your-static-block-id-austria')->toHtml() ?>
<!--End Austrian Store-->
<?php } endif; ?>
<?php if ($storeCode=="canadian"): { ?>
<!--Canadian Store-->
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('your-static-block-id-canadian')->toHtml() ?>
<!--End Canadian Store-->
<?php } endif; ?>
<?php if ($storeCode=="uk"): { ?>
<!--English Store-->
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('your-static-block-id-uk')->toHtml() ?>
<!--End English Store-->
<?php } endif; ?>
<?php if ($storeCode=="german"): { ?>
<!--German Store-->
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('your-static-block-id-german')->toHtml() ?>
<!--End German Store-->
<?php } endif; ?>
<?php if ($storeCode=="ireland"): { ?>
<!--Ireland Store-->
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('your-static-block-id-ireland')->toHtml() ?>
<!--End Ireland Store-->
<?php } endif; ?>
<?php if ($storeCode=="usa"): { ?>
<!--USA Store-->
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('your-static-block-id-usa')->toHtml() ?>
<!--End USA Store-->
<?php } endif; ?>
<!--End Adding dynamic static block for multiple store view-->

Step 3

  1. Open file /layout/page.xml ( /app/design/frontend/YOUR-THEME-FOLDER/layout/page.xml)
  2. Copy paste following code and change your phtml as you wish.

<!--Adding static blocks for right hand side column-->
<block type="core/template" name="yourphtml" template="page/yourphtml.phtml"/>
<!--End Adding static blocks for right hand side column-->

Note: Make sure you copy paste above code under following block
<block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">
<!-- block goes here -->

Step 4

  1. Open your /template/page directory. ( /app/design/frontend/YOUR-THEME-FOLDER/template/page)
  2. Open 2columns-right.phtml file (If you need to place static block in left hand side open, 2columns-left.phtml)
  3. Copy and paste following code following div tag (<div class=”col-right sidebar”>)

<div class="col-right sidebar">
<?php echo $this->getChildHtml('right') ?>
<!--Adding static blocks for right hand side static blocks-->
<?php echo $this->getChildHtml('yourphtml') ?>
<!--End Adding static blocks for right hand side static blocks-->

Q: And how will this work for SEO?!

A: For SEO point of view it’s doesn’t have any effect. Because static block contain html and it’s dynamically converted by PHP echo statements. So dynamic static blocks will work normally. SEO will work normally.

Don’t forget to share your ideas. Thanks for reading.