Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

NEW! Complete Order Editing Tool!


jhilgeman

Recommended Posts

Hello,

 

The bug where PHP was not pulling price prefix from database is still there.

 

I have no idea how to fix it. Anybody can help?

 

Thanks.

 

I want to mention that i use v2.5 Multiple tax zones, on-the-fly total calcs, updated to v2.5.1 with fixes for attributes price prefixes. Everytime when press Edit button, and after that Update, the currency sign is erased.

If the price for a product is let's say $100.00 it will display just 100

Link to comment
Share on other sites

I want to mention that i use v2.5 Multiple tax zones, on-the-fly total calcs, updated to v2.5.1 with fixes for attributes price prefixes. Everytime when press Edit button, and after that Update, the currency sign is erased.

If the price for a product is let's say $100.00 it will display just 100

 

What you're describing is not a bug. The entries for product price should not contain currency symbols, only numbers and a decimal if necessary.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Hello,

 

The bug where PHP was not pulling price prefix from database is still there.

 

I have no idea how to fix it. Anybody can help?

 

Thanks.

 

I don't believe this is true. Are you saying when you add a product with a negative price prefix for a product attribute, the prefix shows up as a positive?

Edited by djmonkey1

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Hi,

 

I did upgrade to the version V2.5.2 ( i had already V2.5 )

 

and when i try to make a new order i have only on the page three button , ( update, order, invoice.. )

 

Xavier

 

I don't understand the problem. Could you be more specific please?

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

I don't believe this is true. Are you saying when you add a product with a negative price prefix for a product attribute, the prefix shows up as a positive?

Look if i press Edit button and after that one of those Update buttons, the currency sign simply dissapear.

It doesn't matter if i change or not something, as long as Update button is pressed, the currency sign is removed.

When the customer place a order, the prices are like this: $100.00. When i press edit and immediately after, the update button, the prices are changed like this: 100

I have no idea why.

Link to comment
Share on other sites

I placed a test order

 

Test order

 

I click on Edit button

 

Clicked on Update, and after on Details, without modifying anything

 

The currency sign was removed and i don't understand why... :(

 

That's bizarre. Have you changed anything in your database or admin/orders.php recently?

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

I don't understand the problem. Could you be more specific please?

 

 

Hi, i have made a mistake. This is much much better this version with atrtibut.

 

Please will it be possbile to think about a solution for working with QTPRO

 

In this contrib with use attributes but th stock is taking in a special table product-stock

here is the detail of this table

 

`products_stock` (

`products_stock_id` int(11) NOT NULL auto_increment,

`products_id` int(11) NOT NULL default '0',

`products_stock_attributes` varchar(255) NOT NULL default '',

`products_stock_quantity` int(11) NOT NULL default '0',

PRIMARY KEY (`products_stock_id`),

UNIQUE KEY `idx_products_stock_attributes` (`products_id`,`products_stock_attributes`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=810 ;

 

--

-- `products_stock`

--

 

INSERT INTO `products_stock` (`products_stock_id`, `products_id`, `products_stock_attributes`, `products_stock_quantity`) VALUES (374, 139, '2-17', 4),

(31, 63, '4-41', -1),

(735, 60, '4-40', 0),

(6, 65, '4-39', 2),

(7, 61, '4-39', 2),

 

Thank you for your help

 

Xav

Link to comment
Share on other sites

I placed a test order

 

Test order

 

I click on Edit button

 

Clicked on Update, and after on Details, without modifying anything

 

The currency sign was removed and i don't understand why... :(

 

Also, check your settings under Administration->Localization->Currencies (admin/currencies.php) and make sure they are correct.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

I haven't changed anything in the database, and never touched the admin/currencies.php.

Other version of this contribution displayed the currency sign, but this one, the latest, have something wrong inside it i don't know...

 

I see a guy who posted this:

 

order_editor.jpg

 

Where is the currency sign displayed?

Edited by invasi0n
Link to comment
Share on other sites

I haven't changed anything in the database, and never touched the admin/currencies.php.

Other version of this contribution displayed the currency sign, but this one, the latest, have something wrong inside it i don't know...

 

I see a guy who posted this:

 

Where is the currency sign displayed?

 

It's not. All the values are displayed in text boxes so the JavaScript can recalculate them. This is a feature, not a bug, that was introduced in v2.5. The display of a currency sign is not necessary. If you look in your database for any of the product price values you will not find a currency sign anywhere; it is added by the php of the various files when displaying the values.

 

For instance if you look in admin/orders.php you should be able to find some code like this:

<td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>

 

This code pulls $order->products[$i]['final_price'] from the database- this can be a value like 27.9500 or 28.9765 or whatever. Note that this is a number, not text like you are looking for (it would be text if it had a currency symbol included). Then it takes that value, say the 28.9765, and it formats that value according to the settings you set at Administration->Localization->Currencies. Go to that page and see what is your default currency, symbol left, symbol right, decimal point, etc. It should all be there.

 

For subtotal, total, etc, there is both a numerical value and a text value saved in the database. Check out your orders_total table for these orders that are messed up and compare the text and value entries for the various components of each order. They should not be identical, but should have the same value, ie one is 450.0000 and the other is $450.00.

 

I can't think of what can be causing the problem you are having other than the $currencies->format function is not working, or your currency settings are missing or something like that.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

It's not. All the values are displayed in text boxes so the JavaScript can recalculate them. This is a feature, not a bug, that was introduced in v2.5. The display of a currency sign is not necessary. If you look in your database for any of the product price values you will not find a currency sign anywhere; it is added by the php of the various files when displaying the values.

 

For instance if you look in admin/orders.php you should be able to find some code like this:

<td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>

 

This code pulls $order->products[$i]['final_price'] from the database- this can be a value like 27.9500 or 28.9765 or whatever. Note that this is a number, not text like you are looking for (it would be text if it had a currency symbol included). Then it takes that value, say the 28.9765, and it formats that value according to the settings you set at Administration->Localization->Currencies. Go to that page and see what is your default currency, symbol left, symbol right, decimal point, etc. It should all be there.

 

For subtotal, total, etc, there is both a numerical value and a text value saved in the database. Check out your orders_total table for these orders that are messed up and compare the text and value entries for the various components of each order. They should not be identical, but should have the same value, ie one is 450.0000 and the other is $450.00.

 

I can't think of what can be causing the problem you are having other than the $currencies->format function is not working, or your currency settings are missing or something like that.

Thanks for your attention, the problem is orders_total table. But how to fix that?

Link to comment
Share on other sites

I found this on my admin/orders.php

 

 

' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .

 

and the Administration->Localization->Currencies setting are correct

Link to comment
Share on other sites

i have a trouble when i try to delete one items on the order i have :

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' products_ordered = products_ordered - WHERE product

 

UPDATE products SET products_quantity = products_quantity + , products_ordered = products_ordered - WHERE products_id = '0'

 

[TEP STOP]

 

 

 

xavier

Link to comment
Share on other sites

i have a trouble when i try to delete one items on the order i have :

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' products_ordered = products_ordered - WHERE product

 

UPDATE products SET products_quantity = products_quantity + , products_ordered = products_ordered - WHERE products_id = '0'

 

[TEP STOP]

 

xavier

 

This is interesting. I believe what is happening is that you are deleting the entry in the quantity box along with checking the delete checkbox, so when you hit the update button the variable $products_details["qty"] is null and you get this error.

 

Thanks- you've identified a very small omission on my part, namely that the code assumes $products_details["qty"] is not null.

 

Find

// 1.3.1 Update orders_products Table
	if (is_array ($_POST['update_products'])){
	foreach($_POST['update_products'] as $orders_products_id => $products_details)	{

and add directly below it

		if (!tep_not_null($products_details["qty"])) $products_details["qty"] = 0;

 

and you should not have a problem with this again.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Thanks for your attention, the problem is orders_total table.

Well, yes and no. I take it you have found that the entries for text and value in the orders_total table to be identical, ie they are both 796.

 

But this just comes back to currencies->format, because in edit_orders.php the code that controls the formatting of the text value entered into the orders_total table for the various order total components is

 $ot_text = $currencies->format($ot_value, true, $order->info['currency'], $order->info['currency_value']);

 

Another thing that can be wrong with this function is the "$order->info['currency'], $order->info['currency_value']" part. In your admin/includes/classes/order.php you should have something like this at around line 42 or so depending on whether you've made other modifications to the file:

$this->info = array('currency' => $order['currency'],
					  'currency_value' => $order['currency_value'],
					  'payment_method' => $order['payment_method'],
					  'cc_type' => $order['cc_type'],
					  'cc_owner' => $order['cc_owner'],
					  'cc_number' => $order['cc_number'],
					  'cc_expires' => $order['cc_expires'],
					  'shipping_tax' => $order['shipping_tax'],
					  'date_purchased' => $order['date_purchased'],
					  'orders_status' => $order['orders_status'],
					  'last_modified' => $order['last_modified']);

 

We see that currency and currency_value are the first two entries that are defined here, but this whole array depends on the order_query. In my file I have

$order_query = tep_db_query("select * from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");

the asterisk (*) being a wildcard that tells the code to pull all the entries for a given order_id. If you have a paragraph of entries rather than an *, make sure that currency and currency_value are listed.

 

Another thing could be if the value of currency and/or currency_value in the orders table for the orders in question are empty or set at NULL (NULL being the default entry). If for some reason this information is not being stored at checkout this may also cause a problem.

 

Check on this stuff and let us know how it goes. We'll get to the bottom of this eventually.

 

Cheers

Stew

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

I found in my admin/includes/classes/order.php the followings:

 

Lines 26, 27, 28

function query($order_id) {
[b]$order_query = tep_db_query("select * from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");[/b]
$order = tep_db_fetch_array($order_query);

 

Lines 41 - 51:

 

$this->info = array('currency' => $order['currency'],
					  'currency_value' => $order['currency_value'],
					  'payment_method' => $order['payment_method'],
					  'cc_type' => $order['cc_type'],
					  'cc_owner' => $order['cc_owner'],
					  'cc_number' => $order['cc_number'],
					  'cc_expires' => $order['cc_expires'],
					  'shipping_tax' => $order['shipping_tax'],
					  'date_purchased' => $order['date_purchased'],
					  'orders_status' => $order['orders_status'],
					  'last_modified' => $order['last_modified']);

 

And in edit_orders.php line 381:

 

$ot_text = $currencies->format($ot_value, true, $order->info['currency'], $order->info['currency_value']);

 

I also checked the currency and currency_value in the orders table:

 

currency6pq.jpg

 

currencyvalue5bf.jpg

 

It seems there is something wrong but have no clue how to fix it...

Link to comment
Share on other sites

I also checked the currency and currency_value in the orders table:

 

currency6pq.jpg

 

currencyvalue5bf.jpg

 

It seems there is something wrong but have no clue how to fix it...

 

For these two items, what is actually stored in the database as entries for these fields for the orders you have that are messed up?

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Hello everyone and HEllo Stew,

 

Eh nice to see how you re helping folks. After all a lot of this mod is your creation. And where i come from it's said "We are responcible for those who got used to us" (sorry if anything is lost in translation). :)

 

Anyway Im having a small issue. I have Points/Rewards and CCGV installed. When one or both of them are used in an order they apply negative values to the order total (ex: Points Redeemed(60 x $0.20): $-11.99). However those values when in the order editor's Discount, Shipping and Total section apear as positive ones. Which seems fine until you hit Update then obviosly those values get added and ... well you get the picture.

 

An idea for a fix that I have is the following: on update check the description feild for strings that start with one of the following "Points" or "Coupon" or "Gift Voucher" and if one of those is found quickly slap a "-" before a value in the corresponding Amount feild, but not before checking if it's alredy there.

 

Ah sounds so nice in English. Is this "doable" in PHP syntax? And of course if you have a much better solution (which you probably do) :) - would be great.

 

Best regards,

 

Arkady.

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

This is interesting. I believe what is happening is that you are deleting the entry in the quantity box along with checking the delete checkbox, so when you hit the update button the variable $products_details["qty"] is null and you get this error.

 

Thanks- you've identified a very small omission on my part, namely that the code assumes $products_details["qty"] is not null.

 

Find

// 1.3.1 Update orders_products Table
	if (is_array ($_POST['update_products'])){
	foreach($_POST['update_products'] as $orders_products_id => $products_details)	{

and add directly below it

		if (!tep_not_null($products_details["qty"])) $products_details["qty"] = 0;

 

and you should not have a problem with this again.

 

 

 

cool it's running very nice now

 

xav

Link to comment
Share on other sites

For these two items, what is actually stored in the database as entries for these fields for the orders you have that are messed up?

Hi,

 

Look what is stored...

 

pic8gd.jpg

 

And for other orders it is displayed the same thing..

Link to comment
Share on other sites

Hi,

 

Look what is stored...

 

And for other orders it is displayed the same thing..

 

Well, you've found your problem. The entry for 'currency' is being left NULL. I duplicated this on my test site and was then able to replicate your problem.

 

Now we need to figure out why this field is being left empty. Check again your currency settings (Administration->Localization->Currencies) and make sure there is a code value for the currency you are using (for Euros it's EUR, for U.S. Dollars it's USD, etc). If not, this is your problem, and you should enter in a three character code for your currency.

 

If there is already a code there then the problem most likely lies in your checkout process (not recording the currency code at the time an order is completed).

 

For the orders that have already been completed you should run an SQL query on your database to input the currency code into the database for all those orders. Something like this should do the trick (be careful with this as it assumes every order uses the same currency and also uses USD as the currency code. If you aren't using USD as your currency you will need to change that to the appropriate code, and if every order doesn't use the same currency you may have to do all the updates one by one):

 

UPDATE orders SET currency =  'USD' WHERE orders_id >=0;

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Hello everyone and HEllo Stew,

 

Eh nice to see how you re helping folks. After all a lot of this mod is your creation. And where i come from it's said "We are responcible for those who got used to us" (sorry if anything is lost in translation). :)

 

Anyway Im having a small issue. I have Points/Rewards and CCGV installed. When one or both of them are used in an order they apply negative values to the order total (ex: Points Redeemed(60 x $0.20): $-11.99). However those values when in the order editor's Discount, Shipping and Total section apear as positive ones. Which seems fine until you hit Update then obviosly those values get added and ... well you get the picture.

 

An idea for a fix that I have is the following: on update check the description feild for strings that start with one of the following "Points" or "Coupon" or "Gift Voucher" and if one of those is found quickly slap a "-" before a value in the corresponding Amount feild, but not before checking if it's alredy there.

 

Ah sounds so nice in English. Is this "doable" in PHP syntax? And of course if you have a much better solution (which you probably do) :) - would be great.

 

Best regards,

 

Arkady.

 

Yes, it is doable, and yes it is probably easier than you think. Each one of these order total modules probably has its own unique class value that is stored in the orders_total table, for instance Total has ot_total, Subtotal has ot_subtotal, Shipping has ot_shipping, etc. If you take a look in that table you should be able to see what I'm talking about, and if you let me know what those class values are for each of your discount modules I can show you how to modify the code to work correctly for you.

 

Cheers

Stew

 

p.s. I like that saying, "We are responsible for those who got used to us" :)

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

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