Post by Qphoria » Sun Dec 19, 2010 3:57 am

added it at the create point, not the order point.. but yea you can trim more.. in 1.4.9.3 I trim the streetnames and city too

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Johnathan » Sun Dec 19, 2010 4:27 am

There's no problem with doing that, but extra spaces in the company/address section don't seem to screw up the invoice display, so it doesn't really matter. For cleanliness sake, it probably should be done, however.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by lucass » Tue Dec 28, 2010 5:24 am

lucass wrote:Hello

I am using Opencart 1.4.9.1 patched to 1.4.9.2.

In my store I have only one product at the moment. I added few options to this product (options were edited and saved many times), but suddenly system stopped working properly. When I go to product edit page, and click "Save" button (even without making any changes) I receive following error:

Code: Select all

2010-12-17 8:56:52 - PHP Notice:  Undefined index:  sort_order in /home/public_html/admin/model/catalog/product.php on line 136
2010-12-17 8:56:52 - PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/public_html/admin/index.php:72) in /home/public_html/system/engine/controller.php on line 27
When I add new product, and click "Save", it works properly.

I am looking forward for Your response.

Best regards, Łukasz
I have suggestions how to reproduce error discussed above. It happens when we add few options with few option values to product. Next try to edit options/option values and/or edit "Sort order" parameter in options and/or option values.

When I added new product, and I added option to this product, saved changes, edited product -> added option value, saved changes, edited product -> added next option value, saved changes etc etc (and this all without editing once added options nor "Sort order parameter") then error does not occur.

Error message points to file product.php to line 136 which is:

Code: Select all

$this->db->query("INSERT INTO " . DB_PREFIX . "product_option_value SET product_option_id = '" . (int)$product_option_id . "', product_id = '" . (int)$product_id . "', quantity = '" . (int)$product_option_value['quantity'] . "', subtract = '" . (int)$product_option_value['subtract'] . "', price = '" . (float)$product_option_value['price'] . "', prefix = '" . $this->db->escape($product_option_value['prefix']) . "', sort_order = '" . (int)$product_option_value['sort_order'] . "'");
[/size]I removed last parameter "sort_order" so the line content was:

Code: Select all

$this->db->query("INSERT INTO " . DB_PREFIX . "product_option_value SET product_option_id = '" . (int)$product_option_id . "', product_id = '" . (int)$product_id . "', quantity = '" . (int)$product_option_value['quantity'] . "', subtract = '" . (int)$product_option_value['subtract'] . "', price = '" . (float)$product_option_value['price'] . "', prefix = '" . $this->db->escape($product_option_value['prefix']) . "'");
[/size]After this change, system does not crash (never) when editing product options. But product options order visible from client view is 'random', probably because of sql query which insert and get product data from table. What is the point is knowledge, that parameter 'sort_order' is probably the source of the problem.

Next I restored 'sort_order' parameter to line 136 and I printed $product_option_value variable with function print_r() added to code:

Code: Select all

if (isset($product_option['product_option_value'])) {
					foreach ($product_option['product_option_value'] as $product_option_value) {
						print_r($product_option_value);
						echo "<br>";
						$this->db->query("INSERT INTO " . DB_PREFIX . "product_option_value SET product_option_id = '" . (int)$product_option_id . "', product_id = '" . (int)$product_id . "', quantity = '" . (int)$product_option_value['quantity'] . "', subtract = '" . (int)$product_option_value['subtract'] . "', price = '" . (float)$product_option_value['price'] . "', prefix = '" . $this->db->escape($product_option_value['prefix']) . "', sort_order = '" . (int)$product_option_value['sort_order'] . "'");
						$product_option_value_id = $this->db->getLastId();
				
						foreach ($product_option_value['language'] as $language_id => $language) {
							$this->db->query("INSERT INTO " . DB_PREFIX . "product_option_value_description SET product_option_value_id = '" . (int)$product_option_value_id . "', language_id = '" . (int)$language_id . "', product_id = '" . (int)$product_id . "', name = '" . $this->db->escape($language['name']) . "'");
						}					
					}
				}
[/size]
What I receive now is this:

Code: Select all

Array ( [language] => Array ( [2] => Array ( [name] => XS ) [1] => Array ( [name] => XS ) ) [quantity] => 0 [subtract] => 0 [price] => 0.0000 [prefix] => + [sort_order] => 0 )
Array ( [language] => Array ( [2] => Array ( [name] => S ) [1] => Array ( [name] => S ) ) [quantity] => 0 [subtract] => 0 [price] => 0.0000 [prefix] => + [sort_order] => 0 )
(...)
many parameters
(...)
Array ( [language] => Array ( [2] => Array ( [name] => Brak ) [1] => Array ( [name] => None ) ) [quantity] => 0 [subtract] => 0 [price] => 0.0000 [prefix] => + [sort_order] => 0 )
Array ( [language] => Array ( [2] => Array ( [name] => Mały: rozmiar do 10 cm x 8 cm ) [1] => Array ( [name] => Mały: rozmiar do 10 cm x 8 cm ) ) [quantity] => 0 [subtract] => 0 [price] => 1.0000 [prefix] => + [sort_order] => 0 )
Array ( [language] => Array ( [2] => Array ( [name] => Duży: rozmiar do 30 cm x 22 cm ) [1] => Array ( [name] => Duży: rozmiar do 30 cm x 22 cm ) ) [quantity] => 0 [subtract] => 0 [price] => 3.0000 [prefix] => + )
Notice: Undefined index: sort_order in /srv/home/lv121791/public_html/admin/model/catalog/product.php on line 138Warning: Cannot modify header information - headers already sent by (output started at /srv/home/lv121791/public_html/admin/model/catalog/product.php:136) in /srv/home/lv121791/public_html/system/engine/controller.php on line 27
[/size]As we can notice in last array there is no sort_order parameter exactly! It ends with:
[price] => 3.0000 [prefix] => + here_should_be_param )

Unfortunately this bug makes OpenCart platform almost useless for me. Please take a look at this bug.

Best regards

Łukasz

Newbie

Posts

Joined
Fri Dec 17, 2010 5:05 pm

Post by Qphoria » Tue Dec 28, 2010 3:13 pm

I've not seen this and can't reproduce it. Is it only that 1 product? What if you try to recreate that product new again, then add the options, then edit and save.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by lucass » Tue Dec 28, 2010 8:15 pm

I will give You admin password via pm and You will take a look at it ok? (I recreated product many times)

Newbie

Posts

Joined
Fri Dec 17, 2010 5:05 pm

Post by anilrmg » Fri Feb 25, 2011 6:14 pm

I am working on v1.4.9.3 OC

http://192.168.0.122/www.opencart.com/i ... ount/login

to

http://192.168.0.122/www.opencart.com/login

Is it possible ?
Any idea ?
great full for any help



thanx

Newbie

Posts

Joined
Thu Feb 24, 2011 3:07 am

Post by broadsighted » Fri Apr 01, 2011 2:26 am

Thank you!!! I was worried I screwed something up, but this fixed my problem.

Qphoria wrote:Ah you are right... there is a bug

1. EDIT: catalog/view/theme/default/template/checkout/address.tpl

2. FIND:

Code: Select all

$('#postcode').load('index.php?route=checkout/create/postcode&country_id=<?php echo $country_id; ?>');
3. REPLACE WITH:

Code: Select all

$('#postcode').load('index.php?route=checkout/address/postcode&country_id=<?php echo $country_id; ?>');

Image


Newbie

Posts

Joined
Tue Nov 30, 2010 4:27 am
Location - Denver, CO
Who is online

Users browsing this forum: No registered users and 33 guests