Jump to content

Instock mod Final


Guest stijnj

Recommended Posts

To an extent...The problem is it is not subtracting from inventory...If I have 5 of something and I go and buy 3, and complete check out,for the next person it should say I have 2....Yet it doesn't says that I have 5 still.

The canceling of the order is working fine.

have you modified secure.php correct?

in that file the stock will get adjusted

Link to comment
Share on other sites

hi again :w00t:

when i try open orders, from admin i get :

Parse error: parse error, unexpected $ in /home/fashionc/public_html/admin/orders.php on line 543

the code in orders.php is:

540 }// end if task !==order

541 include_once ("footer.inc.php");

542 } // end if session is registered

543 ?>

Where is the problem? pls help.

thanks & greetings

Link to comment
Share on other sites

now the order page can open, buy i only view the last order and get this error:

Warning: mysql_fetch_array(): 11 is not a valid MySQL result resource in /home/gpr/public_html/admin/orders.php on line 437

<?php

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

*  File Info: admin/orders.php

*  Purpose:  Display Orders

*  Updated:  31/07/2003

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

*  Developer: Alistar Brookbanks (Brooky.com)

*  Copyright: ©2003 http://www.brooky.com

* Copyright: ©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 "© 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]

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

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");

//Wen clicked cancel order

//we re-add the quantity of stock

//order status set to 'declined'

//'cancel order' button disappears for this order

// let's go...

if($can==1){

$sql_select = mysql_query( "select * from ".$prefix."store_order_inv where cart_order_id='$order_id'");

$totalrows = mysql_num_rows($sql_select);

        while ($row = mysql_fetch_array($sql_select)){

        $product=$row["product"];

        $quantity=$row["quantity"];

$select_prod = mysql_query( "SELECT * FROM ".$prefix."store_inventory WHERE product='$product'");

$totalrows = mysql_num_rows($select_prod);

        while ($row = mysql_fetch_array($select_prod))

        $instock = $row["instock"];

        $new_ins = $instock + $quantity;

        $sql_update = "update ".$prefix."store_inventory set instock='$new_ins' where product='$product'";

        $result = mysql_query ($sql_update);

        $sql_update2 = "update ".$prefix."store_order_sum set status='4',cancel='1' where cart_order_id='$order_id'";

        $result = mysql_query ($sql_update2);

}//end while

}//end cancel order function

if ($type==1){$txtstatus="$la_order_pending";}

if ($type==2){$txtstatus="$la_order_await_ship";}

if ($type==3){$txtstatus="$la_order_shipped";}

if ($type==4){$txtstatus="$la_order_declined";}

else{

$all = 1;

$txtstatus="$la_all";

}

echo"<h2>$la_orders_title - ($txtstatus)</h2>";

if($updated==Y){

echo"<p align=\"center\">$la_ord_updated</p>";}

