Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    May 2005
    Location
    Bath, Somerset
    Posts
    1,053
    Plugin Contributions
    3

    Default Re: Own Shipping Module not working

    Can you post the first bit mof your code? What do you have $this->code = set to at around line 30. Also, what is your file and class called?

    Absolute

  2. #2
    Join Date
    Jun 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: Own Shipping Module not working

    Thanks,
    all constants declared in:
    \shop\includes\languages\english\modules\shipping\mycourier.php

    created mycourier.php in:
    \shop\includes\modules\shipping

    changed the class name to mycourier

    I created a function:
    function do_calc($shipping_num_boxes, $total_weight){
    //my code here
    return 123; //for now just return a shipping cost of $123.00
    }

    I changed function quote to be:
    function quote($method = '') {
    global $order,$cart, $shipping_weight, $shipping_num_boxes, $total_weight;

    //DO CALCULATION HERE
    $mycalc = $this->do_calc($shipping_num_boxes, $total_weight);

    $this->quotes = array('id' => $this->code,
    'module' => MODULE_SHIPPING_MYCOURIER_TEXT_TITLE,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_MYCOURIER_TEXT_WAY,
    'cost' => $mycalc)));

    ....rest of store pickup

    The code in do_calc() is working okay as the correct amount gets put in the order, but I cant get to the payment in my module, only in built in store pickup module.

    Thanks for the help

  3. #3
    Join Date
    May 2005
    Location
    Bath, Somerset
    Posts
    1,053
    Plugin Contributions
    3

    Default Re: Own Shipping Module not working

    That all looks fine.

    The only other thing is, you should havbe something like
    Code:
    class mycourier extends base {
    
      function mycourier() {
        this->code = ...........
    Can you post his bit of code? this->code should equal the name of your shipping module, exactly as the filename appears. Is this included in your code?

    Absolute

  4. #4
    Join Date
    Jun 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: Own Shipping Module not working

    Thanks Again:
    This is copied straight from the StorePickup shipping module except I have changed the constants, and the part in red, is that what you are refering to and where you think it is going wrong. I dont understand it, I thought it was just a description.

    function mycourier() {
    global $order, $db;

    $this->code = 'MYCOURIER';
    $this->title = MODULE_SHIPPING_MYCOURIER_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_MYCOURIER_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_MYCOURIER_SORT_ORDER;
    $this->icon = '';
    $this->tax_class = MODULE_SHIPPING_MYCOURIER_TAX_CLASS;
    $this->tax_basis = MODULE_SHIPPING_ITEM_MYCOURIER_BASIS;
    $this->enabled = ((MODULE_SHIPPING_MYCOURIER_STATUS == 'True') ? true : false);

    if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_MYCOURIER_ZONE > 0) ) {
    $check_flag = false;
    $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . "
    where geo_zone_id = '" . MODULE_SHIPPING_MYCOURIER_ZONE . "'
    and zone_country_id = '" . $order->delivery['country']['id'] . "'
    order by zone_id");
    while (!$check->EOF) {
    if ($check->fields['zone_id'] < 1) {
    $check_flag = true;
    break;
    } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
    $check_flag = true;
    break;
    }
    $check->MoveNext();
    }

    if ($check_flag == false) {
    $this->enabled = false;
    }
    }
    }

    Thanks

  5. #5
    Join Date
    May 2005
    Location
    Bath, Somerset
    Posts
    1,053
    Plugin Contributions
    3

    Default Re: Own Shipping Module not working

    this->code is used to name the choosen shipping module. So if you have a shipping module, and the file is called "mycourier.php", and $this->code equals "MYCOURIER", then the class won't be found. You need to change this->code to lower case, to match the class name. So the line should read:
    Code:
    $this->code = 'mycourier';
    This should fix your little bug. If not, let me know.

    Absolute

  6. #6
    Join Date
    Jun 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: Own Shipping Module not working

    Woohoo,
    thanks heaps,
    working now.

    what a big problem, for such a small thing.

    Thanks

 

 

Similar Threads

  1. USPS Shipping Module Not Working
    By gtmercier in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 21 Apr 2010, 08:05 PM
  2. No Shipping Estimate Quote -- writing my own shipping module
    By Relentless in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 20 Sep 2008, 04:11 AM
  3. Help! Shipping Module not Working
    By xmisspurrfect in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 20 Nov 2007, 05:41 AM
  4. Shipping module not working
    By Nanettedp in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 12 Nov 2007, 09:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg