Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 6 votes

NEW! Complete Order Editing Tool!


3242 replies to this topic

#2961 paulchen2005

  • Community Member
  • 146 posts
  • Real Name:Paul

Posted 20 November 2009, 11:10

View Postfruchtge, on 20 November 2009, 11:07, said:

If edited orders are deleted, stock is not updated.
Hi,

it works only if your product has one attribute... if the product has more than one attribute it works not :(

#2962 paulchen2005

  • Community Member
  • 146 posts
  • Real Name:Paul

Posted 20 November 2009, 19:16

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

#2963 surfalot

  • Community Member
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 21 November 2009, 11:55

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, 21 November 2009, 12:09.


#2964 paulchen2005

  • Community Member
  • 146 posts
  • Real Name:Paul

Posted 21 November 2009, 15:23

View Postsurfalot, on 21 November 2009, 11:55, said:

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...

View Postsurfalot, on 21 November 2009, 11:55, said:

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

#2965 paulchen2005

  • Community Member
  • 146 posts
  • Real Name:Paul

Posted 23 November 2009, 11:15

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

:)

#2966 rjhcloud

  • Community Member
  • 2 posts
  • Real Name:Russell Ham

Posted 23 November 2009, 13:10

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

#2967 paulchen2005

  • Community Member
  • 146 posts
  • Real Name:Paul

Posted 23 November 2009, 13:26

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...

:)

#2968 surfalot

  • Community Member
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 23 November 2009, 19:53

View Postrjhcloud, on 23 November 2009, 13:10, said:

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?

#2969 rjhcloud

  • Community Member
  • 2 posts
  • Real Name:Russell Ham

Posted 23 November 2009, 20:17

View Postsurfalot, on 23 November 2009, 19:53, said:

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.

#2970 surfalot

  • Community Member
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 23 November 2009, 21:07

View Postrjhcloud, on 23 November 2009, 20:17, said:

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?

#2971 paulchen2005

  • Community Member
  • 146 posts
  • Real Name:Paul

Posted 23 November 2009, 21:24

View Postsurfalot, on 23 November 2009, 21:07, said:

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?
The customers_ID in database is 0... that is not correct if i create a order for an existing customer... :(

#2972 surfalot

  • Community Member
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 23 November 2009, 22:44

View Postpaulchen2005, on 23 November 2009, 21:24, said:

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.

#2973 surfalot

  • Community Member
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 23 November 2009, 23:05

View Postrjhcloud, on 23 November 2009, 20:17, said:

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.

see the manual order maker topic:
http://forums.oscommerce.com/index.php?showtopic=312211

#2974 surfalot

  • Community Member
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 23 November 2009, 23:09

View Postpaulchen2005, on 23 November 2009, 13:26, said:

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, 23 November 2009, 23:09.


#2975 paulchen2005

  • Community Member
  • 146 posts
  • Real Name:Paul

Posted 24 November 2009, 23:13

...

Edited by paulchen2005, 24 November 2009, 23:26.


#2976 paulchen2005

  • Community Member
  • 146 posts
  • Real Name:Paul

Posted 25 November 2009, 17:10

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:

Quote

Subtotal:
19% VAT:
Standard Rate (after Germany):
Total (tax incl.):

and so it should look like:

Quote

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

#2977 paulchen2005

  • Community Member
  • 146 posts
  • Real Name:Paul

Posted 25 November 2009, 20:01

Hi,

i see the error is in the sort_order...

what must i change to set the sort_order like the config in the admin?

#2978 J-B

  • Community Member
  • 8 posts
  • Real Name:Johan

Posted 27 November 2009, 16:56

Hello!

I have a little problem, when I edit an order it adds this line in the ´state` field : [img]http://www.brundin.biz/temp/ordereditor.jpg[/img]
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, 27 November 2009, 16:58.


#2979 wHiTeHaT

  • Community Member
  • 134 posts
  • Real Name:wHiTy
  • Gender:Male
  • Location:Netherlands

Posted 30 November 2009, 21:58

Did anyone encounter problems using IE8 and Firefox 3.5.5 .
Couse suddenly i start to have major problems with the ajax updating fields.
installed modules:
-STS
-optiontype V2 (by zappo)

I'm getting aloth of syntax errors and not defined bugs
( did a few reïnstals with the latest version aswell , i not use the qty addons etc etc)

#2980 surfalot

  • Community Member
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 01 December 2009, 06:31

View PostwHiTeHaT, on 30 November 2009, 21:58, said:

Did anyone encounter problems using IE8 and Firefox 3.5.5 .
Couse suddenly i start to have major problems with the ajax updating fields.
installed modules:
-STS
-optiontype V2 (by zappo)

I'm getting aloth of syntax errors and not defined bugs
( did a few reïnstals with the latest version aswell , i not use the qty addons etc etc)

the latest version that I uploaded was tested with IE8 and FF3.5 on a server with globals off. one thing I noticed just recently was that the hide session id isn't being used as it should causing a return to the login page as a response. but logging in once more allows me to continue.

does it happen with products both with and without options/attributes?

did you see there was configuration item added to the database in the latest version?

Edited by surfalot, 01 December 2009, 06:35.