I need to have two product view pages. One for local products and another one for international prducts. I have customized the default product view page for local produts. I have a link for international product in this product view page. Then I have created a module called 'international' for internatioal products and so when the links clicked, it will display my custom module.

Now I want to add some default funtionalities of default product view page in my custom module. I tried to add addtocart block, however it seems to be not working

This is my international.xml file..which is at /app/design/frontend/default/my_theme/layout

<layout version="0.1.0">
        <reference name="root">
            <action method="setTemplate">
        <reference name="head">
            <action method="addItem">
            <action method="addItem">
        <reference name="content">
            <block type="international/international" name="international"  
 <!--adding dropdown section -->
                 <block type="core/template" name="dropdown" as="dropdown" 
 <!--adding common package static block section -->
                 <block type="cms/block" name="common-packages">
                     <action method="setBlockId">
 <!-- adding addtocart part -->                
                <block type="catalog/product_view" name="product.info.addto" 
                as="addto" template="catalog/product/view/addto.phtml"/>
                <block type="catalog/product_view"  
                name="product.info.addtocart" as="addtocart"  


now my international.phtml file which is at /app/design/frontend/default/my_theme/template/catalog/product

      'getInternationalPlans()' function is used to get our international product 
       according to the user input

      foreach ( $_product as $product )

       $plan_array [] = $product->getId ();
     /*it unregisters the product  */
      Mage::unregister ( 'product' );
     /*  loading the current product  */
  <div> <?php echo $this->getChildHtml('addtocart');   ?></div>

My block definiton is as follows..

        class Freefilings_International_Block_International extends  
            public function _prepareLayout()
                return parent::_prepareLayout();
           returns international product object by filering by bundle type, 
           international country span and business type selected
        public function getInternationalPlans($custom_select_business)
             $products = Mage::getModel ( 'catalog/product' )->getCollection ()
                         ->addAttributeToSelect ( '*' )
                ->addAttributeToFilter( 'business_type', array ('eq' =>      
                          Mage::getResourceModel ( 'catalog/product' )
                   ->getAttribute ( 'business_type' )->getSource ()
                           ->getOptionId ( $custom_select_business ) ) )
                ->addAttributeToFilter( 'country_span', array ('eq' =>    
                            Mage::getResourceModel ( 'catalog/product' )
                   ->getAttribute ( 'country_span' )->getSource ()
                           ->getOptionId ( 'international' ) ) )
                ->addFieldToFilter ( 'type_id', array ('eq' => 'bundle' ) )
                ->load ();       
            return $products;       

I Optained the product from the block. However I dont know, how to add default product view page functionalities into my module. Just like this addtocart functionality. How can I convert my custom module into another product view page. Thanks..

  • Why not just use a product attribute, and filter by it? Having a whole module and seperate code seems overkill.
    – ProxiBlue
    Commented Dec 10, 2013 at 10:48
  • i have filtered out the product using country_span attribute. i am getting the product correctly. but as like default product view page. i need to display the options, add to cart functionality, price change functionalities when the options of product is selected(i have only bundle products) etc. to add these features as like product view page, what should i do? Commented Dec 10, 2013 at 10:54

2 Answers 2


Could you have a different attribute set for the two different product types ( local and international ) Then introduce a custom layout handle so that via XML you can have different templates and introduce your custom block logic into the page that way.

<reference name="product.info">
  <action method="setTemplate"><template>my/custom/product/view.phtml</template></action>

Inside this handle you can add a reference to your block that does the custom logic. This way you retain all the product view functionality and are only adding in custom work.

I would recommend looking at: http://magebase.com/magento-tutorials/creating-custom-layout-handles/

  • Yes. It is a good approach that i can adopt. However it would help me, if you answered this question little earlier Commented Nov 9, 2014 at 12:56

I have solved this problem very easily by Magento's layout power.

For each product magento will generate unique layout handle. Suppose my international product id be 15. Then magento will process <PRODUCT_15> layout handle when we view that product. Since this layout handle is processed after <catalog_product_view>, every changes that we made via our product's unique layout handle will get effect for sure. This way I made a layout of an international product be unique and hence solved the issue of cart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.