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

Load layout of a specific store (Multistore configuration)
 
mac75a
Jr. Member
 
Total Posts:  13
Joined:  2010-01-19
 

In a controller, I’m doing the success action for a custom payment method. It is a multistore installation:

http://www.domain1.com - Store 1
http://www.domain2.com - Store 2

The payment gateway calls http://www.domain1.com/index.php/mypayment/standard/success even if the purchase has been made in domain2 (store 2). It is a limitation of the gateway, I cannot set dinamically the URL for the success action.

I would like to render the layout of the store in which the purchase was made (I can know it by the order numbre that the gateway sends).

With the following code I always get the template of store1 (domain1):

$this->loadLayout();
$this->getLayout()->getBlock('content')->append($this->getLayout()->createBlock('mypayment/standard_success')->setData('order',$orderId);
$this->renderLayout();

Is there a way to set the storeId of the layout I want to load?

Thanks in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
jeffcustom
Member
 
Avatar
Total Posts:  67
Joined:  2012-11-29
Boulder, CO
 

So, you can use:

Mage::getDesign()->setPackageName($yourPackageName)

to temporarily change the package you want to load (So, in your case you would wrap this in a conditional to check which store the user started at)

You can also use

Mage::getDesign()->setTheme($yourThemeName$type)
//Where $type is: default, locale, template, skin

This can change a theme in the currently selected package.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mac75a
Jr. Member
 
Total Posts:  13
Joined:  2010-01-19
 
jeffcustom - 04 March 2013 10:30 AM

So, you can use:

Mage::getDesign()->setPackageName($yourPackageName)

to temporarily change the package you want to load (So, in your case you would wrap this in a conditional to check which store the user started at)

You can also use
Mage::getDesign()->setTheme($yourThemeName$type)
//Where $type is: default, locale, template, skin

This can change a theme in the currently selected package.

Thank you very much, Jeff !!
That is exactly what I was looking for… It worked!

I also added the following:

Mage::app()->setCurrentStore($storeId);
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top