Nothing changed, double checked the code, no change for adding or updating

Strange. There obviously is no problems with the query. You are sure the product is not being added to the db ?

try adding this to line 27 on the same page to see if your data is posting and try adding another product.

Add this line:

echo 'Product ID = '. $_POST["product_MerchantProductID"].''; die;

on the same step (clicking update on page 3) it now goes to the white page except it has this on it.

Product ID = test1

that's it.

I took a glance at my database to make sure and yeah, nothing has been added to it.

Product ID = test1 tells you that it is at least posting the data submitted via the form. You can delete line 27 that you added. I'll have another look and see if there might be another reason it's not writing to the db ... that seems to be the only real issue at this point.

on the same step (clicking update on page 3) it now goes to the white page except it has this on it..

Did it say Update Product or Add Product when you submitted ?

Yeah, I have to say I've been trying to get this to work for almost 2 weeks now (minus my downtime from the blizzard in NY) and it's nice being this close. You're helping a lot and I'm searching the code as well.

Thanks

Just out of curiousity, let's try this.

Change the following lines on CWProductAction:

Line 55:

$query_rsCW = mysql_query("INSERT INTO tbl_products

Line 90:

,$_POST["product_used"]) or die(mysql_error());

Line 91:

//$rsCW = $cartweaver->db->executeQuery($query_rsCW, "rsCW");

Warning: mysql_query() expects at most 2 parameters, 11 given in C:\xampp\htdocs\GrBx\cw3\admin\CWProductAction.php on line 71

this is what I got from changing those lines, i don't thing mysql_query will be able to replace sprintf

also, when I submit a new product at page 3 it says 'finish' so i think that'd be more along the lines of adding a product (or attempting to, can't update what isn't there to begin with)

I wasn't looking close enough at the sprintf and how it's structured ... it can be changed over to the actual query it just needs to be written a little differently.

The query seems like it is failing at some point.

bump

Please, anyone else who might be able to help, take a look.

For the sake of testing and finding out one way or another what is going on, replace the query starting at line 55 and ending at line 91 with the following query and try to add another product:

