Category » Magento

SOAP-ERROR: Parsing WSDL: Couldn’t load from … : failed to load external entity …

I had written some code using Magento API, it worked fine on my local machine but when I transferred the same code to my linux server I got the following error:

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://mydomain.com/api/soap/?wsdl=1' : failed to load external entity "http://mydomain.com/api/soap/?wsdl=1"

When I opened the URL ‘http://mydomain.com/api/soap/?wsdl=1’ directlty in my browser, it displayed the wsdl file as expected.

Continue reading »

How to get low stock product notifications in Magento?

Magento

Magento provides RSS feed for low inventory alerts. Lets us discuss how to subscribe to the feed.

First we need to set up the inventory level of a product at which it will be considered as low stock.

  1. Login to admin and navigate to System >> Configuration
  2. Scroll down to the Catalog tab and click the Inventory section to open it. Now expand the ‘Product Stock Options’ section.
  3. Set Manage Stock as ‘Yes’ and add a value for ‘Notify for Quantity Below’, save the configuration. Note that you do not set ‘Notify for Quantity Below’ as 0 as it disables the RSS feed.

Continue reading »

How to get the child block object in .phtml file in Magento

Magento

In one of our projects, the requirement was to have a different layout for some category pages. So, we decided to use a different template file for these categories. We added the following code in the “Custom Layout Update” field for these categories in admin.

 <reference name="category.products">
    <action method="setTemplate">
        <template>catalog/category/custom-category.phtml</template>
    </action>
</reference>

These category pages need to show the products in a different layout.

Continue reading »

How to display the CMS static blocks on a page in Magento

Magento

In Magento you can create CMS static block from Admin by following the path: Admin >> CMS >> Static Blocks.

Lets see how we can display them on the frontend.

1. Using Layout updates

You can add layout updates in local.xml file for a page as shown below:


<reference name="right">
     <block type="cms/block" name="your_block_name" before="-">
         <action method="setBlockId">
             <block_id>your_block_identifier</block_id>
         </action>
     </block>
</reference>

You can enter these layout updates in Magento admin also – Categories, Products, CMS Pages provide a field for “Custom Layout Update”.

Continue reading »

How to find the position of a product in a Magento category

Magento

In Magento you can set the position of the products in a category from Magento admin by following the path Admin >> Catalog >> Categories >> Manage Categories >> Edit a category >> Set the position of the products in the “Category Products” tab.

Let see how we can find the position of a product on the product detail page:


$catId = Mage::registry('current_product')->getCategoryId();
$category = Mage::getModel('catalog/category')->load($catId);
$productPositions = Mage::getResourceModel('catalog/category')->getProductsPosition($category); // This returns all product ids with their position
echo $productPositions[$_product->getId()]; //Print the product postion

Continue reading »

How to set data in Magento Layout Update XML to make it available for use in templates

Magento

If you need to set data in a block so that you can use it in the block view file then you can do it in the layout xml files or in Magento admin using the Layout Update XML/Custom Layout Update XML field.

Suppose you want to differentiate a category based on a variable “category_type”, if the value of “category_type” is “sale” then you will display category image else not on the category landing page.

Navigate to Admin >> Catalog >> Categories >> Manage Categories. Click on the category that you want to mark as a “sale” category to edit it. We assume that “Is Anchor” is set as “Yes” for the category in the “Display Settings” tab.

Continue reading »

Magento Enterprise Edition vs Magento Community Edition – Which one to use?

Magento

Magento is one of the most popular Open Source e-commerce software. It was initially released in March 31, 2008 by Varien Inc. It is a PHP based software, uses Zend Framework and the proprietary “Varien” libraray.

Magento is a free as well as a paid software – How? It depends upon which Magento verision you are using – Magento Community Edition (CE) or the Magento Enterprise Edition (EE). But now the question comes – Why will I pay if I can get it for free? The answer is “Great things come for a fee”. Actuallay Magneto CE is as good as Magento EE. It all depends on you needs, business size and how much are you ready to invest.

Continue reading »

How to display sub-categories on a Category Page

Magento

In one of my project we had a two level category hierarchy. Clicking on the top level category displayed a promotional banner and the sub-categories. The second level category page displayed the products. In this post we will discuss how we can display the subcategories on a category page. We are not going to create any new module.

STEP 1: Create a PHTML file

First we create a phtml file {{MAGENTO_ROOT}}\app\design\frontend\rwd\mytheme\template\catalog\category\subcategories.phtml

Continue reading »

How to move the JS file includes to footer in Magento

Magento

In order to reduce the initial load time of page, it is recommended to move all the JS includes in the <head> section of web page to the footer. Lets see how we can do it in Magento.

Step 1: Add Layout Updates

Create a child block of “before_body_end” named “foot” similar to the head block in local.xml file as shown below:


<?xml version="1.0" ?>
<layout version="0.1.0">
<default>
<reference name="before_body_end">
<block type="page/html_head" name="foot" as="foot" after="-" template="page/html/foot.phtml"/>
</reference>
</default>
</layout>

Continue reading »

How to display products from a category in a CMS static block

Magento

There might have been a situation when you would have created a special category like “Sale Products” or “Featured Products”… and you had wanted to display products from these categories on some page like Home Pages using the CMS static block.

In order to achieve this you may create a CMS static block and add the following segment of code:


{{block type="catalog/product_list" name="product_list" category_id="2" column_count="4" template="catalog/product/list.phtml" }}

This will display the products listing page as a block on the page.

Continue reading »

Back to top