Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

NEW! Complete Order Editing Tool!


jhilgeman

Recommended Posts

can you confirm that it is ONLY the products added with the Order editor?

 

If you delete an order that was never edited, it works fine?

i have the problem too....

if i delete orders with qtpro that was never edited it works fine!!!

 

but not with edited orders and qtpro

 

best regards

Paul

Link to comment
Share on other sites

the error was in this code:

// QT Pro Addon BOF	
				$attrib_q = tep_db_query("select distinct op.products_id, po.products_options_id, pov.products_options_values_id
					                        from products_options po, products_options_values pov, products_options_values_to_products_options po2pov, orders_products_attributes opa, orders_products op
					                        where op.orders_id = '" . $oID . "'
														      and op.orders_products_id = '" . $orders_products_id . "'
														      and products_options_values_name = opa.products_options_values
					                        and pov.products_options_values_id = po2pov.products_options_values_id
					                        and po.products_options_id = po2pov.products_options_id
					                        and products_options_name = opa.products_options");
				while($attrib_set = tep_db_fetch_array($attrib_q)) {
					// corresponding to each option find the attribute ids ( opts and values id )
					$products_stock_attributes[] = $attrib_set['products_options_id'].'-'.$attrib_set['products_options_values_id'];
				}
				sort($products_stock_attributes, SORT_NUMERIC); // Same sort as QT Pro stock
				$products_stock_attributes = implode($products_stock_attributes, ',');
				 // update the stock
				 tep_db_query("update ".TABLE_PRODUCTS_STOCK." set products_stock_quantity = products_stock_quantity + ".$products_details["qty"] . " where products_id= '" . $order_products['products_id'] . "' and products_stock_attributes='".$products_stock_attributes."'");
// QT Pro Addon EOF

 

because this part:

where products_id= '" . $order_products['products_id'] . "' and products_stock_attributes='".$products_stock_attributes."'");

 

what must i change to ask about products_stock_id and not products_stock_attributes in where clause????

Link to comment
Share on other sites

can you confirm that it is ONLY the products added with the Order editor?

 

If you delete an order that was never edited, it works fine?

 

 

Hi all,

 

thank you much for your commitments, and thats the problem: If edited orders are deleted, stock is not updated.

life long and knusper

Link to comment
Share on other sites

Hi,

 

here is my fix, it works :)

 

 

					$attrib_q = tep_db_query("select distinct op.products_id, po.products_options_id, pov.products_options_values_id
				, pov.products_options_values_name,opa.products_options_values, opa.products_options, opa.products_options_values

					        from products_options po, 
							     products_options_values pov, 
								 products_options_values_to_products_options po2pov, 
								 orders_products_attributes opa, 
								 orders_products op

					        where op.orders_id = '" . $_GET['oID'] . "'
					        and opa.orders_id = '" . $_GET['oID'] . "'
							and op.orders_products_id = '" . $_GET['pid'] . "'
							and opa.orders_products_id = '" . $_GET['pid'] . "'

							and po.products_options_name = opa.products_options
							and pov.products_options_values_name = opa.products_options_values
							");	

 

best regards

Paul

Link to comment
Share on other sites

you are awesome Paul !! Thanks for working that out! I'll give it a try.

 

Are update both blocks of code in /admin/edit_orders_ajax.php ?

 

no changes to /admin/edit_orders.php ??

Edited by surfalot
Link to comment
Share on other sites

Are update both blocks of code in /admin/edit_orders_ajax.php ?

yes, the one block is for update quantity and the other if i delete a product...

 

no changes to /admin/edit_orders.php ??

in /admin/edit_orders.php are 2 blocks to change same think like above, one block is for update quantity and the other if i delete a product... :) but this is not important if you use the ajax method ;)

Link to comment
Share on other sites

Hi,

 

here is the next very important bug fix:

 

in: admin/edit_orders_add_product.php:

in line 142 under

//end sppc patch   

add:

// QT Pro Addon BOF		    
       if (isset($_POST['add_product_options'])) {
       	foreach($_POST['add_product_options'] as $option_id => $option_value_id) {
       		$products_stock_attributes[] = $option_id . '-'. $option_value_id;
       	} // for loop
       	sort($products_stock_attributes, SORT_NUMERIC); // Same sort as QT Pro stock
       	$products_stock_attributes = implode($products_stock_attributes, ',');
}
// QT Pro Addon EOF

 

