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

Use of layout
 
ibrown
Jr. Member
 
Total Posts:  10
Joined:  2008-02-26
 

Hi, I am just starting using layout with the XML config. I have been trying to follow the basic example to place the cart on the left side.

Unfortunately, I can’t seem to succeed. My understanding is to change checkout.xml and the reference right to left. After this, providing the theme is correctly used in the admin area, a refresh should bring the cart on the left.

I tried to close the browser in case there was session issue behind the scene. I tried to modify the file checkout.xml directly in the default theme to make sure my theme was not the issue but here I am getting stuck.

Many thanks for all the posts and help I already had using this forum

Herve

 
Magento Community Magento Community
Magento Community
Magento Community
 
ikuzyk
Magento Team
 
Avatar
Total Posts:  60
Joined:  2007-08-09
Ternopil, Ukraine
 

Have you turned off the cache in the back end admin?
You can find the option here - store > system > cache management.
Also - design guide and this thread - good reference to start smile
Hope its help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ibrown
Jr. Member
 
Total Posts:  10
Joined:  2008-02-26
 

Thanks, i was thinking of something around these lines.. that’s great!

 
Magento Community Magento Community
Magento Community
Magento Community
 
ibrown
Jr. Member
 
Total Posts:  10
Joined:  2008-02-26
 

Hi,

I have created a new block in the xml layout structure. This block is displayed in the header exactly in the same way the store_language block is displayed.

I have created a new file called “Summary.php” in app/code/core/Mage/Checkout/Block/Cart/ that contains the class Mage_Checkout_Block_Cart_Summary (since I want to display the basket summary data in this new block).

I have also created a new template called “basketsummary.phtml” in app/design/frontend/default/ntu_theme/template/page/html/.

I was struggling to work with <reference name=""> and getChildHTML() function. And also I was not sure about the difference between the xml keyword “as” and “name”.

All in all, the trick was to understand the xml syntax to create a new block and attach a trigger to it. This gives me the ability to display the basket information in a bespoke way. Below is the block I added in page.xml

<block type="checkout/cart_summary" name="cart.info" as="cartInfo">
    <
action method="getBasketInfo"></action>
</
block>

and also the class code is below

class Mage_Checkout_Block_Cart_Summary extends Mage_Core_Block_Template
{
    
private $_cart_summaryText;

    function 
__construct()
    
{
        parent
::__construct();
        
$this->setTemplate('page/html/basketsummary.phtml');
    
}
    
    
function getBasketInfo() {
        $count 
$this->helper('checkout/cart')->getItemCount();

        if( 
$count {
            $text 
$this->__('you have %d items in your basket'$count);
        
elseif( $count == {
            $text 
$this->__('you have %d item in your basket'$count);
        
else {
            $text 
$this->__('you have no item yet in your basket');
        
}
        $this
->_cart_summaryText $text;
    
}
    
    
protected function _toHtml()
    
{
        $this
->assign('cart_summaryText'$this->_cart_summaryText);
        return 
parent::_toHtml();
    
}
}

I post this in case some of you guys struggle with some of these function, xml keyword and layout in general. I am still a very begineer with Magento but I’ll be happy to put more detail if needed.

Herve

 
Magento Community Magento Community
Magento Community
Magento Community
 
Andrea, Argentina
Sr. Member
 
Total Posts:  164
Joined:  2007-12-05
Buenos Aires, Argentina
 

Can you put a link to your page to see what you have created?

Thanks

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