Jump to content

shippingcost by total order


Guest stijnj

Recommended Posts

Louise,

Were you logged into your admin during the install? I get an error like that sometimes when doing a mod installation and I'm logged into the admin console.

Try logging out and clearing your cache and logging back in to see if the error continues to pop up. It may be a cache thing and not the mod itself, but if the error does continue after trying that please post...

Link to comment
Share on other sites

  • Replies 69
  • Created
  • Last Reply

Top Posters In This Topic

Hello,

Well I guess I have to join the group that gets this message.

(CubeCart mod by Stijn Jammaers © www.pastij.be

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home2/doggies/public_html/store/admin/shipping_by_order.php on line 47

It appears when I click in the Admin panel >shipping>edit shipping by total order

the url to the site is:

www.doggiesworld.com/store

I've looked at this other comments and tried to figure out where I went wrong.

Would appreciate any help. Thanks, Lynda

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

I am using this mod now. Is there a way to have several catagories (or at least one) over ride this mod with custom shipping charges?

Terri

Link to comment
Share on other sites

The vast majority of real users need to calculate by weight..... its how you as a business owner are charged for your shipping costs... and accoringly it is exactly how you should be charging your customers (with profit on top for packaging costs and labour)

http://www.philcartmell.com/services/cubec...dification.html

Installtion onto your server costs £25 if you have no other mods and typically takes an hour.

Kind Regards

Phil

Link to comment
Share on other sites

Guest Snakeking

I get this error during checkout:

Parse error: parse error, unexpected T_STRING in /home/cands/public_html/cc/order.php on line 436

anyone?

Link to comment
Share on other sites

The vast majority of real users need to calculate by weight..... its how you as a business owner are charged for your shipping costs... and accoringly it is exactly how you should be charging your customers (with profit on top for packaging costs and labour)

http://www.philcartmell.com/services/cubec...dification.html

Installtion onto your server costs £25 if you have no other mods and typically takes an hour.

Kind Regards

Phil

A lot of my merchandise is shipped from the distribution warehouse and their rates are based on dollar amount that's why I charge that way, I'm not sure if I am offended or not by the "real users" comment or not :)

Thanks though.

Terri

Link to comment
Share on other sites

Guest Snakeking

Yep, here it is.

<?php

/*************************************************************************** 

*	File Info: order.php 

*	Purpose:   Final Checkout Stage of Building Order 

*	Updated:   31/07/2003 

****************************************************************************   

*	Developer: Alistar Brookbanks (Brooky.com) 

*	Copyright: (C)2003 http://www.brooky.com

*	Copyright: (C)2003 http://www.cubecart.com

*	This program is not "free" software and restrictions apply! 

*	Further Info: http://www.cubecart.com/license.php

*	Contact [email protected] if any conditions are not clear. 

*

*	Licensees holding valid "CubeCart Licence Number" may edit

*	the (powered by CubeCart) from browser title and "Powered by CubeCart"

*	and "(c) Brooky.com" from the web page footer.

*

*	This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING

*	THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR

*	PURPOSE. This and all others in the download package can only be

*	redistributed with written permission from Alistair Brookbanks!

*

*	The "CubeCart License" is available to purchase at

*	https://secure.cubecart.com/

*	For pricing please contact us via e-mail at [email protected] 

***************************************************************************/



$page="order";



session_start();

   

if(!session_is_registered("cart_order_id"))

	{

  $cart_order_id = date("ymd-His-").rand(1000,9999);   // creates a cart order ID for the session

  session_register("cart_order_id");

	}



include("admin/config.php");



include( "admin/settings.inc.php");



include( "header.inc.php");



include( "shoppingcart.php");



echo"<tr><td valign=\"top\" align=\"center\"><br>";

 

$cart = new Cart;



// if register from customer.php

