Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Bulk Weight Change


eagleg

Recommended Posts

Posted

I need to change the product weight for every item in my store, They all weigh the same.Is there any method by which I can do bulk amendments? Ex - all products weigh .45 pounds!

Posted

You need to write some sql along the lines of

 

update product set weight=1.25

 

For more info on sql see www.w3schools.com.

 

Enjoy

 

G

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Posted

Hi Geoffrey

 

I'm back again :lol: Searching techniques not quite mastered yet but I did find your post. I looked at W3school site & went through sql notes, but when I got to the try section I coudn't get it to work, so i haven't understood how to do this?

 

Any chance of some help please :)

 

I too need to change all my current products on the database to weight 1 ie not 0 for virtual products.

 

In MySql the products table has products_weight. The sql tab already has this line in:

 

SELECT * FROM `products` WHERE 1

 

Does this need to be there or do I copy over it?

 

This page suggests

 

UPDATE Persons

SET Address='Nissestien 67', City='Sandnes'

 

so would it be

 

UPDATE products

SET products_weight='1'

 

When I tried a similar one in the test section it said not updateable (searching this confused me more!)

Posted

Hi Geoffrey

 

I'm back again :lol: Searching techniques not quite mastered yet but I did find your post. I looked at W3school site & went through sql notes, but when I got to the try section I coudn't get it to work, so i haven't understood how to do this?

 

Any chance of some help please :)

 

I too need to change all my current products on the database to weight 1 ie not 0 for virtual products.

 

In MySql the products table has products_weight. The sql tab already has this line in:

 

SELECT * FROM `products` WHERE 1

 

Does this need to be there or do I copy over it?

 

This page suggests

 

UPDATE Persons

SET Address='Nissestien 67', City='Sandnes'

 

so would it be

 

UPDATE products

SET products_weight='1'

 

When I tried a similar one in the test section it said not updateable (searching this confused me more!)

Julie,

 

I bookmarked this page a couple of years ago:

Change weight SQL

 

Tim

Posted

 

so would it be

 

UPDATE products

SET products_weight='1'

 

 

If that doesn't work try adding a trailing semicolon (not sure if it's necessary or not since I just habitually add them):

 

UPDATE products SET products_weight='1';

 

Did you see my reply about modifying the order_total price on the SDS topic? Just curious whether it worked.

 

.. Ah, I see someone popped in ahead of me. You were on the right track anyway!

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Posted

:) Yes thanks Richard. I thought I'd better change all my physical products from 0 to 1 first or I couldn't tell if worked. Then I could add virtual ones & test.

 

Will be back to report :)

Posted

Just to slow to reply again :-)

 

Glad you are sorted.

 

G

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Posted

Hi Geoffrey :)

 

OK I'm not sure where to put this now as I don't want to get Richard in trouble for posting back to the SDS thread. :(

 

I tried your code in includes/modules/shipping/table.php but it doesn't appear to be ignoring the 0.00 weight items in my mixed basket?

 

Change this

 $order_total = $cart->show_total();

 

for this

         $order_total = 0; 
         for($i=0, $j=count($order->products); $i<$j; $i++) { 
               if( $order->products[$i]['weight']>0 ) {                        
                      $order_total=$order->products[$i]['final_price']+$order_total;                
           } 
      }

 

I looked at the item.php code but I just can't understand what it is saying! :lol:

 

In your catalog\includes\modules\shipping\item.php locate this code

 

function quote($method = '') {
         global $order, $total_count;

         $this->quotes = array('id' => $this->code,
                                                       'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
                                                       'methods' => array(array('id' => $this->code,
                                                       'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
                                                       'cost' => (MODULE_SHIPPING_ITEM_COST * $total_count) + MODULE_SHIPPING_ITEM_HANDLING)));

 

function quote($method = '') {
         global $order, $total_count;

         $weight_items = 0;
         for($i=0, $j=count($order->products); $i<$j; $i++) {
               if( $order->products[$i]['weight'] > 0 ) {
                 $weight_items++;
               }
         }

         $this->quotes = array('id' => $this->code,
                                                       'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
                                                       'methods' => array(array('id' => $this->code,
                                                       'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
                                                       'cost' => (MODULE_SHIPPING_ITEM_COST * $weight_items) + MODULE_SHIPPING_ITEM_HANDLING)));

 

Any suggestions :) please? :) Thanks :)