if($task=="order"){

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

if($save)

{

mysql_query("update ".$prefix."store_order_sum set comments='$comments', status='$status', ship_date='$ship_date' where cart_order_id='$order_id'");

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

if ($status==1){$txtstatus="$la_order_pending";}

if ($status==2){$txtstatus="$la_order_await_ship";}

if ($status==3){$txtstatus="$la_order_shipped";}

if ($status==4){$txtstatus="$la_order_declined";}

// send email about status change to customer

$subject = "$la_ord_status_tit - $order_id";

$message = "$la_ord_status_email '$txtstatus'$la_ord_status_email2\r\n\n";

if(!empty($staff_comments)){

$message .= "$la_staff_comments_mail\n";

$message .= "~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n$staff_comments\n\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";}

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

if($inform_customer=="Y"){

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

}

// view order content

// find all order records from database

$sql_select = mysql_query( "select * from ".$prefix."store_order_sum where cart_order_id='$order_id'");

$totalrows = mysql_num_rows($sql_select);

if(empty($order_id)){echo"<br><br><p align=\"center\">$la_orders_acident</p>";}

if($totalrows==0){echo"<br><br><p align=\"center\">$la_order_no_exist</p>";}

if($totalrows!==0){   

while ($row = mysql_fetch_array($sql_select)){

  $order_id=$row["cart_order_id"];

  $status=$row["status"];

  $time=$row["time"];

          $year=substr($row["date"],0,2);

            $month=substr($row["date"],2,2);

            $day=substr($row["date"],4,2);

            $prod_total=$row["prod_total"];

  $name_d=$row["name_d"];

  $add_1_d=$row["add_1_d"];

  $add_2_d=$row["add_2_d"];

  $town_d=$row["town_d"];

  $county_d=$row["county_d"];

  $postcode_d=$row["postcode_d"];

  $country_d=$row["country_d"];

  $name=$row["name"];

  $email=$row["email"];

  $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"];

  $total_tax=$row["total_tax"];

  $total_ship=$row["total_ship"];

  $prod_total=$row["prod_total"];

  $subtotal=$row["subtotal"];

  $ip=$row["ip"];

  $sec_order_id=$row["sec_order_id"];

  $ship_date=$row["ship_date"];

  $comments=$row["comments"];

  $gateway=$row["gateway"];

  $customer_comments=$row["customer_comments"];

            $customer_comments = stripslashes($customer_comments);

  if(empty($customer_comments)){

  $customer_comments = $la_cust_no_coms;}

           

            }// end while

  if($date_style=="0")

    {

  $date="$month/$day/$year";}

  // EU date format

  if($date_style=="1")

    {

  $date="$day/$month/$year";}

 

         

  if ($status==1){$txtstatus="$la_order_pending";$pay_status="$la_order_wait_conf";}

  if ($status==2){$txtstatus="$la_order_await_ship";$pay_status="$la_order_confirmed";}

  if ($status==3){$txtstatus="$la_order_shipped";$pay_status="$la_order_confirmed";}

  if ($status==4){$txtstatus="$la_order_declined";$pay_status="$la_order_notrecieved";}

 

  echo"<br><br><table align=\"center\" bgcolor=\"$colour_1\" valign=\"top\" width=\"90%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">

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

    <table cellpadding=\"2\" cellspacing=\"1\" valign=\"top\" width=\"100%\" align=\"center\">

      <tr bgcolor=\"$colour_1\" height=\"20\">

      <td background=\"../images/bevel_bg.gif\" colspan=\"2\"><b>$la_your_orders_no - $order_id</b></td>";

 

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

            <td valign=\"top\" width=\"33%\" align=\"left\"><b>$la_dispatch_add</b><br>$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><br><b>$la_status</b><br>$txtstatus<br><br><b>$la_order_recieved</b><br>$date $la_at $time<br><br><b>$la_order_ip</b><br>";

  if($ip!==$la_search_na) // makes sure theres no n/a as ip if english

    { 

    echo"<a href=\"http://www.nic.com/cgi-bin/whois.cgi?query=$ip\" target=\"_blank\">$ip</a>";

    }

    if($ip==$la_search_na) // makes sure theres no n/a as ip if english

    { 

    echo"$ip";

    }

    echo"</td>

            <td valign=\"top\" align=\"left\">";

 

  echo"<table width=\"100%\" bgcolor=\"$colour_1\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">

    <tr>

      <td valign=\"top\" align=\"left\"><b>$la_items_ordered</b><br><br></td>

        <td valign=\"top\" width=\"100\" align=\"left\"><b>$la_store_price</b><br><br></td>

    </tr>";

        // select order items

    $sql_select = mysql_query( "select * from ".$prefix."store_order_inv where cart_order_id='$order_id'");

                    $totalrows = mysql_num_rows($sql_select);

   

    while ($row = mysql_fetch_array($sql_select)){

    $title=$row["title"];

    $quantity=$row["quantity"];

    $price=$row["price"];

    $product=$row["product"];

   

    $totalprice=$price*$quantity;

    $product_options=$row["product_options"];

    $title = stripslashes($title);

    $totalprice = number_format($totalprice, 2);

    $price = number_format($price, 2);

    echo"<tr>

      <td valign=\"top\" align=\"left\"><li><a href=\"../view_product.php?product=$product\" target=\"_self\">$title</a> ($la_quantity $quantity) [$la_inv_prod_id = $product]</li><br>";

      if(!empty($product_options)){

      $product_options = nl2br($product_options);

      $product_options = stripslashes($product_options);

      echo"<ol>$product_options</ol>";}

      echo"<br><br></td>

      <td valign=\"top\" align=\"right\">

      <table align=\"right\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">

    <tr>

    <td align=\"left\" width=\"100\">$currency$totalprice</td>

    </tr>

    </table></td>

    </tr>";

    }// end while

   

 

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

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

//payment info

echo"<br><br><table align=\"center\" bgcolor=\"$colour_1\" valign=\"top\" width=\"90%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">

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

    <table cellpadding=\"2\" cellspacing=\"1\" valign=\"top\" width=\"100%\" align=\"center\">

      <tr bgcolor=\"$colour_1\" height=\"20\">

      <td background=\"../images/bevel_bg.gif\" colspan=\"2\"><b>$la_payment_info</b></td>";

 

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

            <td valign=\"top\" width=\"33%\" align=\"left\"><b>$la_order_inv_add</b><br>$name<br>$add_1<br>";if(!empty($add_2)){echo"$add_2<br>";}echo"$town<br>$county<br>$postcode<br>$country<br>$la_cust_phone: $phone<br><br><b>$la_pay_method</b><br>$gateway<b><br><br>$la_view_orders_payment</b><br> $pay_status</td>

            <td valign=\"top\" align=\"right\">

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

    <tr>

    <td><b>$la_view_orders_items_sub</b></td>

    <td width=\"100\">$currency$subtotal</td>

    </tr>

    <tr>

      <td><b>$la_order_bask_pap&nbsp;&nbsp;</b></td>

      <td width=\"100\">$currency$total_ship</td>

    </tr>

    <tr>

      <td><b>$la_order_bask_tax ($site_tax%):</b></td>

      <td width=\"100\">$currency$total_tax</td>

    </tr>

    <tr>

      <td></td>

      <td width=\"100\">---------------</td>

    </tr>

    <tr>

      <td><b>$la_view_orders_grand_tot</b></td>

      <td width=\"100\"><b>$currency$prod_total</b></td>

    <tr>

      <td></td>

      <td width=\"100\">---------------</td>

    </tr>

    </tr>

    </table><br>

 

    </td></tr>

    <tr><td bgcolor=\"$colour_1\" colspan=\"2\" align=\"left\" valign=\"top\"><b>$la_view_cust_comms</b><br><br>\"$customer_comments\"</td></tr>";

   

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

    echo"<form method=\"post\" name=\"orders\" action=\"orders.php?task=order&order_id=$order_id&save=yes&email=$email\">

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

    <tr>

      <td valign=\"top\"><b>$la_shipping_date</b><br>";

if($date_style=="0")

    {

  echo"(MM/DD/YYYY)";}

  // EU date format

  if($date_style=="1")

    {

  echo"(DD/MM/YYYY)";}

echo"</td>

      <td><input type=\"text\" name=\"ship_date\" class=\"textbox\" value=\"$ship_date\"><input type=\"checkbox\" name=\"shippedtoday\" value=\"Y\" onClick=\"java script:setToToday();\">$la_ship_today<br><br></td>

    </tr>

<tr>

      <td><b>$la_ord_mod_status</b></td>

      <td><select name=\"status\" >

        <option value=\"1\"";if($status==1){echo "selected";}echo">$la_ord_await_pay_conf</option>

  <option value=\"2\"";if($status==2){echo "selected";}echo">$la_ord_pay_conf</option>

  <option value=\"3\"";if($status==3){echo "selected";}echo">$la_ord_shipped</option>

  <option value=\"4\"";if($status==4){echo "selected";}echo">$la_ord_decl</option>

  </select><br><br></td>

    </tr>

    <tr>

      <td valign=\"top\">$la_ord_comments</td>

      <td><textarea name=\"comments\" cols=\"50\" rows=\"4\" value=\"$comments\">$comments</textarea><br><br></td>

    </tr>

<tr>

      <td valign=\"top\">$la_inform_customer</td>

      <td><input name=\"inform_customer\" type=\"checkbox\" id=\"inform_customer\" value=\"Y\" checked><br><br></td>

    </tr>

<tr>

      <td valign=\"top\">$la_staff_comments</td>

      <td><textarea name=\"staff_comments\" cols=\"50\" rows=\"4\" value=\"$comments\"></textarea><br><br></td>

    </tr>

    <tr>

      <td>&nbsp;</td>

      <td>

  <input type=\"submit\" class=\"submit\" value=\"$la_save\"><input type=\"button\" class=\"submit\" name=\"note\" value=\"$la_ord_save_print\" onClick=\"MM_openBrWindow('print_order.php?order_id=$order_id','image','width=600,height=400,scrollbars=yes,resizable=yes')\"></td>

    </tr>

  </table>

";

}//end if no rows

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

}// end order content

// default page content

if($task!=="order"){

if($all !==1){$where ="where status='$type'";}

$sql_count = "select * from ".$prefix."store_order_sum $where";

$result_count = mysql_query ($sql_count);

$total = mysql_num_rows($result_count);

if ($total==0){

echo "<p align=\"center\">$la_curr_no_ords - ($txtstatus)</p>";

include ("footer.inc.php");

exit;}

if (empty($ddlimit)){$ddlimit=25;}

echo "<p>$la_ord_total_orders $total</p>";

echo"<form action=\"orders.php?type=$type\" method=\"post\"><table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr align=\"right\"><input type=\"hidden\" value=\"$searchStr\" name=\"searchStr\">

    <td align=\"right\">$la_cust_view <select name=\"ddlimit\" >

<option value=\"5\" ";if($ddlimit==5){echo "selected";}echo">5</option>

<option value=\"10\" ";if($ddlimit==10){echo "selected";}echo">10</option>

<option value=\"25\" ";if($ddlimit==25){echo "selected";}echo">25</option>

<option value=\"50\" ";if($ddlimit==50){echo "selected";}echo">50</option>

<option value=\"100\" ";if($ddlimit==100){echo "selected";}echo">100</option>

</select> $la_cust_res_per_page <input type=\"submit\" class=\"submit\" value=\"$la_go\"></div></form></td>

</form><form action=\"orders.php?search=yes&ddlimit=$ddlimit&type=$type\" method=\"post\"><tr><td align=\"right\">$la_ord_order_id <input type=\"text\" class=\"textbox\" name=\"searchStr\">&nbsp;<input type=\"submit\" class=\"submit\" value=\"$la_search_ex\"></td>

</tr></table></form>";

// set limit value for number of records to be shown per page

// query database to find total number of records to display

$limit = $ddlimit;

$searchStr = str_replace(" ", "",$searchStr);

if(!empty($type)){

$query_count = " SELECT * FROM ".$prefix."store_order_sum where status=$type and (cart_order_id like '%$searchStr%')";}

else{

$query_count = " SELECT * FROM ".$prefix."store_order_sum where(cart_order_id like '%$searchStr%')";}

$result_count = mysql_query($query_count);

$totalrows = mysql_num_rows($result_count);

if(empty($page))

$page = 1;

$limitvalue = $page * $limit - ($limit);

if(!empty($type)){

if($search!=="yes"){

$query = "SELECT * FROM ".$prefix."store_order_sum where status=$type order by date desc LIMIT $limitvalue, $limit";}

if($search=="yes"){

$query = "SELECT * FROM ".$prefix."store_order_sum where status=$type and (cart_order_id like '%$searchStr%') order by date desc LIMIT $limitvalue, $limit";}}

else{

if($search!=="yes"){

$query = "SELECT * FROM ".$prefix."store_order_sum order by date desc LIMIT $limitvalue, $limit";}

if($search=="yes"){

$query = "SELECT * FROM ".$prefix."store_order_sum where (cart_order_id like '%$searchStr%') order by date desc LIMIT $limitvalue, $limit";}}

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

$count_result = mysql_num_rows($result);

if((mysql_num_rows($result) == 0)){

if($search!=="yes"){

echo("<p align=\"center\"><br>$la_ord_no_orders_ap</p><br>"); }

if($search=="yes"){

echo("<p align=\"center\"><br>$la_no_ord_match \"<b>$searchStr</b>\"!<br><br><a href=\"orders.php?type=$type\" target=\"_self\">$la_cust_reset</a></p>"); }}

if((mysql_num_rows($result) > 0)){

if($search=="yes"){

echo("<p align=\"center\"><br>$la_orders_match \"<b>$searchStr</b>\"!</p><br>"); }}

// Display links at the bottom to indicate current page and number of pages displayed

$numofpages = ceil($totalrows / $limit);

$from=$limit*$page-$limit+1;

$to=$from + $count_result-1;

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

            <tr><td width=\"50%\" bgcolor=\"$bg_colour\" align=\"left\">";if($numofpages>1){echo"$la_store_showing $from - $to</td><td width=\"50%\" bgcolor=\"$bg_colour\" align=\"right\"><b>$la_store_go_to_page</b> ($numofpages) ";}

$upper_limit = $page + 3;

$lower_limit = $page - 2;

if($page != 1){

$pageprev = $page - 1;

echo("<a href=\"$PHP_SELF?page=1&ddlimit=$ddlimit&searchStr=$searchStr&type=$type\">$la_store_prev</a>&nbsp;");

$lower_dots = $page - $lowerlimit;

if($lower_dots > 3){

echo("...");}

for($i = 1; $i <= $numofpages; $i++){

if($numofpages>1){

if($i == $page){

echo("&nbsp;<b>[".$i."]</b>&nbsp;");}

if(($i != $page)&&($i < $upper_limit)&&($i >= $lower_limit)){

echo("&nbsp;<a href=\"$PHP_SELF?page=$i&ddlimit=$ddlimit&searchStr=$searchStr&type=$type\">$i</a>&nbsp;");}

}}

$upper_dots = $numofpages - 2;

if($page < $upper_dots){

echo("...&nbsp;");}

if(($totalrows - ($limit * $page)) > 0){

$pagenext = $page + 1;

echo("&nbsp;<a href=\"$PHP_SELF?page=$pagenext&ddlimit=$ddlimit&searchStr=$searchStr&type=$type\">$la_store_next</a>");

}

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

if($count_result>0){

echo"<table align=\"center\" bgcolor=\"$colour_1\" width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">

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

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

  <tr bgcolor=\"$colour_1\" align=\"center\" height=\"20\" background=\"../images/bevel_bg.gif\">

  <td align=\"center\" height=\"20\" background=\"../images/bevel_bg.gif\" nowrap><b>$la_your_orders_no</b></td>

  <td align=\"center\" height=\"20\" background=\"../images/bevel_bg.gif\" nowrap><b>$la_your_orders_status</b></td>

  <td align=\"center\" height=\"20\" background=\"../images/bevel_bg.gif\" nowrap><b>$la_your_orders_time</b></td>

  <td align=\"center\" height=\"20\" background=\"../images/bevel_bg.gif\" nowrap><b>$la_customer_sing</b></td>

  <td align=\"center\" height=\"20\" background=\"../images/bevel_bg.gif\" nowrap><b>$la_ord_ip_cus</b></td>

  <td align=\"center\" height=\"20\" background=\"../images/bevel_bg.gif\" nowrap><b>$la_order_total</b></td>

  <td align=\"center\" height=\"20\" background=\"../images/bevel_bg.gif\" nowrap><b>$la_doc_action</b></td>

  </tr>";}

$bgcolour=$colour_3;

while($row = mysql_fetch_array($result)){

  $order_id=$row["cart_order_id"];

  $status=$row["status"];

  $email=$row["email"];

  $time=$row["time"];

          $year=substr($row["date"],0,2);

            $month=substr($row["date"],2,2);

            $day=substr($row["date"],4,2);

            $prod_total=$row["prod_total"];

  $gateway=$row["gateway"];

  $ip=$row["ip"];

  // US date format

 

  if($date_style=="1")

    {

  $date="$month/$day/$year";}

  // EU date format

  if($date_style=="0")

    {

  $date="$day/$month/$year";}

 

  if ($bgcolour ==$colour_3){

    $bgcolour =$colour_4;}

  elseif ($bgcolour ==$colour_4){

    $bgcolour =$colour_3;}

 

      if ($status==1){$status="$la_ord_qed";}

  if ($status==2){$status="$la_ord_incom";}

  if ($status==3){$status="$la_ord_comp";}

  if ($status==4){$status="$la_ord_dec";}

 

  $query = mysql_query ("select name from ".$prefix."store_customer where email='$email'");

  while ($row = mysql_fetch_array($query))

      {

  $name=$row["name"];

  }

  echo"

  <tr bgcolor=\"$bgcolour\">

    <td align=\"center\"><a href=\"orders.php?task=order&order_id=$order_id&type=$type\" target=\"_self\">$order_id</a><br>$gateway</td>

    <td align=\"center\">$status</td>

    <td align=\"center\">$date $time</td>

    <td align=\"center\">$name<br><a href=\"mailto:$email\">$email</a></td>

    <td align=\"center\">";

    if($ip!==$la_search_na) // makes sure theres no n/a as ip if english

    { 

    echo"<a href=\"http://www.nic.com/cgi-bin/whois.cgi?query=$ip\" target=\"_blank\">$ip</a>";

    }

    if($ip==$la_search_na) // makes sure theres no n/a as ip if english

    { 

    echo"$ip";

    }echo"</td>

<td align=\"center\">$currency$prod_total</td>

<td align=\"center\"><a href=\"java script:decision('$la_ord_deleted_conf',

'orders.php?order_id=$order_id&del=1')\">$la_inv_del</a>/<a href=\"orders.php?task=order&order_id=$order_id&type=$type\" target=\"_self\">$la_cust_view</a>";

$sql_select = mysql_query( "select * from ".$prefix."store_order_sum where cart_order_id='$order_id'");

$totalrows = mysql_num_rows($sql_select);

while ($row = mysql_fetch_array($sql_select)){

$order_id=$row["cart_order_id"];

$cancel=$row["cancel"];}

if($cancel==0){

echo"<a href=\"java script:decision('$la_ord_cancel_conf',

'orders.php?order_id=$order_id&can=1')\">/$la_order_cancelled</a>";}

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

/////// end cancel orders button}

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

// Display links at the bottom to indicate current page and number of pages displayed

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

            <tr><td width=\"50%\" bgcolor=\"$bg_colour\" align=\"left\">";if($numofpages>1){echo"$la_store_showing $from - $to</td><td width=\"50%\" bgcolor=\"$bg_colour\" align=\"right\"><b>$la_store_go_to_page</b> ($numofpages) ";}

$upper_limit = $page + 3;

$lower_limit = $page - 2;

if($page != 1){

$pageprev = $page - 1;

echo("<a href=\"$PHP_SELF?page=1&ddlimit=$ddlimit&searchStr=$searchStr&type=$type\">$la_store_prev</a>&nbsp;");

$lower_dots = $page - $lowerlimit;

if($lower_dots > 3){

echo("...");}

for($i = 1; $i <= $numofpages; $i++){

if($numofpages>1){

if($i == $page){

echo("&nbsp;<b>[".$i."]</b>&nbsp;");}

if(($i != $page)&&($i < $upper_limit)&&($i >= $lower_limit)){

echo("&nbsp;<a href=\"$PHP_SELF?page=$i&ddlimit=$ddlimit&searchStr=$searchStr&type=$type\">$i</a>&nbsp;");}

}}

$upper_dots = $numofpages - 2;

if($page < $upper_dots){

echo("...&nbsp;");}

if(($totalrows - ($limit * $page)) > 0){

$pagenext = $page + 1;

echo("&nbsp;<a href=\"$PHP_SELF?page=$pagenext&ddlimit=$ddlimit&searchStr=$searchStr&type=$type\">$la_store_next</a>");

}

mysql_free_result($result);

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

}// end if task !==order

include_once ("footer.inc.php");

}}// end if session is registered

?>

Link to comment
Share on other sites

1

have you added a row 'cancel' to your db table store_order_sum ?

2

you have deleted

if($del==1){



$del = mysql_query("delete from ".$prefix."store_order_sum where cart_order_id  = '$order_id'");

$del = mysql_query("delete from ".$prefix."store_order_inv where cart_order_id  = '$order_id'");

echo"<br><br><p align=\"center\">$la_ord_deleted</p><br>";

}

in your file

please read the install instructions carefull !!

Link to comment
Share on other sites

Guest Ian MacMillan

Is there anyway we can add wildcards to this? I have lots of products that are inventory based, but there are some that are always avilable because they are custom, but are not downloads. Is there a way to make them always avail without having to keep updating the inventory?

Link to comment
Share on other sites

With this mod is there anyway that the admin can look at a glance ALL products and their stock levels?

My client wants to be able to review what his stock is at anytime rather than maintain a seperate database elsewhere.

Neil :whistle:

Link to comment
Share on other sites

Hi guys i have installed instock it is great mod and working great but i want some change in it and need some help . we have 1 in our inventory is showing out of product table and under it can i make it show inside the table and beside the product code.Hope i have explained well there Thanks

problem has been resolved !

Edited by stijnj
Link to comment
Share on other sites

@netmotive8

My client wants to be able to review what his stock is at anytime rather than maintain a seperate database elsewhere.

on the inventory page there is a column displaying the instock per product

Link to comment
Share on other sites

Guest Couttsy

Hi all,

Please bear with me as I am new to this software. I have tried editing the files as reqd in instock mod but keep getting errors. Is it possible to obtain the files needed so I can just upload and replace. Can anyone point me to a place/person that offers this service. I have installed 2.0.3 version. Can someone help?

Link to comment
Share on other sites

Hi guys  i have installed instock it is great mod and working great but i want some change in it and need some help . we have 1 in our inventory is showing out of product table and under it can i make it show inside the table and beside the product code.Hope i have explained well there Thanks

problem has been resolved !

i need help to we have 1 in our inventory to show beside product code Thanks

Link to comment
Share on other sites

Guest Couttsy

Ok, I have managed to edit the files but get the following error:

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/USERNAME/public_html/thestore/admin/add_product.php on line 213

when I try to add a product in admin.

Can someone help?

Link to comment
Share on other sites

THIS DOWNLOAD HAS NOW BEEN FIXED AND UPADTED TO THE AUTHORS LATEST VERSION - Stijnj

This topic replaces all privious topics concerning the instock mod

Name: instock mod.zip

Version: 1.0

Author: Bill Whitmire

Short Description: Auto instock update Mod with extras

Long Description:

1. This will let you, in your add_product.php and edit_product.php enter in a in stock amount for that product.

2. When a customer is on the view_product.php page it will show a in stock

3. If the in stock in at 0 the add to cart button will display OUT OF STOCK and they cant click it.

4. If it is in stock and they try to add more to the quantity then what is in stock for that item on the view_cart.php page the in stock coloum will display the in stock amount in red for that product and the quantity will default to the in stock amount. So they cant order more then what you have.

5. When the go to check out after the click Check Out your in stock amount will subtract the quantity they purchased therfore updating automaticly

---------------------------

as of 28 01 2005 this mod is updated :

- BEFORE INSTALLING TAKE TIME TO READ THE README.txt !!! (included in the

zipfile)

- all typos are gone

- compatible with Cubecart V2.0.0 / V2.0.1 / V2.0.2 / V2.0.3

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

grab the instock mod here

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

The download link on that post seems to link to an old version of instock mod not the modified/fixed version.

Please clarify. Where can i get hold of the latest version?

Neil :P

Link to comment
Share on other sites

Guest cikopajo

Instock mod Security Problem reported by magicexpress :

When you go to the product that is out of stock and you click on the quantity box, and then press enter...it goes to checkout with the final price being $0.00!!! Meaning that if you have a download mod or somthing....they will get your item for free.

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

to solve this matter :

open header.inc.php

find

<style type="text/css">

        <!--

                @import url(<?echo"$site_url";?>/admin/style.css);

        -->

</style>




add below




<script type="text/javascript">



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

* Disable "Enter" key in Form script- By Nurul Fadilah([email protected])

* This notice must stay intact for use

* Visit http://www.dynamicdrive.com/ for full source code

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



function handleEnter (field, event) {

                var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;

                if (keyCode == 13) {

                        var i;

                        for (i = 0; i < field.form.elements.length; i++)

                                if (field == field.form.elements[i])

                                        break;

                        i = (i + 1) % field.form.elements.length;

                        field.form.elements[i].focus();

                        return false;

                }

                else

                return true;

        }



</script>






open view_product.php



find




<td height=\"30\" align=\"right\" valign=\"middle\" background=\"images/grey_bev.gif\">$la_order_quan: <INPUT TYPE=\"text\" class=\"textbox\" size=\"3\" value=\"1\" name=\"quan\">






replace with




<td height=\"30\" align=\"right\" valign=\"middle\" background=\"images/grey_bev.gif\">$la_order_quan: <INPUT TYPE=\"text\" class=\"textbox\" size=\"3\" value=\"1\" name=\"quan\" onkeypress=\"return handleEnter(this, event)\"><br>






now the enterkey is disabled, tested in Internet Explorer , Mozilla, Firefox,Opera



* javascript found at www.dynamicdrive.com *
i can not find your code.... i have only this in view_product.php

<?php

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

*   File Info: admin/view_product.php 

*   Purpose:   View Particular Product

*   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] 

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

