Jump to content

Auto instock update Mod with extras


Recommended Posts

Guest pataslak

thanks a lot anyway.

it was not criticism, i want just to warn other who didn't realise that :)

anyway CSDiff or Diff will do the job B)

did you fix the problem i report at the beginning of this page ?

this mod is not complete

the authors miss some part .

exemple : when you delete an order the inventory stay the same and no change is made in the inventory.

if not will try fix it when i got some time.

Link to comment
Share on other sites

  • 3 months later...

Howdy all :D

Firstly my Name is Daran Thomas from the UK. (Useless Information I know ;) )

I have attempted the install of the instock_mod. All is ok apart from the error below:

Parse error: parse error in /home/adultdvd/public_html/shop/admin/add_product.php on line 472

I get this error when attempting to Add Product from the Admin Control Panel.

Here is the add_product file content:

<?php

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

*   File Info: admin/add_product.php 

*   Purpose:   Add 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] 

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



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

*   Modified to allow custom product numbers by BrJones33;) Cheers Dude!  

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

session_start();



// if session is not registered redirect to login

if (!session_is_registered("admin"))

  {

    header("Location: login.php"); 

  }

// if session is registered continue

if(session_is_registered("admin")){

include ("config.php");

include ("settings.inc.php");

include ("../images/makethumb.txt");

include_once ("header.inc.php");

echo "<h2>$la_add_prod</h2>";



// see if categories are present

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

	$result_count = mysql_query ($sql_count);

	$total = mysql_num_rows($result_count);

if ($total==0)

{

	echo "<div align=center><a href='add_category.php'>$la_add_cat_title</a></div><p align=\"center\">$la_no_prod_no_cat<p>";

include ("footer.inc.php");

exit;

}

// if submit has not been clicked

if (!$submit){



echo "<FORM ENCTYPE=\"multipart/form-data\" ACTION=\"add_product.php\" 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\"><input class=\"textbox\" type=\"textbox\"  name=\"title\"><font color=\"990000\"><b>*</b></font></td>

  </tr>

  <tr bgcolor=\"$colour_3\">

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

	<td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\"  name=\"prodnum\"></td>

	</tr>

  <tr bgcolor=\"$colour_3\">

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

    <td width=\"400\" valign=\"top\"><textarea name=\"description\" cols=\"40\" rows=\"8\"></textarea></td>

  </tr>

  <tr bgcolor=\"$colour_3\">

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

    <td width=\"400\" valign=\"top\">";



// Build drop down menu for full category!

	print "<select  name=\"cat_id\"><option value=\"none\">$la_please_choose</option>";

	$select = mysql_query("select * from ".$prefix."store_category");

	while ($row = mysql_fetch_array($select))

      {

          $cat_id_dd = $row["cat_id"];

    

	echo"<option value=\"$cat_id_dd\">";

	$cat_full_name = $row["cat_full_name"];

    $category = $row["category"];

    $catfatherid_1 = $row["cat_father_id"];

  

        $t1 = $category;



        if ($catfatherid_1 <> 0)

        {

             $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_1";

             $result1 = mysql_query ($sql_lowercat);

             $row1 = mysql_fetch_array($result1);

             $catfatherid_2 = $row1["cat_father_id"];

             $catname_2 = $row1["category"];

             $t2 = $catname_2;

             $catid2 = $catid_2;

        }



        if ($catfatherid_2 <> 0)

        {

             $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_2";

             $result1 = mysql_query ($sql_lowercat);

             $row1 = mysql_fetch_array($result1);

             $catfatherid_3 = $row1["cat_father_id"];

             $catname_3 = $row1["category"];

             $t3 = $catname_3;

             $catid3 = $catid_3;

        }



        if ($catfatherid_3 <> 0)

        {

             $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_3";

             $result1 = mysql_query ($sql_lowercat);

             $row1 = mysql_fetch_array($result1);

             $catfatherid_4 = $row1["cat_father_id"];

             $catname_4 = $row1["category"];

             $t4 = $catname_4;

             $catid4 = $catid_4;

        }



        if ($catfatherid_4 <> 0)

        {

             $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_4";

             $result1 = mysql_query ($sql_lowercat);

             $row1 = mysql_fetch_array($result1);

             $catfatherid_5 = $row1["cat_father_id"];

             $catname_5 = $row1["category"];

             $t5 = $catname_5;

             $catid5 = $catid_5;

        }



        if ($catfatherid_5 <> 0)

        {

             $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_5";

             $result1 = mysql_query ($sql_lowercat);

             $row1 = mysql_fetch_array($result1);

             $catfatherid_6 = $row1["cat_father_id"];

             $catname_6 = $row1["category"];

             $t6 = $catname_6;

             $catid6 = $catid_6;

        }



        if ($catfatherid_6 <> 0)

        {

             $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_6";

             $result1 = mysql_query ($sql_lowercat);

             $row1 = mysql_fetch_array($result1);

             $catfatherid_7 = $row1["cat_father_id"];

             $catname_7 = $row1["category"];

             $t7 = $catname_7;

             $catid7 = $catid_7;

        }

  

  if ($catfatherid_7 <> 0)

        {

             $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_7";

             $result1 = mysql_query ($sql_lowercat);

             $row1 = mysql_fetch_array($result1);

             $catfatherid_8 = $row1["cat_father_id"];

             $catname_8 = $row1["category"];

             $t8 = $catname_8;

             $catid8 = $catid_8;

        }



  if ($catfatherid_8 <> 0)

        {

             $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_8";

             $result1 = mysql_query ($sql_lowercat);

             $row1 = mysql_fetch_array($result1);

             $catfatherid_9 = $row1["cat_father_id"];

             $catname_9 = $row1["category"];

             $t9 = $catname_9;

    

        }





if ($t9)

print "$t9/";

if ($t8)

print "$t8/";

if ($t7)

print "$t7/";

if ($t6)

print "$t6/";

if ($t5)

print "$t5/";

if ($t4)

print "$t4/";

if ($t3)

print "$t3/";

if ($t2)

print "$t2/";

if ($t1)

print "$t1/";

unset($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$catfatherid_1,$catfatherid_2,$catfatherid_3,$catfatherid_4,$catfatherid_5,$catfatherid_6,$catfatherid_7,$catfatherid_8,$catfatherid_9,$catname_1,$catname_2,$catname_3,$catname_4,$catname_5,$catname_6,$catname_7,$catname_8,$catname_9);

    echo"</option>";}

    echo"</select><font color=\"990000\"><b>*</b></font></td>

  </tr>";

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

  <tr bgcolor=\"$colour_3\">

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

    <td width=\"400\" valign=\"top\">&nbsp;&nbsp;<input class=\"textbox\" type=\"textbox\"  name=\"instock\"><font color=\"990000\"><b>*</b></font></td>

  </tr>";

  //<tr bgcolor=\"$colour_3\">

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

  //  <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\"  name=\"quantity\"><font color=\"990000\"><b>*</b></font></td>

  //</tr>

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

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

    <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\"  name=\"price\"><font color=\"990000\"><b>*</b></font></td>

  </tr>

 <tr bgcolor=\"$colour_3\">

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

    <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\"  name=\"sale_price\"><br>$la_leave_empt_no_sa</td>

  </tr>

  <tr bgcolor=\"$colour_3\">

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

    <td width=\"400\" valign=\"top\"><input name=\"upload_image\" type=\"checkbox\" value=\"yes\">$la_upload_checked</td>

  </tr>

  <tr bgcolor=\"$colour_3\">

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

    <td width=\"400\" valign=\"top\"><INPUT class=\"file\" NAME=\"userfile\"  TYPE=\"file\">$la_prod_types</td>

  </tr>

  <tr bgcolor=\"$colour_3\">

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

    <td width=\"400\" valign=\"top\"><INPUT class=\"submit\" TYPE=\"submit\" NAME=\"submit\" VALUE=\"$la_add_prod\"></td>

  </tr>

</table>

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

</FORM>";



}

 // if submit has been clicked

if ($submit){

	

	

// create back link

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



// create back link

	$goback="<p align=\"center\"><a href=\"javascript:history.back()\">Try again</a></p>";

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

	$dupresult = mysql_query($dupquery);

	// check required fields were filled

	if ((empty($title)) or (empty($price)))

  {

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

  exit;

  }

	// if product number field is blank, create a product number

	if ((empty($prodnum)))

  {

  $addfrontchar = substr($title,0,3);

  $addfrontchar = strtoupper($addfrontchar);

  $chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N",

    "O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3",

    "4","5","6","7","8","9","0");

  $max_chars = count($chars) - 1;

  srand((double)microtime()*1000000);

	for($i = 0; $i < 5; $i++)

  {

  $randnum = ($i == 0) ? $chars[rand(0, $max_chars)] : $randnum . $chars[rand(0, $max_chars)];

  }

  $addcatid = $cat_id;

  $createprodnum = $addfrontchar . $randnum . $addcatid;

  $prodnum = $createprodnum;

  }

	// make sure product number doesn't already exist

	if (mysql_num_rows($dupresult)!=0 )

  {

  echo "<p align=\"center\"><b>$la_prod_exists</b><br><br>$goback</p>";

  exit;

  }



// check category was selected

if ($cat_id=="none")

	{

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

	exit;

	}



// make sure quantity is apropriate

if (eregi("[a-z\.\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $quantity)) 

	{

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

	exit;

	}



// make sure price is apropriate

if (eregi("[a-z\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $price)) 

	{

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

	exit;

	}

// make sure sale price is apropriate

if (eregi("[a-z\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $sale_price)) 

	{

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

	exit;

	}





// if upload was not selected

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



$sql = "SELECT max(product) AS total FROM ".$prefix."store_inventory";

  	if(!$r = mysql_query($sql, $db))

  	die("Error connecting to the database.");

  	list($product) = mysql_fetch_array($r);

  	$product = $prodnum;



  	$title = addslashes($title);

  	$description = addslashes($description);

  	$userfile_name = "nophoto.jpg";

  	$userfile_name = addslashes($userfile_name);

  	if(empty($sale_price)){$sale_price="0.00";}

  	$quantity=1;

  	$sql_insert = "insert into ".$prefix."store_inventory (product, quantity, description, image, price, title, cat_id, sale_price) values ('$product', '$quantity', '$description', '$userfile_name', '$price', '$title', '$cat_id', '$sale_price')";

  	

  	$result = mysql_query($sql_insert);    

  	$description= nl2br($description);

  	$title = stripslashes($title);

  	$title = stripslashes($title);

  	$instock = stripslashes($instock);

  	$description = stripslashes($description);

  	$description = stripslashes($description);

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

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

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

echo "<p align=\"center\">$la_product_nm $product $la_it_add_succ</p>

<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\" 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>

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

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

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

  </tr>

<tr bgcolor=\"$colour_3\">

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

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

  </tr>

  <tr bgcolor=\"$colour_3\">

    <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$userfile_name\"></td>

    <td width=\"400\" valign=\"top\"><img src=\"../images/$userfile_name\"></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\"></td>

  </tr>

</table>

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

</FORM>";



echo "<p align=\"center\"><a href=add_product.php>$la_add_anoth_prod</a> | <a href=\"product_options.php\">$la_product_options</a></p>";



}



// if upload was clicked

if($upload_image=="yes"){

// Upload

$path = "$site_dir/images/";

$max_size = 200000;



if (is_uploaded_file($userfile)) {



if ($userfile_size>$max_size) { echo "$la_too_big<br>\n"; exit; }



if (($userfile_type=="image/x-png") || ($userfile_type=="image/pjpeg") || ($userfile_type=="image/jpeg")) {



if (file_exists($path . $userfile_name)) { echo "<p align=\"center\">$la_used_already</p><br>\n";$escape=1; }



if($escape!=1){

$res = move_uploaded_file($userfile, $path . $userfile_name);

// create thumbnail



if (file_exists("$site_dir/images/" . "thumb_$userfile_name"))

	{

  

  unlink("$site_dir/images/thumb_$userfile_name");

  $thumb=new thumbnail("$site_dir/images/$userfile_name");

  $thumb->size_auto(75);

  $thumb->jpeg_quality(75);

  $thumb->save("$site_dir/images/thumb_$userfile_name", $gd_version);

	

	} else {

  

  $thumb=new thumbnail("$site_dir/images/$userfile_name");

  $thumb->size_auto(75);

  $thumb->jpeg_quality(75);

  $thumb->save("$site_dir/images/thumb_$userfile_name", $gd_version);

  }

}

if($escape=1){$res="continue";}



// Resultant output



if (!$res) {

echo "<p align=\"center\">$la_upload_failed<br><br><a href=\"javascript:history.back()\">$la_try_again</a></p>\n"; exit; }

  } else { echo "<p align=\"center\">$la_wrong_type<br><br><a href=\"javascript:history.back()\">$la_try_again</a></p>\n"; exit; }





// everything is ok 

if (!$stop)

  {

  	

  	$sql = "SELECT max(product) AS total FROM ".$prefix."store_inventory";

  	if(!$r = mysql_query($sql, $db))

  	die("Error connecting to the database.");

  	list($product) = mysql_fetch_array($r);

  	$product = $prodnum;



  	$title = addslashes($title);

  	$description = addslashes($description);

  	if(empty($sale_price))

      {$sale_price="0.00";}

  	$quantity=1;

  	$sql_insert = "insert into ".$prefix."store_inventory (product, quantity, description, image, price, title, cat_id, sale_price) values ('$product', '$quantity', '$description', '$userfile_name', '$price', '$title', '$cat_id', '$sale_price')";

  	$result = mysql_query($sql_insert);

  

  $title = stripslashes($title);

  $title = stripslashes($title);

  $description= nl2br($description);

  $description = stripslashes($description);

  $description = stripslashes($description);

  $description= nl2br($description);

  $instock = stripslashes($instock);

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

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

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

  if($sale_price=="0.00"){$sale_result="$la_it_nt_sale";}

  if($sale_price!=="0.00"){$sale_result="$currency$sale_price";}



// display product info



echo "<p align=\"center\">$la_product_nm $product $la_it_add_succ</p>

<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\" cellpadding=\"2\" cellspacing=\"1\">

  <tr bgcolor=\"$colour_3\">

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

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

  </tr>";



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

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

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

 </tr>";



[b]  <tr bgcolor=\"$colour_3\">[/b]

	<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_instock</b></td>

   <td width=\"400\" valign=\"top\">$instock</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>";

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

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

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

  </tr>";

  <tr bgcolor=\"$colour_3\">

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

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

  </tr>";

  <tr bgcolor=\"$colour_3\">

    <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$userfile_name\"></td>

    <td width=\"400\" valign=\"top\"><img src=\"../images/$userfile_name\"></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\"></td>

  </tr>";

</table>

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

</FORM>";



echo "<p align=center><a href=add_product.php>$la_add_anoth_prod</a> | <a href=\"product_options.php\">$la_product_options</a></p>";

  

  }



}}

}

include ("footer.inc.php");

} // end if session is registered

?>

I have tried it all 3 times and still come up with the same error every time. I have used the supposed older release, the fixed ones and the one fixed by a forum member within this post. Line 472 is in bold text

What would be ideal is if someone can forward me their working file so I can compair the code...... */*

Thanks again.

Daran

Any help is greatly appreciated.

Link to comment
Share on other sites

Hey

Here is the fix

<?php

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

*   File Info: admin/add_product.php 

*   Purpose:   Add 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] 

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



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

*   Modified to allow custom product numbers by BrJones33;) Cheers Dude!  

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

session_start();



// if session is not registered redirect to login

if (!session_is_registered("admin"))

 {

   header("Location: login.php"); 

 }

// if session is registered continue

if(session_is_registered("admin")){

include ("config.php");

include ("settings.inc.php");

include ("../images/makethumb.txt");

include_once ("header.inc.php");

echo "<h2>$la_add_prod</h2>";



// see if categories are present

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

$result_count = mysql_query ($sql_count);

$total = mysql_num_rows($result_count);

if ($total==0)

{

echo "<div align=center><a href='add_category.php'>$la_add_cat_title</a></div><p align=\"center\">$la_no_prod_no_cat<p>";

include ("footer.inc.php");

exit;

}

// if submit has not been clicked

if (!$submit){



echo "<FORM ENCTYPE=\"multipart/form-data\" ACTION=\"add_product.php\" 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\"><input class=\"textbox\" type=\"textbox\"  name=\"title\"><font color=\"990000\"><b>*</b></font></td>

 </tr>

 <tr bgcolor=\"$colour_3\">

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

<td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\"  name=\"prodnum\"></td>

</tr>

 <tr bgcolor=\"$colour_3\">

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

   <td width=\"400\" valign=\"top\"><textarea name=\"description\" cols=\"40\" rows=\"8\"></textarea></td>

 </tr>

 <tr bgcolor=\"$colour_3\">

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

   <td width=\"400\" valign=\"top\">";



// Build drop down menu for full category!

print "<select  name=\"cat_id\"><option value=\"none\">$la_please_choose</option>";

$select = mysql_query("select * from ".$prefix."store_category");

while ($row = mysql_fetch_array($select))

     {

         $cat_id_dd = $row["cat_id"];

   

echo"<option value=\"$cat_id_dd\">";

$cat_full_name = $row["cat_full_name"];

   $category = $row["category"];

   $catfatherid_1 = $row["cat_father_id"];

 

       $t1 = $category;



       if ($catfatherid_1 <> 0)

       {

            $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_1";

            $result1 = mysql_query ($sql_lowercat);

            $row1 = mysql_fetch_array($result1);

            $catfatherid_2 = $row1["cat_father_id"];

            $catname_2 = $row1["category"];

            $t2 = $catname_2;

            $catid2 = $catid_2;

       }



       if ($catfatherid_2 <> 0)

       {

            $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_2";

            $result1 = mysql_query ($sql_lowercat);

            $row1 = mysql_fetch_array($result1);

            $catfatherid_3 = $row1["cat_father_id"];

            $catname_3 = $row1["category"];

            $t3 = $catname_3;

            $catid3 = $catid_3;

       }



       if ($catfatherid_3 <> 0)

       {

            $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_3";

            $result1 = mysql_query ($sql_lowercat);

            $row1 = mysql_fetch_array($result1);

            $catfatherid_4 = $row1["cat_father_id"];

            $catname_4 = $row1["category"];

            $t4 = $catname_4;

            $catid4 = $catid_4;

       }



       if ($catfatherid_4 <> 0)

       {

            $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_4";

            $result1 = mysql_query ($sql_lowercat);

            $row1 = mysql_fetch_array($result1);

            $catfatherid_5 = $row1["cat_father_id"];

            $catname_5 = $row1["category"];

            $t5 = $catname_5;

            $catid5 = $catid_5;

       }



       if ($catfatherid_5 <> 0)

       {

            $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_5";

            $result1 = mysql_query ($sql_lowercat);

            $row1 = mysql_fetch_array($result1);

            $catfatherid_6 = $row1["cat_father_id"];

            $catname_6 = $row1["category"];

            $t6 = $catname_6;

            $catid6 = $catid_6;

       }



       if ($catfatherid_6 <> 0)

       {

            $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_6";

            $result1 = mysql_query ($sql_lowercat);

            $row1 = mysql_fetch_array($result1);

            $catfatherid_7 = $row1["cat_father_id"];

            $catname_7 = $row1["category"];

            $t7 = $catname_7;

            $catid7 = $catid_7;

       }

 

 if ($catfatherid_7 <> 0)

       {

            $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_7";

            $result1 = mysql_query ($sql_lowercat);

            $row1 = mysql_fetch_array($result1);

            $catfatherid_8 = $row1["cat_father_id"];

            $catname_8 = $row1["category"];

            $t8 = $catname_8;

            $catid8 = $catid_8;

       }



 if ($catfatherid_8 <> 0)

       {

            $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_8";

            $result1 = mysql_query ($sql_lowercat);

            $row1 = mysql_fetch_array($result1);

            $catfatherid_9 = $row1["cat_father_id"];

            $catname_9 = $row1["category"];

            $t9 = $catname_9;

   

       }





if ($t9)

print "$t9/";

if ($t8)

print "$t8/";

if ($t7)

print "$t7/";

if ($t6)

print "$t6/";

if ($t5)

print "$t5/";

if ($t4)

print "$t4/";

if ($t3)

print "$t3/";

if ($t2)

print "$t2/";

if ($t1)

print "$t1/";

unset($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$catfatherid_1,$catfatherid_2,$catfatherid_3,$catfatherid_4,$catfatherid_5,$catfatherid_6,$catfatherid_7,$catfatherid_8,$catfatherid_9,$catname_1,$catname_2,$catname_3,$catname_4,$catname_5,$catname_6,$catname_7,$catname_8,$catname_9);

   echo"</option>";}

   echo"</select><font color=\"990000\"><b>*</b></font></td>

 </tr>";

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

 <tr bgcolor=\"$colour_3\">

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

   <td width=\"400\" valign=\"top\">&nbsp;&nbsp;<input class=\"textbox\" type=\"textbox\"  name=\"instock\"><font color=\"990000\"><b>*</b></font></td>

 </tr>";

 //<tr bgcolor=\"$colour_3\">

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

 //  <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\"  name=\"quantity\"><font color=\"990000\"><b>*</b></font></td>

 //</tr>

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

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

   <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\"  name=\"price\"><font color=\"990000\"><b>*</b></font></td>

 </tr>

<tr bgcolor=\"$colour_3\">

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

   <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\"  name=\"sale_price\"><br>$la_leave_empt_no_sa</td>

 </tr>

 <tr bgcolor=\"$colour_3\">

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

   <td width=\"400\" valign=\"top\"><input name=\"upload_image\" type=\"checkbox\" value=\"yes\">$la_upload_checked</td>

 </tr>

 <tr bgcolor=\"$colour_3\">

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

   <td width=\"400\" valign=\"top\"><INPUT class=\"file\" NAME=\"userfile\"  TYPE=\"file\">$la_prod_types</td>

 </tr>

 <tr bgcolor=\"$colour_3\">

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

   <td width=\"400\" valign=\"top\"><INPUT class=\"submit\" TYPE=\"submit\" NAME=\"submit\" VALUE=\"$la_add_prod\"></td>

 </tr>

</table>

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

</FORM>";



}

// if submit has been clicked

if ($submit){





// create back link

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



// create back link

$goback="<p align=\"center\"><a href=\"javascript:history.back()\">Try again</a></p>";

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

$dupresult = mysql_query($dupquery);

// check required fields were filled

if ((empty($title)) or (empty($price)))

 {

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

 exit;

 }

// if product number field is blank, create a product number

if ((empty($prodnum)))

 {

 $addfrontchar = substr($title,0,3);

 $addfrontchar = strtoupper($addfrontchar);

 $chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N",

   "O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3",

   "4","5","6","7","8","9","0");

 $max_chars = count($chars) - 1;

 srand((double)microtime()*1000000);

for($i = 0; $i < 5; $i++)

 {

 $randnum = ($i == 0) ? $chars[rand(0, $max_chars)] : $randnum . $chars[rand(0, $max_chars)];

 }

 $addcatid = $cat_id;

 $createprodnum = $addfrontchar . $randnum . $addcatid;

 $prodnum = $createprodnum;

 }

// make sure product number doesn't already exist

if (mysql_num_rows($dupresult)!=0 )

 {

 echo "<p align=\"center\"><b>$la_prod_exists</b><br><br>$goback</p>";

 exit;

 }



// check category was selected

if ($cat_id=="none")

{

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

exit;

}



// make sure quantity is apropriate

if (eregi("[a-z\.\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $quantity)) 

{

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

exit;

}



// make sure price is apropriate

if (eregi("[a-z\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $price)) 

{

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

exit;

}

// make sure sale price is apropriate

if (eregi("[a-z\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $sale_price)) 

{

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

exit;

}





// if upload was not selected

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



$sql = "SELECT max(product) AS total FROM ".$prefix."store_inventory";

  if(!$r = mysql_query($sql, $db))

  die("Error connecting to the database.");

  list($product) = mysql_fetch_array($r);

  $product = $prodnum;



  $title = addslashes($title);

  $description = addslashes($description);

  $userfile_name = "nophoto.jpg";

  $userfile_name = addslashes($userfile_name);

  if(empty($sale_price)){$sale_price="0.00";}

  $quantity=1;

  $sql_insert = "insert into ".$prefix."store_inventory (product, quantity, description, image, price, title, cat_id, sale_price, instock) values ('$product', '$quantity', '$description', '$userfile_name', '$price', '$title', '$cat_id', '$sale_price', '$instock')";

  

  $result = mysql_query($sql_insert);    

  $description= nl2br($description);

  $title = stripslashes($title);

  $title = stripslashes($title);

  $instock = stripslashes($instock);

  $description = stripslashes($description);

  $description = stripslashes($description);

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

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

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

echo "<p align=\"center\">$la_product_nm $product $la_it_add_succ</p>

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

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

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

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

</tr>

<tr bgcolor=\"$colour_3\">

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

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

 </tr>

<tr bgcolor=\"$colour_3\">

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

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

 </tr>

 <tr bgcolor=\"$colour_3\">

   <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$userfile_name\"></td>

   <td width=\"400\" valign=\"top\"><img src=\"../images/$userfile_name\"></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\"></td>

 </tr>

</table>

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

</FORM>";



echo "<p align=\"center\"><a href=add_product.php>$la_add_anoth_prod</a> | <a href=\"product_options.php\">$la_product_options</a></p>";



}



// if upload was clicked

if($upload_image=="yes"){

// Upload

$path = "$site_dir/images/";

$max_size = 200000;



if (is_uploaded_file($userfile)) {



if ($userfile_size>$max_size) { echo "$la_too_big<br>\n"; exit; }



if (($userfile_type=="image/x-png") || ($userfile_type=="image/pjpeg") || ($userfile_type=="image/jpeg")) {



if (file_exists($path . $userfile_name)) { echo "<p align=\"center\">$la_used_already</p><br>\n";$escape=1; }



if($escape!=1){

$res = move_uploaded_file($userfile, $path . $userfile_name);

// create thumbnail



if (file_exists("$site_dir/images/" . "thumb_$userfile_name"))

{

 

 unlink("$site_dir/images/thumb_$userfile_name");

 $thumb=new thumbnail("$site_dir/images/$userfile_name");

 $thumb->size_auto(75);

 $thumb->jpeg_quality(75);

 $thumb->save("$site_dir/images/thumb_$userfile_name", $gd_version);



} else {

 

 $thumb=new thumbnail("$site_dir/images/$userfile_name");

 $thumb->size_auto(75);

 $thumb->jpeg_quality(75);

 $thumb->save("$site_dir/images/thumb_$userfile_name", $gd_version);

 }

}

if($escape=1){$res="continue";}



// Resultant output



if (!$res) {

echo "<p align=\"center\">$la_upload_failed<br><br><a href=\"javascript:history.back()\">$la_try_again</a></p>\n"; exit; }

 } else { echo "<p align=\"center\">$la_wrong_type<br><br><a href=\"javascript:history.back()\">$la_try_again</a></p>\n"; exit; }





// everything is ok 

if (!$stop)

 {

  

  $sql = "SELECT max(product) AS total FROM ".$prefix."store_inventory";

  if(!$r = mysql_query($sql, $db))

  die("Error connecting to the database.");

  list($product) = mysql_fetch_array($r);

  $product = $prodnum;



  $title = addslashes($title);

  $description = addslashes($description);

  if(empty($sale_price))

     {$sale_price="0.00";}

  $quantity=1;

  $sql_insert = "insert into ".$prefix."store_inventory (product, quantity, description, image, price, title, cat_id, sale_price, instock) values ('$product', '$quantity', '$description', '$userfile_name', '$price', '$title', '$cat_id', '$sale_price', '$instock')";

  $result = mysql_query($sql_insert);

 

 $title = stripslashes($title);

 $title = stripslashes($title);

 $description= nl2br($description);

 $description = stripslashes($description);

 $description = stripslashes($description);

 $description= nl2br($description);

 $instock = stripslashes($instock);

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

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

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

 if($sale_price=="0.00"){$sale_result="$la_it_nt_sale";}

 if($sale_price!=="0.00"){$sale_result="$currency$sale_price";}



// display product info



echo "<p align=\"center\">$la_product_nm $product $la_it_add_succ</p>

<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\" cellpadding=\"2\" cellspacing=\"1\">

 <tr bgcolor=\"$colour_3\">

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

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

 </tr>";



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

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

  <td width=\"400\" valign=\"top\">$instock</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>";

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

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

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

 </tr>

 <tr bgcolor=\"$colour_3\">

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

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

 </tr>

 <tr bgcolor=\"$colour_3\">

   <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$userfile_name\"></td>

   <td width=\"400\" valign=\"top\"><img src=\"../images/$userfile_name\"></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\"></td>

 </tr>

</table>

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

</FORM>";



echo "<p align=center><a href=add_product.php>$la_add_anoth_prod</a> | <a href=\"product_options.php\">$la_product_options</a></p>";

 

 }



}}

}

include ("footer.inc.php");

} // end if session is registered

?>

If you still get errors you might get one on like 508, 510, 511, or 513

if it is one of those lines then remove ONE of the } at the bottom of the page but if all errors are gone then you all good */*

Let me know if this helped

wildbill

Link to comment
Share on other sites

My version: CubeCart 2.0.1

Stock Mod Version: "v1.0"

I just added this to my store to test it out, and I noted the following fixes that may be of help for others:

[Edit Product Error]

Example Url

-http://www.mysite.com/admin/edit_product.php?product=some_prod_i_have

Error List:

Parse error, line 456

Solution:

Replace:

  unset($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$catfatherid_1,$catfatherid_2,$catfatherid_3,$catfatherid_4,$catfatherid_5,$catfatherid_6,$catfatherid_7,$catfatherid_8,$catfatherid_9,$catname_1,$catname_2,$catname_3,$catname_4,$catname_5,$catname_6,$catname_7,$catname_8,$catname_9);

echo"</option>";}

    echo"</select><font color=\"990000\"><b>*</b></font></td>

  </tr>";

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

   <tr bgcolor=\"$colour_3\">

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

    <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\"  name=\"instock\" value=\"$instock\"><font color=\"990000\"><b>*</b></font></td>

 </tr>
With:
  unset($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$catfatherid_1,$catfatherid_2,$catfatherid_3,$catfatherid_4,$catfatherid_5,$catfatherid_6,$catfatherid_7,$catfatherid_8,$catfatherid_9,$catname_1,$catname_2,$catname_3,$catname_4,$catname_5,$catname_6,$catname_7,$catname_8,$catname_9);

echo"</option>";}

    echo"</select><font color=\"990000\"><b>*</b></font></td>

  </tr>";

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

   <tr bgcolor=\"$colour_3\">

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

    <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\"  name=\"instock\" value=\"$instock\"><font color=\"990000\"><b>*</b></font></td>

 </tr>";




[Add Product Error]

Example Url

-http://www.mysite.com/admin/add_product.php

Error List:

Parse error, line 455

Parse error, line 486

Solution #1:

Replace:
unset($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$catfatherid_1,$catfatherid_2,$catfatherid_3,$catfatherid_4,$catfatherid_5,$catfatherid_6,$catfatherid_7,$catfatherid_8,$catfatherid_9,$catname_1,$catname_2,$catname_3,$catname_4,$catname_5,$catname_6,$catname_7,$catname_8,$catname_9);

    echo"</option>";}

    echo"</select><font color=\"990000\"><b>*</b></font></td>

  </tr>";

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

  <tr bgcolor=\"$colour_3\">

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

    <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\"  name=\"instock\"><font color=\"990000\"><b>*</b></font></td>

  </tr>
With:
unset($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$catfatherid_1,$catfatherid_2,$catfatherid_3,$catfatherid_4,$catfatherid_5,$catfatherid_6,$catfatherid_7,$catfatherid_8,$catfatherid_9,$catname_1,$catname_2,$catname_3,$catname_4,$catname_5,$catname_6,$catname_7,$catname_8,$catname_9);

    echo"</option>";}

    echo"</select><font color=\"990000\"><b>*</b></font></td>

  </tr>";

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

  <tr bgcolor=\"$colour_3\">

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

    <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\"  name=\"instock\"><font color=\"990000\"><b>*</b></font></td>

  </tr>";
