Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add menu category to packing slip


JMB Designs

Recommended Posts

I am a web designer and have setup a store for a client that is now live. We have rearranged the packing slip to display

 

Product - Model - Quantity

 

Is it possible to get the "Product" data to pull from the main Categories? (I.E. instead of listing Product: Elmo DVD Model: Elmo2003 Quantity: 1, it would pull from the main category and list Product: Children's DVD Model: Elmo2003 Quantity: 1)

 

Is it possible? Does this make sense? Here is the current code snippet:

<?php

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

echo ' <tr class="dataTableRow">' . "\n" .

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

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

 

if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) {

for ($j=0, $k=sizeof($order->products[$i]['attributes']); $j<$k; $j++) {

echo '<br><nobr><small>?<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];

echo '</i></small></nobr>';

}

}

 

echo ' </td>' . "\n" .

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

' ' . "\n";

 

 

echo ' </td>' . "\n" .

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

' </tr>' . "\n";

}

 

?>

 

I am a php newbie, but have learned a lot over the past few months.

 

Thanks

Link to comment
Share on other sites

Shambi,

Do an $product_to_categories_query which will give you the xref of the product to categories and having the category_id us the bellow to give

you the Category name.

 

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");

 

I hope this helps...

Roman

Link to comment
Share on other sites

Shambi,

Do an $product_to_categories_query which will give you the xref of the product to categories and having the category_id us the bellow to give

you the Category name.

 

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");

 

I hope this helps...

Roman

 

Thanks! I will try it and let you know how it goes.

 

Shambi

Link to comment
Share on other sites

Shambi,

Do an $product_to_categories_query which will give you the xref of the product to categories and having the category_id us the bellow to give

you the Category name.

 

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");

 

I hope this helps...

Roman

 

Ok, I think I may be in over my head. I thought I understood the above instructions and as I tried to follow them, I now think I don't. Do I run the $product_to_categories_query in myphpadmin? If so i think I did something wrong. If you have the patience, can I get step by step instructions, including where the piece of code above should go? I have placed it above the HTML - no results and when I insert it in the PHP (I have since deleted the changes and cannot post the code), but it pulled something that said "resource id # 39" where the category name should be.

 

Maybe I just need a PHP expert, or a good night's sleep :D

 

Any help is appreciated!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...