under:

'products_quantity' => tep_db_prepare_input($_POST['add_product_quantity']),

add:

'products_stock_attributes' => $products_stock_attributes);

 

like this:

'products_quantity' => tep_db_prepare_input($_POST['add_product_quantity']),
'products_stock_attributes' => $products_stock_attributes);

 

under:

// QT Pro Addon BOF	

delete:

        if (isset($_POST['add_product_options'])) {
       	foreach($_POST['add_product_options'] as $option_id => $option_value_id) {
       		$products_stock_attributes[] = $option_id . '-'. $option_value_id;
       	} // for loop
       	sort($products_stock_attributes, SORT_NUMERIC); // Same sort as QT Pro stock
       	$products_stock_attributes = implode($products_stock_attributes, ',');

 

and under:

          tep_db_query("update ".TABLE_PRODUCTS_STOCK." set products_stock_quantity = ".$new_quantity." where products_id=" . $_POST['add_product_products_id']. " and products_stock_attributes='".$products_stock_attributes."'");

delete:

        }

 

like this:

	        //end sppc patch   

// QT Pro Addon BOF		    
       if (isset($_POST['add_product_options'])) {
       	foreach($_POST['add_product_options'] as $option_id => $option_value_id) {
       		$products_stock_attributes[] = $option_id . '-'. $option_value_id;
       	} // for loop
       	sort($products_stock_attributes, SORT_NUMERIC); // Same sort as QT Pro stock
       	$products_stock_attributes = implode($products_stock_attributes, ',');
}
// QT Pro Addon EOF

       $sql_data_array = array('orders_id' => tep_db_prepare_input($oID),
                               'products_id' => tep_db_prepare_input($add_product_products_id),
                               'products_model' => tep_db_prepare_input($product['products_model']),
                               'products_name' => tep_db_prepare_input($product['products_name']),
                               'products_price' => tep_db_prepare_input($product['products_price']),
                               'final_price' => tep_db_prepare_input(($product['products_price'] + $AddedOptionsPrice)),
                               'products_tax' => tep_db_prepare_input($products_tax),
                               'products_quantity' => tep_db_prepare_input($_POST['add_product_quantity']),
							'products_stock_attributes' => $products_stock_attributes);

       tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
       $new_product_id = tep_db_insert_id();

       if (isset($_POST['add_product_options'])) {
         foreach($_POST['add_product_options'] as $option_id => $option_value_id) {
           $sql_data_array = array('orders_id' => tep_db_prepare_input($oID),
                                   'orders_products_id' => tep_db_prepare_input($new_product_id),
                                   'products_options' => tep_db_prepare_input($option_names[$option_id]),
                                   'products_options_values' => tep_db_prepare_input($option_values_names[$option_value_id]),
            'options_values_price' => tep_db_prepare_input($option_value_details[$option_id][$option_value_id]['options_values_price']),
            'price_prefix' => tep_db_prepare_input($option_value_details[$option_id][$option_value_id]['price_prefix']));
           tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);


	//add on for downloads
	if (DOWNLOAD_ENABLED == 'true' && isset($filename[$option_id])) {

	$Query = "INSERT INTO " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " SET
			orders_id = '" . tep_db_prepare_input($oID) . "',
			orders_products_id = '" . tep_db_prepare_input($new_product_id) . "',
			orders_products_filename = '" . tep_db_prepare_input($filename[$option_id]) . "',
			download_maxdays = '" . tep_db_prepare_input($maxdays[$option_id]) . "',
            download_count = '" . tep_db_prepare_input($maxcount[$option_id]) . "'";

				tep_db_query($Query);

      	} //end if (DOWNLOAD_ENABLED == 'true') {
	//end downloads 
         }
       }

	// Update inventory Quantity
		// This is only done if store is set up to use stock
		if (STOCK_LIMITED == 'true'){
			tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_quantity = products_quantity - " . $_POST['add_product_quantity'] . "  WHERE products_id = '" . $_POST['add_product_products_id'] . "'");
// QT Pro Addon BOF		    

       	$stock_chk_q = tep_db_query("select * from " . TABLE_PRODUCTS_STOCK . " where products_id=" . $_POST['add_product_products_id']. " and products_stock_attributes='".$products_stock_attributes."'");
         $stock_chk_arr = tep_db_fetch_array($stock_chk_q);
         $new_quantity = $stock_chk_arr['products_stock_quantity'] - $_POST['add_product_quantity'];
         // update the stock
         tep_db_query("update ".TABLE_PRODUCTS_STOCK." set products_stock_quantity = ".$new_quantity." where products_id=" . $_POST['add_product_products_id']. " and products_stock_attributes='".$products_stock_attributes."'");
// QT Pro Addon EOF

 

now will saved products_stock_attributes in TABLE_ORDERS_PRODUCTS and if i delete the complete order in orders.php the qtpro stock will be update correct

 

:)

