Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

NEW! Complete Order Editing Tool!


jhilgeman

Recommended Posts

this insert workd 100%

$sql_data_array2 = array('orders_id' => tep_db_prepare_input($oID),

'vendors_id' => tep_db_prepare_input($product['vendors_id']));

tep_db_perform(TABLE_ORDERS_SHIPPING, $sql_data_array2);

 

$new_product_id = tep_db_insert_id();

 

the problem is it inserts this every time you add a product.

 

I need to expand a check to see if the field was created already or not... if so skip if not run the above.

 

Does this make sense?

Link to comment
Share on other sites

this insert workd 100%

$sql_data_array2 = array('orders_id' => tep_db_prepare_input($oID),

'vendors_id' => tep_db_prepare_input($product['vendors_id']));

tep_db_perform(TABLE_ORDERS_SHIPPING, $sql_data_array2);

 

$new_product_id = tep_db_insert_id();

 

the problem is it inserts this every time you add a product.

 

I need to expand a check to see if the field was created already or not... if so skip if not run the above.

 

Does this make sense?

I think I understand you.

 

First of all your code example should looks a bit different or you will get improper results for product attributes. Here it is

$new_product_id = tep_db_insert_id();

$sql_data_array2 = array('orders_id' => tep_db_prepare_input($oID),
'vendors_id' => tep_db_prepare_input($product['vendors_id']));
tep_db_perform(TABLE_ORDERS_SHIPPING, $sql_data_array2);

We must have $new_product_id filled with ID of last insert operation for PRODUCT. In your version we have it filled with ID of last insert for VENDOR_ID in another table. Attributes become broken after that.

 

And the last we should have one more query before the $sql_data_array2. This query should check if vendor_id is already present in the TABLE_ORDERS_SHIPPING for current order_id.

 

So the complete code should looks like

        $new_product_id = tep_db_insert_id();

       $check_vendor_query = tep_db_query("select * from " . TABLE_ORDERS_SHIPPING . " where orders_id = '" . (int)$oID . "' and vendors_id = '" . (int)$product['vendors_id'] . "'");
       if (tep_db_num_rows($check_vendor_query) == 0) {
         $sql_data_array = array('orders_id' => tep_db_prepare_input($oID),
                                 'vendors_id' => tep_db_prepare_input($product['vendors_id']));
         tep_db_perform(TABLE_ORDERS_SHIPPING, $sql_data_array);
       }

This check will be pass after each product adding. This is the easiest way to exclude mistakes if we have a special button to check the order only once after all products will be added.

 

Not tested.

Link to comment
Share on other sites

I'd like to help you, but I have no SPPC yet and never use it. May be in future I need it then a bug will be resolved.

 

I would also like to take help in resolving Order editor with SPPC. I too see only retail price when adding products thro OE.

Link to comment
Share on other sites

I would also like to take help in resolving Order editor with SPPC. I too see only retail price when adding products thro OE.

I remember about your issue. Unfortunatelly SPPC I also never use, but this will be tricky to do. If fixes for MVC lies on top, SPPC is some in deep and takes too long time.

 

I saw instructions and screenshots for SPPC. It has several columns with prices in products tables. But it also has individual discounts per customer, has it? I may suggest to made a selector (drop down list) for price groups when adding each product product. This is one solution. There may be some more solutions. What to do with individual discounts and individual shipping quotes I don't know. So big modification takes too many time.

Link to comment
Share on other sites

I am a newbie to oscommerce and forums, so please bear with me. I have just installed order editor 5.0.9(twice) and keep getting the same error message when going into shop admin:

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /usr/www/users/gooimim/catalog/admin/includes/filenames.php:60) in /usr/www/users/gooimim/catalog/admin/includes/functions/sessions.php on line 102

 

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/gooimim/catalog/admin/includes/filenames.php:60) in /usr/www/users/gooimim/catalog/admin/includes/functions/general.php on line 22

 

Does this editor work with Online Merchant v2.2 RC2? Can someone point me in the right direction?

Link to comment
Share on other sites

Hi

 

I am using the order editor with SPPC and have managed to get everything working perfectly except for one small problem. Is anyone able to figure this out PLEASE?

 

When I add a products that has attributes to the order, using the order editor, the product is only added using the standard attribute price. I nedd it to add the product using the attribute price for the selected customer group.

 

