OptionCart Catalog

 

HACKER SAFE certified sites prevent over 99.9% of hacker crime.
Home Features Requirements Purchase Showcase Resellers Resources Help

Customization Questions From Users

Rent a Coder

Need help customizing your script? Post a free bid on Rent A Coder and have PHP programmers compete for your business. It's free for buyers to bid - you only pay the script costs if you hire someone to do the work for you - and it gives you the opportunity to view programmers' work before hiring.
The following are actual questions from our users, with the answers. The help below are for those who have a general understanding of PHP and HTML, and feel comfortable modifying the include files. WARNING: If you decide to attempt any of these customizes, you need to make a backup of any file you change, as restoration is not part of our installation service!!! (Disclaimer: the customizations shown here were developed for older system versions, and are not necessarily needed for newer systems.

I want the "Price:" label on the category page to read "Suggested Retail Price:". How do I do that?
For any general text changes, open the products.php file (in the include folder), and in the HTML mode, find the text you want to change and replace it with the wording you want to include. Be sure not to change anything else in the file! You can do this for just about any basic text changes. If you have the Deluxe edition, be sure to change the new.php file as well. TOP

I only want the "Limited Quantity" message to show if there are four items in stock or less. How do I change this?
In the products.php page, find the following line:

if ($searchrow[14] > 0 AND $searchrow[12] == "No")

and change it to:

if ($searchrow[14] > 0 AND $searchrow[14] <= 4 AND $searchrow[12] == "No")

Now, when your total inventory quantity for any item is 5 or more, the "Limited Quantity" field will not display. Change the 4 to whatever number you want as the stock limit field. TOP

How do I put the navigation bar or search box(es) on my other pages?
If you have a Basic Catalog, the other pages in your site that will have your navigation components must have PHP extensions. In other words, you'll have to rename your index file to index.php to add the components. If you have a Deluxe Catalog and your server supports the HTM extensions, you can end your page in .htm or .html.

On the top of the page that you want to add the navigation bar or search box, add the line:

<script language="php">include("$DOCUMENT_ROOT/inc/openinfo.php");</script>

This line must be ABOVE the <html> tag, and must be included in every page that you want to add components to. Then, in your page body, add the following line wherever you want the keyword search box:

<script language="php">include("$DOCUMENT_ROOT/inc/search.php");</script>

or this line where you want the navigation bar:

<script language="php">include("$DOCUMENT_ROOT/inc/navbar.php");</script>

and so on. With the deluxe version, you can also add the file catnum.php for the category drop down search, or the price.php for the price search. TOP

I would like to add the newest products to my index page. How can I do that? (Deluxe Only)
First, make sure to read the question above, on including files in pages outside the catalog page. Then, simply add the include statement for the new.php page, adding variables to change the look if desired. So you'd add the openinfo include page to the top of your index page, then add this code where you want the new items to be shown:

<script language="php">
$Item_Columns = 3;
$LimitOfItems = 12;
$imgwidth = 100;
include("$DOCUMENT_ROOT/inc/new.php");
</script>

The extra variables tell the cart something about the setup. The $imgwidth variable has to be included, and tells the system how wide to make the images listed in the new page.

The $Item_Columns is optional, and used if you want the number of columns on a page to differ from the number of columns on your catalog page. For example, if you have two columns across on your product page, you can set this number to 4 and display four new products across your index page.

The $LimitOfItems is optional, and is used only if you want to display a different number of items on your page. For example, if you only want to display the last 3 products entered, change this value to 3. TOP

Can I set different categories to display different column numbers on my catalog page? (Deluxe Only)
You can set "Category 3" to display three items across, "Category 2" to display two items across and "Category 1" to display one item across. But without code customization (ie. adding an extra field to the Shop_Categories table to add the column numbers), you'll need to do a hard code fix.

Open your products.php page (in the include file), and find the line just under the Javascript that shows:

<?php
$imgwidth = "100";

Add a statement underneath that line that reads:

if ($category == "Category 3")
$Item_Columns = 3;
if ($category == "Category 2")
$Item_Columns = 2;
if ($category == "Category 3")
$Item_Columns = 1;

and so on. You'll basically be changing the $Item_Columns field to match whatever number of rows across you want to display on that page. For even more changes, you can set the number of rows down, too. So on your previous example, you could always keep the total products displayed to be 12 by changing the rows of each of the categories:

if ($category == "Category 3")
{
$Item_Columns = 3;
$Item_Rows = 4;
}
if ($category == "Category 2")
{
$Item_Columns = 2;
$Item_Rows = 6;
}
if ($category == "Category 3")
{
$Item_Columns = 1;
$Item_Rows = 12;
}

The result of the above is that, when someone selects "Category 3", they will see 12 items on a page - 3 across and 4 down. When they select "Category 2", they will see 12 items on a page - 2 across and 6 down. When they select "Category 1", they will see 12 items - a single line across and 12 down. TOP

How do I change the widths of my thumbnail images?
Open your products.php page (in the "inc" folder), and find the line towards the top of the page:

<?php
$imgwidth = "100";

And change that number to whatever number you want as your image width. TOP

I want the heights of my thumbnail images to be a certain size instead of the widths. How do I do this? (Deluxe Only)
To change the image height instead of the width, go through your products.php page and your new.php pages (both in the "inc" folder) and do a find/replace to find the following information:

width=\"$imgwidth\"

change that to read:

height=\"$imgwidth\"

If you want that height to be different than 100 pixels, use the question above to change that height by changing the "imgwidth" variable to a number other than 100. TOP

When a customer clicks on the thumbnail image to get a larger image, the screen that opens is too large or too small. How can I change the size of that window?
You'll need to change your pop up dimensions. Open the products.php page (in the inc folder) and change the PopUp window width and height. To find this, look for the statements:

echo "<a href=\"view.php?image=$searchrow[5]\" target=\"_blank\" onClick=\"PopUp=window.open('view.php?image=$searchrow[5]', 'NewWin', 'resizable=yes,width=425,height=500,left=0,top=0,screenX=0,screenY=0'); PopUp.focus(); return false;\">";

or

echo "<a href=\"$searchrow[5]\" target=\"_blank\" onClick=\"PopUp=window.open('$searchrow[5]', 'NewWin', 'resizable=yes,width=425,height=500,left=0,top=0,screenX=0,screenY=0'); PopUp.focus(); return false;\">";

and change the width=425 to the width you want the screen to be, and the height=500 to be the height you want the screen to be. TOP

Is it possible to set the title of my catalog page to match the category or item my customer is viewing? (Deluxe Only)
Yes. Simply replace the following line on your catalog page:

<title>My Web Site</title>

with the following:

<title>
<script language="php">
if ($item OR $catalog)
{
$itemquery = "SELECT Item FROM Shop_Items";
if ($item)
$itemquery .= " WHERE ID='$item'";
if ($catalog)
$itemquery .= " WHERE Catalog='$catalog'";
$itemquery .= " LIMIT 1";
$itemresult = mysql_query($itemquery) or die ("Unable to select.");
if (mysql_num_rows($itemresult) == 1)
{
$itemrow = mysql_fetch_row($itemresult);
$stripitem = stripslashes($itemrow[0]);
echo "My Web Site: $stripitem";
}
else
echo "My Web Site";
}
else if ($category OR $maincat)
{
$stripcat = stripslashes($category);
echo "My Web Site: $stripcat";
}
else
echo "My Web Site";
</script>
</title>

And now your title will change if your customer searches for a particular category or item. This is helpful for search engine optimization as well, since it seems some search engines rely on the information in your title to display results. TOP

I see that the meta tags display specific tags for categories, but default tags for everything else. Can I set it so that the tags display the keywords and  descriptions of the items, too? (Deluxe Only)
Yes, you can. Keep in mind that you can use HTML code in the item descriptions, so if you use that field for the meta descriptions too, it will display the HTML code too! So for best results, if you want to set specific meta tags for each item, don't use HTML in your descriptions.

To set up the tags, open your openinfo.php page (in the "inc" folder) and change the following lines from:

else if ($item)
$searchquery .= " AND ID = '$item'";

to:

else if ($item)
{
$searchquery .= " AND ID = '$item'";
$metaquery = "SELECT Description, Keywords FROM Shop_Items WHERE ID='$item'";
$metaresult = mysql_query($metaquery) or die ("Unable to select. Try again later.");
if (mysql_num_rows($metaresult) == 1)
{
$metarow = mysql_fetch_row($metaresult);
$Meta_Keywords=stripslashes($metarow[1]);
$Meta_Description=stripslashes($metarow[0]);
}
}

You don't need to add keywords and descriptions to each product if you use this code; it will simply display that info only if you have descriptions and/or keywords for that item. TOP

I would like for my system to set an item to "Out of Stock" when the inventory turns to zero. Why doesn't the system do this, and how can I make it happen? (Deluxe Only)
Some users want to distinguish between out of stock items which they don't plan to get back in and backordered items which will come in at a later date. Because of this, the system does not set a product to "Out of Stock" automatically once the inventory reaches zero. But if you want to do this, you can easily make a quick update to do this.

You'll need to modify the finish.php page in your main directory. Find the line that reads:

$updinvquery = "UPDATE Shop_Items SET Inventory='$newinv' WHERE ID='$itemid'";

and change it to read:

$updinvquery = "UPDATE Shop_Items SET Inventory='$newinv'";
if ($newinv == 0)
$updinvquery .= ", OutOfStock='Yes'";
$updinvquery .= " WHERE ID='$itemid'";

That's all there is to it. This changes your out of stock entry to "Yes" automatically, when the inventory reaches a total of zero. TOP

I'd like to display my products from newest to oldest (or vice versa). How can I do this?
Update the "variables.php" page in your "shopadmin" folder. Just add these lines under the "orderofproduct" drop down:

if ($OrderOfProduct == "ID")
echo "<option selected value=\"ID\">Oldest to Newest</option>";
else
echo "<option value=\"ID\">Oldest to Newest</option>";
if ($OrderOfProduct == "ID DESC")
echo "<option selected value=\"ID DESC\">Newest to Oldest</option>";
else
echo "<option value=\"ID DESC\">Newest to Oldest</option>";

Now go into your System Variables in the administration area and select "Newest to Oldest" (or "Oldest to Newest"). TOP

When a customer uses the Email a Friend feature, I'd like to send a copy to myself so I know what they're viewing. How do I do this?
In the email.php, add the following to line #65:

mail("youremailhere", "Check This Out - Copy", "$fromname ($fromemail) was viewing $sitename and sent the following information to $toname ($toemail):

$sitename
$siteaddress$addl", "From: youremailhere\r\nReply-To: youremailhere");

Then replace youremailhere with your email address. Now when a customer uses this feature, you'll know what they were interested in. TOP

Is there a way for me to specify which items will appear as "new" on the site?
To specify new items without adding a new field to the database, you can use the "Units" field as a work around. Note that this only works if you do not need to use the "Units" field for your Mals cart.

First, set the "Units" to "99" for any product you want to appear as a new item. Next, open the new.php page in the inc folder and change the first line:

$newquery = "SELECT * FROM Shop_Items WHERE Active = 'Yes' ORDER BY ID DESC LIMIT $LimitOfItems";

to:

$newquery = "SELECT * FROM Shop_Items WHERE Active = 'Yes' AND Units='99' ORDER BY ID DESC LIMIT $LimitOfItems";

Now open the "products.php" page in the "inc" folder and change this line from:

$searchquery .= " ORDER BY ID DESC";

to:

$searchquery .= " AND Units='99' ORDER BY ID DESC";

That's all there is to it. Now, only items marked as "99" in the Units will appear under the new items listing. TOP

I'm using the muti column format for my site. Can I set it so that when someone clicks the link they go to the more information page as usual, but if they click the picture they get a larger image?
Yes. Open the products.php page in the inc folder and change the following line from:

echo "<a href=\"$Catalog_Page?item=$searchrow[0]&ret=$ret\">";

to:

if ($searchrow[5])
echo "<a href=\"$searchrow[5]\" target=\"_blank\" onClick=\"PopUp=window.open('$searchrow[5]', 'NewWin', 'resizable=yes,width=425,height=500,left=0,top=0,screenX=0,screenY=0'); PopUp.focus(); return false;\">";

Now open the new.php page in the inc folder and change the following line from:

echo "<a href=\"$Catalog_Page?item=$newrow[0]&ret=$ret\">";

to:

if ($newrow[5])
echo "<a href=\"$newrow[5]\" target=\"_blank\" onClick=\"PopUp=window.open('$newrow[5]', 'NewWin', 'resizable=yes,width=425,height=500,left=0,top=0,screenX=0,screenY=0'); PopUp.focus(); return false;\">";

Now your customers will get a pop up when they click images, but more information when they click the text link for a product. Again, this only works in the multi column view (ie. setting Product Columns to 2 or more in your administration area). TOP

How can I keep the inventory quantities from displaying on my catalog page?
In your products.php page in the "inc" folder, find the two lines that read:

if ($searchrow[14] > 0 AND $searchrow[12] == "No")

and change this to read:

if ($searchrow[14] > 0 AND $searchrow[12] == "No" AND $Limited_Qty != "")

Now access the system variables in the administration area and make sure the "Limited Qty Info" field has no information. Now the limited quantity. TOP

I would like to display just a single category or only sale items or all items when someone first accesses the catalog. How do I do this?
You'll need to do a quick modification of the catalog. First access your products.php page in the "inc" folder and find the lines:

// Catalog page is displayed with no vars
if (($QUERY_STRING == "" OR $QUERY_STRING == "page=1") AND ($REQUEST_METHOD != "POST"))
{
include("$DOCUMENT_ROOT/$Initial_Page");
}

Remove the above line by putting // in front of each line, so you'll have:

// Catalog page is displayed with no vars
// if (($QUERY_STRING == "" OR $QUERY_STRING == "page=1") AND ($REQUEST_METHOD != "POST"))
// {
// include("$DOCUMENT_ROOT/$Initial_Page");
// }

Just underneath that, you'll see the following:

// If there are no records, display error message
else if ($totalsearchnum == 0)
{

Take off the "else", so you'll have:

// If there are no records, display error message
if ($totalsearchnum == 0)
{

Now you'll need to open the openinfo.php page in your "inc" folder and find the lines that read:

// Set www or ww3 for add page
$Mals_Page = "http://" .$Mals_Server;
$Add_Page = $Mals_Page .".aitsafe.com/cf/add.cfm";
$View_Page = $Mals_Page .".aitsafe.com/cf/review.cfm";

Just above those lines, add the following code if you want to display all records when the page first opens:

if (!$category AND !$maincat AND !$keyword AND !$cond AND !$item AND !$catalog AND !$price AND !$sale AND !$new)
$all = "yes";

Or add the following code if you want to display sale items when the page first opens:

if (!$category AND !$maincat AND !$keyword AND !$cond AND !$item AND !$catalog AND !$price AND !$sale AND !$new)
$sale = "yes";

Or add the following code if you want to display a specific category when the page first opens:

if (!$category AND !$maincat AND !$keyword AND !$cond AND !$item AND !$catalog AND !$price AND !$sale AND !$new)
$category = "Your Category";

Now when someone accesses the main catalog page they will see all records, sale records or a specific category, depending on what you chose. 

For even more customization, try adding a column number to display a certain number of columns across, even if it is different from your default, as in:

if (!$category AND !$maincat AND !$keyword AND !$cond AND !$item AND !$catalog AND !$price AND !$sale AND !$new)
{
$all = "yes";
$Item_Columns = 5;
}

This will override the number of columns you set in your main system variables. TOP

How do I change the order of the categories? (Deluxe Workaround)
OptionCart does not currently allow a store to arrange categories in a particular order. To do this, you will need to add a new field to the categories table for sorting.

One optional workaround is to sort the categories by keyword. To do this, add a set of numbers or letters to the beginning of each keyword so that you can sort them in alphabetical order. For instance, on the category you would like to display first, if your keywords are:

candles gel wicks

Add 001 to the beginning of your keywords, so you would have:

001 candles gel wicks

Do the same for all the keywords on each of your categories. It is important to use 001, 002, 003, and so on (adding zeroes in front of the numbers to pad them to three digits). The reason for this is that the keywords are sorted by alphabet, and so you need to put in place holders to force the sort to show 001 first, then 002, 003, etc. 

After you have added numbers to the beginning of each category keywords, you will have to adjust your PHP pages to sort by keyword instead of category name. Open up the following pages: advsearch.php, categories.php, howtoshop.php, navbar.php, products_maincat.php

and everywhere you see the text:

ORDER BY Category

change this to read:

ORDER BY Keywords, Category

Make sure you change this text on all instances on each of the above pages. That's it! Your categories will be changed to sort by keyword first.

Now if you want, you can finish with this final step to change the meta keyword display. Open up the meta.php page and find the lines:

if ($Meta_Keywords != "")
echo "<meta name=\"keywords\" content=\"$Meta_Keywords\">\r\n";

and change it to:

if ($Meta_Keywords != "")
{
$Meta_Keywords = substr($Meta_Keywords, 3);
echo "<meta name=\"keywords\" content=\"$Meta_Keywords\">\r\n";
}

This will delete those first few characters off the meta keywords before displaying them in the catalog. This last step is only necessary if the extra characters bug you, because they don't actually "show" on the catalog to the site visitor - they're only displayed in the meta tags. TOP

I want to order my products in a very specific order. Can I do that? (Deluxe Workaround)
OptionCart Deluxe allows you to specify the order of your products through the administration area. You can choose to sort products by name (A to Z or Z to A), units value, catalog number, or random order. To add even more customization, you can utilize the keywords values to sort your items.

To do this, add a set of numbers or letters to the beginning of each keyword so that you can sort them in alphabetical order. For instance, on the item you would like to display first, if your keywords are:

candles gel wicks

Add 001 to the beginning of your keywords, so you would have:

001 candles gel wicks

Do the same for all the keywords on each of your items. It is important to use 001, 002, 003, and so on (adding zeroes in front of the numbers to pad them to three digits). The reason for this is that the keywords are sorted by alphabet, and so you need to put in place holders to force the sort to show 001 first, then 002, 003, etc. 

After you have added numbers to the beginning of each item keywords, open the variables.php page (in the shopadmin folder) and find the lines:

if ($OrderOfProduct == "rand()")
echo "<option selected value=\"rand()\">Random</option>";
else
echo "<option value=\"rand()\">Random</option>";

(which will be around line 661), and just underneath those lines, add:

if ($OrderOfProduct == "Keywords, Item")
echo "<option selected value=\"Keywords, Item\">Keywords</option>";
else
echo "<option value=\"Keywords, Item\">Keywords</option>";

Now, save the file to your server, and access the administration area. Choose "Keywords" from the values under "Product Order" and save. Items will now be sorted by keywords. TOP

How can I preview items before they are available to the public (Deluxe)
To add a "preview" setting which allows you to view items before your customers can see them, open up the openinfo.php page (in the "inc" folder) and find the following line:

$searchquery = "SELECT * FROM Shop_Items WHERE Active = 'Yes'";

Change this line to:

$searchquery = "SELECT * FROM Shop_Items WHERE ";
if ($preview == "yes")
$searchquery .= "(Active = 'Yes' OR Active = 'No')";
else
$searchquery .= "Active = 'Yes'";

and save the file. (Note: be sure to back up the original, just incase!!!)

Now, go to your catalog and select a category or item from your catalog. In the URL, at the very end of the page URL, enter &preview=yes

For example, if you select a category and the URL is:

http://www.yoursite.com/catalog.php?category=Votive+Candles

Just add &preview=yes to the end, so you'll have:

http://www.yoursite.com/catalog.php?category=Votive+Candles&preview=yes

Which will display the inactive items. Note that you'll have to add this extra text any time you click a link, as it's not carried through the catalog. (You wouldn't want that anyway, because you don't want your customers to view inactive items.) TOP

Stop back for more customization questions and answers. As we receive them, we'll add them here!

Privacy Policy: We respect your privacy. We will never give your email to third party companies nor use it for sales
purposes. Emails are used only for support purposes or to relay information to you about your OptionCart systems.