News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Canada Post Module breaks site

Started by GooRu, May 06, 2010, 19:13:48 PM

Previous topic - Next topic

GooRu

In Virtuemart when I activate the Canada Post module and advance through the checkout screen to the choose a shipper screen, the site breaks like this:

The right hand menus slip into the content area, and bottom positions all shift hard left. The Canada Post module still works if you scroll down far enough to find it. Everything else on site continues to work so I'm thinking it may be a CSS issue?
??? ???

Discovered that the module cannot stand alone and needs the Standard shipping module published with at least one rate defined...who knew??
Joomla Web Development, Hosting and site management

GooRu

Jason...

I have not been able to figure what and or why we need to have the standard shipping module present. All I know so far is that it makes everything else work. I do know though that having the standard there, is a good thing, in that if the CP servers are down, the user can still choose a shipping option.

Keep me posted anyways!

Curt
Joomla Web Development, Hosting and site management

jbavington

Hi Curt,

Well, I'm happy to report that the Canada Post module is now co-existing quite nicely on my site.  Here's what I did:

1.  Using a Canpar shipping module as well, which I had custom developed (and now free for use for all) for two other clients.  You can grab it here:  http://forum.virtuemart.net/index.php?topic=70560.0

2a.  Created a new Shipper, in VM's Shipping section, and just gave it a name.  This is the only Shipper I have.

2b.  Created a new Shipping Rate, for this Shipper, with all Countries selected, a zip range of 00000 to 99999, weight of 0.001 to 100 and fees of 0.  This ensures that the Standard Shipping Module will get triggered, no matter the Shipping Address.  Also made sure that Standard Shipping was checked in VM's Admin > Config > Shipping section

3.  Modified /administrator/components/com_virtuemart/classes/shipping/standard_shipping.php and removed the html it generates (so no shipper, shipping rate, or radio button appear).  I kept the table structure, though.

4.  Modified /administrator/components/com_virtuemart/classes/shipping/canada_post.php to remove the table headings and also the descriptions that appear under the table.

5.  Set up a Merchant ID account with CPC, then went in to the CPC Shipping Profile website and chose shipping methods and set up boxes (which I understand is very important)

6.  Added Canpar and Canada Post logos.

7.  Went out and treated myself to some ice cream on this 40C day.

See the attached screen cap for how the shipping methods are displayed (chose a Canadian address and client is shipping from Canada).

Now the last thing is to figure out why CPC is returning an ETA of "Thursday January 01, 1970" for one of the Int'l shipping options...

Hope this info. is useful!

Jason


[attachment cleanup by admin]

lori_oreo

Thank you thank you thank you,  jbavington!!


Your reply solved my problem!

I wasn't able to take out the new shipper, as I couldn't figure out php if my life depended on it, but we wanted to offer local delivery and pickup anyway, so it worked out fine.

The only question I have now, is how did you add the logos? Is that in the PHP somewhere?  How do I know where to put them?

Thanks!

jbavington

Hi there,

You'll have to dive into the php to add in the logos...

1.  Canada Post:

Edit this file:  /administrator/components/com_virtuemart/classes/shipping/canadapost.php

Around line 215, enter the following:

<table width="100%"><tr><td colspan=4><img style="margin-bottom:10px;" src="https://YOUR_SITE_URL/images/canada_post.jpg" alt="Canada Post"></td></tr></table>

above these lines:

      <?php
        foreach( $this->shipping_methods as $m ){


Replace "YOUR_SITE_URL" with your store's web address.  I put the logo in the /images folder.


2. Canpar Logo

Edit this file:  /administrator/components/com_virtuemart/classes/shipping/canpar.php

You'll need to place the image in several sections in this one, to account for the various possible error messages the Canpar shipping module produces.

From lines 161-185, you'll see several commented areas.  In the middle of each section, you'll see text such as "Sorry, Canpar only ships to", etc etc.

Place this code:  <img style=\"margin-bottom:10px;\" src=\"https://YOUR_SITE_URL/images/canpar.jpg\" alt=\"Canpar\"><br />

right before the beginning of each "Sorry" text, so for example, line 165 becomes:

$vmLogger->notice("<img style=\"margin-bottom:10px;\" src=\"https://YOUR_SITE_URL/images/canpar.jpg\" alt=\"Canpar\"><br />Sorry, CanPar only ships to Canada and the US.<br />Please select a Canada Post international shipping method, below.");

Watch the quotation marks and again replace "YOUR_SITE_URL" with your site's store address.  Again I placed the Canpar logo in the /images folder and that's reflected in the code.

FINALLY, lines 193-194 (working with both for simplicity)

Replace with:

      $html .= "<img style=\"margin-bottom:10px;\" src=\"https://YOUR_SITE_URL/images/canpar.jpg\" alt=\"Canpar\"><br /";
      foreach($final_rates as $service => $data){


That should be it.  Be sure to make backups of your Canada Post / Canpar php files before diving in.

LOGOS ATTACHED!

Jason


[attachment cleanup by admin]