Posted

Julie, the first code is what I suggested for the table.php file to modify the total price figure used by table.php when calculating shipping costs based on product price. It should appear below the If statement which prepares the shipping quote based on the total price of the basket contents. I didn't know if it would work or not. If that doesn't work something like it should, it is just a matter of using weight to identify the non-downloadables, calcuting the price of the basket contents of those non-downloadables, and setting the $order_total variable to that figure before the shipping quote looks at the table of shipping prices.

 

Item.php only deals with per item charging and any changes won't have any effect if the module is not enabled or chosen by the customer. That code should work to prevent downloadables with a zero weight being used in the shipping cost calculation.

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Posted

This is my table.php Have I done it right please? You have understood what I am trying to achieve so I'm thinking I may have either made a mistake with your code (I didn't try the other just noticed it was written differently) or I have something other than SDS affecting it :( (can't think what though?)

 

<?php
/*
 $Id: table.php,v 1.27 2003/02/05 22:41:52 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class table {
   var $code, $title, $description, $icon, $enabled;

// class constructor
   function table() {
     global $order;

     $this->code = 'table';
     $this->title = MODULE_SHIPPING_TABLE_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_TABLE_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_TABLE_SORT_ORDER;
     $this->icon = '';
     $this->tax_class = MODULE_SHIPPING_TABLE_TAX_CLASS;
     $this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);

     if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_TABLE_ZONE > 0) ) {
       $check_flag = false;
       $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");
       while ($check = tep_db_fetch_array($check_query)) {
         if ($check['zone_id'] < 1) {
           $check_flag = true;
           break;
         } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
           $check_flag = true;
           break;
         }
       }

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

// class methods
   function quote($method = '') {
     global $order, $cart, $shipping_weight, $shipping_num_boxes;

     if (MODULE_SHIPPING_TABLE_MODE == 'price') {
        $order_total = 0; 
         for($i=0, $j=count($order->products); $i<$j; $i++) { 
               if( $order->products[$i]['weight']>0 ) {                        
                      $order_total=$order->products[$i]['final_price']+$order_total;                
           } 
      }

     } else {
       $order_total = $shipping_weight;
     }

     $table_cost = split("[:,]" , MODULE_SHIPPING_TABLE_COST);
     $size = sizeof($table_cost);
     for ($i=0, $n=$size; $i<$n; $i+=2) {
       if ($order_total <= $table_cost[$i]) {
         $shipping = $table_cost[$i+1];
         break;
       }
     }

     if (MODULE_SHIPPING_TABLE_MODE == 'weight') {
       $shipping = $shipping * $shipping_num_boxes;
     }

     $this->quotes = array('id' => $this->code,
                           'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE,
                           'methods' => array(array('id' => $this->code,
                                                    'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,
                                                    'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)));

     if ($this->tax_class > 0) {
       $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }

     if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);

     return $this->quotes;
   }

   function check() {
     if (!isset($this->_check)) {
       $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_TABLE_STATUS'");
       $this->_check = tep_db_num_rows($check_query);
     }
     return $this->_check;
   }

   function install() {
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Table Method', 'MODULE_SHIPPING_TABLE_STATUS', 'True', 'Do you want to offer table rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Table', 'MODULE_SHIPPING_TABLE_COST', '25:8.50,50:5.50,10000:0.00', 'The shipping cost is based on the total cost or weight of items. Example: 25:8.50,50:5.50,etc.. Up to 25 charge 8.50, from there to 50 charge 5.50, etc', '6', '0', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Table Method', 'MODULE_SHIPPING_TABLE_MODE', 'weight', 'The shipping cost is based on the order total or the total weight of the items ordered.', '6', '0', 'tep_cfg_select_option(array(\'weight\', \'price\'), ', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_TABLE_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_TABLE_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_TABLE_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_TABLE_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
   }

   function remove() {
     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }

   function keys() {
     return array('MODULE_SHIPPING_TABLE_STATUS', 'MODULE_SHIPPING_TABLE_COST', 'MODULE_SHIPPING_TABLE_MODE', 'MODULE_SHIPPING_TABLE_HANDLING', 'MODULE_SHIPPING_TABLE_TAX_CLASS', 'MODULE_SHIPPING_TABLE_ZONE', 'MODULE_SHIPPING_TABLE_SORT_ORDER');
   }
 }
?>

Posted

Hi Julie, no you've entered it correctly. If it's executing without producing php errors then it must not be affecting the shipping cost calculation in the way I would expect and something else must be affecting it. It would be interesting to be able to verify first of all whether the correct figure for $order_value is being set. You could try commenting out (with a couple of //) the line

 

'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)));

 

and changing it temporarily to

 

'cost' => $order_total)));

 

just to see what figure is being produced for $order_total and compare it to what you expect. It won't give you the right shipping price, but $order_total should be the price of the non-downloadables in the basket - hopefully. This is just a bit of fumbling around really to try to work towards a solution...

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Posted

Hi Julie, no you've entered it correctly. If it's executing without producing php errors then it must not be affecting the shipping cost calculation in the way I would expect and something else must be affecting it. It would be interesting to be able to verify first of all whether the correct figure for $order_value is being set. You could try commenting out (with a couple of //) the line

 

'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)));

 

and changing it temporarily to

 

'cost' => $order_total)));

 

just to see what figure is being produced for $order_total and compare it to what you expect. It won't give you the right shipping price, but $order_total should be the price of the non-downloadables in the basket - hopefully. This is just a bit of fumbling around really to try to work towards a solution...

Oh I didn't think it was making any difference ... until I went to checkout & the P&P was the total of the physical products (virtual products cost wasn't added to the P&P cost showing) Does that make sence.

Back to original now as a customer is online & would have kittens at that P&P cost :lol:

 

Just remember I have changed the includes/boxes/shopping_cart.php to show "spend another £xx to get free P&P etc" and shopping cart box enhancement. This shouldn't affect things??

 

Thanks for your help.

Posted

Oh I didn't think it was making any difference ... until I went to checkout & the P&P was the total of the physical products (virtual products cost wasn't added to the P&P cost showing) Does that make sence.

Back to original now as a customer is online & would have kittens at that P&P cost :lol:

 

Just remember I have changed the includes/boxes/shopping_cart.php to show "spend another £xx to get free P&P etc" and shopping cart box enhancement. This shouldn't affect things??

 

Thanks for your help.

 

It sounds as though the mod does work then, at least so far as excluding the price of any downloadables in calculating shipping is concerned. So far as telling the client they have to spend another £xx to get free shipping, that confuses me a bit. Are you saying that there is a band for free shipping, ie below the minimum it's not free and above the maximum (£30?) it's also not free? Or is £30 the minimum spend for free shipping? Anyway to trigger a prompt based on the basket value, if you are going to exclude downloadables from the calculation used in the prompt that will have to additionally be done somewhere other than in the shipping module - whereever the prompt is processed.

 

None of that should affect SDS though.

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Posted

It sounds as though the mod does work then, at least so far as excluding the price of any downloadables in calculating shipping is concerned. So far as telling the client they have to spend another £xx to get free shipping, that confuses me a bit. Are you saying that there is a band for free shipping, ie below the minimum it's not free and above the maximum (£30?) it's also not free? Or is £30 the minimum spend for free shipping? Anyway to trigger a prompt based on the basket value, if you are going to exclude downloadables from the calculation used in the prompt that will have to additionally be done somewhere other than in the shipping module - whereever the prompt is processed.

 

None of that should affect SDS though.

:lol: we are confusing each other :)

 

Your code didn't exclude the download totals as you first posted with regards the standard table rate shipping.EG

 

In my basket I have

physical £21

Downloads £10

Total £31

 

Ignoring the enhanced shopping box the shipping should still trigger the table rate in checkout_shipping(set at £1.99 up to £30 & free over £30)as the total being taken for calculating whether to add shipping or not is £21

 

This basket comes through as free, but with your first code in place it should say P&P £1.99

 

With your second test code it went through as shipping £21 so it did exclude the download totals but made the P&P the physical total.

 

I'm guessing that line needs to show the P&P for that value you created (ie physical - downloads)

 

Am I babbling now? Sorry I have been searching & reading for days & really need to get this resolved. :(

 

Does that make any sence? If you can spare any more help here is my site You'll need to set up a test account to see the enhanced shopping box in action.

Posted

Hi Julie

 

Hmmm. Okay so the $order_total figure correctly excluded downloads as per the test, but somehow despite changing this variable from the value of contents in the cart, which it is normally assigned, to the value of the physical only, the shipping quote when the rest of the shipping code is executed still comes out as based on value of cart contents? Right now I'm at a loss to think why that should be. I'm not aware of shipping costs being reset or recalculated anywhere other than in the chosen shipping module itself. It intrigues me so I'll look into more later if someone else doesn't come up with an answer first.

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Posted

Hi Julie

 

Hmmm. Okay so the $order_total figure correctly excluded downloads as per the test, but somehow despite changing this variable from the value of contents in the cart, which it is normally assigned, to the value of the physical only, the shipping quote when the rest of the shipping code is executed still comes out as based on value of cart contents? Right now I'm at a loss to think why that should be. I'm not aware of shipping costs being reset or recalculated anywhere other than in the chosen shipping module itself. It intrigues me so I'll look into more later if someone else doesn't come up with an answer first.

:) thanks...much appreciated. I'm looking at the code in a vain hope I can read something into it :) you never know enlightenment may happen!

Posted

Hi Julie

 

Well, I set up a table on my own site for free shipping above £30 for a weighted product and £1.99 for shipping below that and it worked for me so I don't know what to say. The only thing I did notice was that the code I gave you needs to be modified to take into account the quantity of a particular product if the customer orders more than one ie note the change in the $order_total calculation below:

 

   
        $order_total = 0;           
 for($i=0, $j=count($order->products); $i<$j; $i++) {                 
  if( $order->products[$i]['weight']>0 ) {    
         $order_total=($order->products[$i]['final_price'])*($order->products[$i]['qty'])+$order_total;               
         }
 } 

 

Perhaps your 'free above' prompt mod is doing something to the shipping price when it comes down to paying? I don't know why it should since I would expect something like that only to display information rather than actually controlling shipping prices, but I can't think of anything else.

 

Richard

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Posted

Hi Richard

 

One last thing please, as I know you have been very patient & helpful already. :)

 

I have your new code in & still it gives free P&P in the checkout if mixed. SDS is working by skipping if only downloads, but the only file I can I have altered that may affect your code is includes/boxes/shopping_cart.php

 

Please can you see if there is any conflict here?

 

If necessary I'll remove this mod as you say it works on a normal shopping cart.

 

<?php
/*
 $Id: shopping_cart.php,v 1.18 2003/02/10 22:31:06 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2005 leisuret
 Released under the GNU General Public License  


Changes:
2006-06-11 Modify to 1 line for item count and amount & clean up code


*/
?>
<!-- shopping_cart //-->
         <tr>
           <td>
<?php

 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_SHOPPING_CART);

 new infoBoxHeading($info_box_contents, false, false);


$cart_contents_string = '';

 if ($cart->count_contents() > 0) {
   $cart_contents_string = '<table border="0" width=BOX_WIDTH cellspacing="0" cellpadding="0">';
   $products = $cart->get_products();
{

$cart_contents_string .= '<tr><td align="center" valign="middle" class="infoBoxContents">';
    if ($cart->count_contents() > 1) {
            $cart_contents_string .=' Items ';

         } else {

         $cart_contents_string .=' Item ';
           }
                                                                   }
$cart_contents_string .= '<b>' . $cart->count_contents() . '</b></td>';
           $cart_contents_string .= '</table>';
         } else {
           $cart_contents_string .= BOX_SHOPPING_CART_EMPTY;
         }


$info_box_contents = array();
$info_box_contents[] = array('text' => $cart_contents_string);

 if ($cart->count_contents() > 0) {
   $info_box_contents[] = array('align' => 'left',
                                'text' => 'Sub Total: ' . '<b>' . $currencies->format($cart->show_total()) . '</b><br>' .
                                          '<a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><b>View Basket</b></a>');
 }

// Bof Shopping Cart Box Enhancement
$showcheckoutbutton = 1; // set to 1: show checkout button (default); set to 0: never show checkout button
$showhowmuchmore = 1;    // set to 1: show how much more to spend for free shipping (default); set to 0: don't show

$cart_show_string = '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td>' . tep_draw_separator('pixel_trans.gif', '100%', '4') . '</td></tr>';

if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') { 
   if (($cart->show_total()) < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
      if (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION == 'both') {
          $cart_show_string .= '<tr><td class="smalltext" align="center">' . sprintf(TEXT_FREE_SHIPPING_LIMIT, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER));
      }
      else if (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION == 'international') {
          $cart_show_string .= '<tr><td class="smalltext" align="center">' . sprintf(TEXT_FREE_SHIPPING_LIMIT_INTERNATIONAL, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER));       
      }
      else {
          $cart_show_string .= '<tr><td class="smalltext" align="center">' . sprintf(TEXT_FREE_SHIPPING_LIMIT_NATIONAL, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER));       
      }
      if (($showhowmuchmore) && ($cart->count_contents() > 0)) {
               $cart_show_string .= '<br>' . sprintf(TEXT_ADD_TO_GET_FREE_SHIPPING, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER - ($cart->show_total()))); 
      }
      $cart_show_string .='</td></tr>';
   }
   if ((($cart->show_total()) >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)&&($showhowmuchmore)) {
      if (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION == 'both') {    
        $cart_show_string .= '<tr><td class="smalltext" align="center">' . TEXT_FREE_SHIPPING_RECEIVED . '</td></tr>';
      }
      else if (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION == 'international') {
        $cart_show_string .= '<tr><td class="smalltext" align="center">' . sprintf(TEXT_FREE_SHIPPING_RECEIVED_INTERNATIONAL) . '</td></tr>';       }
      else {
        $cart_show_string .= '<tr><td class="smalltext" align="center">' . sprintf(TEXT_FREE_SHIPPING_RECEIVED_NATIONAL) . '</td></tr>';              
      }
   }
}

