Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Relatively easy problem with shipping module


user001

Recommended Posts

Posted

Hi,

 

I have this one small problem with shipping modules, the ones where i can give the weight and price (like 1:x,2:x3:x etc.)

 

How could i get it to go like this -> 1:n/a,2:x,3:x etc.. so that it would not print a price of 0.00 on catalog side, but that text n/a?

 

any help is appreciated!!

 

VB

Posted

What, in this context, does n/a mean? Free shipping? You don't want to change this in the table rates module, as you want it to return a numeric value. But you could fudge checkout_shipping.php to display something else when the cost is zero.

Posted

n/a stands for that this shipping method isnt available, if i could it to show just that one module that is, would be great, but dont think there is such contribution that would do that.

 

Fudging checkout_shipping.php would do it aswell, any pointers of how do i make teh code to check if the value is zero, and if it is, print out text n/a would be greatly appreciated! :D

 

This is how far i got it:

 

if <insert somekind of funny variables in here>

echo "n/a"

else "$price"

 

Now as you see, my php skills are outstanding, but could still use a little help from the real programmers! :thumbsup:

 

 

 

What, in this context, does n/a mean?  Free shipping?  You don't want to change this in the table rates module, as you want it to return a numeric value.  But you could fudge checkout_shipping.php to display something else when the cost is zero.

Posted

Ok, I understand. That's not how to do it. What I think you want is for the table method to not be shown if the weight is under 2. Here's how to do it.

 

In includes/modules/shipping/table.php, function table, add $shipping_weight to the list of globals (after $order). Then after this code:

          } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
           $check_flag = true;
           break;
         }

add

          elseif ($shipping_weight < 2.0) {
            $check_flag = true;
            break;
         }

I think that will do it. Try it and see.

Posted

Yes, this was exactly what i was looking for :)

 

I added this code, but it still shows that shipping method, even when weight is under 2.0, i wonder should there be somekind of query to database to get the product_weight?

 

i found this from the table.php:

 

$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_TABLE_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");

 

Aaaand this is how far i got it: :D

 

$check_query = tep_db_query("select products_weight from " . TABLE_PRODUCTS . " where products_id = '" . MODULE_SHIPPING_TABLE_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");

 

and as you can see it certainly wont work, im kinda lost of how can i complete this query, since i dont know what variables should i pull to get the products_id...

 

But then again, im not even sure does the weight needs to be queryed, or is it already passed by in some other way...?

 

Help still needed! i need the coder superhero with the cape! :)

 

 

 

Ok, I understand.  That's not how to do it.  What I think you want is for the table method to not be shown if the weight is under 2.  Here's how to do it.

 

In includes/modules/shipping/table.php, function table, add $shipping_weight to the list of globals (after $order).  Then after this code:

 ? ? ? ? ?} elseif ($check['zone_id'] == $order->delivery['zone_id']) {
? ? ? ? ? ?$check_flag = true;
? ? ? ? ? ?break;
? ? ? ? ?}

add

 ? ? ? ? ?elseif ($shipping_weight < 2.0) {
? ? ? ? ? ? $check_flag = true;
? ? ? ? ? ? break;
? ? ? ? ?}

I think that will do it.  Try it and see.

Posted

My earlier suggestion doesn't work because the total shipping weight isn't calculated that soon. This works (I tested it).

 

In table.php, function quote, after the line:

      global $order, $cart, $shipping_weight, $shipping_num_boxes;

add this:

      if ($shipping_weight < 2.0) {
       $this->quotes = null;
       return $this->quotes;
       }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...