Solution #2:

Replace:
// display product info



echo "<p align=\"center\">$la_product_nm $product $la_it_add_succ</p>

<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\" 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_instock</b></td>

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

 </tr>

  <tr bgcolor=\"$colour_3\">

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

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

  </tr>";

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

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

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

 </tr>
With:
// display product info



echo "<p align=\"center\">$la_product_nm $product $la_it_add_succ</p>

<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\" 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_instock</b></td>

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

 </tr>

  <tr bgcolor=\"$colour_3\">

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

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

  </tr>";

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

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

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

 </tr>";

Those are all the errors I've found so far. */*

btw: Not that bad Bill, seems to work fine ;)

Link to comment
Share on other sites

Guest cupboard

Hi there! I finally got the in stock mod working (I think?) with no errors popping up when I add or edit. However, when I test the store it does not properly add the item to the cart. It shows the item name and number in the cart, but the price is set to 0. Any ideas?

Thanks!!

Sandy

Link to comment
Share on other sites

Guest cupboard

I am wondering if the problem has to do with something I was confused about? In the mod it says "*Note* You also need to create a new row in your store_inventory database file called instock

The php code is: $sql = 'ALTER TABLE `store_inventory` ADD `instock` INT( 30 ) DEFAULT \'0\' NOT NULL ; '; "

