Jump to content
Sign in to follow this  
fmmap

HANDLING FEE FOR Canadapost module

Recommended Posts

I'm using the bug fix to canadapost.php that was posted Feb05/06. I'm ignorant of this scripting language and don't know how to enter values so that the handling fee is added at checkout in my store. Any help will be appreciated. Thanks

FMMacri'

Toronto

Share this post


Link to post
Share on other sites
I'm using the bug fix to canadapost.php that was posted Feb05/06. I'm ignorant of this scripting language and don't know how to enter values so that the handling fee is added at checkout in my store. Any help will be appreciated. Thanks

FMMacri'

Toronto

 

Are you using the Canada Post Shipping Module with Dimensions?

 

If so, I hard coded a change that will add the handling charge (as a percentage of the shipping cost) into the code and I can post the changes


No Good Deed EVER Goes Unpunished

Share this post


Link to post
Share on other sites
Are you using the Canada Post Shipping Module with Dimensions?

 

If so, I hard coded a change that will add the handling charge (as a percentage of the shipping cost) into the code and I can post the changes

 

Thanks for the reply. I'm not using the module with dimensions because I didn't feel confident enough to install it. In any case, I'd be happy to have your modified version. You can post them or send them to me.

FMM

Share this post


Link to post
Share on other sites
Thanks for the reply. I'm not using the module with dimensions because I didn't feel confident enough to install it. In any case, I'd be happy to have your modified version. You can post them or send them to me.

FMM

 

I'm afraid that, if you're not using it, the change in code isn't going to help you any.


No Good Deed EVER Goes Unpunished

Share this post


Link to post
Share on other sites
I'm afraid that, if you're not using it, the change in code isn't going to help you any.

 

OK, I understand. If I install this module, are there other changes in the code besides the one for handling fee that have to be made? In other words, is your change for handling fee the only one I have to make? Other than putting in the correct CPost server address & cpc id?

FM

Share this post


Link to post
Share on other sites
OK, I understand. If I install this module, are there other changes in the code besides the one for handling fee that have to be made? In other words, is your change for handling fee the only one I have to make? Other than putting in the correct CPost server address & cpc id?

FM

 

No, that should be it, unless you want the files that put the extra fields in Easy Populate to accomodate the Canada Post with Dimension module.

 

It's a simple cut and paste operation

 

Richard


No Good Deed EVER Goes Unpunished

Share this post


Link to post
Share on other sites

Thanks for the reply. I was hoping to use the fix posted Feb/06 for handling fee, but I can't get it to work.

FMM

 

No, that should be it, unless you want the files that put the extra fields in Easy Populate to accomodate the Canada Post with Dimension module.

 

It's a simple cut and paste operation

 

Richard

Share this post


Link to post
Share on other sites
Thanks for the reply. I was hoping to use the fix posted Feb/06 for handling fee, but I can't get it to work.

FMM

 

Well you let me know what you want to do and then we'll go from there.


No Good Deed EVER Goes Unpunished

Share this post


Link to post
Share on other sites
Well you let me know what you want to do and then we'll go from there.

 

Thank you again.

 

I've installed the module with dimensions AND I still get no handling fee added to the cost of shipping.

 

FMM

Share this post


Link to post
Share on other sites
Thank you again.

 

I've installed the module with dimensions AND I still get no handling fee added to the cost of shipping.

 

FMM

 

Well, that's probably because the module doesn't contain the modification. I only modded my file because no one seemed interested in helping me do it, so, I'll assume that not too many people want to do it this way.

 

So, in \catalog\includes\modules\shipping\canadapost.php

 

find

 

$methods = array();
	for ($i=0; $i<sizeof($canadapostQuote); $i++) {
	  list($type, $cost) = each($canadapostQuote[$i]);

if ( $this->cp_oniline_handling == true) {
  if ( $method == '' || $method == $type ) {
		$methods[] = array('id' => $type,
						 'title' => $type,
				 'cost' => $cost + $this->handling_cp);
}
	} else {
  if ( $method == '' || $method == $type ) {
		$methods[] = array('id' => $type,
						 'title' => $type,
						'cost' => (SHIPPING_HANDLING + $cost));
		}
	}
}

 

and replace it with

 

$methods = array();
	for ($i=0; $i<sizeof($canadapostQuote); $i++) {
	  list($type, $cost) = each($canadapostQuote[$i]);

if ( $this->cp_oniline_handling == true) {
  if ( $method == '' || $method == $type ) {
		$methods[] = array('id' => $type,
						 'title' => $type,
				 'cost' => $cost + $this->handling_cp);
}
	} else {
  if ( $method == '' || $method == $type ) {
		$methods[] = array('id' => $type,
						 'title' => $type,
						'cost' => ((($cost*XX)/100) + $cost));
		}
	}
}

 

Now, you see near the very end where it says

 