Link to comment
Share on other sites

might have been coverd b4 but i cant see it.

 

I have instaled this contrib and all works well, except that orders are not appearing in the customers account. They are in admin just not in customers order history.

 

Any idea how to fix this?? I am using v2.2 Rc2

 

Thanks in advance

Link to comment
Share on other sites

Hi,

 

very important is this fix:

before:

sort($products_stock_attributes, SORT_NUMERIC); // Same sort as QT Pro stock
$products_stock_attributes = implode($products_stock_attributes, ',');
				 // update the stock
				 tep_db_query("update ".TABLE_PRODUCTS_STOCK." set products_stock_quantity = products_stock_quantity + ".$order['products_quantity'] . " where products_id= '" . (int)$order['products_id'] . "' and products_stock_attributes='".$products_stock_attributes."'");

add:

if (!empty($products_stock_attributes)) {

and after the code add:

}

 

this is important because there is an error if i delete or update a product without attribute...

 

:)

Link to comment
Share on other sites

might have been coverd b4 but i cant see it.

 

I have instaled this contrib and all works well, except that orders are not appearing in the customers account. They are in admin just not in customers order history.

 

Any idea how to fix this?? I am using v2.2 Rc2

 

Thanks in advance

Did you use the Manual Order Maker?

 

The first thing to ensure you understand is the Order Status and Public Status. If you look at Admin -> Localization -> Order Status, is the current status of the order public?

Link to comment
Share on other sites

Did you use the Manual Order Maker?

 

The first thing to ensure you understand is the Order Status and Public Status. If you look at Admin -> Localization -> Order Status, is the current status of the order public?

 

Thanks for geting back to me. Yes, i installed and use manual order maker. I have also checked the order status is set to public and all of them are.

Link to comment
Share on other sites

Thanks for geting back to me. Yes, i installed and use manual order maker. I have also checked the order status is set to public and all of them are.

 

OK, to recap, you used Manual Order Maker to create an order for an existing customer, but the order is not visible in the customer's history? And you checked to make sure the order's status is visible?

Link to comment
Share on other sites

The customers_ID in database is 0... that is not correct if i create a order for an existing customer... :(

 

This is a problem for order maker and the issue should be moved to that support topic. But for the record, the issue is in hand, please be patient.

Link to comment
Share on other sites

this is important because there is an error if i delete or update a product without attribute...

 

:)

 

so back to order editor. wow, looks like you're finding many more issues with the QTPro solution.

 

just a bit ago, I notice the add product popup sent me back to the login page, I think there is a missing hide session id function there.

Edited by surfalot
Link to comment
Share on other sites

Hello,

 

I would like to know how I can push in order editor in the list below to display the order total value added to bottom?

 

the time it looks like this:

 

Subtotal:

19% VAT:

Standard Rate (after Germany):

Total (tax incl.): [/Quote]

 

and so it should look like:

Subtotal:

Standard Rate (after Germany):

Total (tax incl.)

19% VAT:

 

but how do I reach it, as to get by somehow not ...:(

 

 

I hope someone can help me?

 

greetings

Paul

Link to comment
Share on other sites

Hello!

 

I have a little problem, when I edit an order it adds this line in the ´state` field : ordereditor.jpg

We do not have states here in Sweden so I would prefere that it would not add anything there.

To get rid of the line I have to go in to phpmyadmin and delete it in the database.

 

How can I get rid of it?

I would like to keep the country line however.

 

I use version 5.07

 

 

Thank you for a very nice contrib!

Edited by J-B
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...