Pasting Mini Cart Code Into Your Custom Page Template
If you already have a custom page template that you're using in your ShopSite Pro store, you can easily add the mini cart by just copying some code from this page and pasting it into your template. After copying in the code, you can optionally set some values to change the colors in the cart. You may want to print out these instructions so that you are not having to constantly switch windows on your screen to read them.
1. Copy and Paste the Code
In this step, you select a mini cart style and copy and paste the code for that style into a text editor.
- While you have this help page open in your browser, open a text editing application on your computer, such as Notepad.
- Select one of the four mini cart styles to use in your store (ItemCount, Subtotal, Summary, or Detail). Scroll down this page and find the text box that has the code for that style.
- Click once with your mouse inside the text box, then type Ctrl+A (Command-A on a Macintosh) to select all of the code in the box.
- Type Ctrl+C (Command-C) to copy all of the code to the clipboard.
- Switch to the text editing application.
- Type Ctrl+V (Command-V) to paste the code into the text editing application.
- At this point you should save the file with a file name like minicart. Since it is part of a ShopSite custom template, it does not need a file extension
2. Set Colors and Options
The default settings in the mini cart code use the page link color and a transparent background colors. The ItemCount and Subtotal layouts also display a small black graphic of a shopping cart. You can follow these steps to change these colors, or you can skip this part to use the default colors.
- To change the color of the text in the mini cart, replace the [-- PAGE.LinkColor --] in this line near the top of the file with a color name in quotation marks. Not all color names are recognized, but most of the basic colors (such as red, green, blue, etc.) should work. You can also enter a hex RGB color value if you are familiar with that kind of color coding.
[-- VAR.MiniCartTextColor PAGE.LinkColor --]
- The background color is set to "transparent," which means that the underlying colors will show through. To specify a color, replace the "transparent" in this line with a color name like you did for the text color. Or you can delete this line entirely and delete the pound sign at the beginning of the previous line to use the page background color.
[-- VAR.MiniCartBackgroundColor "transparent" --]
- You can set the cart graphic to display or not, and you can set the color to either black or white. For these two lines, the only valid values are "yes" or "no" and "black" or "white".
[-- VAR.ShowCart "yes" --]
[-- VAR.MiniCartColor "black" --]
- By default, the mini cart display will appear on the left side of whatever space it is in. You can move the mini cart to the right side or the center if it looks better in your page layout. The only valid values in this line are "left" "right" and "center".
[-- VAR.TextAlign "left" --]
- Save any changes that you've made.
3. Paste the Code into Your Template
Now that you've copied the code and customized it, you're ready to paste it into your custom page template. (You may want to save it as an "include" file, which looks cleaner but has the same end result; see the next section for instructions on how to do that.)
- In your text editing application, select all of the code by typing Ctrl+A, then copy it to the clipboard by typing Ctrl+C.
- Switch to the browser window containing the ShopSite back office.
- Click on the Merchandising icon, then click Custom Templates.
- Your template should be listed in the Page Templates section. Click on it once to select it, then click Edit Template.
- Scroll to the place in your template where you want the mini cart to appear and click once to put the insertion point there.
- If you want the mini cart to appear only if the merchant has enabled it, type these lines into your template:
[-- IF MiniCart --]
[-- END_IF MiniCart --]
Then insert a blank line between those two lines and put the insertion point there.
- Type Ctrl+V to paste the code into the field.
- Click Save Changes.
- Publish your store.
- Click the My Store icon to view your store. You should see the mini cart display, and it will probably say "0 Items" or just show the "Your Shopping Cart" header.
- Add an item to your cart, then click the Continue Shopping button. The mini cart display should now show the updated information.
4. Saving Your Mini Cart Code as an Include File
Custom template "include" files make it easy to modularize your templates, which can result in cleaner code and reusable components. By saving your mini cart code as an include file, it will be easier to make changes to that code and your page template will be easier to read.
- In your text editing application, select all of the code by typing Ctrl+A, then copy it to the clipboard by typing Ctrl+C.
- Switch to the browser window containing the ShopSite back office.
- Click on the Merchandising icon, then click Custom Templates.
- Scroll down the page to the Include Files section.
- Click New Include.
- Type a name for the include file, such as "minicart," then click Create.
- Back on the Custom Templates screen, scroll down to the Include Files section.
- Select your new include file, then click Edit Include.
- On the Edit Custom Include File screen, select and delete the one line in the editing window.
- Type Ctrl+V to paste the code into the field.
- Click Save Changes.
- On the Custom Templates screen, select your page template and click Edit Template.
- Scroll to the place in your template where you want the mini cart to appear and click once to put the insertion point there.
- If you want the mini cart to appear only if the merchant has enabled it, type these lines into your template:
[-- IF MiniCart --]
[-- END_IF MiniCart --]
Then insert a blank line between those two lines and put the insertion point there.
- Type this line (assuming that you used "minicart" as the name of your include file):
[-- INCLUDE minicart PROCESS --]
- Click Save Changes.
- Publish your store.
- Click the My Store icon to view your store. You should see the mini cart display, and it will probably say "0 Items" or just show the "Your Shopping Cart" header.
- Add an item to your cart, then click the Continue Shopping button. The mini cart display should now show the updated information.