'cost' => ((($cost*XX)/100) + $cost));

?

 

Replace the XX with a whole number (like 10, 20, 33, whatever) and the module will automatically add that percentage to the figures received from Canada Post and will display the shipping cost and handling charge combined.

 

If you compare the figures you get from Canada Post's site with what you get on your site, they will be different because the GST (and PST in the province you're in) for shipping isn't added until the checkout page.

 

It comes out correctly though.

 

Do NOT choose CPC handling or flat rate handling in the module setup, leave both blank as this is an inelegant, down and dirty mod.

 

To change the percentage, change the XX figure in the canadapost.php file.

 

Richard


No Good Deed EVER Goes Unpunished

Share this post


Link to post
Share on other sites

Thanks for the detailed answer; I made this change and there was a syntax error; I figured out it was missing a ')'; that eliminated the error. But I'm still not getting past the page that brings up the CP gif with error message that says, can't contact CP Server, refresh, etc; refresh repeats the error. The info in canadapost.php contains the correct server address & ID name; the CP module also conatins the correct info, so I'm buggered if I know what's happening.

 

I have another store running perfectly.

 

FMMacri

 

Well, that's probably because the module doesn't contain the modification. I only modded my file because no one seemed interested in helping me do it, so, I'll assume that not too many people want to do it this way.

 

So, in \catalog\includes\modules\shipping\canadapost.php

 

find

 

$methods = array();
	for ($i=0; $i<sizeof($canadapostQuote); $i++) {
	  list($type, $cost) = each($canadapostQuote[$i]);

if ( $this->cp_oniline_handling == true) {
  if ( $method == '' || $method == $type ) {
		$methods[] = array('id' => $type,
						 'title' => $type,
				 'cost' => $cost + $this->handling_cp);
}
	} else {
  if ( $method == '' || $method == $type ) {
		$methods[] = array('id' => $type,
						 'title' => $type,
						'cost' => (SHIPPING_HANDLING + $cost));
		}
	}
}

 

and replace it with

 

$methods = array();
	for ($i=0; $i<sizeof($canadapostQuote); $i++) {
	  list($type, $cost) = each($canadapostQuote[$i]);

if ( $this->cp_oniline_handling == true) {
  if ( $method == '' || $method == $type ) {
		$methods[] = array('id' => $type,
						 'title' => $type,
				 'cost' => $cost + $this->handling_cp);
}
	} else {
  if ( $method == '' || $method == $type ) {
		$methods[] = array('id' => $type,
						 'title' => $type,
						'cost' => ((($cost*XX)/100) + $cost));
		}
	}
}

 

Now, you see near the very end where it says

 

'cost' => ((($cost*XX)/100) + $cost));

?

 

Replace the XX with a whole number (like 10, 20, 33, whatever) and the module will automatically add that percentage to the figures received from Canada Post and will display the shipping cost and handling charge combined.

 

If you compare the figures you get from Canada Post's site with what you get on your site, they will be different because the GST (and PST in the province you're in) for shipping isn't added until the checkout page.

 

It comes out correctly though.

 

Do NOT choose CPC handling or flat rate handling in the module setup, leave both blank as this is an inelegant, down and dirty mod.

 

To change the percentage, change the XX figure in the canadapost.php file.

 

Richard

Share this post


Link to post
Share on other sites
Thanks for the detailed answer; I made this change and there was a syntax error; I figured out it was missing a ')'; that eliminated the error. But I'm still not getting past the page that brings up the CP gif with error message that says, can't contact CP Server, refresh, etc; refresh repeats the error. The info in canadapost.php contains the correct server address & ID name; the CP module also conatins the correct info, so I'm buggered if I know what's happening.

 

I have another store running perfectly.

 

FMMacri

 

Make sure that port 30000 is open on the server. You'll have to get the tech guys at your hosting company to check it and open it if need be.

 

Richard


No Good Deed EVER Goes Unpunished

Share this post


Link to post
Share on other sites
Make sure that port 30000 is open on the server. You'll have to get the tech guys at your hosting company to check it and open it if need be.

 

Richard

 

Once again, I have to thanks you. Yes, it was the port, which also taught me that you have to pay for a dedicated IP address & also for a SSL certificate. More learning curve ahead! I know zilch about SSL but I have to secure the payment process.

FMMacri

Share this post


Link to post
Share on other sites
Once again, I have to thanks you. Yes, it was the port, which also taught me that you have to pay for a dedicated IP address & also for a SSL certificate. More learning curve ahead! I know zilch about SSL but I have to secure the payment process.

FMMacri

 

Glad you got that worked out.

 

I was wondering why you have to pay for a dedicated IP address? There is no reason why you can't use a dynamic one for your store and you might want to check in your hosting control panel to see if you have access to a shared SSL.

 

