Category display in order's at admin panel

  • Posts: 8
  • Thank you received: 1
11 years 4 months ago #111982

Hello, i need to display a product category in orders at admin panel, already tryed a lot of code, but still doesnt work :( How to do it? Thanks.

Last edit: 11 years 4 months ago by reeker.

Please Log in or Create an account to join the conversation.

  • Posts: 2334
  • Thank you received: 403
11 years 4 months ago #112054

Hi there,

First you have to load the categories because they are not present in this form. Just add this code:

foreach($this->order->products as $k => $product){
	$ids[]=$product->product_id;
}
$db = JFactory::getDBO();
$query='SELECT * FROM '.hikashop_table('product_category').' as pc LEFT JOIN '.hikashop_table('category').' as c ON c.category_id=pc.category_id WHERE product_id IN ('.implode(',',$ids).')';
$db->setQuery($query);
$categories = $db->loadObjectList('product_id');

before this line:
foreach($this->order->products as $k => $product) {

Then add these lines:
<td class="hikashop_order_item_category_value"><?php echo $categories[$product->product_id]->category_name;?></td>

before:
			<td class="hikashop_order_item_edit_value" style="text-align:center">

And
<th class="hikashop_order_item_category_title title titletoggle"><?php echo JText::_('CATEGORY'); ?></th>

before:
<th colspan="2" class="hikashop_order_item_remove_title title"><?php echo JText::_('ACTIONS'); ?></th>

The following user(s) said Thank You: reeker

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 1
11 years 4 months ago #112199

Thabk you very much :) Maybe you can help me with individual discount prices for every user?

Please Log in or Create an account to join the conversation.

  • Posts: 82758
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #112202

You can create a user group for each user via the joomla user management and then restrict each discount to each user group. Then, based on the user group of the user the discount will be selected by Hikashop automatically

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 1
11 years 4 months ago #112207

Thanks, but now i use a free version of Hikashop :(

Please Log in or Create an account to join the conversation.

  • Posts: 2334
  • Thank you received: 403
11 years 4 months ago #112234

Since it's the only solution, you will understand that we can't help you anymore :)

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 1
11 years 4 months ago #112355

I need help again :) This category display solution doesnt work at checkout page in product listing, please can you help me with that?
Also, how to edit code of $amount for payment? ive made a discount system, but it does not affilate on payment amount :(

Last edit: 11 years 4 months ago by reeker.

Please Log in or Create an account to join the conversation.

  • Posts: 82758
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #112422

The code Xavier provided was for the order details page.
So it's normal that it doesn't do anything for the checkout.
You will need to do similar changes in the file "cart" of the view "checkout" of your frontend template via the menu Display->Views for that.

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 1
11 years 4 months ago #112423

Already applied this changes, but its just doesnt work :(

Please Log in or Create an account to join the conversation.

  • Posts: 82758
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #112440

Can you attach the content of the cart file so that we can see the changes you made ?

Please Log in or Create an account to join the conversation.

Time to create page: 0.080 seconds
Powered by Kunena Forum