Quick Tip: Easy Domain Switching for Miva Merchant Stores
Because we do a lot of redesigns and offline development, our customers usually have at least two stores operational at one time – the live store and a development platform. Sometimes that makes it hard to test, though, if links from the development site link back to the live site half of the time. You don’t always notice when you navigate away from the development site.
The sessionurl and secure_sessionurl variables in Miva Merchant will automatically pick up the right domain. But any hardcoded URLs, if they are using absolute paths (and in most cases, they should) will not be as easy to manage. And if you use shortened SEO-friendly urls, you may have even more widespread URLs to manage.
Here’s an easy tip for Miva Merchant users who have more than one environment: set a variable in your store that references your domain name, and then build your URLs around that. This is easy if you use the Toolkit module from Emporium Plus. Go into Miva Merchant, click the name of your store within the left frame, and then on the right side, click HTML Profile. The great thing about this field is that it’s usually the first field referenced by the store’s page templates. (If your site doesn’t use the HTML profile, or if you are running Miva Merchant 5.0 instead of 5.5, use the head tag insert field.)
At the bottom of this box, enter the following code:
<mvt:item name="toolkit" param="sassign|basedomain|http://www.yoursite.com" />
<mvt:item name="toolkit" param="sassign|secure_basedomain|https://www.yoursite.com" />
Then to change the variables for a particular environment, you just have two variables to change. Still too much work? You can use the toolkit to extract the url from your domain settlings instead:
<mvt:item name="toolkit" param="gettoken|g.domain:MM_URL,/,3|mydomain" />
<mvt:item name="toolkit" param="sassign|httpprotocol|http://" />
<mvt:item name="toolkit" param="sassign|httpsprotocol|https://" />
<mvt:item name="toolkit" param="concat|basedomain|httpprotocol|mydomain" />
<mvt:item name="toolkit" param="concat|secure_basedomain|httpsprotocol|mydomain" />
After that, you can build your URLs using this “basedomain” global variable, and when you copy code from one site to the other, the links should still work. Here’s an example link to the shopping cart page:
<a href="&mvt:global:basedomain;/mm5/merchant.mvc?Screen=BASK">View Your Cart</a>
This little bit of work can make your life much simpler down the road!