Then later in a fix it said ALTER TABLE `store_inventory` ADD `instock` INT( 30 ) DEFAULT '100' NOT NULL ;

I don't have a php file called store_inventory, but I do have an inventory.php file under the admin section. So I just pasted that line into the bottom of that file. I saw several people ask a question about this, but I never saw an answer, so I just did the only thing that seemed close.

However, one of the fixes I downloaded had an inventory php file which I copied to the server. When I looked at that file, I don't see any line like that in the file? Was the fix missing something vital? What do I need to change?

Thanks!!

Sandy

Link to comment
Share on other sites

Guest cupboard

ACK! Just discovered a new problem (please look at my 2 previous posts for my full scope of as yet unanswered problems hehehe)

When I used one of the fixes it installed a place in my add/edit product for shipping price. Does this need to be filled in? Currently I use the per category national and international shipping prices, and that works for me, I want to keep it in that format.

Does the new line override the category per shipment/per item shipping prices? Is it a required line to fill in if it is there? Is this why items added to my cart have a price of $0??

Please help, I am SO confused now :(

Sandy

Link to comment
Share on other sites

.. The reason you can't add products is because when it tries to add a product it's looking for the field instock, not finding it, then quiting.

The code:

$sql = 'ALTER TABLE `store_inventory` ADD `instock` INT( 30 ) DEFAULT \'0\' NOT NULL; '; "

Is only supposed to be executed ONCE, and all it does is add a new column in the inventory database to keep track of your current stock for a item. Notice that the name is `store_inventory`, if you wrote in a prefix it will not work, you will have to find your prefix. If you had followed the instructions properly you probably would not have these issues right now.

Link to comment
Share on other sites

Guest cupboard

.. The reason you can't add products is because when it tries to add a product it's looking for the field instock, not finding it, then quiting.

The code:

$sql = 'ALTER TABLE `store_inventory` ADD `instock` INT( 30 ) DEFAULT \'0\' NOT NULL; '; "

Is only supposed to be executed ONCE, and all it does is add a new column in the inventory database to keep track of your current stock for a item. Notice that the name is `store_inventory`, if you wrote in a prefix it will not work, you will have to find your prefix. If you had followed the instructions properly you probably would not have these issues right now.

Sorry, but your signature SAYS to PM you, so I gathered from that it would be ok... not offensive. Obviously I was wrong about that, and feel even more stupid now. I built my store pretty basic, but a girl I met is using the same software and needed the mod for her store because she only has a couple of each item in stock. So I was doing her a favor by installing it. I know nothing about php (all I know is html), but she is clueless when it comes to anything about websites (even html), so was doing my best to muddle through it to help her. I read the help posts and info in the hacks I downloaded, plus did some trial and error for about 8 hours. I followed the instruction precisely, but no one said WHERE to put the line I needed. Just to "edit the table" or "add a new line to the table", I don't even know where this "table" is. I even saw other people asking the same question and not getting a clear answer.

I don't want to be a bother to anyone, I just figured many of the people in here had figured out how to make this thing work, and that no one would mind one question about it. I guess that's just me, I always try to help people whenever I can, but I understand not everyone is into that. Which is cool, different strokes for different folks.

So anyway, thanks. I appreciate you taking the time to give your input, and again apologize for asking you. I'll see if I can figure out which file to edit on on my own.

Link to comment
Share on other sites

Sorry, but your signature SAYS to PM you, so I gathered from that it would be ok... not offensive. Obviously I was wrong about that, and feel even more stupid now.
I apologize, but I don't appreciate it when people pm me with things they want me to fix for free. If you want me to fix things for free, your best bet is to post here about it instead of sending me a pm. Right now this is my only form of secular work, and in this forum I am doing freelance work, brooky does not give me anything for helping others, I just do it for "charity".
...I was doing her a favor by installing it. I know nothing about php (all I know is html), but she is clueless when it comes to anything about websites (even html), so was doing my best to muddle through it to help her. I read the help posts and info in the hacks I downloaded, plus did some trial and error for about 8 hours...
8 hours? I seriously doubt that. You have to do everything the readme says, everything. (took me 20 minutes personally)
I followed the instruction precisely, but no one said WHERE to put the line I needed. Just to "edit the table" or "add a new line to the table", I don't even know where this "table" is. I even saw other people asking the same question and not getting a clear answer.
Here's the issue; you didn't buy this modification, so all the help you get is a few people like me giving advice/guidelines on how to fix things. A "clear answer" is what I would call hand holding. I told you what you did not do, and you should know how to fix it, if you can't add just one field in a MySQL database, what are you doing here? I'm sorry, but just like you I had to learn by myself. Nobody said "open this", "run that", "that does this". You have to learn it by yourself OR get trained in it.
I don't want to be a bother to anyone, I just figured many of the people in here had figured out how to make this thing work, and that no one would mind one question about it...
I gave you my own copyrighted code to fix it, which was much better than "add this mysql query into a php file". Maybe next time I'll be less leniant, and more cryptic.
Link to comment
Share on other sites

  • 2 weeks later...
Guest moses

Hi,

Can someone plz send me working copy of the files for this mod.

I've tried to follow the instructions but i've messed up files during find/replace process.

I just done a fresh install so all the files are fresh.

Thanks in advance

mo

moses[at]ubox.co.uk

Link to comment
Share on other sites

Guest JohnCuts

So can I ask is the version now posted at the beginning the latest fixed version. I have seen a few versions now and am just wondering which one is the very latest. If it isnt the latest feel free to mail me the latest version

Thanks again

John Cutliffe

[email protected]

Link to comment
Share on other sites

Guest moonsoft

Okay got a few questions.. i cant sort one thing out from the other.. i need the most stable version of the instock mod and the two images mod... i want them to work together and i have heard about problems with this... is there ANYONE out there that has a working cart with both the two-images and instaock mod together??? cause now my cart does not allow you to change the amount instock or even enter an instock amount when i go to add products.. and now i have to log in twice for the admin page... something really spooky is going on here.. check it out

(note since installing the instaock the products i entered in before the two images upgrade worked so you still cant over order some items, but you cant change the instock amount either!!!!!)

Troubled site

please let me know if you know of a fix.. or know of anyone who has a blank install of both mods that i can use as a template

Thanx

Aaron Moon

Link to comment
Share on other sites

  • 2 weeks later...

Is it possible to use this mod for certain products only? Most of my items are available in unlimited supply, but I have a few pieces - for example handmade jewelry - that I perhaps have 1 - 12 of and may not be able to get again. I'm thinking of adding a "Limited Edition" category to handle these and would love to use this mod to track the inventory of them!

I realize I could probably put 1000000 or some big number on those I have a huge stock of, but this seems a rather clumsy way to handle it. A toggle on/off for this mod (like a checkbox for "Use Inventory") would be nice.

Mysty

Link to comment
Share on other sites

Alright, here's my problem with the mod and I have done all the updates and patches to the best of my knowledge. From the start it would act funny and do different quirks but now I have a persistent problem

When I go to add a product it says it added fine and shows the result product looking great. Then I click edit product and I get all blank fields except for the product id.

When visiting the store and browsing normally the product is listed in it's category and looks fine but when I go to view it, it says it isn't there. I checked the mysql database and all the info is there. I also can't delete the product from the admin section of the store.

Can someone please lead me in the right direction?

Link to comment
Share on other sites

Hello again, :rolly:

I have another problem in the admin/edit_product.php

When I try to edit product I get this error:

Parse error: parse error, expecting `','' or `';'' in /home/houston/public_html/scart/admin/edit_product.php on line 456

This and the surrounding lines are this:

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

  <tr bgcolor=\"$colour_3\">

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

    <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\"  name=\"instock\" value=\"$instock\"><font color=\"990000\"><b>*</b></font></td>

</tr>

  //<tr bgcolor=\"$colour_3\">

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

  //  <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\"  name=\"quantity\" value=\"$quantity\"><font color=\"990000\"><b>*</b></font></td>

  //</tr>

<-- This is line 456 -- >  echo"<tr bgcolor=\"$colour_3\">

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

    <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\"  name=\"price\" value=\"$price\"><font color=\"990000\"><b>*</b></font></td>

  </tr>

  <tr bgcolor=\"$colour_3\">

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

    <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\"  name=\"sale_price\" value=\"$sale_price\"></td>

  </tr>

  <tr bgcolor=\"$colour_3\">

    <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$dbimage\"></td>

    <td width=\"400\" valign=\"top\">

<img src=\"../images/$dbimage\"></td>

Can someone help?

Don Haney

[email protected]

Houstonaxl's Flea Market

Link to comment
Share on other sites

  • 2 weeks later...

Look for a " without the \ - that usually turns out to be the problem when I get that error. Didn't see it offhand in the snippet you posted but it could be anywhere.

Mysty

Link to comment
Share on other sites

wow.. having read through all the pages, i am getting frightened of installing this mod.. there seems to be so many versions around.. which is the latest updated working one?

I know totally nothing about php and have already reinstalled cubecart twice. Now that everything is working for me, I need to install a mod which states "In Stock", "Out of Stock" n "Coming Soon".

Is there a mod which works and I can install without fear that it will cause my cart to crash again?

Thanks.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.



×
×
  • Create New...