Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Altering Orders.php to insert (sub)category into invoice line item details

Altering Orders.php to insert (sub)category into invoice line item details

Views: 695

Results 1 to 5 of 5
4 Dec 2012, 10:15 PM
#1
centurius avatar

centurius

New Zenner

Join Date:
Dec 2012
Posts:
3
Plugin Contributions:
0

Altering Orders.php to insert (sub)category into invoice line item details

Hi, I'm hoping someone can help me with a small coding problem I'm having.

I'm trying to make the order page display the category of the item instead of the product model (which is useless to me due to the way my custom mass populator program works) - I've identified the relevent piece of code that needs changing in orders.php as:

      echo '            </td>' . "\n" .
           '            <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" .
           '            <td class="dataTableContent" align="right" valign="top">' . 

So products model needs to be replaced with category. Does anyone know how to do this? Also, bonus question, the category will be a subcategory, so is that different?

Thanks in advance.

5 Dec 2012, 4:47 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Altering Orders.php to insert (sub)category into invoice line item details

You could try using the function zen_get_categories_name_from_product by passing the products_id to it ...

11 Dec 2012, 3:47 PM
#3
centurius avatar

centurius

New Zenner

Join Date:
Dec 2012
Posts:
3
Plugin Contributions:
0

Re: Altering Orders.php to insert (sub)category into invoice line item details

How would I do that? Sorry, I'm fairly new to PHP.

12 Dec 2012, 1:04 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Altering Orders.php to insert (sub)category into invoice line item details

As an example, this code uses both model and the specific categories_name for the Product:

           '            <td class="dataTableContent" valign="top">' . $order->products[$i]['model'][B] . '<br>' . zen_get_categories_name_from_product($order->products[$i]['id'])[/B] . '</td>' . "\n" .
12 Dec 2012, 3:30 PM
#5
centurius avatar

centurius

New Zenner

Join Date:
Dec 2012
Posts:
3
Plugin Contributions:
0

Re: Altering Orders.php to insert (sub)category into invoice line item details

That is brilliant. Works perfectly, thanks very much!