session_start();

// Redirect user to request page on successful authentication

  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_vp_title</h2>";



if ((!$edit) or(!del)){



$sql_select = "select * from ".$prefix."store_inventory where product ='$product'";

$result = mysql_query($sql_select);

$count = mysql_num_rows($result);



if($count==0){

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

}

if($count>0){

while ($row = mysql_fetch_array($result))

      {

          $title = $row["title"];

          $product = $row["product"];

    $description = $row["description"];

          $quantity = $row["quantity"];

          $price = $row["price"];

    $image = $row["image"];



    }

$title = stripslashes($title);

$description=stripslashes($description);

$description = nl2br($description);

echo "<FORM ACTION=\"edit_product.php?product=$product\" METHOD=\"POST\">

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

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

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

  <tr bgcolor=\"$colour_3\">

    <td width=\"200\" valign=\"top\"><b>$la_title</b></td>

    <td width=\"400\" valign=\"top\">$title</td>

  </tr>

  <tr bgcolor=\"$colour_3\">

	<td width=\"200\" valign=\"top\"><b>$la_prod_stock</b></td>

	<td width=\"400\" valign=\"top\">$product</td>

  </tr>

  <tr bgcolor=\"$colour_3\">

    <td width=\"200\" valign=\"top\"><b>$la_description</b></td>

    <td width=\"400\" valign=\"top\">$description</td>

  </tr>

  <tr bgcolor=\"$colour_3\">

    <td width=\"200\" valign=\"top\"><b>$la_quantity</b></td>

    <td width=\"400\" valign=\"top\">$quantity</td>

  </tr>

  <tr bgcolor=\"$colour_3\">

    <td width=\"200\" valign=\"top\"><b>$la_store_price ($currency):</b></td>

    <td width=\"400\" valign=\"top\">$price</td>

  </tr>

  <tr bgcolor=\"$colour_3\">

    <td width=\"200\" valign=\"top\"><b>$la_prod_image</b></td>

    <td width=\"400\" valign=\"top\"><img src=\"../images/$image\"></td>

  </tr>

  <tr bgcolor=\"$colour_3\">

    <td width=\"200\" valign=\"top\"><b>$la_prod_url</b> [ <a href=\"$site_url/view_product.php?product=$product\" target=\"_blank\" >$la_cust_view</a> ]</td>

    <td width=\"400\" valign=\"top\"><textarea name='code' cols='55' rows='3'>$site_url/view_product.php?product=$product</textarea></td>

  </tr>

   <tr bgcolor=\"$colour_3\">

    <td width=\"200\" valign=\"top\">&nbsp;</td>

    <td width=\"400\" valign=\"top\"><INPUT class=\"submit\" TYPE=\"submit\" VALUE=\"$la_edit_prod_title\"><INPUT class=\"submit\" TYPE=\"button\" name=\"del\" VALUE=\"$la_vp_del_prod\" onclick=\"javascript:decision('$la_vp_del_warn',

'inventory.php?product=$product&del=1&image=$image')\"></td>

  </tr>

</table>

</td></tr></table>

   </form>";



}



}

