+ Reply to Thread
Results 1 to 2 of 2

Thread: Question on Methods

  1. #1
    Client
    Join Date
    Nov 2006
    Location
    Illinois
    Posts
    193
    Squirrelcart version
    v3.3.4

    Question on Methods

    OK so I think I am having a dumb moment, I recently added USPS to my cart after a few customer requests, but it shows up first, I would like it to be last but do not see any sort order anywhere,

    I would like to put my custom Economy first as its the cheapest choice, followed by FedEx then USPS can someone explain how to do this, as i spent about 30mins trying to figure this thing out.

  2. #2
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,829
    Squirrelcart version
    v3.3.7
    We don't have a feature to do this unfortunately. You can do it by modifying the checkout_ship.tpl.php template file. For info on working with template files, see here:
    http://www.squirrelcart.com/help/?Mo...Templates.html

    To do this:
    1. In your custom theme copy of checkout_ship.tpl.php, locate this code:
    PHP Code:
    <?php foreach($Couriers as $Courier): ?>
    2. Before that line, add this:
    PHP Code:
            <?php
            
    // the order you want, via Shipping_Couriers.record_number
            
    $order = array(2,1);
            
            
    // create an array of couriers, indexed by record_number
            
    $couriers_by_rn = array();
            foreach(
    $Couriers as $Courier$couriers_by_rn[$Courier['record_number']] = $Courier;

            
    // create an array of those couriers in the order specified
            
    $couriers_ordered = array();
            foreach(
    $order as $rn) {
                if (!empty(
    $couriers_by_rn[$rn])) {
                    
    $couriers_ordered[$rn] = $couriers_by_rn[$rn];
                    unset(
    $couriers_by_rn[$rn]);
                }
            }

            
    // if any couriers are left that weren't in $order, add them to the end
            
    if (!empty($couriers_by_rn)) $couriers_ordered array_merge($couriers_ordered$couriers_by_rn);

            
    // put them back where they belong
            
    $Couriers $couriers_ordered;
            
    ?>
    3. Change the numbers in this line to represent the Shipping Courier record numbers in the order you want them to appear:

    $order = array(2,1);

    You can leave out ones you don't care about.

    4. Save the file

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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