Forums / Customization from the Admin / Adding additional information to cart/order/packing slip

Adding additional information to cart/order/packing slip

Locked

Views: 2,689

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
9 Jun 2006, 7:40 AM
#1
talib avatar

talib

New Zenner

Join Date:
May 2006
Posts:
17
Plugin Contributions:
0

Adding additional information to cart/order/packing slip

Hi

I posted this already but I think in the wrong part of the forum, so I am reposting it here:

Been reading through this forum and can't find any help. I have the situation where two different products can have the same name, yet are in different categories.

Now my dillema is that on the shopping cart and order and packing slip only the name appears and not the category which it came from (or at least the product id). So far it looks like I need to edit templates. I think I found the files I am suppose to edit:

admin/invoice.php
admin/packingslip.php
includes/templates/MYTEMPLATE/templates/tpl_shopping_cart_default.php (using override)

I tried this in invoice.php:

<td class="dataTableContent" valign="top">' . $order->products[$i]['name'] . $order->products[$i]['id'];

yet to no avail, then I tried this:

<td class="dataTableContent" valign="top">' . $order->products[$i]['name'] . $order->products[$i]['name'];

which resulted in the name being printed twice at the right place, so I am on the right track. Why is 'id' not working?

PS Changing the cart is not critical, however, the invoice and packing slip is. There is no need to display the model on the packing slip or invoice so that can be replaced with category (I am using model for other details and thus can't use it to display the category it is in)

12 Jun 2006, 12:49 PM
#2
talib avatar

talib

New Zenner

Join Date:
May 2006
Posts:
17
Plugin Contributions:
0

Re: Adding additional information to cart/order/packing slip

Please, anybody have any suggestions? I need this for my shop to wok correctly.

12 Jun 2006, 1:58 PM
#3
talib avatar

talib

New Zenner

Join Date:
May 2006
Posts:
17
Plugin Contributions:
0

Re: Adding additional information to cart/order/packing slip

OK, tried a bit on my own again. I found this post http://www.zen-cart.com/forum/showthread.php?t=6910&highlight=displaying+%22product+category%22 with the same problem as me. However, I need my modifications in the packing slip/invoice/cart. I've tried replacing:

$order->products[$i]['model']

with the following:

zen_get_categories_name_from_product($order->products[$i]['products_id'])
zen_get_categories_name_from_product($order->products[$i]['id'])
zen_get_categories_name_from_product($order->products[$i]->fields['products_id'])
zen_get_categories_name_from_product($order->products[$i]->fields['id'])

yet to no avail.

I am really desperate for a solution.

Thanks

13 Jun 2006, 11:18 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Adding additional information to cart/order/packing slip

In the orders class ... you will note that the array contains the following:

        $this->products[$index] = array('qty' => $new_qty,
                                        'name' => $orders_products->fields['products_name'],
                                        'model' => $orders_products->fields['products_model'],
                                        'tax' => $orders_products->fields['products_tax'],
                                        'price' => $orders_products->fields['products_price'],
                                        'onetime_charges' => $orders_products->fields['onetime_charges'],
                                        'final_price' => $orders_products->fields['final_price'],
                                        'product_is_free' => $orders_products->fields['product_is_free']);

There is no products_id stored ...

You would need to alter the orders class to include the products_id in the array in order to use this to display the categories name ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

14 Jun 2006, 8:06 AM
#5
talib avatar

talib

New Zenner

Join Date:
May 2006
Posts:
17
Plugin Contributions:
0

Re: Adding additional information to cart/order/packing slip

Thank you very much for the help. However, I still seem to be doing something wrong. I changed (in admin/includes/classes/order.php):

'model' => $orders_products->fields['products_model'],

to:

'model' => $orders_products->fields['products_id'],

As it seemed the quickest way to test it and would mean no changes in packing slip or invoice. But still nothing

then I did this:

'id' => $orders_products->fields['products_model'], (in admin/includes/classes/order.php)

and also this (in admin/packingslip.php):

$order->products[$i]['model'] to $order->products[$i]['id']

I am not an expert in PHP and am very sorry if I seem stupid, but hey at least I am trying.

15 Jun 2006, 4:57 AM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Adding additional information to cart/order/packing slip

I beleive the actual products_id field name in the orders_products table is:

orders_products_id

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

15 Jun 2006, 6:20 AM
#7
talib avatar

talib

New Zenner

Join Date:
May 2006
Posts:
17
Plugin Contributions:
0

Re: Adding additional information to cart/order/packing slip

Still no go, orders_products_id seems to give me the id the product has in the orders table, I need the ID of the product in the catalog.

Thanks for the help so far. I am learning a lot from this. Very keen to start learning PHP, although that has to wait for a while.

PS Is there any file I need to include in invoice.php or packingslip.php for zen_get_categories_name_from_product()?

15 Jun 2006, 8:25 PM
#8
talib avatar

talib

New Zenner

Join Date:
May 2006
Posts:
17
Plugin Contributions:
0

Re: Adding additional information to cart/order/packing slip

Well, I seem to get the idea that the invoice and packing slip part does not seem to have the product id in it's tables.

And it seems it would be a major coding expedition to modify it, thus I have decided to use the model part of the product to display my category. Although not ideal.

This may be a feature that the Zen ppl might want to add later ...

15 Jun 2006, 9:04 PM
#9
ajeh avatar

ajeh

Oba-san

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

Re: Adding additional information to cart/order/packing slip

Blond moment ... :blink:

Add products_id to:

      $orders_products = $db->Execute("select orders_products_id, products_name,                    products_model,
                                              products_price, products_tax, products_quantity,
                                              final_price, onetime_charges,
                                              product_is_free,
                                              products_id
                                       from " . TABLE_ORDERS_PRODUCTS . "
                                       where orders_id = '" . (int)$order_id . "'");

And add products_id to:

        $this->products[$index] = array('qty' => $new_qty,
                                        'id' => $orders_products->fields['products_id']
                                        'name' => $orders_products->fields['products_name'],
                                        'model' => $orders_products->fields['products_model'],
                                        'tax' => $orders_products->fields['products_tax'],
                                        'price' => $orders_products->fields['products_price'],
                                        'onetime_charges' => $orders_products->fields['onetime_charges'],
                                        'final_price' => $orders_products->fields['final_price'],
                                        'product_is_free' => $orders_products->fields['product_is_free']);

Then call it in the invoice.php with: $order->products[$i]['id']

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 Jun 2006, 8:44 AM
#10
talib avatar

talib

New Zenner

Join Date:
May 2006
Posts:
17
Plugin Contributions:
0

Re: Adding additional information to cart/order/packing slip

Thanks. I'll try it out as soon as I get time.