include ("footer.inc.php");

} // end if session is registered

?>
Link to comment
Share on other sites

Guest cikopajo

Instock mod Security Problem reported by magicexpress :

When you go to the product that is out of stock and you click on the quantity box, and then press enter...it goes to checkout with the final price being $0.00!!! Meaning that if you have a download mod or somthing....they will get your item for free.

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

to solve this matter :

open header.inc.php

find

<style type="text/css">

        <!--

                @import url(<?echo"$site_url";?>/admin/style.css);

        -->

</style>




add below




<script type="text/javascript">



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

* Disable "Enter" key in Form script- By Nurul Fadilah([email protected])

* This notice must stay intact for use

* Visit http://www.dynamicdrive.com/ for full source code

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



function handleEnter (field, event) {

                var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;

                if (keyCode == 13) {

                        var i;

                        for (i = 0; i < field.form.elements.length; i++)

                                if (field == field.form.elements[i])

                                        break;

                        i = (i + 1) % field.form.elements.length;

                        field.form.elements[i].focus();

                        return false;

                }

                else

                return true;

        }



</script>






open view_product.php



find




<td height=\"30\" align=\"right\" valign=\"middle\" background=\"images/grey_bev.gif\">$la_order_quan: <INPUT TYPE=\"text\" class=\"textbox\" size=\"3\" value=\"1\" name=\"quan\">






