Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Different layout for grouped products via Custom Layout Update in Admin (Please Help)
 
len3121
Member
 
Total Posts:  35
Joined:  2008-11-21
 

I am not a programmer, just a shop owner with some limited programming knowledge gained via forums and testing on my dev sites over the years. I really like Magento and its possiblities and am setting up an alternate shop so I can do a sort of A/B testing with my existing Virtuemart store to see what my customers prefer.

Using these forums I was able to figure out how to change the way Grouped Items show up on the product page by altering the view.phtml & grouped.phtml files and placing them in the appropriate folder in /app/design/frontend/default/my_theme/.... However, all the changes I have made to the view.phtml file now also apply to all other product types (simple, bundled etc)

I attempted renaming view.phtml file to 2view.phtml in my folder structure and added a custom layout update in the Design section of the grouped product I want it to apply the change to by using the following code:

<reference name="content">
            <
block type="catalog/product_view" name="product.info" template="catalog/product/2view.phtml">
</
reference>
which if I have read the forums correctly should call the 2view.phtml file for this particular piece, but I get the following error
Warningsimplexml_load_string() [function.simplexml-load-string]Entityline 445parser error Opening and ending tag mismatchblock line 444 and reference  in /home/relicons/domains/relicons.com/public_html/app/code/core/Mage/Core/Model/Layout/Update.php on line 235

#0 [internal function]: mageCoreErrorHandler(2, 'simplexml_load_...', '/home/relicons/...', 235, Array)
#1 /home/relicons/domains/relicons.com/public_html/app/code/core/Mage/Core/Model/Layout/Update.php(235): simplexml_load_string('asSimplexml()
#3 /home/relicons/domains/relicons.com/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(269): Mage_Core_Model_Layout->generateXml()
#4 /home/relicons/domains/relicons.com/public_html/app/code/core/Mage/Catalog/controllers/ProductController.php(101): Mage_Core_Controller_Varien_Action->generateLayoutXml()
#5 /home/relicons/domains/relicons.com/public_html/app/code/core/Mage/Catalog/controllers/ProductController.php(125): Mage_Catalog_ProductController->_initProductLayout(Object(Mage_Catalog_Model_Product))
#6 /home/relicons/domains/relicons.com/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(349): Mage_Catalog_ProductController->viewAction()
#7 /home/relicons/domains/relicons.com/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(163): Mage_Core_Controller_Varien_Action->dispatch('view')
#8 /home/relicons/domains/relicons.com/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(174): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#9 /home/relicons/domains/relicons.com/public_html/app/Mage.php(447): Mage_Core_Controller_Varien_Front->dispatch()
#10 /home/relicons/domains/relicons.com/public_html/index.php(46): Mage::run()
#11 {main}

Can anyone help and tell me what I am doing wrong? Am I missing a step somewhere? Am I going about this in the wrong way? Is there a way to call 2 different view.phtml files depending on what type of product is being viewed?

So i would want Magento’s regular view.phtml file to be called for all types of products except Grouped products where I would need 2view.phtml file to be called. I don’t mind doing this through the Custom Layout Update of every grouped product i add if I could find a way to do it.

Is this possible? If so can someone point me in the right direction?

Thanks in advance for any help you can provide as this would be the last alteration I need done before adding products and taking the site live.

 
Magento Community Magento Community
Magento Community
Magento Community
 
fenixf
Member
 
Total Posts:  35
Joined:  2008-04-08
 

First the erromessage you receive has to do with your syntax in the xml file , check this first.

Solution for different .phtml file for grouped product:

In catalog.xml you see:

<PRODUCT_TYPE_grouped>
<
reference name="product.info">
       <
block type="catalog/product_view_type_grouped" name="product.info.grouped" as="product_type_data" template="catalog/product/view/type/grouped.phtml"/>
</
reference>
</
PRODUCT_TYPE_grouped>

Add the following code the reference tags:

<action method="setTemplate">
             <
template>catalog/product/myTemplateFile.phtml</template>
</
action>

This should work

 
Magento Community Magento Community
Magento Community
Magento Community
 
len3121
Member
 
Total Posts:  35
Joined:  2008-11-21
 

Yup that did the trick.. thank you, i really appreciate the help

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top