This seems to be the applicable code:

 

 $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$add_product_products_id . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");
     while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
       $selected = 0;
       $products_options_array = array();
       if ($i > 1) echo '            <td class="dataTableContent"> </td>' . "\n";
       $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.code_suffix, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$add_product_products_id . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'");
       while ($products_options = tep_db_fetch_array($products_options_query)) {
         $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options_name['products_options_name'] . ' - ' . $products_options['products_options_values_name']);
         if ($products_options['options_values_price'] != '0') {
           $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->format($products_options['options_values_price'], true, $order->info['currency'], $order->info['currency_value']) .')';
         }
       }

	if(isset($_POST['add_product_options'])) {
         $selected_attribute = $_POST['add_product_options'][$products_options_name['products_options_id']];
       } else {
         $selected_attribute = false;
       }

 

I have seen that using the customer side of the store, product_info.php uses this code to ensure that the correct attribute price is used for the customer group:

 

 $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by popt.products_options_name");
     while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
       $products_options_array = array();
        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0");
	$list_of_prdcts_attributes_id = '';
	$products_options = array(); // makes sure this array is empty again
       while ($_products_options = tep_db_fetch_array($products_options_query)) {
	$products_options[] = $_products_options;
	$list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].",";
}

     if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') { 
        $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
 $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'");
 while ($pag_array = tep_db_fetch_array($pag_query)) {
	 $cg_attr_prices[] = $pag_array;
 }

 // substitute options_values_price and prefix for those for the customer group (if available)
 if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
    for ($n = 0 ; $n < count($products_options); $n++) {
	 for ($i = 0; $i < count($cg_attr_prices) ; $i++) {
		 if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) {
			$products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
			$products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
		 }
	 } // end for ($i = 0; $i < count($cg_att_prices) ; $i++)
    }
       } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
     } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')

  for ($n = 0 ; $n < count($products_options); $n++) {
         $products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $products_options[$n]['products_options_values_name']);
         if ($products_options[$n]['options_values_price'] != '0') {
           $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
         }
       }
// EOF SPPC attributes mod


       if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
         $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
       } else {
         $selected_attribute = false;
       }

 

 

Is there any genius here, who know how to integrate the product_info.php code into the code in edit_orders_add_product.php so that the order editor can also use the customer group prices for attributes instead of just the standard attribute price?

 

Thank you so much for taking a look at this.

Link to comment
Share on other sites

I am a newbie to oscommerce and forums, so please bear with me. I have just installed order editor 5.0.9(twice) and keep getting the same error message when going into shop admin:

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /usr/www/users/gooimim/catalog/admin/includes/filenames.php:60) in /usr/www/users/gooimim/catalog/admin/includes/functions/sessions.php on line 102

 

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/gooimim/catalog/admin/includes/filenames.php:60) in /usr/www/users/gooimim/catalog/admin/includes/functions/general.php on line 22

 

Does this editor work with Online Merchant v2.2 RC2? Can someone point me in the right direction?

You must carefully check all your .php files pointing much attention on files in admin\includes\classes, admin\includes\functions to find and REMOVE all beginning spacing before each <? tag and all trailing spaces after ?> tag. It will be better if you check all your .php files and remove spaces.

Link to comment
Share on other sites

I am using the order editor with SPPC and have managed to get everything working perfectly except for one small problem.

The same as for member sukumkart. Unfortunately, nobody except me support OE contrib now. But I never use SPPC and never test OE with it.

Link to comment
Share on other sites

Newbie osC user here - don't yell at me if this has already been answered (but how do you find things in a 158 page thread?).

 

I just installed 5.0.9c. I get the following for any field that has a drop down. What needs fixing?

 

Success Success!

Parse error: syntax error, unexpected '?' in /home/mysite/public_html/osc/admin/edit_orders_ajax.php on line 1028

has been updated

Link to comment
Share on other sites

Newbie osC user here - don't yell at me if this has already been answered (but how do you find things in a 158 page thread?).

 

I just installed 5.0.9c. I get the following for any field that has a drop down. What needs fixing?

 

Success Success!

Parse error: syntax error, unexpected '?' in /home/mysite/public_html/osc/admin/edit_orders_ajax.php on line 1028

has been updated

 

It isn't just drop downs - it is any change to any field.

Link to comment
Share on other sites

It isn't just drop downs - it is any change to any field.

