Hello!
now I want to explain a new hack that I hope will be included in next VM version, due it's very, very important!
many times there are companies that sell the same product for different categories, think to spare automotive parts, or to printing cartridges, there is the same product listed on many categories (example: the same bulb for different cars), in this case is important for the customer to know that the purchased product is really for that vehicle I call this a "marketing importance" and the best way to reach the "customer tranquility" on this, is to place the category of the selected product on the cart and on the checkout. Otherweise, the seller in the backoffice of the shop is advanced to know the category selected by customer at the order's time, yes, he can know the categories linked to that product from the sku, but not the customer's category choice, this maybe very important for support (think for example to specific car model problems linked to a bulb: maybe a car have a electric problem so it finishes the bulb before other models that use the same product, thik also to the advantage for the operator that needs to ship the product, to know it's category directly from the website, he goes directly to the bookshelf :-)
so, please, insert this hack on next Vm version:-)
ok, go to the coding:
components/com_virtuemart/themes/default/templates/basket/basket_b2b.html.php
after line 23 insert: <th><?php echo $VM_LANG->_('PHPSHOP_CATEGORY') ?></th>
after line 30 insert: <td><?php echo $product['product_cat']  ?></td>
repeat the same operation on it's twin file
components/com_virtuemart/themes/default/templates/basket/basket_b2c.html.php
file administrator/components/com_virtuemart/html/basket.php
after line 93 insert
global $database;
$querycat = "select category_name from #__vm_category
where category_id = " . $cart[$i]["category_id"];
$database->setQuery($querycat);
$categories = $database->loadResult();
$product_rows[$i]['product_cat'] = $categories;
file administrator/components/com_virtuemart/html/shop.basket_short.php
after line 97 insert:
global $database;
$querycat = "select category_name from #__vm_category
where category_id = " . $cart[$i]["category_id"];
$database->setQuery($querycat);
$categories = $database->loadResult();
$minicart[$ci]['product_cat'] = $categories;
file components/com_virtuemart/themes/default/templates/common/minicart.tpl.php
after line 32 insert
?>
<div>
Category: <?php echo $cart['product_cat'] ?>
</div>
<?php
file /administrator/components/com_virtuemart/classess/ps_checkout.php
at line 1106 the following
global $database;
$querycat = "select category_name from #__vm_category
where category_id = " . $cart[$i]["category_id"];
$database->setQuery($querycat);
$ct = $database->loadResult();
at line 1125 insert after 'mdate' => $timestamp a comma (,) then on next line
'category'=>$ct
file /administrator/components/com_virtuemart/html/order.order_print.php
after line 277 insert:
<th class="title" width="22%"><?php echo $VM_LANG->_('PHPSHOP_CATEGORY') ?></th>
at line 288 find the query, and add in it the "category" field so it needs to appear like the following::
$qt = "SELECT order_item_id,category,product_quantity,order_item_name,order_item_sku,product_id,product_item_price,product_final_price, product_attribute, order_status
at line 372 insert:
<td width="10%" align="left"><?php  $dbt->p("category") ?></td>
now access on the database via phpmyadmin or other db admin interfaces
In table jos_vm_order_item add a field of type varchar, width 255 named "category"
how can you see from the query, the category is not taken from the category table, but directly from the cart, so you know exactly what category the customer selected!
Regards