code view order

  • Posts: 4
  • Thank you received: 0
9 years 7 months ago #199550

-- HikaShop version -- : 2.4.0
-- Joomla version -- : 2.5.19

Hello,

1/ I would like to have on the order, the name of the category just before the purchased product .
If it is in Display-view-order-show, can you give me the code to add and where ?.
If not, what should I do

2/ is it possible to have the product name in the summary table orders instead of the mode of payment?

thank you

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
9 years 7 months ago #199576

Hi,

For both questions it will require view editions, for the point 1 the view to edit is "checkout / cart" then you will have to add code like:

$productClass = hikashop_get('class.product');
$categoryClass = hikashop_get('class.category');
$fullProduct = $productClass->get($row->product_id);
$category = $categoryClass->get($fullProduct->category_id);
echo $category ->category_name;
before the product name display part.

2. The view to edit is "order / listing" in the backend template, so you can replace the desired column name and date by the desired content. To get all the product's names, you will have to do some requests to get the informations in the listing directly as they are not loaded by default.

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

  • Posts: 4
  • Thank you received: 0
9 years 6 months ago #202178

Hi,

For the first ,
I tried but I must not put the code in the right place. The code appears on the order.
Please, between what line and what line, we must put the code ?
thanks

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

  • Posts: 13201
  • Thank you received: 2322
9 years 6 months ago #202183

Hi,

1. To display the category of the product, it must be present in the table, else when you have many products in the cart from different categories, it will be unreadable.
So you have to put the code before:

<tr class="row<?php echo $k; ?>">
And the code to use is something like:
<tr class="row<?php echo $k; ?>">
<?php
$productClass = hikashop_get('class.product');
$categoryClass = hikashop_get('class.category');
$fullProduct = $productClass->get($row->product_id);
$category = $categoryClass->get($fullProduct->category_id);
?>
<td colspan="5"><?php echo $category ->category_name; ?></td>
</tr>

ps: it can be optimized by moving the php code:
$productClass = hikashop_get('class.product');
$categoryClass = hikashop_get('class.category');
Before the foreach.

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

Time to create page: 0.073 seconds
Powered by Kunena Forum