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.


Reply With Quote

