Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get url for specific store in magento

Tags:

php

magento

I am developing a custom payment module and i need help in one thing!

when i click on place order on my onepagecheckout in magento url i am redirecting to my payment gateway which i am getting by this code

Mage::getUrl('comm/comm/redirect')

this generated the redirect url

My problem is when running multistore in magento for store www.abc.com this redirects works good and returns (www.abc.com/index.php/comm/comm/redirect)

But for another store www.def.com also it is redirecting to this same url (www.abc.com/index.php/comm/comm/redirect)

which it should be (www.def.com/index.php/comm/comm/redirect) so that this store redirects to its own specific payment gateway.

How could i get the specific store url when clicking on place order.

Thanks for the help

like image 967
user3135713 Avatar asked Dec 26 '22 06:12

user3135713


1 Answers

Mage::getUrl() can take two parameters:

Parameter 1 - $routePath -> The route path expressed in the form of "module/controller/action"

Parameter 2 - $routeParams -> This is an array that converts key/values into pairs of path directories.

Magento will use the correct domain as the base URL if you add the _store param. e.g.

Mage::getUrl('comm/comm/redirect', array(
    '_store'=>'your_store_id'
));

OR

Mage::getUrl('comm/comm/redirect', array(
    '_store'=>'your_store_code'
));

For additional reference and a complete list of options available visit: http://www.magentocommerce.com/wiki/5_-_modules_and_development/reference/geturl_function_parameters

like image 93
Daniel Kratohvil Avatar answered Dec 27 '22 20:12

Daniel Kratohvil