You may use "Search topic" edit box under the last post to search in 158 pages :)

 

Your error is definitely caused by incorrect installation. But OE 5.9.0c uses some contribs I don't have. So I can't support for it carefully. Some folks also had problems with latest version. Try to check your installation of OE and installation of ALL contribs that was added to OE since version 5.0.7. If you have not some, try to install them, but I can''t guarantee positive results. So, use them on your own risk. And never try to do on working shop!!!

Link to comment
Share on other sites

It isn't just drop downs - it is any change to any field.

You may use "Search topic" edit box under the last post to search in 158 pages :)

 

Your error is definitely caused by incorrect installation. But OE 5.0.9c uses some contribs I don't have. So I can't support for it carefully. Some folks also had problems with latest version. Try to check your installation of OE and installation of ALL contribs that was added to OE since version 5.0.7. If you have not some, try to install them, but I can''t guarantee positive results. So, use them on your own risk. And never try to do on working shop!!!

Link to comment
Share on other sites

You may use "Search topic" edit box under the last post to search in 158 pages :)

 

Your error is definitely caused by incorrect installation. But OE 5.0.9c uses some contribs I don't have. So I can't support for it carefully. Some folks also had problems with latest version. Try to check your installation of OE and installation of ALL contribs that was added to OE since version 5.0.7. If you have not some, try to install them, but I can''t guarantee positive results. So, use them on your own risk. And never try to do on working shop!!!

 

I reinstalled the OE add on, paying careful attention to the changes I made to the 4 existing modules. This was no help - I still get the same error when attempting to update anything (clicking on any value in a drop down or pressing return after changing a text field).

 

Parse error: syntax error, unexpected '?' in /home/mysite/public_html/osc/admin/edit_orders_ajax.php on line 1028

 

You suggest installing other add ons. I'd rather not do that if there is another way to get OE to work. I prefer one package of changes at a time. If there is no other way, is there any of the other contribs that you would suggest I start with first?

 

John

Link to comment
Share on other sites

Further info:

 

If I disable the use of Ajax in the Configuration for OE then all appears to work. This, to me anyway, points to a problem with the module referenced in the error message below.

 

Parse error: syntax error, unexpected '?' in /home/mysite/public_html/osc/admin/edit_orders_ajax.php on line 1028

 

BTW, I'm using Firefox 3.6.3 and I've tried this on a couple of different computers.

 

 

John

Edited by jwpalfa
Link to comment
Share on other sites

Further info:

 

If I disable the use of Ajax in the Configuration for OE then all appears to work. This, to me anyway, points to a problem with the module referenced in the error message below.

 

Parse error: syntax error, unexpected '?' in /home/mysite/public_html/osc/admin/edit_orders_ajax.php on line 1028

 

BTW, I'm using Firefox 3.6.3 and I've tried this on a couple of different computers.

 

 

John

