Musings From the Throne

Random Ramblings from the Tiny Queen

Restrict Access to a Product Page in Miva Merchant

Tuesday, July 22, 2008

I have received numerous requests for some code I wrote to password protect a product page in Miva Merchant 5 (or 5.5), so I thought I'd share it here. This code was originally written for a site that wanted to implement custom product pricing using the Emporium Plus External Product Purchase module, but wanted to ensure that only staff members could access the page.

Note: This code requires the Tool Kit from Emporium Plus. If you have a Miva Merchant 5 (or 5.5) store, the Tool Kit is an immensely valuable module that allows developers and store owners enormous flexibility in customizing their stores. It is beyond worth the money (and no, I don't get anything for saying so except the satisfaction of spreading the word about an extremely useful tool).

To use the code below:
  1. Set up an availability group, and assign authorized customers to this group.
  2. Substitute your desired product code where indicated by the text YOUR_PRODUCT_CODE_HERE (2 places).
  3. Substitute your availability group name (not code!) for the AVAILABILITY_GROUP_NAME in the code below.

This code is designed to work on the main screen of the regular PROD page. If you're using a template manager, you can remove the conditional that tests for the product code.


<html>
<head>
<title>&mvt:store:name;: &mvt:product:name;</title>
<base href="&mvt:global:basehref;">
<mvt:item name="head" param="head_tag" />
</head>

<mvt:item name="body">
<mvt:item name="hdft" param="global_header" />

<tr><td align="left" valign="bottom">
<mvt:item name="hdft" param="header" />
</td></tr>
<tr><td align="left" valign="top" bgcolor="&mvt:colors:ctgy_bg;">
<table border="0" cellpadding="10" cellspacing="0">
<tr><td align="left" valign="top" nowrap>
<mvt:item name="fonts" param="ctgy_font">
<mvt:item name="customerlink" />
<mvt:item name="affiliatelink" />
<mvt:item name="category_tree" />
</mvt:item>
</td></tr>
</table>

</td><td align="left" valign="top" width="80%">
<br>
<blockquote>
<mvt:comment>Test for desired product code</mvt:comment>
<mvt:if expr="l.settings:product:code EQ 'YOUR_PRODUCT_CODE_HERE'">

<mvt:comment>Check to see if customer is logged in</mvt:comment>

<mvt:if expr="g.Basket:CUST_ID">

<mvt:comment>Check to see if customer is a member of your availability group</mvt:comment>
<mvt:item name="toolkit" param="agroup|acount" />
<mvt:foreach iterator="customer_agroup" array="customer_agroups">


<mvt:comment>Set test variable for use later in the page</mvt:comment>

<mvt:if expr="l.settings:customer_agroup:name EQ 'YOUR_AVAILABILITY_GROUP'">
<mvt:item name="toolkit" param="sassign|staffid|1" />
<mvt:item name="prod_ctgy_hdft" param="prod_header" />
<mvt:item name="prod_ctgy_hdft" param="prod_header" />
<mvt:item name="product_display" />

<mvt:if expr="l.settings:product_count NE 0">
<br><br>
<mvt:item name="fonts" param="hdr_font">
<b>Related Item(s)</b><br>
</mvt:item>

<mvt:item name="product_list" />
</mvt:if>
<mvt:item name="prod_ctgy_hdft" param="prod_footer" />
</blockquote>

</mvt:if>
</mvt:foreach>
</mvt:if>


<mvt:comment>If staffid variable not set, display login</mvt:comment>
<mvt:if expr="g.Basket:CUST_ID AND (g.staffid NE '1')">
<p>This page is for internal use only.</p><br><br><br>
<p><a href="http://domain.com"><img src="graphics/00000001/continue_shopping.jpg"
alt="Continue Shopping"></a></p>

<mvt:elseif expr="g.staffid NE '1'">


<p>This page is for internal use only. Staff members may log in below.</p>
<form method="post" action="&mvt:global:secure_sessionurl;" class="loginform">
<input type="hidden" name="Store_Code" value="&mvte:store:code;">
<input type="hidden" name="Screen" value="PROD">
<input type="hidden" name="Product_Code" value="YOUR_PRODUCT_CODE_HERE">
<label for="user">Username</label><input type="text" id="user" size="20" name="Customer_Login"
value="&mvte:global:Customer_Login;"><br><br>
<input type="radio" name="Action" value="LOGN" checked="checked" style="display: none;">
<label for="pass">Password:</label> <input type="password" id="pass" size="20"
name="Customer_Password"><br><br>
<mvt:item name="buttons" param="Login" /><br><br>
</form>

</mvt:if>

<mvt:comment>For all other products, display the regular layout</mvt:comment>

<mvt:else>

<mvt:item name="product_display" />

<mvt:if expr="l.settings:product_count NE 0">
<br><br>
<mvt:item name="fonts" param="hdr_font">
<b>Related Item(s)</b><br>
</mvt:item>

<mvt:item name="product_list" />
</mvt:if>
<mvt:item name="prod_ctgy_hdft" param="prod_footer" />
</blockquote>

</mvt:if>

</td></tr>

<tr><td align="left" valign="bottom">
<mvt:item name="hdft" param="footer" />
</td></tr>
</table>

<mvt:item name="hdft" param="global_footer" />
</mvt:item>
</html>

Happy Mid-Year!

Wednesday, July 2, 2008

Ok, ok, I know there isn't really such a thing as Happy Mid-Year. But one of my New Year's Resolutions for this year was to post regularly to my blog. It doesn't take a rocket scientist to see that didn't exactly happen. So I figured rather than beat myself up over it, I'd declare a new Mid-Year Resolution.

In honor of Happy Mid-Year, I'd like to express some thoughts on the new Miva Merchant 5.5. A party atmosphere is definitely fitting here. Miva Merchant 5.5 not only provides a more aesthetic admin interface, it breaks out some handy new features for developers and store owners alike.

Among my favorites is the new Quick Find feature in the top navigation. The ability to instantly do a product, category, order or customer search without having to first expand multiple menus comes in very handy.

Another favorite is the new category and product sorting feature. Click through to a category, select Category Order: Show and simply enter the new sort order in the text boxes. Click Update to re-order multiple categories or products at once, or enter the new display order number in a single box and hit Enter on your keyboard to move that item to the new location.

The new SEO options are a great benefit to store owners. Products and Categories now have built-in meta tags and store owners can set up search engine friendly links with just a click.

Designers and developers will greatly benefit from the new Dreamweaver integration and the frameworks system. There are still a few bugs being worked out here, but these features show great promise for helping non-technical designers and store owners build an attractive, user friendly site.

Developers will also be pleased to have full access to the underlying template system. Category tree and attribute templates are now fully accessible without module purchases, making creation of a completely custom layout a breeze.

The launch of 5.5 hasn't been without its hiccups, but the new MM management has shown great responsiveness in dealing with them. If you liked the earlier versions of Miva Merchant, the new MM5.5 will definitely please.

My only complaint about the new look is that the "Log in securely" link is no longer very prominent on the admin login page. My favorite webhost for both Miva Merchant hosting and non-Miva sites, Hostasaurus, suggested this easy to implement solution. Just add the following lines to your .htaccess file to force admin pages to secure so that remembering to click the link is no longer an issue.
RewriteEngine On
RewriteCond %{REQUEST_URI} /mm5/admin.mvc
RewriteCond %{SERVER_PORT} !443
RewriteRule (.*) https://www.domain.com/mm5/admin.mvc [R]

A picture is what you make of it

Thursday, February 7, 2008

Time was when photographs were what they were. Poorly cropped, bad lighting, the dreaded red-eye...sure, you could pay an expert to sit down with some pencil crayons and painstakingly color in the details you wanted, but most of the time it was easier to take a new photo.

Today, though, things are different. There's a plethora of photo editing packages out there, from expensive to free, all of which, to varying degrees, can take a not-quite-right photo, and turn it into a zinger.

I'm currently working on some ideas for a new project, and had a very specific image in mind as to what I wanted. A woman, dressed in white, in a meditative pose, with candles and a warm background. A stock photo search didn't turn up the exact picture I had in mind, but gave me a photo that was pretty close.

We had the woman in white, the meditative pose, and the candles, but the green edging on the bamboo mat didn't fit my color scheme; nor did the red vase filled with grasses. To top it off, the woman, while attractive, looked just a little too perky for what I had in mind, and the white background was overly stark.

Step in my photo editing software. First, I replaced the green edging with a warm rust tone taken from the candle on the left. Next, I removed the red vase with the grasses, and cropped the picture to eliminate the too-upbeat facial expression. Finally, I added a warm-toned background, designed to look like flooring and a wall, to replace the stark white. The colors for the background are taken from the bamboo matting.

The result? A photo that conveys exactly the warm tones and relaxing impression I had in mind:

How "catchy" are your headlines?

Friday, January 18, 2008

The passive voice has taken a beating (and then some!) over the last several years for its lack of ownership, passion and drive. Lately, however, usability guru Jakob Nielsen has encouraged passive voice to rise from the ashes and take its proper place in web site copy.

Ok, maybe that's an overstatement -- nevertheless, Mr. Nielsen has some interesting points to make about the potential efficacy of the passive voice, particularly as it applies to website users and headline reading patterns.

Passive Voice Is Redeemed For Web Headings

The #1 mistake when building a website

Monday, January 7, 2008


I've been working on a database and scripting project for one of my clients over the last couple of days, and it got me to thinking about some of the lessons I've learned in my years as a website designer, and one of the most important ones in particular.

I've put several hours into this project so far, but I've yet to fire up my computer. Like any well-executed database project, this one is starting with pencil and paper. What is the purpose of the database? What kind of information do people want to be able to extract from it? How do the bits of information relate to each other, and what links need to be created among them? Scribbling, and highlighting, and scratching out, and most of all thinking. Planning.

Just as this planning process is vital to the success of this project, the same is true of a website. Before worrying about graphics and design, before picking colors and deciding on a theme, you need to sit down and hash out a plan for your site.

  • What is its goal?
  • Who will it serve?
  • What will it consist of?
  • How will the pages relate to each other?
  • Which content is primary and should be part of top-level navigation?
  • Which is secondary, and should flow from the primary content?
  • How will it be structured?
  • What tools will you need to achieve the site's goal?
  • How will you measure achievement of your goal?

So if you're starting a new website, or even if you're just looking at revamping an existing one, do yourself a favor, and turn off your computer. Put away the color swatches, and get out a pencil and a piece of paper, and start thinking about your site. It's not the most fun step in building a good website. But it is the most critical one.

New year, new website?

Wednesday, January 2, 2008


What a busy year it was for Tiny Queen Designs! December saw the launching of several projects, including PBDN Motorsports. There are still thousands (gulp!) of products to add, but the online Miva Merchant store is fully functional and open for business! If you don't find what you're looking for, a quick email to the customer service team will likely turn it up.

With the beginning of a new year, what better time to take a good look at your website, and do a little housekeeping? A nifty Firefox Extension called Dust-Me Selectors is a very handy tool for cleaning up your site. The extension crawls your site (or just a single page if you prefer) looking for unused css selectors. It stores its results so that as it goes through your site it can cross off selectors that are being used on other pages, and at the end, you have a tidy list that you can use to clean things up.

Want to spruce up your site for the new year, but stumped on where to start? Check out this easy to follow graphics design tutorial from Prochroma. The Design Problems To Avoid section is especially good!

Read your way to a better website

Tuesday, November 13, 2007


I know, I know...it's way too early to be thinking about the holidays. However, if you have a web site, particularly an ecommerce web site, it's in no way too soon to be thinking about gearing up for the largest shopping season of the year.

One of the best things you can do to help your company compete on the web is to be informed about the hows and whys and ways your shoppers think, act and react to web sites.

In their recent newsletter, Practical Ecommerce highlighted an article containing some excellent reads to help you re-think your web site, and the way you approach your online business.

Even if you only snag one of the books on Mat Greenfield's list, you're bound to be a better web site owner as a result, with plenty of ideas for ways to improve conversions and increase sales.

So this year, when your friends and family ask you what you want Santa to bring, point them to these "Great resources that can alter how you think about the web"