Category Archives: functions

tips on how to change, improve how osCommerce-based cart functions

can’t see link to new box added in admin (cre loaded)

Cre Loaded 6.4.x versions have a sort of useful feature that enables specific admin access to specific files. Eg if you don’t want your employees being able to access anything in the Admin >> Reports area, you simply remove the tick from the folder (or file) from their admin group by going through Administrator >> Admin Group >> Set Menu and File Access area.

However this can be a gotcha too when you go to add a new mod and wonder why you and no-one else can see the link in the left column (I’m referring to non-Configuration panel links here which are dragged out of the database.)

So to add a file to the menu, you need obviously to login as a Top Administrator or to have access to the database via phpmyadmin.

If you’re a Top Administrator:
Login and click Administrator >> Menu File Access as shown.

Choose the admin area that your new link is going into by clicking on it:

The using the dropdown on the right, find your new file and click Save (ignore the all yellow look … a beta version obviously):

New file should appear with list of others in this Admin panel and importantly, the link to it will appear in the relevant box in the left column:

If you’re NOT a Top Administrator:
You’re going to need access to the database via something like phpmyadmin, because the first thing you’ll need to do is change your admin_groups_id in the table admin to whatever the Top Administrator group id is (usually 1.) Once this is done, login to the Admin as this new administrator and go through the steps above. Remember to change your admin_group_id back to avoid an issue later on.

But wait, there’s more… give permission to others
So now the file appears in the link … but should you want to give access to other non-Administrator account people (possibly including yourself) you need to be logged in as a member of that Top Administrator group again and go to Admininstrator >> Admin Groups and select the group you want to give access to (1), then click File Permissions (2):

A simple system of tick/no tick comes into play here – folders (read “entire box in the left column”) are in bold; files are not. If ticked – you have access, if not ticked – you don’t have access:

Make sure you click ‘Insert’ at the bottom of the page when done.

cre loaded adserver authsecure annoyance

I was working on a client’s site today and found the admin panel was slow to load. The url it was getting stuck on was one of the links, one of the Cre direct ‘feeds’ into the admin panel.

Taking a closer look at a some files in the admin revealed a possible solution for Cre Loaded 6.4.x users:

The file is admin/messages.php
Find (around line 27):

case 'upgrade': //index
  $n = 'a6bb2567';
  $zone = '50';
  echo cre_iframe($n,$zone);

Replace with:

case 'upgrade': //index
  $n = 'a7d7b7d2';
  $zone = '49';
  echo cre_iframe($n,$zone);

Find and delete this block (around line 45):

case 'login': //std admin login nag
  $n = 'ac49906f';
  $zone = '103';
  echo cre_iframe($n,$zone);

stop google from indexing https secure pages of your website

To stop google and other bots from indexing your website https pages you need to create a new version of a robots file and add a conditional to your store’s root htaccess file. Note – your server should be running the Apache mod_rewrite module for this to work.

Simply create and upload a txt file containing the following code to your store’s root directory:

User-agent: Googlebot 
Disallow: / 

User-agent: * 
Disallow: /

modify the store’s htaccess file
Add the following lines near the top of your htaccess file:

RewriteCond %{SERVER_PORT} ^443$ 
RewriteRule ^robots.txt$ robots_ssl.txt

Check your Google Webmaster account to check this is working correctly.

how to set up tax zones for countries with variable state or province tax rates (eg Canada)

Setting up tax correctly in osCommerce-based carts can be confusing. In some countries, each state or province has a different sales tax. The following example uses Canada and the province of Nova Scotia as an example.

Step 1. Set up Tax Class
This is the actual name of the Tax that you will attach to a product or shipping module. If you’re in Canada, it would make sense to call this ‘Canadian Tax.’

In Admin >> Locations/Taxes >> Tax Classes … create the following by clicking New Tax Class – entering the Title and Description – then Insert. So you get:
create a tax class in cre loaded

Step 2a. Set up Tax Zones – Country
In Admin >> Locations/Taxes >> Tax Zones … insert a new Tax Zone called ‘Canada HST/GST 5%.’
Then with this new Tax Zone selected, click on Details and add each of the Canadian provinces to the ‘Canada HST/GST 5%’ zone by selecting Canada then the Province from the dropdowns.
setting a tax zone

Step 2b. Set up Tax Zones – Provinces
Now you need to add in each province on its own as a Tax Zone. Here is Nova Scotia as an example:
nova scotia tax zone

Once again with the Province selected, click Details and add itself to it’s own Tax Zone.
Do this for all provinces, creating a separate Tax Zone for each.

Why is Canada 5% and Nova Scotia 8%? These aren’t the current tax rates for either place.

Many provinces in Canada have a GST rate of 5%. The tax calculation is based on adding (or compounding) tax at a national and regional level (so country and state level) and because both entities must be created as Tax Zones, by setting Canada at 5% tax, you can then just set the province to carry the difference.

The system then adds together both rates to find the tax rate. So as an example, Nova Scotia, which at the moment has a tax rate of 13%, is set up with 8% tax (the difference between its actual rate and the Canadian rate it includes.)

Many provinces currently have a GST rate of 5%, so by making the tax zone ‘Canada’ at 5% the provinces don’t need to have any tax added (but listed with 0% tax.)

Step 3a. Set up Tax Rates – Country
In Admin >> Locations/Taxes >> Tax Rates … insert a New Tax Rate, choose ‘Canadian Tax’ as the Title, choose the Canadian HST/GST 5% Zone, enter the base tax rate of 5% and a description – tip: you can enter your Tax# here and it will print on invoices. Make the Priority 1.

Step 3a. Set up Tax Rates – Provinces
Yes, you guessed it – same for each province as the main Canadian tax rate in 3a. However, remember that the Tax Rate (%) you enter here is the actual provincial rate less the base Canadian rate of 5%. So some provinces will be entered as 0% Tax Rate, because their GST is equal to 5%. Here is Nova Scotia, with a tax rate of 13% total (5% Canada, 8% Nova Scotia):
set tax rate for nova scotia

Do the same for all provinces, creating a separate Tax Rate for each. In the case of provinces like Manitoba (5% tax) you would enter 0% Tax Rate in the right hand Tax Rate (%) box. Make the Tax Priority the same for all (ie 1.)

add tax rates for provinces

Step 4. Attach tax class
Edit your product and from the dropdown select ‘Canadian Tax.’ Now if a customer from Nova Scotia adds this taxable product to her order, the total tax of 13% will be applied to this product at checkout.

tax added to product via dropdown

Edit your shipping module – choose ‘Canadian Tax’ as the Shipping Tax rate. This will add the applicable provincial tax rate to your net shipping charges.
add tax to shipping module

cre loaded – how to change the menu links in the navbar

Here’s how to edit the navigation menu at the top of your Cre Loaded store.

The default menu bar in the cre63_ats template (which is a stock Cre Loaded template) looks like this:

Removing a link
Find the file /templates/cre63_ats/header.php and make a backup of this first. Then edit the copy, looking for this code at around line 80:

Let’s remove the ‘Specials’ link. Find this code (top) and comment it out (bottom):

(Note that the ‘Specials’ link also has a divider image after it, so this is why both lines are commented out.)

The other thing to change is the width of the table containing the links – if you don’t then the remaining links will get ‘stretched out’ to fill the original fixed width of 440px:

change to