mysql_query("INSERT INTO tbl_products SET
				product_MerchantProductID='$_POST[product_MerchantProductID]', 
				product_Name='$_POST[product_Name]', 
				product_Description='$_POST[product_Description]', 
				product_ShortDescription='$_POST[product_ShortDescription]',
				product_Sort='$_POST[product_Sort]', 
				product_OnWeb='$_POST[product_OnWeb]', 
				product_Archive='$_POST[product_Archive]', 
				product_shipchrg='$_POST[product_shipchrg]',
				product_taxgroupid='$_POST[product_taxgroupid]',
				product_style='$_POST[product_style]',
				product_l='$_POST[product_l]',
				product_w='$_POST[product_w]',
				product_d='$_POST[product_d]',
				product_board='$_POST[product_board]',
				product_grade='$_POST[product_grade]',
				product_print='$_POST[product_print]',
				product_used='$_POST[product_used]'")or die(mysql_error());
commented: CFROG made a HUGE breakthrough on a code I've been hammering for 2 weeks now, kudos! +1

Holy shit, for adding a product...that actually works. This is amazing, man. Thank you so much.

On the other hand the products still aren't updating..

I replaced the same code in the update section (line 310-346) and found what MIGHT have been the underlying problem with updating this whole time.

Notice: Undefined index: product_MerchantProductID in C:\xampp\htdocs\GrBx\cw3\admin\CWProductAction.php on line 310
No database selected

Thanks again, at least I can function somewhat now, and the SKU's are a separate story so I can update the stock number at the moment ;).

There is still progress to be made!
-Ian

That pretty much proves that something was up with the original query which is pretty much what I was thinking .... I wouldn't ditch the original query though. After the fact, I noticed some missing commas in the original. I would add the missing commas back into the original and try running it again. Getting the original query to work just may fix the update, etc. by the looks of it.

Lines 65 - 71 all need a comma. I would keep 310 - 346 the way that it was for now.

Well, I changed the code back and fixed the commas. Adding products is still working fine. I can't believe I didn't notice those loose commas...

Updating is still the same problem. I think the

Notice: Undefined index: product_MerchantProductID in C:\xampp\htdocs\GrBx\cw3\admin\CWProductAction.php on line 310
No database selected

is the key to the problem

Try changing your error reporting to this:

error_reporting (E_ALL ^ E_NOTICE);

And add this to line 310 and let's see what it does:

if(!isset($_POST["action"]))
{
	$_POST["action"] = "UpdateProduct";
}

The change to 310 made it crash when I tried to open productform.php, i changed it back. It didn't show any error reporting

I can't say I understand that one ... the change shouldn't have affected productform.php .... strange. I would possibly expect an error when trying to update a product, but that's about it. So the error no longer shows ??

Doh, that one is my bad, sorry. Was using the laptop and the line #'s are different cuz I don't have the changes saved on that one ... the error is starting to make a little more sense now, let me d/l the original and have another look.

Doh, that one is my bad, sorry. Was using the laptop and the line #'s are different cuz I don't have the changes saved on that one ... the error is starting to make a little more sense now, let me d/l the original and have another look.

even better i'll upload the latest versions. :)

...as soon as it lets me lol

somethings up...forums aren't letting me upload? I click manage attachments and nothing happens, very very strange

I think both copies should be relatively the same .... what does line 310 look like on your copy ?

lines 308-365:

/* ===== UPDATE PRODUCT ===== */
/* [ START ] Update Existing Product */
if(isset($_POST["action"]) && $_POST["action"] == "UpdateProduct") {
	/* Set Default FORM values */
	$_POST["product_Description"] = isset($_POST["product_Description"]) ? $_POST["product_Description"] : "NULL";
	$_POST["product_ShortDescription"] = isset($_POST["product_ShortDescription"]) ? $_POST["product_ShortDescription"] : "NULL";
	$_POST["product_Sort"] = isset($_POST["product_Sort"]) ? $_POST["product_Sort"] : "0";
	$_POST["product_OnWeb"] = isset($_POST["product_OnWeb"]) ? $_POST["product_OnWeb"] : "NULL";
	$_POST["product_Archive"] = isset($_POST["product_Archive"]) ? $_POST["product_Archive"] : "0";
	$_POST["product_shipchrg"] = isset($_POST["product_shipchrg"]) ? $_POST["product_shipchrg"] : "1";
	$_POST["product_Category_ID"] = isset($_POST["product_Category_ID"]) ? $_POST["product_Category_ID"] : array();
	$_POST["product_style"] = isset($_POST["product_style"]) ? $_POST["product_style"] : "NULL";
		$_POST["product_l"] = isset($_POST["product_l"]) ? $_POST["product_l"] : "NULL";
		$_POST["product_w"] = isset($_POST["product_w"]) ? $_POST["product_w"] : "NULL";
		$_POST["product_d"] = isset($_POST["product_d"]) ? $_POST["product_d"] : "NULL";
		$_POST["product_board"] = isset($_POST["product_board"]) ? $_POST["product_board"] : "NULL";
		$_POST["product_grade"] = isset($_POST["product_grade"]) ? $_POST["product_grade"] : "NULL";
		$_POST["product_print"] = isset($_POST["product_print"]) ? $_POST["product_print"] : "NULL";
		$_POST["product_used"] = isset($_POST["product_used"]) ? $_POST["product_used"] : "NULL";
		
	$query_rsCW = sprintf("UPDATE tbl_products 
		SET 
			product_Name='%s', 
			product_Description = '%s',
			product_ShortDescription = '%s', 
			product_Sort = %d, 
			product_OnWeb = %d, 
			product_Archive = %d, 
			product_shipchrg = %d,
			product_taxgroupid = %d,
			product_style='%s',
			product_l='%s',
			product_w='%s',
			product_d='%s',
			product_board='%s',
			product_grade='%s',
			product_print='%s',
			product_used='%s'

		WHERE product_ID=%d"
		,$_POST["product_Name"]
		,$_POST["product_Description"]
		,$_POST["product_ShortDescription"]
		,$_POST["product_Sort"]
		,$_POST["product_OnWeb"]
		,$_POST["product_Archive"]
		,$_POST["product_shipchrg"]
		,$_POST["product_taxgroupid"]
		,$_POST["product_ID"]
		,$_POST["product_style"]
		,$_POST["product_l"]
		,$_POST["product_w"]
		,$_POST["product_d"]
		,$_POST["product_board"]
		,$_POST["product_grade"]
		,$_POST["product_print"]
		,$_POST["product_used"]);
	$rsCW = $cartweaver->db->executeQuery($query_rsCW, "rsCW");

The only thing I can really suggest at this point is to see what the $_POST array holds. Insert this at line 310 and see what it says when you try update a product.

echo "<pre>";
print_r($_POST);
echo "</pre>";
die;

Array
(
[nextpage] => 1
)

is what I get.

That explains some of the problem ... that's not at all what i would expect to see there.

It appears that something really hosed your files, perhaps as was mentioned a move in Dreamweaver is the culprit... Unless you've done a lot of customizations, have you tried re placing the default files? This way you'll know you're at least working from uncorrupted code. Also, for help from developers that intimately know the Cartweaver code you should start a support ticket at http://www.cartweaver.com/support or start a thread in the support newsgroup - news://suppoert.cartweaver.com/php - they will be happy to help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.