Packing Slip attributes sorting randomly
On my packing slip (and admin invoice), the attributes are sorting in random order.... only 'sometimes'. (Works great on product pages, just odd at times on packing slip)
i.e. (Product name and value sort orders set)
Product Caramel Cheesecake
Attribute 1: Bottle Size 5ml
Attribute 2: Cool Hit
Attribute 3: Base Mix 50/50
Attribute 4: First Flavor Choice
Attribute 5: First Flavor Percent
Attribute 6: Second Flavor Choice
Attribute 7: Second Flavor Choice
Will RANDOMLY appear as (example, other random sorts happen as well):
Attribute 5: First Flavor Percent
1 Product Caramel Cheesecake
Attribute 2: Cool Hit
Attribute 7: Second Flavor Choice
Attribute 3: Base Mix 50/50
Attribute 4: First Flavor Choice
Attribute 1: Bottle Size 5ml
Attribute 6: Second Flavor Choice
I would guess about 80% of the time it sorts correctly, and 20% randomly in any order. I've even had the qty/product line show up in between the products.
I found an old thread about this from 2006 that has been closed, but had no answer.
Any ideas on how to fix this?
Thx
Re: Packing Slip attributes sorting randomly
I got exactly the same problem. It's 2013 now. Did you find the solution?
Thanks in advance.
Re: Packing Slip attributes sorting randomly
since the OP has not been around since 2011, chances are he won't answer.
Please start by providing us some more info, like ZC version an installed add ons. Otherwise we can only guess
Re: Packing Slip attributes sorting randomly
Hello there. I really need help. My ZC version is 1.5.1. No big add ons to mention.
I have created products with 7 attributes and products with 12 attributes.
My problem is: when I place an order, the attributes appear totally in random order in the ORDERS page, ORDER, INVOICE and PACKING SLIP. This happens specially when the order includes several products ( 2 or more of 7 attributes) or when the order has at least one product of 12 attributes.
The interesting thing about this, it's that the ORDER CONFIRMATION EMAIL displays the information in the correct sort order, in the same sort order it appears in the website.
Here you can see the page with the product with 12 attributes:
http://armytags.com/tienda/index.php...kndsirkgba6vq5
The page with a product of only 7 attributes:
http://armytags.com/tienda/index.php...=1&language=en
I want the attributes appear in the ORDERS in the exact same order they appear in the product page.
For your information I have already set the sort value of option names. The order is SILENCERS: 10, CHAINS: 20, LINE 1: 30, LINE 2: 40 and so on....
The same goes for OPTION VALUES. I created a sort order for: SILENCERS OPTIONS: Black (0), Clear (1), Blue (2) and so on. CHAINS: 24" (14), 27" (15), 30" (16).
The TEXT attributes has no options, however I have given a consecutive ORDER: LINE 1 (19), LINE 2 (20) and so on, just in case. I have even assigned order numbers of bigger value than the previous attributes: SILENCERS and CHAINS to make sure they will appear after the first two attributes.
I have seen this topic has been a recurrent question along the years, but there is not a thread with the solution. I am afraid it has to be with the algorithm of the processing of the cart or the code in orders.php or order.php
I have made several TEST orders and the only pattern I have noticed is when there are a lot of products with attributes involved, the system gets crazy and order the attributes in a random order. Something a noticed: when I order 3 products, the attributes of at least one product appears ok, but the ones of the others product display totally in a random order, with no pattern.
In this thread ( http://www.zen-cart.com/showthread.p...e-packing-slip )
this person mentions this piece of code:
if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) {
for ($j=0, $k=sizeof($order->products[$i]['attributes']); $j<$k; $j++) {
echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
echo '</i></small></nobr>';
}
}
I don't know if it is related and the loop collapses when the number of attributes is over a certain number (attributes > 10). In my case this seems to happen. But I don't know how to interpretate the code, since I am not an expert in PHP.
In my investigation I also found this ( http://coding.derkeiler.com/Archive/.../msg00094.html )
The title is: " $j++ oddtities from PHP 4.4.8 to 5.2.0 "
This guy says:
"Hi,
Migrating an application from PHP 4.4.8 to 5.2.0 hosted under debian, I'm encountering a weird thing that look like a bug, but I don't know from where the problem is comming: me, debian patch, or php himself.
Try the following pretty stupid sample code below (command line oriented, replace \r\n by <br> to test it from a web server):
<?php
// PHP 4.4.8 give the following:
// 0 - 0 - 0
// 1 - 1 - 1
// 2 - 2 - 2
// ...and so on
//
// PHP 5.2.0 give the following:
// 0 - 0 -
// 1 - 1 - 0
// 2 - 2 - 1
// ...and so on
.
.
. (continues)
¿Will that be related to my problem?
I am not an expert in PHP programming, but I have the feeling that the problem is the algorithm or the PHP processing. Can anybody check that?
Thanks in advance for your tips and suggestions.
Re: Packing Slip attributes sorting randomly
I did a test order on your site and everything I can see is in order ... did the order itself for #10332 come out in the right method?
So far on my test site I cannot break the sort order of my attributes either ...
Re: Packing Slip attributes sorting randomly
Hi Linda. Thanks for you time.
I received your order. It arrived ok.
Products Ordered: 1
1 x Order STEEL (2 equal dog tags)
- Silencers Color: Blue
- Chain Length: 27"
- LINE 1: test 1
- LINE 2: test 2
- LINE 3: test 3
- LINE 4: test 4
- LINE 5: test 5
In a perfect world, all of the products in the order should arrive in this order. The crazyness happens when there is more than one product ordered ( 2 or more ) or when you place an order with one product of more than 7 attributes ( two dog tags different = 12 attributes).
I encourage you to test with more than one product or at least one product with two dog tags different.
Sincerely:
Alfonso
Re: Packing Slip attributes sorting randomly
Here is an example of what I get:
Products Ordered: 3
1 x Order SHINY (2 equal dog tags)
#### - Silencers Color: Red
#### - Chain Length: 27 "
#### - Line 1: 1
#### - Line 2: 1
#### - Line 3: 1
#### - Line 4: 1
#### - LINE 5: 1
1 x Order STEEL (2 equal dog tags)
#### - LINE 5: a
#### - Line 4: a
#### - Line 3: a
#### - Line 2: a
#### - Line 1: a
#### - Chain Length: 27 "
#### - Silencers Color: Black
1 x Order WWII (2 equal dog tags)
#### - Line 3: 1
#### - Line 4: 1
#### - LINE 5: 1
#### - Line 2: 1
#### - Line 1: 1
#### - Chain Length: 27 "
#### - Silencers Color: Green
The first product: OK.
The second one: INVERTED ORDER.
The third one: totally random... :(
Re: Packing Slip attributes sorting randomly
Weird ... I still cannot repeat this on my site ...
Could you add the three Products to your customer basket then go to phpMyAdmin and browse the table customers_basket_attributes and look to see how those attributes are stored?
Do they all have the field products_options_sort_order filled in?
Are you able to do a screen shot of that?
3 Attachment(s)
Re: Packing Slip attributes sorting randomly
Hi Linda.
This is what I get after I included 3 products with 26 attributes ( 2 of 7 and 1 of 12). I have never manipulated any value here. Are they ok? do you need another view?
Thanks again for your time and concern.
Attachment 12270Attachment 12271Attachment 12272
Re: Packing Slip attributes sorting randomly
I was kind of hoping to see all the fields for your customers_id for all of the products/attributes added to the customers_basket_attributes to see what is being put in each of the fields ...