Author Topic: category indication on cart, checkout and order print page  (Read 5989 times)

mmarfy

  • Beginner
  • *
  • Posts: 36
category indication on cart, checkout and order print page
« on: January 02, 2009, 03:11:08 am »
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:
Code: [Select]
<th><?php echo $VM_LANG->_('PHPSHOP_CATEGORY'?></th>after line 30 insert:
Code: [Select]
<td><?php echo $product['product_cat']&#160; ?></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
Code: [Select]
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:
Code: [Select]
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
Code: [Select]
?>
            <div>
            Category: <?php echo $cart['product_cat'?>
            </div>
            <?php
file /administrator/components/com_virtuemart/classess/ps_checkout.php
at line 1106 the following
Code: [Select]
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
Code: [Select]
'category'=>$ctfile /administrator/components/com_virtuemart/html/order.order_print.php
after line 277 insert:
Code: [Select]
<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::
Code: [Select]
$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_statusat line 372 insert:
Code: [Select]
<td width="10%" align="left"><?php&#160; $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

mole84

  • Beginner
  • *
  • Posts: 6
Re: category indication on cart, checkout and order print page
« Reply #1 on: January 12, 2009, 01:57:20 am »
great work mmarfy, I needed the same modification this week, you should polish this up and add it to the SVN. Thanks!

faulk511

  • Beginner
  • *
  • Posts: 37
  • Howdy!
Re: category indication on cart, checkout and order print page
« Reply #2 on: January 23, 2009, 17:06:15 pm »
Not only did it work?  Could you find a way to print sort?

oscarnastro

  • Beginner
  • *
  • Posts: 1
Re: category indication on cart, checkout and order print page
« Reply #3 on: March 19, 2009, 20:09:38 pm »
Hi!
In the ro_basket page doesnt' appear.
Why? ???

olegych

  • Beginner
  • *
  • Posts: 2
Re: category indication on cart, checkout and order print page
« Reply #4 on: March 27, 2009, 13:39:40 pm »
Very useful hack! is there a way do display category in the confirmation e-mail as well?

Thank you

olegych

  • Beginner
  • *
  • Posts: 2
Re: category indication on cart, checkout and order print page
« Reply #5 on: March 27, 2009, 13:41:12 pm »
2 oscarnastro: remove #160; from the code provided above as well as & before it.