Tag Archives: settings

how to change admin session lifetime, avoid getting logged out

There’s nothing worse than editing a product description, clicking save and finding that you’ve been timed out by the server. This can be caused by having an admin session set too low. If you’re running a cart that saves sessions to a directory rather than to the mysql database, this may be a problem too. Here’s an easy way to fix this:

Go to /admin/includes/functions/sessions.php, simply add at the top after the copyright info:
ini_set('session.gc_maxlifetime', 3660); // 3660 seconds = 1 hour

Note – the session lifetime is entered as seconds.

Hope this helps!

(PS If you’re using database storage of sessions you might have an admin configuration setting for this already. Check Admin >> Configuration >> Sessions to see and change the figure there.)

mod pagespeed causes google checkout problems on dreamhost vps

If you’re running a vps (virtual private server), an oscommerce-based cart, a 3rd party google checkout payment module that requires zend optimizer and happen to be with a hosting company that offers ‘web site optimizations’ … (yeah I know, pretty select situation), make sure to take a close look at the web hosting control panel because ‘page speed optimization defaults’ may include the apache module mod_pagespeed, Google’s own bash at making your sites go faster.

A recent job I had was to fix a failing google checkout callback for a client who runs a site on a dreamhost vps. After a lot of of tests and removing various caching and compression features, plus an investigation into php compiled via fastcgi (that I wouldn’t recommend to anyone), I noticed that all the stylesheets were getting linked together in the page source code of the site. For example, a cre loaded site running product page tabs and a social media box might look:

http://mysite.com/cgi-bin/dispatch.fcgi/templates/mytemplate/sty lesheet.css+tabs,_tabpane.css.pagespeed.cc.1234abc.css

Note ‘pagespeed’ in the url – this is an indicator that you too have google’s mod_pagespeed running on your server.

It was easy to deactivate the Page Speed Optimization module (which includes mod_pagespeed – remove a tick in a box) but man, it took some hunting down (mainly because I wasted time looking at the ‘complicated’ when it would be better to check the ‘obvious.’)

You can read a whole lot more about Google’s ‘Page Speed Optimization’ suite of tools (which includes the apache mod_pagespeed) from this url: code [dot] google [dot] com/speed/page-speed/

Here is a list of some of the filters it uses, to give you an idea of what it might do to for your site:

ModPagespeedEnableFilters combine_css
ModPagespeedEnableFilters rewrite_css,rewrite_javascript
ModPagespeedEnableFilters inline_css,inline_javascript
ModPagespeedEnableFilters rewrite_images
ModPagespeedEnableFilters insert_img_dimensions
ModPagespeedEnableFilters remove_comments
ModPagespeedEnableFilters extend_cache
ModPagespeedEnableFilters remove_quotes

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.

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