if (($showcheckoutbutton==1) && ($cart->count_contents() > 0) && (substr(basename($PHP_SELF), 0, 8) != 'checkout')) {
 $cart_show_string .= '<tr><td>' . tep_draw_separator('pixel_trans.gif', '100%', '7') . '</td></tr><tr><td align="center"><a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a></td></tr>'; 	
}
$cart_show_string .= '</table>';
$info_box_contents[] = array('text' => $cart_show_string); 
// Eof Shopping Cart Box Enhancement  

#### Points/Rewards Module V1.60 BOF ####
 if (tep_session_is_registered('customer_id')) {
   $shopping_points = tep_get_shopping_points($customer_id);
   if ($shopping_points > 0) {
     $info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
     $info_box_contents[] = array('align' => 'center','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td align="center" class="smalltext"><b><a href="' . tep_href_link(FILENAME_MY_POINTS) . '">'. TEXT_POINTS_BALANCE . '</a></b></tr></td><tr><td class="smalltext" align="right" valign="bottom">' . TEXT_POINTS .' '. number_format($shopping_points,2) .'</tr></td><tr><td class="smalltext" align="right" valign="bottom">' .  TEXT_VALUE . $currencies->format(tep_calc_shopping_pvalue($shopping_points)) . '</td></tr></table>');
   }
 }
