dave_mck Posted October 8, 2013 Posted October 8, 2013 I'm trying to get the 'tax_class_id' from a product during the checkout process, I've been googling different combinations of this with no luck. $products_tax_class_id = $order->products[$i]['tax_class_id'];
Bob Terveuren Posted October 8, 2013 Posted October 8, 2013 Hi It's not passed onto the $order->products array so you can't get it that way - you'd have to either grab the id from the products table by a direct query using the products_id in question or, if you want to use your code add the tax_class_id into the array by editing includes/classes/order.php - around line 282 you'll see where it creates the order products array from the shopping cart array - tax_class_id does get passed over in the line $products = $cart->get_products(); so all you need to do is add 'tax_class_id' => $products[$i]['tax_class_id'], as shown below - that'll pass tax_class_id to checkout_process where your code can grab it $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $this->products[$index] = array('qty' => $products[$i]['quantity'], 'name' => $products[$i]['name'], 'model' => $products[$i]['model'], 'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_class_id' => $products[$i]['tax_class_id'], 'price' => $products[$i]['price'], 'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']), 'weight' => $products[$i]['weight'], 'id' => $products[$i]['id']);
Recommended Posts
Archived
This topic is now archived and is closed to further replies.