if ($register)

	{

  // make sure relevant data was entered

  if ((empty($name))or(empty($add_1))or(empty($town))or(empty($county))or(empty($postcode))or(empty($country))or(empty($phone))or(empty($password1))or(empty($password2)))

 	 {

    echo "<p align='center'><font color=#990000><b>$la_order_required</b></font></p>";

    $again=1;

 	 }

	

  // make sure relevant data was entered

  if (!eregi("[0-9]",$phone))

 	 {

    echo "<p align='center'><font color=#990000><b>$la_account_tel_validate</b></font></p>";

    $again=1;

 	 }



  // check passwords match

  if ($password1!=$password2)

 	 {

    echo "<p align='center'><font color=#990000><b>$la_account_password_match</b></font></p>";

    $again=1;

 	 }

  // check password length 

  if ((strlen($password1)<6 || strlen($password1) >20)and(strlen($password2)<6 || strlen($password2) >20))

 	 {

    echo "<p align='center'><font color=#990000><b>$la_account_password_length</b></font></p>";

    $again = 1;

 	 }

  // if error provide link back

  if ($again==1)

 	 {

    echo"<p align=\"center\"><a href = \"customer.php?do=new&submit=submit&session=$session&county=$county&email=$email&name=$name&add_1=$add_1&add_2=$add_2&town=$town&postcode=$postcode&site_country=$country&phone=$phone\">$la_customer_try_again</a></p>";

    exit;

 	 } // end ($again==1)



  // make sure email is not a duplicate

  $dupe_email = mysql_query ("select * from ".$prefix."store_customer where email = '$email'");

  if (mysql_num_rows($dupe_email)>0)

 	 {

    $stop = 1;

 	 }

  

  //Insert data to database

  if($stop!==1)

 	 {

    $passwd=md5($password1);

    $date=date("Ymd");

    $time=date("H:i");

    $ip= $_SERVER["REMOTE_ADDR"];

    

    if(empty($perm))

   	 {

      $perm = "Y";

   	 }



  $sql_insert = "insert into ".$prefix."store_customer (email, password, name, add_1, add_2, town, county, postcode, country, phone, date, time, ip, perm) values ('$email', '$passwd', '$name', '$add_1', '$add_2', '$town', '$county', '$postcode', '$country', '$phone','$date','$time','$ip','$perm')";



  $result = mysql_query($sql_insert);

 	 

  // Email user



  $subject = "$la_order_reg_details";

  $message = "$la_account_dear $name,\n$la_order_reg_thank $site_business\n\n";

  $message .= "$la_order_look_after\n";

  $message .= "----------------------------------------------\n";

  $message .= "  $la_account_username: $email\n";

  $message .= "  $la_account_password: $password1\n";

  $message .= "----------------------------------------------\n";

  $message .="\n$la_order_rem_pass";

  $message .= "\r\n\n$la_account_ending,\n\n\n$site_business\n$site_url";

  

  mail($email, $subject, $message, "From: $site_email");

	}// no dupe





}// end ($register)



if($add=="new_add")

	{

  $sql_select = mysql_query( "select * from ".$prefix."store_customer where email='$email'");



  while ($row = mysql_fetch_array($sql_select))

 	 {

    $email=$row["email"]; 

    $name= $row["name"];

    $add_1=$row["add_1"]; 

    $add_2=$row["add_2"];

    $town=$row["town"];

    $county=$row["county"];

    $postcode=$row["postcode"];

    $country=$row["country"];

    $phone=$row["phone"];

    $customer_id=$row["customer_id"];

 	 }



  if(empty($country_d))

 	 {

    $country_d=$site_country;

 	 }



  echo"<form method=\"post\" name=\"order\" action=\"order.php?session=$session\">

 	 <table align=\"center\" width=\"550\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">

    <tr>

   	 <td bgcolor=\"$colour_2\">

      <table cellpadding=\"2\" border=\"0\" cellspacing=\"1\" width=\"100%\" align=\"center\">

     	 <tr bgcolor=\"$colour_1\">

        <td width=\"100%\" colspan=\"2\" background=\"images/bevel_bg.gif\"><b>$la_order_enter_ship</b> $email</td>

     	 </tr>

     	 <tr bgcolor=\"$colour_1\"> 

        <td width=\"40%\">$la_account_full_name</td>

        <td width=\"60%\"><input name=\"name_d\" class=\"textbox\" value=\"$name_d\" type=\"text\">

        <font color=\"#990000\">* </font></td>

     	 </tr>

     	 <tr bgcolor=\"$colour_1\"> 

        <td width=\"40%\">$la_account_add_1</td>

        <td width=\"60%\"><input name=\"add_1_d\" class=\"textbox\" value=\"$add_1_d\" type=\"text\">

        <font color=\"#990000\">* </font></td>

     	 </tr>

     	 <tr bgcolor=\"$colour_1\"> 

        <td width=\"40%\">$la_account_add_2</b></td>

        <td width=\"60%\"><input name=\"add_2_d\" class=\"textbox\" value=\"$add_2_d\" type=\"text\">

        </td>

     	 </tr>

     	 <tr bgcolor=\"$colour_1\"> 

        <td width=\"40%\">$la_account_town</b></td>

        <td width=\"60%\"><input name=\"town_d\" class=\"textbox\" type=\"text\" value=\"$town_d\">

        <font color=\"#990000\">*</font></td>

     	 </tr>

     	 <tr bgcolor=\"$colour_1\"> 

        <td width=\"40%\">$la_account_state</td>

        <td width=\"60%\"><input name=\"county_d\" class=\"textbox\" type=\"text\" value=\"$county_d\">

        <font color=\"#990000\">*</font> </td>

     	 </tr>

     	 <tr bgcolor=\"$colour_1\"> 

        <td width=\"40%\">$la_account_zip</td>

        <td width=\"60%\"><input name=\"postcode_d\" class=\"textbox\" type=\"text\" value=\"$postcode_d\">

        <font color=\"#990000\">*</font> </td>

     	 </tr>

     	 <tr bgcolor=\"$colour_1\"> 

        <td width=\"40%\">$la_account_country</td>

        <td width=\"60%\">";

 	 

        countries("country_d",$country_d,$prefix);

        echo" *</font></td>

     	 </tr> 

     	 <tr bgcolor=\"$colour_1\">

        <td width=\"40%\">&nbsp;</td>

        <td width=\"60%\">

        <input type=\"hidden\" name=\"diff\" value=\"diff\">

        <input type=\"hidden\" name=\"add\" value=\"same_add\">

        <input type=\"hidden\" name=\"submit_form\" value=\"submit_form\">

        <input type=\"hidden\" name=\"name\" value=\"$name\">

        <input type=\"hidden\" name=\"email\" value=\"$email\">

        <input type=\"hidden\" name=\"add_1\" value=\"$add_1\">

        <input type=\"hidden\" name=\"add_2\" value=\"$add_2\">

        <input type=\"hidden\" name=\"town\" value=\"$town\">

        <input type=\"hidden\" name=\"county\" value=\"$county\">

        <input type=\"hidden\" name=\"postcode\" value=\"$postcode\">

        <input type=\"hidden\" name=\"country\" value=\"$country\">

        <input type=\"hidden\" name=\"phone\" value=\"$phone\">

 	 

       	 <table width=\"188\" height=\"24\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">

          <tr>

         	 <td bgcolor=\"$colour_1\" height=\"24\" width=\"94\" background=\"images/white_button.gif\" align=\"center\" style=\"cursor: hand;\" onClick=\"location.href='index.php?session=$session'\">

         	 <A HREF=\"index.php?session=$session\"><font class=\"wht_btn\">$la_shop_more</font></A></td>

    

         	 <td bgcolor=\"$colour_1\" height=\"24\" width=\"94\" background=\"images/red_button.gif\" align=\"center\" style=\"cursor: hand;\" onClick='order.submit();'>

         	 <a href='#'><font class=\"red_btn\">$la_continue</font></a>

         	 </td>

          </tr>

       	 </table>

    

        </td>

     	 </tr>

      </table>

   	 </td>

    </tr>

 	 </table>

 	 

 	 <div align=\"center\"><br>$la_account_form_must

  </form>";

}