#### Points/Rewards Module V1.60 EOF ####

 new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- shopping_cart_eof //-->

 

Thanks very much for your support.

Julie

Posted

Hi Julie

 

Well, it's curious. Firstly, that module is referring to a free shipping module that I, at least, don't have in my store. I simply set up the table rates to zero shipping cost above £30, ie I had 29:1.99,30:0.00 set as the table rates. Since I don't have free shipping module I also hadn't enabled it and I didn't need it either, to get the shipping cost at £0.00 above £30. All I needed to do was put the appropriate figures in the table rates.

 

Secondly, that mod is of course only looking at the total price in the cart and isn't distinguishing between downloadable and physical, but that's only to be expected. It does seem to perform only a display function which is also to be expected.

 

It seems to me the shopping cart enhancement by itself can't be the problem. Perhaps the "free shipping module" is? Is that another mod or do other people just have it automatically as part of their OsC installation?

 

Finally, just as an aside, of course you're perfectly entitled to charge your customers whatever you like and this isn't a criticism, but have you considered that if a customer is spending more than £30 with you, regardless of whether it includes some downloadables, they might feel that money is money and that should actually entitle them to free shipping on the physical part of their order? Which, if they could have it, would mean the problem would disappear?

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Posted

Hi Julie

 

Well, it's curious. Firstly, that module is referring to a free shipping module that I, at least, don't have in my store. I simply set up the table rates to zero shipping cost above £30, ie I had 29:1.99,30:0.00 set as the table rates. Since I don't have free shipping module I also hadn't enabled it and I didn't need it either, to get the shipping cost at £0.00 above £30. All I needed to do was put the appropriate figures in the table rates.

 