replace with




<td height=\"30\" align=\"right\" valign=\"middle\" background=\"images/grey_bev.gif\">$la_order_quan: <INPUT TYPE=\"text\" class=\"textbox\" size=\"3\" value=\"1\" name=\"quan\" onkeypress=\"return handleEnter(this, event)\"><br>






now the enterkey is disabled, tested in Internet Explorer , Mozilla, Firefox,Opera



* javascript found at www.dynamicdrive.com * 
I try your script... hmmm now i f... up something ..please help ..my shop is not working... www.kite-forum.com/shop/

<?php/*************************************************************************** *	File Info: header.inc.php *	Purpose:   Header For Webpage *	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] ***************************************************************************/// update site hits for statsinclude("hits.php");?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><HTML><head><title><?echo "$site_name";?></title><meta http-equiv='Content-Type' content='text/html; charset=<?php echo $charset; ?>'><style type="text/css">	<!--  @import url(<?echo"$site_url";?>/admin/style.css);	--></style>



<script language="JavaScript" type="text/javascript">	setTimeout ("changePage()", 0);function changePage()	{  if (self.parent.frames.length != 0)  self.parent.location=document.location;	}</script></head><BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="<?echo$bg_colour;?>"<?// used for secure.php to autosubmit form dataif($url=="secure"){	echo"onLoad='document.SecureForm.submit();'";	}?>><form action ="search.php" method="post">	<table width='100%' height='100%' align='center' border='0' cellspacing='0' cellpadding='0'>  <tr height='80' width='100%'> 	 <td valign='top' height='80' width='100%' align='center'>    <table width='100%' height='80' valign='top' align='center' border='0' cellspacing='0' cellpadding='0'>   	 <tr height='80'>      <td align='left' height="80" width="100%" background="<?echo"$site_url/";?>images/store_logo_bg.jpg"><a href="<?echo"$site_url/index.php";?>"><img src="<?echo"$site_url/";?>images/store_logo.gif" alt="<?echo"$la_powered_by_cc";?>" border="0"></a></td>      <td align="right" valign="bottom" width='220' height="80" background="<?echo"$site_url/";?>images/store_logo_bg.jpg">              <!-- start buttons & search -->     	 <table width="220" height="80" border="0" cellspacing="0" cellpadding="0">        <tr width="220" valign="middle" align="right">       	 <td width="110" colspan="2" valign="middle" align="right">                    <!-- start search table -->          <table valign='top' width="110" align='right' valign='middle' height='56' border="0" cellspacing="0" cellpadding="0">         	 <tr align='right'>            <td height='56' align="center"><b><?echo$la_header_search?></b>&nbsp;</td>            <td height='56' align="center"><input name="search" class="textbox" type="text" size="15" maxlength="60"></td>            <td height='56' align="center">&nbsp;<input type="submit" class="submit" value='<?echo$la_go;?>' border="0" name="submit"></td>         	 </tr>          </table>          <!-- end search table -->       	 </td>        </tr>     	 <tr width="220">        <td width="110" align="center" height="24" background="<?echo"$site_url/";?>images/tab.gif" style='cursor:hand;' onclick='window.external.AddFavorite(location.href,document.title);'><a href='#' target='_self'><font class='wht_btn'><?echo$la_add_favorites?></font></a></td>        <td width="110" align="center" height="24" background="<?echo"$site_url/";?>images/tab.gif" style='cursor: hand;' onClick="location.href='control_panel.php'"><a href='control_panel.php' target='_self'><font class='wht_btn'><?echo$la_your_account?></font></a></td>     	 </tr>      </table>      <!-- end buttons & search -->   	 </td>    </tr> 	 </table><?if(($page!=="order")&&($online!=="N"))	{  //display welcome is session is not registered  if (!session_is_registered("valid_user")) 	 {    echo$la_welcome_geust; 	 }  //display welcome is session is registered  if (session_is_registered("valid_user")) 	 {    $sql_select = mysql_query( "select * from ".$prefix."store_customer where email='$valid_user'");    while ($row = mysql_fetch_array($sql_select))   	 {      $user_name = $row["name"];   	 }   	 echo"<b>$la_welcome_member $user_name</b> $la_welcome_tools"; 	 }  }//end if(($page!=="order")&&($online!=="N"))// if store is selected as off line display message and disableif($online=="N")	{  echo"$offmsg</table>";  exit;	}?>  </td></form></tr>
Link to comment
Share on other sites




×
×
  • Create New...