Product Codes on order details page?

Hi all,



Does anyone know how to include the product code in the order details page?



Although the customer can see the product codes on the storefront, it doesn’t make sense to omit them from the order details page as they would likely to be used by picking staff.



Many thanks.

Try putting this where you want the code:


```php

{if $product.product_code}

{$lang.sku}: {$product.product_code}

{/if}
```

I got that from the product details page. I did not try it out myself, but it might just work on the order details page as well...

Thank you but that has not worked.



I tried something similar myself, thought I might just get lucky.



I am wondering if the product code needs to be passed into the order details in the db first as some of the code in the order details template show as:



{$oi.product|escape:html}



There is the extra oi. (order info) in the variables.



Many thanks

There is a product code column in the order details table in the database.



The column is blank for all of my test orders and I know some of those products have codes.



Perhaps they are not being passed to the db on order?

Try putting this in order_details.tpl before {$oi.product|escape:html}



```php

{$oi.product_code}



```



Peter

Sorry but it’s not worked.



There is a column in the orders table in the database for the product code but I don’t see any codes in there from test orders I have done (products which have codes).



That makes me think that the product code is not being written to the db in the first place. No code work in the smarty template is going to get it to work because it is missing the PHP functionality.



I could be wrong but that’s what it looks like to me?

It does work and is quite simple…



Using CS-Cart 1.3.4r2 as mentioned…



EDIT /skins/youskin…/admin/order_pages/order_details.tpl



Add the lines highlighted in RED :


```php



{include file=“common_templates/subheader.tpl” title=$lang.products_information}



[COLOR=red]
[/COLOR]



{if $order_info.use_discount}

```

and then :

```php
{elseif $settings.Modules.product_configurator != 'Y' || !$oi.extra.in_configuration}

[COLOR=red][/COLOR]
{$lang.product_code} {$lang.product} {$lang.options} {$lang.price} {$lang.amount}
{$oi.product_code}
{$oi.product|escape:html}
{if $oi.extra.is_edp && $oi.extra.ekey}
{assign var="edp_exist" value="Y"}




```

I added extra code so it was easy for you to find...

I know this works 100% as ive been using it since I went live.

Yes it does work. (I thought that’s what I did but it didn’t work earlier, must have done it wrong?)



Thank you

I had a go at also adding the product code to the customer side when a customer views their order history.



Using CS-Cart 1.3.4r2 as mentioned…



EDIT /skins/youskin…/customer/order_pages/order_details.tpl



Add the lines highlighted in RED :


```php {include file=“common_templates/subheader.tpl” title=$lang.products_information}



[COLOR=Red] class="table-head"> {$lang.product_code}[/COLOR]




{if $order_info.use_discount}

{/if}
{if $order_info.taxes}

{/if} ```

and then...```php {if $settings.Modules.product_configurator == 'Y' && $oi.extra.configuration}
{include file="addons/product_configurator/order_details_configurable.tpl"}
{elseif $settings.Modules.product_configurator != 'Y' || !$oi.extra.in_configuration}

[COLOR=Red][/COLOR]
```

It works ok but you guys are the gurus. I'm learning ...
{$lang.product} {$lang.options} {$lang.price} {$lang.amount} {$lang.discount} {$lang.tax}
{$oi.product_code} {$oi.product}
{if ($order_info.status == 'P' || $order_info.status == 'C') && $oi.extra.is_edp}

{/if}

adding myself as a subscriber… I’ll be looking into this very shortly