Daniel Patilea Posted July 10, 2015 Share Posted July 10, 2015 Hello, Is there any way i can add a custom product field to the table from the order history in the customers account? I already added {$product.shipping_date} in the order-detail.tpl file but it won't display anything. The custom product field is working great if i use it elsewhere. Here's a debug view of the $product variable: http://i.imgur.com/SqjImiE.png Here's a screenshot: Can anybody help me please? Link to comment Share on other sites More sharing options...
NemoPS Posted July 24, 2015 Share Posted July 24, 2015 I think it's not retrieving it. Have a look at OrderDetailController$products = $order->getProducts();It uses this method, so I think you have to modify Order::getProducts so it gets the correct column from the DB 1 Link to comment Share on other sites More sharing options...
Daniel Patilea Posted July 24, 2015 Author Share Posted July 24, 2015 I think it's not retrieving it. Have a look at OrderDetailController $products = $order->getProducts(); It uses this method, so I think you have to modify Order::getProducts so it gets the correct column from the DB Thanks Nemo, I added the custom field in the query list and it works perfectly. One more question, how can I display this custom field on the order email that the client receives after he places the order? Link to comment Share on other sites More sharing options...
NemoPS Posted July 24, 2015 Share Posted July 24, 2015 Cool!That's another story, PaymentModule.php, ValidateOrder method 1 Link to comment Share on other sites More sharing options...
Daniel Patilea Posted July 24, 2015 Author Share Posted July 24, 2015 Cool! That's another story, PaymentModule.php, ValidateOrder method I have edited this file: /classes/PaymentModule.php and added my custom field: $product_var_tpl = array( 'reference' => $product['reference'], 'shipping' => $product['custom_field'], 'name' => $product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : ''), 'unit_price' => Tools::displayPrice($product_price, $this->context->currency, false), 'price' => Tools::displayPrice($product_price * $product['quantity'], $this->context->currency, false), 'quantity' => $product['quantity'], 'customization' => array() ); Then i tried to add it to the email template (not sure this is the correct file) editing this file: /mails/en/order_conf_product_list.tpl <tr> <td width="10"> </td> <td> <font size="2" face="Open-sans, sans-serif" color="#555454"> {$product['reference']} </font> <p>{$product['shipping']}</p> </td> <td width="10"> </td> </tr> But it doesn't show anything in the email. Can you tell what seems to be the problem please? Link to comment Share on other sites More sharing options...
NemoPS Posted July 25, 2015 Share Posted July 25, 2015 What if you dump this$product['custom_field'],Then kill the script. You'll see if the variable is actually there in the php code 1 Link to comment Share on other sites More sharing options...
Daniel Patilea Posted July 29, 2015 Author Share Posted July 29, 2015 What if you dump this $product['custom_field'], Then kill the script. You'll see if the variable is actually there in the php code Thanks Nemo, I managed to solve the issue. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now