if($add=="same_add")

	{

  if($diff)

 	 {

    if ((empty($name_d))or(empty($add_1_d))or(empty($town_d))or(empty($county_d))or(empty($postcode_d))or(empty($country_d)))

   	 {

      echo "<p align='center'><font color=#990000><b>$la_order_required</b></font></p>";

      $again=1;

   	 }//must be filled elements



    if ($again==1)

   	 {

      echo"<p align=\"center\"><a href = \"order.php?add=new_add&session=$session&county_d=$county_d&email=$email&name_d=$name_d&add_1_d=$add_1_d&add_2_d=$add_2_d&town_d=$town_d&postcode_d=$postcode_d&country_d=$country_d\">$la_customer_try_again</a></p>";

      exit;

   	 } // end ($again==1)

 	 }



  if(!$diff)

 	 {

    $name_d = $name;

    $add_1_d = $add_1;

    $add_2_d = $add_2;

    $town_d = $town;

    $county_d = $county;

    $postcode_d = $postcode;

    $country_d = $country;

 	 }



	

	// see if the delivery address is excluded, national or international

	$select_ship = "select status from ".$prefix."store_countries where country='$country_d'";

	$result_ship = mysql_query($select_ship);

	$row_status = mysql_fetch_array($result_ship);

	$ship_status= $row_status[status];

	// give message if it is excluded

	if($ship_status=="e")

	{

	echo"<br><br><p align=\"center\">$la_order_no_ship ship to $country_d!</p></td></tr>";

	include("footer.inc.php");

	exit;

	}

	if($ship_status=="i")

	{

	$per_shipment = "per_int_ship";

	$per_item = "item_int_ship";

	}

	if($ship_status=="n")

	{

	$per_shipment = "per_ship";

	$per_item = "item_ship";

	}

	

	

	echo"<table width=\"450\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">

 	 <tr width=\"225\" align=\"left\">

    <td width=\"225\"><b>$la_order_inv_add</b></td>

    <td width=\"0\">&nbsp;</td>

    <td width=\"225\"><b>$la_order_ship_add</b></td>

 	 </tr>

 	 <tr align=\"left\" width=\"225\" valign=\"top\">

    <td>$name<br>$add_1<br>";if(!empty($add_2)){echo"$add_2<br>";}echo"$town<br>$county<br>$postcode<br>$country</td>

    <td width=\"0\">&nbsp;</td>

    <td width=\"225\">$name_d<br>$add_1_d<br>";if(!empty($add_2_d)){echo"$add_2_d<br>";}echo"$town_d<br>$county_d<br>$postcode_d<br>$country_d<br><a href=\"order.php?session=$session&add=new_add&county=$county&email=$email&name=$name&add_1=$add_1&add_2=$add_2&town=$town&postcode=$postcode&country=$country&&county_d=$county_d&name_d=$name_d&add_1_d=$add_1_d&add_2_d=$add_2_d&town_d=$town_d&postcode_d=$postcode_d&country_d=$country_d\" target=\"_self\">$la_order_edit</td>

 	 </tr>

  </table><br>";





  echo"<FORM ACTION=\"secure.php?session=$session\" name=\"checkout\" method=\"post\">\n

  <a name=\"top\"></a>

 	 <table align=center border=\"0\" cellpadding=\"5\" cellspacing=\"0\">

    <tr valign=\"top\">

    <td width=\"100%\" align=\"center\" valign=\"TOP\"><b>$la_order_sum</b></td>

    <tr>

 	 </table>";



	if($ShoppingCart)

  {    

 	 $session = $ShoppingCart;

  }

	

	$total_per_item = 0;

	$max_per_ship = 0;

  

	$contents = $cart->display_contents($prefix,$session,$sale);

  

	if($contents[product][0] !=  "")

  {

 	 echo "<table align=\"center\" width=\"450\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">

   	 <tr>

      <td bgcolor=\"$colour_2\">

     	 <table cellpadding=\"2\" border=\"0\" cellspacing=\"1\" width=\"100%\" align=\"center\">

        <tr bgcolor=\"$colour_1\">";	

 	 

        if($cart_thumb=="Y")

       	 {

          $colspan=5;

          echo"<td background=\"images/bevel_bg.gif\" height=\"20\" align=\"center\"><b>$la_store_image</b></td>";

       	 } else {

          $colspan=4;

       	 }

 	 

          echo"<TD background=\"images/bevel_bg.gif\" height=\"20\" align=\"center\"><b>$la_order_prod</b></TD>

          <TD background=\"images/bevel_bg.gif\" height=\"20\" align=\"center\"><b>$la_view_car_opts</b></TD>

          <TD height=\"20\" background=\"images/bevel_bg.gif\"><b>$la_store_price</b></TD>

          <TD height=\"20\" background=\"images/bevel_bg.gif\"><b>$la_order_quan</b></TD>

          <TD height=\"20\" background=\"images/bevel_bg.gif\"><b>$la_order_total</b></TD>";

 	 

       	 $x = 0;

       	 while($x != $cart->num_items($prefix,$session))

          {

         	 echo"<TR bgcolor='$colour_1'>";

         	 $title_strip = stripslashes($contents[title][$x]);

    

         	 if($cart_thumb=="Y")

            {

           	 echo"<TD align=center><img src=\"images/thumb_".$contents[image][$x]."\"></TD>";

            }

         	 echo"<TD align=center>$title_strip</TD>";

  

       	 // generate options

       	 echo"<TD align=left>";

       	 // split options from 2,87,21,45 etc to sepearte variable

       	 $current_options = $contents[product_options][$x];

  

       	 if(empty($current_options))

          {

         	 echo$la_no_options;

          }



       	 $pass_options = $current_options;

       	 $current_options = split (",",$current_options);   

  

       	 $price = $contents[price][$x];



       	 foreach ($current_options as $assign_id)

          { 

         	 // get data

         	 $query = "SELECT * FROM ".$prefix."store_options_bot where assign_id = '$assign_id'";

         	 $result = mysql_query($query);

    

         	 while($row = mysql_fetch_array($result))

            {

           	 $option_id = $row["option_id"];

           	 $value_id = $row["value_id"];

           	 $option_price = $row["option_price"];

           	 $option_symbol = $row["option_symbol"];

           	 

           	 if($option_symbol =="+")

              {

             	 $price = $price + $option_price;

              }

      

           	 if($option_symbol =="-")

              {

             	 $price = $price - $option_price;

              }



           	 // find names of options/values

           	 // get option name :)

           	 $query = "select * from ".$prefix."store_options_top where option_id = '$option_id'"; 

           	 $result = mysql_query($query)or die("Error: " . mysql_error()); 

           	 while ($row = mysql_fetch_array($result))

              {

             	 $option_name=$row["option_name"];

              }



           	 // get value name :)

           	 $query = "select * from ".$prefix."store_options_mid where value_id = '$value_id'"; 

           	 $result = mysql_query($query)or die("Error: " . mysql_error()); 

           	 while ($row = mysql_fetch_array($result))

              {

             	 $value_name=$row["value_name"];

              }

           	 echo"<b>$option_name:</b><br>$value_name<br>";

      

            }

       	 }// end for each

   	 echo"</TD>";

   	 // end genterate options 

   	 $prod_total = $price * $contents[quantity][$x];

   	 $price = sprintf("%.2f", $price);

   	 echo"<TD align=center>$currency$price</TD>\n";

   	 $product  = $contents[product][$x];

   	 echo  "<TD align=center>".$contents[quantity][$x]. "</TD>";

   	 $quantity = $contents[quantity][$x];

   	 $prod_total = sprintf("%.2f", $prod_total);

   	 echo"<TD align=center>$currency$prod_total</TD>\n";

   

   	 $x ++;

    

  // first get shipping prices from category

        $sel_cat = "select cat_id from ".$prefix."store_inventory where product = '$product'";

        $result_sel_cat = mysql_query($sel_cat);

        $row_cat = mysql_fetch_array($result_sel_cat);

        $cat_id = $row_cat[cat_id];

       

        $sel_ship = "select * from ".$prefix."store_category where cat_id = '$cat_id'";

        $result_sel_ship = mysql_query($sel_ship);

        $row_ship = mysql_fetch_array($result_sel_ship);

        $per_ship = $row_ship[$per_shipment];

        $per_it = $row_ship[$per_item];

       

        select highest per_ship or per_int_ship and multiply item_ship or item_int_ship

        $total_per_item = ($per_it * $quantity) + $total_per_item;

        if($per_ship>$max_per_ship){$max_per_ship=$per_ship;}

  $result_sel_ship = mysql_query($sel_ship);

	

	// select highest per_ship or per_int_ship and multiply item_ship or item_int_ship

	$total_per_item = ($per_it * $quantity) + $total_per_item;

	if($per_ship>$max_per_ship){$max_per_ship=$per_ship;}

	

    }// ends loop for each product

	//////////////////////////////////////////////////////////////////////

///////////        start shipping modification           /////////////

//////////////////////////////////////////////////////////////////////

//shipping gets calculated by total order sum so let's get the sum first

$cart_total=$cart->cart_total($prefix,$session,$sale);

//now select data set by the admin

$query = "SELECT * FROM ".$prefix."store_ship_by_ordersum";

$result = mysql_query($query);

while($row = mysql_fetch_array($result))

        {

        $ship_amount = $row["ship_amount"];

        $ship_amount_base = $row["ship_amount_base"];

        $ship_amount_up = $row["ship_amount_up"];

        $ship_amount_up_base = $row["ship_amount_up_base"];

        }

if($cart_total>$ship_amount_base)

$rest_ship = $cart_total - $ship_amount_base;

$ship_calc = ($rest_ship/$ship_amount_up_base)*$ship_amount_up;

$ship_calc = ceil($ship_calc);

$total_ship = $ship_calc + $ship_amount;

if($cart_total<$ship_amount_base)

$total_ship = $ship_amount;

if($cart_total==$ship_amount_base)

$total_ship = $ship_amount;

////////////////////////////////////////////////////////////////////////

///////////////   end shipping modification               //////////////

////////////////////////////////////////////////////////////////////////

  $cart_total=$cart->cart_total($prefix,$session,$sale);

  //$total_ship = $total_per_item + $max_per_ship;

  $pre_total_tax = $cart_total * ($site_tax/100);

  $payable = $cart_total + $total_ship + $pre_total_tax;

    

  $total_ship = sprintf("%.2f", $total_ship);

  $pre_total_tax = sprintf("%.2f", $pre_total_tax);

  $payable = sprintf("%.2f", $payable);



  echo"</TR>";

  echo"<tr bgcolor='$colour_1'>

    <td colspan='$colspan' align='right'><b>$la_order_bask_tot</b></td>

    <td align='center'>$currency$cart_total</td>

 	 </tr>

 	 <tr bgcolor='$colour_1'>

    <td colspan='$colspan' align='right'><b>$la_order_bask_tax ($site_tax%):</b></td>

    <td align='center'>$currency$pre_total_tax</B></td></tr><tr bgcolor='$colour_1'>

    <td colspan='$colspan' align='right'><b>$la_order_bask_pap</b></td>

    <td align='center'>$currency$total_ship</td>

 	 </tr>

 	 <tr bgcolor='$colour_1'>

    <td colspan='$colspan' align='right'><b>$la_order_bask_pay</b></td>

    <td align='center'>$currency$payable</td>

 	 </tr>

 	 <tr bgcolor='$colour_1'>

    <td colspan='$colspan' align='right'><b>$la_order_bask_choose</b></td>

    <td align='center'>";

	

  // build drop down menu

    $sql_select = mysql_query( "select * from ".$prefix."store_gateways where status='e'");

    

    echo"<select name=\"gateway\">";

    

    while ($row = mysql_fetch_array($sql_select))

   	 {

      $gateway = $row["gateway"]; 

      $cust_3 = $row["cust3"];

      echo"<option value=\"$gateway\" ";if($pay_default=="$gateway"){echo "selected";}echo">$cust_3</option>";

   	 }

    

    $colspan = $colspan +1;

    echo"</select></td></tr>

 	 <tr bgcolor='$colour_1'>

    <td colspan='$colspan' align='right'>	

   	 <table align=\"right\" bgcolor=\"$colour_1\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">

      <tr>

     	 <td valign=\"top\" align=\"right\">$la_order_cust_comments</td>

     	 <td valign=\"top\" align=\"right\"><textarea name=\"customer_comments\" cols=\"30\" rows=\"3\" value=\"\"></textarea></td></td>

      </tr>

   	 </table>

    </tr>

 	 </tr>

  </TABLE>

	</td>

</tr>

</table>";

    

	echo"

     <input type=\"hidden\" name=\"name\" value=\"$name\">

  <input type=\"hidden\" name=\"email\" value=\"$email\">

  <input type=\"hidden\" name=\"add_1\" value=\"$add_1\">

  <input type=\"hidden\" name=\"add_2\" value=\"$add_2\">

  <input type=\"hidden\" name=\"town\" value=\"$town\">

  <input type=\"hidden\" name=\"county\" value=\"$county\">

  <input type=\"hidden\" name=\"postcode\" value=\"$postcode\">

  <input type=\"hidden\" name=\"country\" value=\"$country\">

  <input type=\"hidden\" name=\"phone\" value=\"$phone\">

  <input type=\"hidden\" name=\"name_d\" value=\"$name_d\">

  <input type=\"hidden\" name=\"add_1_d\" value=\"$add_1_d\">

  <input type=\"hidden\" name=\"add_2_d\" value=\"$add_2_d\">

  <input type=\"hidden\" name=\"town_d\" value=\"$town_d\">

  <input type=\"hidden\" name=\"county_d\" value=\"$county_d\">

  <input type=\"hidden\" name=\"postcode_d\" value=\"$postcode_d\">

  <input type=\"hidden\" name=\"country_d\" value=\"$country_d\">

  <input type=\"hidden\" name=\"cart_total\" value=\"$cart_total\">

        <input type=\"hidden\" name=\"payable\" value=\"$payable\">

  <input type=\"hidden\" name=\"pre_total_tax\" value=\"$pre_total_tax\">

  <input type=\"hidden\" name=\"total_ship\" value=\"$total_ship\">";

	echo"<table align=\"center\" bgcolor=\"$bg_colour\" height=\"40\" width=\"450\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">

 	 <tr align=\"right\" bgcolor=\"$bg_colour\"><td height=\"40\" align=\"left\">

    <table width=\"188\" height=\"24\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">

   	 <tr>

      <td bgcolor=\"$bg_colour\" height=\"24\" width=\"94\" background=\"images/white_button.gif\" align=\"center\" style=\"cursor: hand;\" onClick=\"location.href='index.php?session=$session'\">

      <A HREF=\"index.php?session=$session\"><font class=\"wht_btn\">$la_shop_more</font></A></td>

    

      <td bgcolor=\"$bg_colour\" height=\"24\" width=\"94\" background=\"images/red_button.gif\" align=\"center\" style=\"cursor: hand;\" onClick='checkout.submit();'>

      <a href='#'><font class=\"red_btn\">$la_checkout</font></a>

      </td>

   	 </tr>

    </table>

 	 </td>

  </tr>

	</TABLE>

</form>";

  

} else 

	{

  echo "<p align=center>$la_order_empty_cart</p>";

	}



	echo "</td></tr>";    

}



