Discount Coupon Entry not Displaying Opencart 1.5.3.1

Opencart Cart Version 1.5.3.1

We have been using opencart Version 1.5.3.1 with a custom template or skin. We found that the skin had some coding that stepped users through the “cart” step of the checkout, directly to the checkout process.

The stops the “voucher or coupon” step being available to the end user during checkout. (Unless they had more than one item in their cart).

The problem appears to be that the template is using the code:

<a href="<?php echo $checkout; ?>"

 

rather than:

<a href="<?php echo $cart; ?>"

 

You see the difference is the word “checkout” vs “cart” in this string.

This means that when you click on the:

image

icon for checkout, you are directed to:

domain.com/index.php?route=checkout/checkout

where you need to go to get the coupon option is:

domain.com/index.php?route=checkout/cart

 

Things to check first

1. Ensure you have added coupon codes!

The first obvious check is to ensure you have added voucher (discount) codes to your storethrough OpenCart’s administration panel, in Sales > Coupons.

image

2. Ensure Coupons are enabled in OpenCart

Next, we need to check the coupons feature is enabled in OpenCart. In OpenCart 1.5+, this is located in the Extensions > Order Totals menu in the administration panel. Make sure that the Coupons feature is enabled (it should be by default).

image

3. The Fix

Use a program that will search all files in your website structure looking for the phrase:

<a href="<?php echo $checkout; ?>"

and replace it with

<a href="<?php echo $cart; ?>"

 

What you will probably find is an error when you then try to proceed from the “Cart” to the correct “Checkout”

We found that the find and replace we did, broke the actual button found here:

image

But the good news was that the fix is really easy.

If you hover on that link / button you will find that the error message appears that says something like: Undefined Error in (and lists the file) and the line number.

Just open that file, find the correct line number, and replace the word “cart” with “checkout” in that once instance.

The net result being that you are changing all but one of the instance of the <a href="<?php echo $checkout; ?>" string.

Opencart on IIS 7.5 Windows 2008 Server FTP Permissions Changing

Opencart and PHP running on IIS, we found Permissions incorrect on uploaded files

After working with IIS server running PHP, we found the files uploaded through the web interface of the opencart CMS failed to inherit the correct permissions.

After spending weeks time to resolve this problem, believing that it was a glitch that required file permissions to be reset we found an easy solution.

The Problem

The problem lies with the PHP system running on IIS. When you use a web interface to upload files to your PHP CMS website, they are initially loaded to the PHP defined temporary folder. The temporary folder is set in the PHP.ini file.

To find this file and check the setting, you do this:

Open IIS and select PHP Manager

NewImage

 

Then Check phpinfo()

NewImage

 

Then search the php.ini file that opens for “upload_tmp_dir”

Notice that the default location (unless you have changed it) is: c:\windows\temp

NewImage

Now navigate to that folder on your IIS server rick click and select Properties / Security Tab and find the IIS_IUSRS security group.

NewImage

Edit the permissions there to match the permissions of your IIS website folder that is causing you the grief. Probably Read Write at least is needed.

Why the solution works.

As files are uploaded through the website interface, they land in the temp directory. Once there they inherit the temp directory permissions before being moved onto the website folders. By adding the website security to the temp folder, you allow the files to move across with the correct permissions set.

This would be applicable for WordPress running on IIS server, or Opencart.

WordPress 3.5 Manual Fix

Below is the manual fix you can apply to be able to get your WordPress 3.5 install working correctly, there are two options that should work.

1) In the file wp-config.php, add the following line before “That’s all, stop editing”

define( 'WP_TEMP_DIR', ABSPATH . 'wp-content/' );

or

2) In the file /wp-includes/class-http.php comment out lines 144 and 145, which look like the following:

if ( ! is_writable( dirname( $r['filename'] ) ) )
	return new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) );

After applying one of the above fixes you should be able to add/upgrade your plugins and upgrade your themes, and will allow you to use the auto upgrade feature when WordPress version 3.5.1 is released.

Opencart .php on IIS 7.5 Permission Denied

image

The Problem

We ran into an interesting issue while playing with Opencart on IIS 7.5. The issue was around a common third party module being used called Magic Zoom Plus.

The error showed it’s self with the loading of some junk text at the beginning of many pages when loading.

The text looked like this:

Warning: file_put_contents(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/magiczoomplus.css): failed to open stream: Permission denied in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 171Warning: unlink(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/magiczoomplus.css): Permission denied in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 172Warning: rename(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/magiczoomplus

.css~backup,C:\inetpub\wwwroot\www.domain.com\admin\controller\module\

magictoolbox/magiczoomplus.css): Access is denied. (code: 5) in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 173Warning: file_put_contents(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/magiczoomplus.css): failed to open stream: Permission denied in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 171Warning: unlink(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/magiczoomplus.css): Permission denied in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 172Warning: rename(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/

magiczoomplus.css~backup,C:\inetpub\wwwroot\www.domain.com\admin\controller\module

\magictoolbox/magiczoomplus.css): Access is denied. (code: 5) in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 173Warning: file_put_contents(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/magiczoomplus.css): failed to open stream: Permission denied in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 171Warning: unlink(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/magiczoomplus.css): Permission denied in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 172Warning: rename(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/magiczoomplus

.css~backup,C:\inetpub\wwwroot\www.domain.com\admin\controller\module\

magictoolbox/magiczoomplus.css): Access is denied. (code: 5) in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 173Warning: file_put_contents(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/magiczoomplus.css): failed to open stream: Permission denied in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 171Warning: unlink(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/magiczoomplus.css): Permission denied in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 172Warning: rename(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/magiczoomplus

.css~backup,C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox

/magiczoomplus.css): Access is denied. (code: 5) in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 173Warning: file_put_contents(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/magiczoomplus.css): failed to open stream: Permission denied in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 171Warning: unlink(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/magiczoomplus.css): Permission denied in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 172Warning: rename(C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/magiczoomplus

.css~backup,C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox/

magiczoomplus.css): Access is denied. (code: 5) in C:\inetpub\wwwroot\www.domain.com\admin\controller\module\magictoolbox\module.php on line 173

 

We knew immediately that it is a windows server permission error. However the strange thing is that we were pretty sure that the permissions were correct. We looked around at the settings and found them to be correct too.

The Solution

We ended up going to the website root, and selecting permission (on the server with RDP) and resetting the entire folder and all sub folders permissions. This fixed the problems. Can’t explain why but this is the second time we have needed to do this while running PHP on IIS. May be time to change back to a real php server.

The Permanent Fix

We have done details here that explain how to stop the being necessary.

Opencart on IIS 7.5 Windows 2008 Server FTP Permissions Changing