Guest Posted May 4, 2007 Share Posted May 4, 2007 Hi Everyone I'm developping a module for Amazon Seller Central that will reuse some functions of the existing PDF batch print module. The module will import txt files from order notifications, display the orders and print a PDF contining a batch of a range of orders. I'm using a clone of the order.php class, but only the FIRST item of an order containing multiple items is retrieved. Looks like my products array is not fetched correctly, and I don't understand why. Here is the query in the order.php class: $orders_products_query = tep_db_query("SELECT oi.order_id, oi.order_item_id, oi.product_name, oi.sku, oi.item_price, oi.item_tax, oi.shipping_price, oi.shipping_tax, oi.quantity_purchased, oi.item_promotion_id, oi.item_promotion_discount, oi.ship_promotion_id, oi.ship_promotion_discount FROM amazon_items oi WHERE oi.order_id = '" . $order['order_id'] ."'"); $num_rows = mysql_num_rows($orders_products_query); while ($orders_products = mysql_fetch_array($orders_products_query, MYSQL_ASSOC)) { $this->products[$index] = array( 'order_id' => $orders_products['order_id'], 'order_item_id' => $orders_products['order_item_id'], 'quantity_purchased' => $orders_products['quantity_purchased'], 'product_name' => $orders_products['product_name'], 'sku' => $orders_products['sku'], 'shipping_price' => $orders_products['shipping_tax'], 'shipping_tax' => $orders_products['shipping_price'], 'item_promotion_id' => $orders_products['item_promotion_id'], 'item_promotion_discount' => $orders_products['item_promotion_discount'], 'ship_promotion_id' => $orders_products['ship_promotion_id'], 'ship_promotion_discount' => $orders_products['ship_promotion_discount'], 'item_price' => $orders_products['item_price'], 'item_tax' => $orders_products['item_tax']); } and in my packing_slip and invoice.php, the products are is rendered with a for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { ... ...} I echoed the variable $n, that gives the size of the array, and its value is always 1, no matter how many products are in the order... I echoed the query in the order class, and the correct number of products are returned. Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
Guest Posted May 5, 2007 Share Posted May 5, 2007 solved: a bracket was misplaced. Quote Link to comment Share on other sites More sharing options...
tyveris Posted May 21, 2007 Share Posted May 21, 2007 Hi Everyone I'm developping a module for Amazon Seller Central that will reuse some functions of the existing PDF batch print module. The module will import txt files from order notifications, display the orders and print a PDF contining a batch of a range of orders. I'm using a clone of the order.php class, but only the FIRST item of an order containing multiple items is retrieved. Looks like my products array is not fetched correctly, and I don't understand why. Here is the query in the order.php class: $orders_products_query = tep_db_query("SELECT oi.order_id, oi.order_item_id, oi.product_name, oi.sku, oi.item_price, oi.item_tax, oi.shipping_price, oi.shipping_tax, oi.quantity_purchased, oi.item_promotion_id, oi.item_promotion_discount, oi.ship_promotion_id, oi.ship_promotion_discount FROM amazon_items oi WHERE oi.order_id = '" . $order['order_id'] ."'"); $num_rows = mysql_num_rows($orders_products_query); while ($orders_products = mysql_fetch_array($orders_products_query, MYSQL_ASSOC)) { $this->products[$index] = array( 'order_id' => $orders_products['order_id'], 'order_item_id' => $orders_products['order_item_id'], 'quantity_purchased' => $orders_products['quantity_purchased'], 'product_name' => $orders_products['product_name'], 'sku' => $orders_products['sku'], 'shipping_price' => $orders_products['shipping_tax'], 'shipping_tax' => $orders_products['shipping_price'], 'item_promotion_id' => $orders_products['item_promotion_id'], 'item_promotion_discount' => $orders_products['item_promotion_discount'], 'ship_promotion_id' => $orders_products['ship_promotion_id'], 'ship_promotion_discount' => $orders_products['ship_promotion_discount'], 'item_price' => $orders_products['item_price'], 'item_tax' => $orders_products['item_tax']); } and in my packing_slip and invoice.php, the products are is rendered with a for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { ... ...} I echoed the variable $n, that gives the size of the array, and its value is always 1, no matter how many products are in the order... I echoed the query in the order class, and the correct number of products are returned. Any help would be appreciated. Hello, im still interested on this "modul/script". Did you share it ? Tyv Quote Link to comment Share on other sites More sharing options...
homewetbar Posted June 15, 2007 Share Posted June 15, 2007 Have you fully intergrated your store with amazon.com seller central. Please contact me if so, we may be able to work together. Quote Most Valuable OsCommerce Contributions: Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294 FedEx Automated Labels -- Contribution 2244 RMA Returns system -- Contribution 1136 Sort Products By Dropdown -- Contribution 4312 Ultimate SEO URLs -- Contribution 2823 Credit Class & Gift Voucher -- Contribution 282 Cross-Sell -- Contribution 5347 Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.