include("footer.inc.php");



?>

Link to comment
Share on other sites

I have new products that have an extra shipping charge due to the weight on top of the total shipping by purchase amount. How can I add this in? Will I need a different mod?

Terri

Link to comment
Share on other sites

Guest krickarby

Hi this is the first time I've posted in the Cube Cart forum, but I'm amazed at the amount of free help and advice offered to newbies like me, so I am hoping someone will be able to solve my little problem with this mod?

I've installed the shippingcost mod and, as far as I can see, my db is fine and I've made the necessary changes to my files, but I am still getting the same result when I try to change the values in admin - it just adds £1 to whatever initial value I enter and it's driving me maaaaaaaaaaad!

I keep checking here in case there's something that will fix it or I've missed something silly (which I probably have), but I'm just coming to a dead end all the time.

btw I don't seem to have any related error messages displaying in my files/shop so I don't know what else to try...

Please, please can someone point me in the right direction? ;)

Thanks in advance

Link to comment
Share on other sites

Guest lrk999

I've seen this problem addressed several times, but still not sure what to do. When I go to settings/edit shipping by total order, I get the following:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/southbay/public_html/store/admin/shipping_by_order.php on line 47

I've seen the replies with solutions for those with a store name prefix - I don't think I have a prefix, although I'm not sure what that means.