Secondly, that mod is of course only looking at the total price in the cart and isn't distinguishing between downloadable and physical, but that's only to be expected. It does seem to perform only a display function which is also to be expected.

 

It seems to me the shopping cart enhancement by itself can't be the problem. Perhaps the "free shipping module" is? Is that another mod or do other people just have it automatically as part of their OsC installation?

 

Finally, just as an aside, of course you're perfectly entitled to charge your customers whatever you like and this isn't a criticism, but have you considered that if a customer is spending more than £30 with you, regardless of whether it includes some downloadables, they might feel that money is money and that should actually entitle them to free shipping on the physical part of their order? Which, if they could have it, would mean the problem would disappear?

Hi Richard

 

I don't have a free shipping module? This works on the shipping set in the default OSC table rate in admin(as you said)Does your stock shopping_cart refer to this module as well?

 

Looking through all my mods for any references to shipping & I do thave this in the shopping_cart.php which is only a dropdown, but hey it MAY have an affect?

 

includes/shopping_cart.php

<?php
/*
 $Id: shopping_cart.php,v 1.73 2003/06/09 23:03:56 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require("includes/application_top.php");

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART);

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="0">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_cart.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 if ($cart->count_contents() > 0) {
?>
     <tr>
       <td>
<?php
   $info_box_contents = array();
   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_REMOVE);

   $info_box_contents[0][] = array('params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_PRODUCTS);

   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_QUANTITY);

   $info_box_contents[0][] = array('align' => 'right',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_TOTAL);

   $any_out_of_stock = 0;
   $products = $cart->get_products();
   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
// Push all attributes information in an array
     if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
       while (list($option, $value) = each($products[$i]['attributes'])) {
         echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
         $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
                                     from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                     where pa.products_id = '" . (int)$products[$i]['id'] . "'
                                      and pa.options_id = '" . (int)$option . "'
                                      and pa.options_id = popt.products_options_id
                                      and pa.options_values_id = '" . (int)$value . "'
                                      and pa.options_values_id = poval.products_options_values_id
                                      and popt.language_id = '" . (int)$languages_id . "'
                                      and poval.language_id = '" . (int)$languages_id . "'");
         $attributes_values = tep_db_fetch_array($attributes);

         $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
         $products[$i][$option]['options_values_id'] = $value;
         $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];
         $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
         $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
       }
     }
   }

   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
     if (($i/2) == floor($i/2)) {
       $info_box_contents[] = array('params' => 'class="productListing-even"');
     } else {
       $info_box_contents[] = array('params' => 'class="productListing-odd"');
     }
// bof dropdown qty box      
$max_to_order = tep_get_products_stock($products[$i]['id']);
$options = array();
if ($max_to_order > 0) {
for ($s=0 ; $s<$max_to_order; $s++) {
$z = $s+1;
$options[] = array('id' => $z,
'text' => $z); 
}
} else {
$options[] = array('id' => 0,
'text' => 0);
}
//eof dropdown qty box

     $cur_row = sizeof($info_box_contents) - 1;

     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));

     $products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
                      '  <tr>' .
                      '    <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
                      '    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';

     if (STOCK_CHECK == 'true') {
       $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
       if (tep_not_null($stock_check)) {
         $any_out_of_stock = 1;

         $products_name .= $stock_check;
       }
     }

     if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
       reset($products[$i]['attributes']);
       while (list($option, $value) = each($products[$i]['attributes'])) {
         $products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
       }
     }

     $products_name .= '    </td>' .
                       '  </tr>' .
                       '</table>';

     $info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',
                                            'text' => $products_name);
// bof dropdown qty box
$info_box_contents[$cur_row][] = array('align' => 'right',
'params' => 'class="productListing-data" valign="top" nowrap',
'text' => tep_draw_pull_down_menu('cart_quantity[]', $options, $products[$i]['quantity'], ' class="inputBox" ').tep_draw_hidden_field('products_id[]', $products[$i]['id'])); 
//eof dropdown qty box

     $info_box_contents[$cur_row][] = array('align' => 'right',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');
   }

   new productListingBox($info_box_contents);
?>
       </td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td align="right" class="main"><b><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></b></td>
     </tr>
<?php
   if ($any_out_of_stock == 1) {
     if (STOCK_ALLOW_CHECKOUT == 'true') {
?>
     <tr>
       <td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></td>
     </tr>
<?php
     } else {
?>
     <tr>
       <td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></td>
     </tr>
<?php
     }
   }
?>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main"><?php echo tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART); ?></td>
<?php
   $back = sizeof($navigation->path)-2;
   if (isset($navigation->path[$back])) {
?>
               <td class="main"><?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>
<?php
   }
?>
               <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
<?php
 } else {
?>
     <tr>
       <td align="center" class="main"><?php new infoBox(array(array('text' => TEXT_CART_EMPTY))); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
<?php
 }
?>
   </table></form></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="0">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

I hear what you are saying about P&P, but most of my goods are in the packet/parcel force weight range, so I subsedize it anyhow. I am not making any money out of the downloads either as I'm allowing a friend to use my site (will benefit us both in the long run) That is mainly why I need to get the correct shipping for the products I do have to ship.

 

Thanks :)

Posted

Hi Julie

 

Well, it's curious. Firstly, that module is referring to a free shipping module that I, at least, don't have in my store. I simply set up the table rates to zero shipping cost above £30, ie I had 29:1.99,30:0.00 set as the table rates. Since I don't have free shipping module I also hadn't enabled it and I didn't need it either, to get the shipping cost at £0.00 above £30. All I needed to do was put the appropriate figures in the table rates.

 

Oh I found it under Order Total just before seeing your message. I never even looked at that before. It's set to false on my store, I guess by default. So I'd suggest switching it off and see if that makes a difference to the outcome of the shipping module with my code in. At least it'll be easy enough to switch it back on again!

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Posted

Well, I looked at the code for the free shipping module and it has to be that. There is a module, ot_shipping.php in modules\order_total, and this sets the shipping cost to zero if free shipping is enabled and the order is over the amount specified. Changing the behaviour of this module by providing it with information about physical products only appears likely to be much less straightforwards than it is to provide it to the table rate shipping method.

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Posted

Well, I looked at the code for the free shipping module and it has to be that. There is a module, ot_shipping.php in modules\order_total, and this sets the shipping cost to zero if free shipping is enabled and the order is over the amount specified. Changing the behaviour of this module by providing it with information about physical products only appears likely to be much less straightforwards than it is to provide it to the table rate shipping method.

:D You are a star Richard B)

I hadn't even realised that was set to true (or where it was) until you had said. Setting it to false & your code does work. :) I think the Shopping Cart Box Enhancement contribution must use this as it now doesn't show when "Allow free shipping" is set to false. I was thinking last night that I might have to un-install that but a simple tick box was the answer. The extra info was nice but getting your code working was more important! Margins are tight & giving even more free shipping away just wasn't an option. I have spent alot of time giving info to customers but I still find they don't read it! I will just add notes about the downloads in the categories & front page & t&c (will still get emails >_< )

 

Thank you so much for your help & patience. It is much appreciated. :thumbsup:

Julie

Posted

You're very welcome Julie. It was also a useful exercise for me.

 

Richard

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Archived

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

×
×
  • Create New...