Edit admin/edit_orders_ajax.php FIND line 1028

		if ( FILENAME_EMAIL_ORDER_TEXT !== ?FILENAME_EMAIL_ORDER_TEXT? ){	

and REPLACE it with

		if ( FILENAME_EMAIL_ORDER_TEXT !== FILENAME_EMAIL_ORDER_TEXT ){	

But I can't understand what the author of the line wants to say. This line seems useless, but because this is need for integration with one of other contrib, leave it there as is with my correction.

 

I can't suggest you other contrib, because there is no other contrib like OE. If you don't want to install all of contribs OE 5.0.9 and 5.0.8 working with, I may only suggest to install version 5.0.7.

Edited by RusNN
Link to comment
Share on other sites

Edit admin/edit_orders_ajax.php FIND line 1028

		if ( FILENAME_EMAIL_ORDER_TEXT !== ?FILENAME_EMAIL_ORDER_TEXT? ){	

and REPLACE it with

		if ( FILENAME_EMAIL_ORDER_TEXT !== FILENAME_EMAIL_ORDER_TEXT ){	

 

Bingo!

 

Thanks RussNN - that fixed the error completely.

 

John

Link to comment
Share on other sites

Couldn't find an answer to this...

 

 

So my store allows customers to enter their first of last names as Mike "the boss" Donavan..

 

Which as you can see can cause a headache for many mods.. I got this mod successful installed however, if a customer has the quotes in their name, when I edit the order it deletes the "quoted text" and their last name.

 

I've noticed that It only happens when i first click on the edit order button. However if I input the name with the quotes, it enters it in correctly. Until I edit the order again....

 

It seems that the function for oe_html_no_quote() is not working.. any ideas?

Link to comment
Share on other sites

Hi,

 

I've got 5.0.9c installed on my shop and the only problem I find is that I have a few order total additions e.g. a surcharge for PayPal. Initially the order total all adds up correctly, but if I edit the order e.g. add another item, I then find that while the PayPal surcharge line remains visible, the amount for that doesn't get included in the recalculation of the order total. The only workaround is to add a second order total line and copy the paypal surcharge from the line above. It seems this second total DOES get included in subsequent calculations when edits are done, but why doesn't the original one?

 

Thanks,

Greg

Link to comment
Share on other sites

Hi,

 

I've got 5.0.9c installed on my shop and the only problem I find is that I have a few order total additions e.g. a surcharge for PayPal. Initially the order total all adds up correctly, but if I edit the order e.g. add another item, I then find that while the PayPal surcharge line remains visible, the amount for that doesn't get included in the recalculation of the order total. The only workaround is to add a second order total line and copy the paypal surcharge from the line above. It seems this second total DOES get included in subsequent calculations when edits are done, but why doesn't the original one?

 

Thanks,

Greg

Maybe this and this aswers to your question. You shoould improve it to your needs. But all risk are yours. OE does not calculate such totals by default and some of totals are very difficult to calculate automatically, eg. ot_redeem, ot_coupon and so on. If this not suits to you, use standart way by adding manual totals and recalculate them manually every time.

Edited by RusNN
Link to comment
Share on other sites

Thanks for this much needed contrib.

 

Im having a bit of a problem with orders since installing. Im getting two sub totals, two postage costs, and two totals. three emails are being sent out too.

 

Sub-Total: £0.00

Sub-Total: £63.00

ROYAL MAIL ( lbs) (FIRST CLASS RECORDED): £3.50

ROYAL MAIL ( lbs) (FIRST CLASS RECORDED): £0.00

Total: £3.50

Total: £63.00

 

also getting two orders for one purchase.

 

 

Customers Order Total Date Purchased Status Action

Preview Ashley Fred £3.50 01.11.2010 20:20:39 Order Received

Preview Ashley Fred £63.00 01.11.2010 20:20:39 Order Received

Preview Nathan Jim £3.50 28.10.2010 19:32:54 Dispached

Preview Nathan Jim £25.50 28.10.2010 19:32:54 Dispached

 

 

anyone have an idea whats going on??

 

Much thanks for any help.

Link to comment
Share on other sites

Bruce, I don't know if you'll see this, but about a year after you ran into this so did I. Thank you for posting this, it corrected the very same problem I had.

 

 

Ha ha, I took the long way around the barn and figured this out. It works perfect now. I googled "tep_round_up" and found a solution buried in the forums here. Anyone with USPS Methods V4.3.1 will need to add this to their catalog/admin/includes/funtions/general.php file: (I put it around where USPS Methods are located.)

////

// Round up function for non whole numbers by GREG DEETH

// The value for the precision variable determines how many digits after the decimal and rounds the last digit up to the next value

// Precision = 0 -> xx.xxxx = x+

// Precision = 1 -> xx.xxxx = xx.+

// Precision = 2 -> xx.xxxx = xx.x+

function tep_round_up($number, $precision) {

$number_whole = '';

$num_left_dec = 0;

$num_right_dec = 0;

$num_digits = strlen($number);

$number_out = '';

$i = 0;

while ($i + 1 <= strlen($number))

{

$current_digit = substr($number, $i, ($i + 1) - $num_digits);

if ($current_digit == '.') {

$i = $num_digits + 1;

$num_left_dec = strlen($number_whole);

$num_right_dec = ($num_left_dec + 1) - $num_digits;

} else {

$number_whole = $number_whole . $current_digit;

$i = $i + 1;

}

}

if ($num_digits > 3 && $precision < ($num_digits - $num_left_dec - 1) && $precision >= 0) {

$i = $precision;

$addable = 1;

while ($i > 0) {

$addable = $addable * .1;

$i = $i - 1;

}

$number_out = substr($number, 0, $num_right_dec + $precision) + $addable;

} else {

$number_out = $number;

}

return $number_out;

}

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

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