Installing the SSL isn't that big of a deal, just a couple of changes to your catalog/includes/configure.php and catalog/admin/includes/configure.php. We can help you out with that, or you can search for info here on it, since it's been explained a number of times and I believe I've even seen a pinned tutorial thread on it around here somewhere.

 

Richard


No Good Deed EVER Goes Unpunished

Share this post


Link to post
Share on other sites

Well... Now I'm getting this error msg. when I insert a product (/includes/categories.php):

 

1054 - Unknown column 'products_weight_type' in 'field list'

 

insert into products (products_quantity, products_model, products_price, products_date_available, products_weight, products_weight_type, products_dim_type, products_length, products_height, products_width, products_ready_to_ship, products_status, products_tax_class_id, manufacturers_id, products_image, products_date_added) values ('1', '', '720', null, '6.6', 'lbs', 'in', '', '', '', '', '1', '0', '', 'mapson1.jpg', now())

 

[TEP STOP]

 

Can't find anything in categories.php that gives me a clue. Every have this error?

FMM

 

 

Glad you got that worked out.

 

I was wondering why you have to pay for a dedicated IP address? There is no reason why you can't use a dynamic one for your store and you might want to check in your hosting control panel to see if you have access to a shared SSL.

 

Installing the SSL isn't that big of a deal, just a couple of changes to your catalog/includes/configure.php and catalog/admin/includes/configure.php. We can help you out with that, or you can search for info here on it, since it's been explained a number of times and I believe I've even seen a pinned tutorial thread on it around here somewhere.

 

Richard

Share this post


Link to post
Share on other sites
Well... Now I'm getting this error msg. when I insert a product (/includes/categories.php):

 

1054 - Unknown column 'products_weight_type' in 'field list'

 

insert into products (products_quantity, products_model, products_price, products_date_available, products_weight, products_weight_type, products_dim_type, products_length, products_height, products_width, products_ready_to_ship, products_status, products_tax_class_id, manufacturers_id, products_image, products_date_added) values ('1', '', '720', null, '6.6', 'lbs', 'in', '', '', '', '', '1', '0', '', 'mapson1.jpg', now())

 

[TEP STOP]

 

Can't find anything in categories.php that gives me a clue. Every have this error?

FMM

 

Ok, when you installed CPwD, did you import the cpMS2.sql file, in the root of the package, into your data base? This file adds the size and weight type fields.

 

You're obviously using Easy Populate. Which version and did you add the additional fields that CPwD would need in it?


No Good Deed EVER Goes Unpunished

Share this post


Link to post
Share on other sites

Thanks for the reply.

No, I forgot to import the .sql file.

Easy Populate? Don't know it.

FMM

 

Ok, when you installed CPwD, did you import the cpMS2.sql file, in the root of the package, into your data base? This file adds the size and weight type fields.

 

You're obviously using Easy Populate. Which version and did you add the additional fields that CPwD would need in it?

Share this post


Link to post
Share on other sites

I imported the .sql file, but I don't get the weight, dimensions etc when I put into another product.

 

Thanks for the reply.

No, I forgot to import the .sql file.

Easy Populate? Don't know it.

FMM

Share this post


Link to post
Share on other sites

This is a mystery. Before I imported .sql and uploaded the files for 3.7, I got weight choice, dimensions etc new products when I added product. Now, I import .sql and that's all disappeared.

F

 

I imported the .sql file, but I don't get the weight, dimensions etc when I put into another product.

Share this post


Link to post
Share on other sites
This is a mystery. Before I imported .sql and uploaded the files for 3.7, I got weight choice, dimensions etc new products when I added product. Now, I import .sql and that's all disappeared.

F

 

 

Ok, there are two sql files there, one which installs the fields and one which uninstalls them


No Good Deed EVER Goes Unpunished

Share this post


Link to post
Share on other sites
I'm using the bug fix to canadapost.php that was posted Feb05/06. I'm ignorant of this scripting language and don't know how to enter values so that the handling fee is added at checkout in my store. Any help will be appreciated. Thanks

FMMacri'

Toronto

I know you've switched to "with dimensions" one now, but I have an answer for anyone looking for the solution for the other module that you were using, I also have been pulling my hair out, but I figured it out. http://www.oscommerce.com/community/contri...rch,canada+post

Download the file titled "Tax Class Added" dated May 5 2006 (it also contains the earlier bug fixes).

Find code

'cost' => (SHIPPING_HANDLING + $cost) * $shipping_num_boxes);

and replace SHIPPING_HANDLING with the extra amount that you would like to charge ie 3.5 for $3.50 cents

'cost' => (3.5 + $cost) * $shipping_num_boxes);

And upload the file to includes/modules/shipping/ folder

Hope this helps someone :)

Share this post


Link to post
Share on other sites
Ok, there are two sql files there, one which installs the fields and one which uninstalls them

 

Thanks, I'll check it out.

FM

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×