Page 1 of 3 123 LastLast
Results 1 to 10 of 24
  1. #1
    Join Date
    Jan 2009
    Posts
    2
    Plugin Contributions
    0

    help question problem adding script for module shipping

    morning everyone.
    i'm newbie in zen cart. want to start my first online store.

    i've problem here.
    i want to add shipping module that connect to shipping rates in another page.
    the script for module is like general modul (this case is perweight unit). but in function quote, i add script for database connection. this script cause my checkout shipping blank.

    the script is like this (the problem is in italic):

    function quote($method = '') {
    global $order, $cart, $total_count, $shipping_weight_x, $shipping_num_boxes_x, $shipping_count_x;

    if ( zen_not_null($method) && (isset($this->types[$method])) ) {
    $this->_setService($method);
    }

    $customer_city_rate_query = $db->Execute("select city, rate1, rate2, types from " .TABLE_KURIRTIKI." where city = '" . $order->delivery['city'] . "'");
    if(zen_db_num_rows($customer_city_rate_query) > 0 ){
    $total_count = $shipping_count_x[1];
    if ($cart->weight > 0) {
    $total_weight_units = ceil($cart->weight / 1);
    } else {
    $total_weight_units = ceil(1 );
    }
    $methods = array();
    $this->quotes = array('id' => $this->code,
    'module' => $this->title . 'Shipping to : ' . $order->delivery['city'] . ', Weight : ' . $total_weight_units);
    if (isset($this->service)) {
    $this->types = array($this->service => $this->types[$this->service]);
    }
    while(!$customer_city_rate->EOF) {
    $city_ship_rate = $customer_city_rate->fields['rate1'];
    $city_ship_rate2 = $customer_city_rate->fields['rate2'];

    if ($total_weight > 1) {
    $total_cost = $city_ship_rate + (($total_weight - 1) * $city_ship_rate2);
    } else { $total_cost = 1 * $city_ship_rate; }

    $methods[] = array('id' => $customer_city_rate->fields['types'] ,
    'title' => $this->types[$customer_city_rate->fields['types']] , 'cost' => $total_cost );
    }
    $this->quotes['methods'] = $methods;
    if ($this->tax_class > 0) {
    $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
    }

    } else {
    $this->quotes = array('id' => $this->code,
    'error' => MODULE_SHIPPING_KURIRTIKI_TEXT_ERROR);
    }

    if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
    return $this->quotes;
    }


    can u help me ?
    note:
    i'm using v 1.3.8

    regards

  2. #2
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: problem adding script for module shipping

    Quote Originally Posted by baqrie View Post
    i want to add shipping module that connect to shipping rates in another page.
    the script for module is like general modul (this case is perweight unit). but in function quote, i add script for database connection. this script cause my checkout shipping blank.
    Almost any error in the script will cause a blank page, which does tend to make faultfinding difficult.

    Assuming the problem is caused by the database connection, I'd hazzard a guess and suggest this line is causing the problem.

    -----------------------------------------------------------------
    customer_city_rate_query = $db->Execute("select city, rate1, rate2, types from " .TABLE_KURIRTIKI." where city = '" . $order->delivery['city'] . "'");
    ---------------------------------------------------------

    I can't actually see anything wrong with it, but for some reason or another (probably for debugging) most of my code has this split into two commands. eg:

    $myquery="select city, rate1, rate2, types from " .TABLE_KURIRTIKI." where city = '" . $order->delivery['city'] . "'");

    $customer_city_rate_query = $db->Execute($myquery) ;

    ----

    If nothing else, it'll help you isolate the problem (assuming this is the error line) by letting you echo exactly what data is being sent to the $db.

    Oh, another common cause of blank pages is from having extra (blank) lines at the end of the file.

    Cheers
    Rod

  3. #3
    Join Date
    Jan 2009
    Posts
    2
    Plugin Contributions
    0

    Default Re: problem adding script for module shipping

    thanks RodG.

    i've found the mistake for this script.

    in this function :

    function quote($method = '') {
    global $order, $cart, $total_count, $shipping_weight_x, $shipping_num_boxes_x, $shipping_count_x;


    it should be add $db.
    function quote($method = '') {
    global $order, $cart, $total_count, $shipping_weight_x, $shipping_num_boxes_x, $shipping_count_x, $db;


    this problem have solved, BUT there is another problem for this same module. maybe you or anyone can help me for my new problem??

    i've add the module in attachment.

    the global problem is:
    - the radio button is OK, but when i choose number 2 or after, the page didn't move to payment but still shipping page and the text in radio button have gone

    - i just try to solve this problem by change includes\modules\shipping\kurirtiki.php
    in line 129

    'title' => $this->types[$tiki_rate->fields['types']] ,

    to

    'title' => $this-> $tiki_rate->fields['types'] ,

    - the first problem handled (when i choose number 2 or after i can move to payment page), BUT the shipping price is always set to number 1.

    i can't solve this new problem and this make me insane
    maybe you or anyone could solve it? help...
    Attached Files Attached Files

  4. #4
    Join Date
    Aug 2008
    Location
    Jakarta
    Posts
    4
    Plugin Contributions
    1

    Default Re: problem adding script for module shipping

    Quote Originally Posted by baqrie View Post

    - i just try to solve this problem by change includes\modules\shipping\kurirtiki.php
    in line 129

    'title' => $this->types[$tiki_rate->fields['types']] ,

    to

    'title' => $this-> $tiki_rate->fields['types'] ,

    - the first problem handled (when i choose number 2 or after i can move to payment page), BUT the shipping price is always set to number 1.

    i can't solve this new problem and this make me insane
    maybe you or anyone could solve it? help...
    halo baqrie,
    i had download your module from this link :
    http://www.zen-cart.com/index.php?ma...oducts_id=1252

    and i modify it for my TIKI JNE shipping service.
    thank you for your effort to create this module.

    i'm facing the same problem and then i try to solve the problem by tracing your scripts.
    the blank beside radio button because of the $SESSION['shipping'] not loaded successfully and the checkout_shipping just take the first index in array of shipping method. here are some modifications :

    1. in includes/modules/shipping/kurirtiki.php :
      - not needed to change line 129
    2. in includes/modules/pages/checkout_shipping/header_php.php :
      - insert the script at line 147 (before if (isset($quote['error']))) :
      PHP Code:
                  $arr_id = array();
                for (
      $i=0$i sizeof($quote[0]['methods']); $i++) {
                  
      $arr_id[$i] = $quote[0]['methods'][$i]['id'];
                }
                
      $key array_search($method$arr_id); 
      the script is to get the index of the user choice.

      - change line 150 :
      PHP Code:
      if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
                    
      $_SESSION['shipping'] = array('id' => $_SESSION['shipping'],
                                      
      'title' => (($free_shipping == true) ?  $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' $quote[0]['methods'][0]['title'] . ')'),
                                      
      'cost' => $quote[0]['methods'][0]['cost']); 
      with this :
      PHP Code:
      if ($key !== FALSE) {
                    
      $_SESSION['shipping'] = array('id' => $_SESSION['shipping'],
                                      
      'title' => (($free_shipping == true) ?  $quote[0]['methods'][$key]['title'] : $quote[0]['module'] . ' (' $quote[0]['methods'][$key]['title'] . ')'),
                                      
      'cost' => $quote[0]['methods'][$key]['cost']); 
      the script is to get the title and cost of user choice (not just the first index in array but search the index in array and return the title and cost)


    after this modification, this shipping module working fine.

    i hope this help you.

    cmiiw.

    salam,

    siyam junianto

  5. #5
    Join Date
    Dec 2008
    Posts
    1
    Plugin Contributions
    0

    Default Re: problem adding script for module shipping

    so is there anyone kind enough re upload the fixed version? so a n00b like me can avoid mistakes :)

    Greetz
    Aggy

  6. #6
    Join Date
    Aug 2009
    Posts
    2
    Plugin Contributions
    0

    Default Re: problem adding script for module shipping

    yes.. i also need the TIKI shipping module.. since i have no knowledge about making shipping modules..

  7. #7
    Join Date
    Aug 2009
    Posts
    2
    Plugin Contributions
    0

    Default Re: problem adding script for module shipping

    after i instlal the shipping module and also modify it based on sjunianto's advise i have something strange in my cart. Each time the user order, the weight is always 4, can u give me solution for that ? btw, im indonesian too mas :)

  8. #8
    Join Date
    Aug 2009
    Posts
    25
    Plugin Contributions
    0

    Default Re: problem adding script for module shipping

    This shipping module is very important to Indonesian online shop. I would donate $100 to someone could finish this module perfectly. Please PM me for details.

  9. #9
    Join Date
    Aug 2008
    Location
    Jakarta
    Posts
    4
    Plugin Contributions
    1

    Default Re: problem adding script for module shipping

    hi all,
    it's a long time i'm not opening this zen-cart forum. the revision module attached with this post.

    the module has been uploaded to zen-cart add-on as a new contribution and still waiting review from zen cart team.

    hope this module will help you.


    regards,

    siyam junianto
    Attached Files Attached Files

  10. #10
    Join Date
    May 2010
    Posts
    1
    Plugin Contributions
    0

    Default Re: problem adding script for module shipping

    how to do this :

    3. Run the SQL statement included with the package. don't forget to change the prefix. notice that sql file have a large size (> 1 MB).



    and

    what to do whit this file :

    zen_kurirtikijne_insert1


    thanks

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Problem adding WorldPay module
    By vidmarc in forum Addon Payment Modules
    Replies: 0
    Last Post: 20 Mar 2013, 02:46 PM
  2. v150 built in Shipping Module not adding shipping to total
    By jeffreydesign in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 3 Jul 2012, 02:15 PM
  3. Problem adding any payment module
    By andret in forum Addon Payment Modules
    Replies: 1
    Last Post: 2 May 2011, 10:21 PM
  4. Replies: 3
    Last Post: 13 Jul 2009, 05:19 AM
  5. Adding Canada to UPS Shipping Module problem
    By Mickmo68 in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 10 Jun 2009, 03:53 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR