Quick Tip: Easy Domain Switching for Miva Merchant Stores

August 25, 2008 by Susan Petracco 

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!
Please Bookmark and Share:
  • Reddit
  • Digg
  • Facebook
  • Mixx
  • StumbleUpon
  • Technorati
  • Propeller
  • del.icio.us
  • Twitter

Like this Post?

Subscribe to our RSS feed or sign up to receive new posts via email:




Comments

  1. Chuck Lasker
    August 26th, 2008

    Awesome! This is one of the best tips I’ve ever read. There’s nothing better than some code to make life easier.

  2. Mark - Miva Merchant
    September 12th, 2008

    Great tip for managing a redesign and especially useful for store owners who are always testing leading to a continuous live & dev environment.

  3. Luis Gross
    September 25th, 2008

    Great post!

    This was very informative and a great tutorial

    I haven’t really tried Miva, but now I’m looking into it.

    It sounds like it can definitely be interesting, and I always wanted to have my own online store.

    I’m going to go see if I check it out!

    Thanks for sharing Susan!

    PS I love the site! I just put your feed in my reader!

  4. Ken @ Work From Home Secret
    January 20th, 2009

    I can do some stuff, but I am difinitely not a techy…so this kindof stuff has always bothered me. Anyway, thanks for the info.

  5. winters
    April 16th, 2009

    you might be able to add the snippets to “snippely” along with the above instructions… and you’ll start to be able to keep a very organized toolbox of tricks.

    this goes for any neat chunks of code. once you use it a little you’ll find you can organize pretty good and document the snippets very well too.

  6. Susan Petracco
    April 16th, 2009

    Neat. I wasn’t even aware of snippely.

Leave a Comment