I'd appreciate any advice. All I want to do is charge $5.00 shipping for orders up to $25.00 and free shipping for orders over $25.00.

I've included below the section of the file that contains line 47.

if($submit) {

$goback="<p align=\"center\"><a href=\"java script:history.back()\">$la_try_again</a></p>";

if(empty($ship_amount)or(empty($ship_amount_base))or(empty($ship_amount_up))or(empty($ship_amount_up_base)))

{

echo "<p align=\"center\">$la_ship_by_order_error</p><p>$goback</p>";

exit;

}

$sql_update = mysql_query("update ".$prefix."store_ship_by_ordersum set ship_amount='$ship_amount', ship_amount_base='$ship_amount_base' , ship_amount_up='$ship_amount_up' , ship_amount_up_base='$ship_amount_up_base' ");

echo"<p align=\"center\">$la_ship_by_order_val</b><br><br><a href =\"shipping_by_order.php\">$la_ship_by_order_result</a></p>";

}

if(!$submit){

$sql_count = "select * from ".$prefix."store_ship_by_ordersum";

$result = mysql_query ($sql_count);

while($row = mysql_fetch_array($result))

{

$ship_amount = $row["ship_amount"];

$ship_amount_base = $row["ship_amount_base"];

$ship_amount_up = $row["ship_amount_up"];

$ship_amount_up_base = $row["ship_amount_up_base"];

Link to comment
Share on other sites

Look at your database.

If you see tables like this: "store_inventory, store_config" then you DO NOT HAVE A PREFIX.

If you see something like: "cubecartstore_inventory, cubecartstore_config" then YOUR PREFIX IS cubecart

Your prefix is all characters coming before "store_"

Link to comment
Share on other sites

  • 3 months later...
Guest allinoneaccess

:D I JUST got done posting a request for this exact mod! I MUST have it!! And my next question is, what do I do if I've already installed that other shipping mod that does it per item? Will it overwrite it or will things start to get ugly really quick? What can I do to get this mod!!?? :D

Link to comment
Share on other sites

Guest allinoneaccess

MANUAL INSTALL GUIDE

1

copy / paste to

cubecartdirectory/admin/lang/English.inc.php

//************************

// SHIP BY TOTAL ORDER SUM

//************************

$la_ship_by_order_header="Shipping by total order sum";

$la_ship_by_order_edit="edit shipping by total order";

$la_ship_by_order_error="Please complete all required fields";

$la_ship_by_order_val="Values are updated";

$la_ship_by_order_result="Result is here";

$la_ship_by_order_if="If the total order sum is over";

$la_ship_by_order_base="Base settings";

$la_ship_by_order_cost="Shippingcost is";

$la_ship_by_order_for="for orders up to";

$la_ship_by_order_add="Add";

$la_ship_by_order_next="for every next";

2

open

cubecartdirectory/admin/nav.php

find about line 191

['<?echo$la_shipping_title;?>', '<?echo"$site_url/admin/shipping.php";?>'],

add below

['<?echo$la_ship_by_order_edit;?>', '<?echo"$site_url/admin/shipping_by_order.php";?>'],

3

open

cubecartdirectory/order.php

find about line 431

// first get shipping prices from category

        $sel_cat = "select cat_id from ".$prefix."store_inventory where product = '$product'";

        $result_sel_cat = mysql_query($sel_cat);

        $row_cat = mysql_fetch_array($result_sel_cat);

        $cat_id = $row_cat[cat_id];

       

        $sel_ship = "select * from ".$prefix."store_category where cat_id = '$cat_id'";

        $result_sel_ship = mysql_query($sel_ship);

        $row_ship = mysql_fetch_array($result_sel_ship);

        $per_ship = $row_ship[$per_shipment];

        $per_it = $row_ship[$per_item];

       

        select highest per_ship or per_int_ship and multiply item_ship or item_int_ship

        $total_per_item = ($per_it * $quantity) + $total_per_item;

        if($per_ship>$max_per_ship){$max_per_ship=$per_ship;}

uncomment these lines like this (or delete them)

// first get shipping prices from category

        //$sel_cat = "select cat_id from ".$prefix."store_inventory where product = '$product'";

        //$result_sel_cat = mysql_query($sel_cat);

        //$row_cat = mysql_fetch_array($result_sel_cat);

        //$cat_id = $row_cat[cat_id];

       

      // $sel_ship = "select * from ".$prefix."store_category where cat_id = '$cat_id'";

        //$result_sel_ship = mysql_query($sel_ship);

        //$row_ship = mysql_fetch_array($result_sel_ship);

      // $per_ship = $row_ship[$per_shipment];

      // $per_it = $row_ship[$per_item];

       

        // select highest per_ship or per_int_ship and multiply item_ship or item_int_ship

      // $total_per_item = ($per_it * $quantity) + $total_per_item;

        //if($per_ship>$max_per_ship){$max_per_ship=$per_ship;}

find about line 446

}// ends loop for each product

add below

//////////////////////////////////////////////////////////////////////

///////////        start shipping modification          /////////////

//////////////////////////////////////////////////////////////////////

//shipping gets calculated by total order sum so let's get the sum first

$cart_total=$cart->cart_total($prefix,$session,$sale);

//now select data set by the admin

$query = "SELECT * FROM ".$prefix."store_ship_by_ordersum";

$result = mysql_query($query);

while($row = mysql_fetch_array($result))

        {

        $ship_amount = $row["ship_amount"];

        $ship_amount_base = $row["ship_amount_base"];

        $ship_amount_up = $row["ship_amount_up"];

        $ship_amount_up_base = $row["ship_amount_up_base"];

        }

if($cart_total>$ship_amount_base)

$rest_ship = $cart_total - $ship_amount_base;

$ship_calc = ($rest_ship/$ship_amount_up_base)*$ship_amount_up;

$ship_calc = ceil($ship_calc);

$total_ship = $ship_calc + $ship_amount;

if($cart_total<$ship_amount_base)

$total_ship = $ship_amount;

if($cart_total==$ship_amount_base)

$total_ship = $ship_amount;

////////////////////////////////////////////////////////////////////////

///////////////  end shipping modification              //////////////

////////////////////////////////////////////////////////////////////////

find about line 484

$total_ship = $total_per_item + $max_per_ship;

uncomment like

//$total_ship = $total_per_item + $max_per_ship;

4

Run SQL queries on your cubecart database :

CREATE TABLE store_ship_by_ordersum (

  ship_amount decimal(30,2) NOT NULL default '0.00',

  ship_amount_base decimal(30,2) NOT NULL default '0.00',

  ship_amount_up decimal(30,2) NOT NULL default '0.00',

  ship_amount_up_base decimal(30,2) NOT NULL default '0.00'

) TYPE=MyISAM;

#

# Gegevens worden uitgevoerd voor tabel `store_ship_by_ordersum`

#

INSERT INTO store_ship_by_ordersum VALUES ('4.99', '25.00', '1.00', '25.00');

6

save next file as shipping_by_order.php and upload to admindir

<?php

/***************************************************************************

*

*                          MOD INFO

*

**************************************************************************

*

*        File info  : shipping by order.php

*                    add-on for cubecart version 2

*

*        Author    :Stijn Jammaers

*                   

*

*        Last update: 24/05/2004

*

*

*

*

*

*

**************************************************************************/

session_start();

if (!session_is_registered("admin"))

  {

    header("Location: login.php");

  }

if(session_is_registered("admin")){

include ("config.php");

include( "settings.inc.php");

$url="index";

include_once ("header.inc.php");

echo"<H2>$la_ship_by_order_header</H2></font><font size='1'> (CubeCart mod by <b>Stijn Jammaers ©<a target='_blank' href='http://www.pastij.be'> www.pastij.be</a>";

if($submit)  {

$goback="<p align=\"center\"><a href=\"java script:history.back()\">$la_try_again</a></p>";

if(empty($ship_amount)or(empty($ship_amount_base))or(empty($ship_amount_up))or(empty($ship_amount_up_base)))

                {

echo "<p align=\"center\">$la_ship_by_order_error</p><p>$goback</p>";

                exit;

                }

$sql_update = mysql_query("update ".$prefix."store_ship_by_ordersum set ship_amount='$ship_amount', ship_amount_base='$ship_amount_base' , ship_amount_up='$ship_amount_up' ,  ship_amount_up_base='$ship_amount_up_base' ");

echo"<p align=\"center\">$la_ship_by_order_val</b><br><br><a href =\"shipping_by_order.php\">$la_ship_by_order_result</a></p>";

}

if(!$submit){

$sql_count = "select * from ".$prefix."store_ship_by_ordersum";

$result = mysql_query ($sql_count);

while($row = mysql_fetch_array($result))

        {

        $ship_amount = $row["ship_amount"];

        $ship_amount_base = $row["ship_amount_base"];

        $ship_amount_up = $row["ship_amount_up"];

        $ship_amount_up_base = $row["ship_amount_up_base"];

        }

echo"<form action=\"shipping_by_order.php\" method=\"post\">

<table align=\"left\" width=\"500\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">

<tr><td bgcolor=\"$colour_2\">

<table cellpadding=\"2\" cellspacing=\"1\" border=\"0\" width=\"100%\" align=\"center\">

<tr bgcolor=\"$colour_2\">

<td  valign=\"top\"width=\"25%\"><b>$la_ship_by_order_base</b></td> <td width=\"25%\">&nbsp;</td> <td width=\"25%\">&nbsp;</td> <td width=\"25%\">&nbsp;</td></tr>

<tr bgcolor=\"$colour_3\">

    <td width=\"25%\" valign=\"top\" align=\"center\">$la_ship_by_order_cost</td>

    <td width=\"25%\" valign=\"top\" align=\"center\">$currency<input class=\"textbox\" type=\"textbox\" size=\"6\" name=\"ship_amount\" value=\"$ship_amount\"><font color=\"990000\"><b>*</b></font></td>

    <td width=\"25%\" valign=\"top\" align=\"center\">for orders up to</td>

    <td width=\"25%\" valign=\"top\" align=\"center\">$currency<input class=\"textbox\" type=\"textbox\" size=\"6\" name=\"ship_amount_base\" value=\"$ship_amount_base\"><font color=\"990000\"><b>*</b></font></td>

  </tr>

<tr bgcolor=\"$colour_2\">

<td valign=\"top\"width=\"25%\"><b>$la_ship_by_order_if $ship_amount_base </b></td> <td width=\"25%\">&nbsp;</td> <td width=\"25%\">&nbsp;</td> <td width=\"25%\">&nbsp;</td></tr>

  <tr bgcolor=\"$colour_3\">

    <td width=\"25%\" valign=\"top\" align=\"center\">$la_ship_by_order_add</td>

    <td width=\"25%\" valign=\"top\" align=\"center\">$currency<input class=\"textbox\" type=\"textbox\" size=\"6\" name=\"ship_amount_up\" value=\"$ship_amount_up\"><font color=\"990000\"><b>*</b></font></td>

    <td width=\"25%\" valign=\"top\" align=\"center\">$la_ship_by_order_next</td>

    <td width=\"25%\" valign=\"top\" align=\"center\">$currency<input class=\"textbox\" type=\"textbox\" size=\"6\" name=\"ship_amount_up_base\" value=\"$ship_amount_up_base\"><font color=\"990000\"><b>*</b></font></td>

  </tr>

  </td>

</table>

<center><INPUT class=\"submit\" name=\"submit\" TYPE=\"submit\" VALUE=\"$la_ship_save_changes\">";

echo"</td></tr></table><br></form>";

}

include_once ("footer.inc.php");

}// end if session is registered

?>

7

go to your admin ,select Settings/Shipping by total order sum to edit the values

back-up your old files first

if you find any bugs, repport them here, if there are no bugs...

a small thank-you would be apriciated ! :D

Stijn

Ok, I looked over this and it seems cut and dry. I have 2 questions. How do I do step 4 that says: Run SQL queries on your cubecart database. Do I copy and paste that code somewhere? What does that mean to this layman. I think the other parts I can handle.

The other question I have is will these steps overwrite the shipping mod I installed before that does shipping cost on each product?

Link to comment
Share on other sites

  • 2 weeks later...

I would love the shipping to work like this:

for 1-4 items

UK orders: Free

1. Flat rate for normal delivery to a country

2. Flat rate for Express Delivery to a country

for 5-9 items

UK orders: Free

1. Flat rate for normal delivery to a country

2. Flat rate for Express Delivery to a country

for 10-19 items

UK orders: Free

1. Flat rate for normal delivery to a country

2. Flat rate for Express Delivery to a country

for 19+ items

UK orders: Free

1. Flat rate for normal delivery to a country

2. Flat rate for Express Delivery to a country

I am selling records so weight is not much of an issue

Link to comment
Share on other sites




×
×
  • Create New...