[Skip to main content](#vessel-content)

#   Create Related Products column in Administrator

##

- **[jnascimento](/forum/user/17752-jnascimento "View jnascimento's Profile")**
- [![jnascimento's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/17752-jnascimento "View jnascimento's Profile") Topic Author
- [ Offline](/forum/user/17752-jnascimento)

Less More

- Posts: 12
- Thank you received: 0
-
-

12 years 4 weeks ago [\#174300](#174300) by [jnascimento](/forum/user/17752-jnascimento "View jnascimento's Profile")  *[Create Related Products column in Administrator](/forum/31-development/872087-create-related-products-column-in-administrator#174300 "Hello,  I'm trying to change the Administrator products listing to show the related products link in the list. (image in attachment  So far i was able to add the Title by adding the  on the right place.  My difficulty now is that i cannot get the related products title in the fields. I enter this code in the product/listing.php file:   manage){ ?&gt;   product&#95;name; ?&gt; manage){ ?&gt;     But what i get is only the same product name... Can you please tell me what can i do to make this possible?")* was created by *[jnascimento](/forum/user/17752-jnascimento "View jnascimento's Profile")*

Hello,

I'm trying to change the Administrator products listing to show the related products link in the list. (image in attachment
[ ![hikashop.png](/forum/attachment/19955) ](/forum/attachment/19955 "hikashop.png")

So far i was able to add the Title by adding the &lt;td&gt; on the right place.

My difficulty now is that i cannot get the related products title in the fields.
I enter this code in the product/listing.php file:

&lt;td align="center"&gt;
&lt;?php if($this-&gt;manage){ ?&gt;
&lt;a href="&lt;?php echo hikashop_completeLink('product&amp;task=edit&amp;cid[]='.$row-&gt;product_related_id); ?&gt;"&gt;
&lt;?php } ?&gt;
&lt;?php echo $row-&gt;product_name; ?&gt;
&lt;?php if($this-&gt;manage){ ?&gt;
&lt;/a&gt;
&lt;?php } ?&gt;
&lt;/td&gt;

But what i get is only the same product name...
Can you please tell me what can i do to make this possible?

- [ ![hikashop.png](/forum/attachment/19955) ](/forum/attachment/19955 "hikashop.png") [ ](/forum/attachment/19955?download=1 "hikashop.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3MjA4Ny1jcmVhdGUtcmVsYXRlZC1wcm9kdWN0cy1jb2x1bW4taW4tYWRtaW5pc3RyYXRvcj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

12 years 4 weeks ago -  12 years 4 weeks ago [\#174342](#174342) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Create Related Products column in Administrator](/forum/31-development/872087-create-related-products-column-in-administrator#174342 "Hello,  I'm trying to change the Administrator products listing to show the related products link in the list. (image in attachment  So far i was able to add the Title by adding the  on the right place.  My difficulty now is that i cannot get the related products title in the fields. I enter this code in the product/listing.php file:   manage){ ?&gt;   product&#95;name; ?&gt; manage){ ?&gt;     But what i get is only the same product name... Can you please tell me what can i do to make this possible?")*

Hi,

Doing such modification require some development/PHP skills.
You have to perform an SQL query in order to get the related products for the products you will list.
For the moment the code display the product name of the current product in the loop ; but if you do not have loaded the related products, you won't be able to display them.
Code:

$query = 'SELECT a.*,b.* FROM '.hikashop_table('product_related').' AS a LEFT JOIN '.hikashop_table('product').' AS b ON a.product_related_id=b.product_id WHERE a.product_related_type=\'related\' AND a.product_id = '.$row-&gt;product_id; $database-&gt;setQuery($query); $related_products = $database-&gt;loadObjectList();

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Last edit: 12 years 4 weeks ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3MjA4Ny1jcmVhdGUtcmVsYXRlZC1wcm9kdWN0cy1jb2x1bW4taW4tYWRtaW5pc3RyYXRvcj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jnascimento](/forum/user/17752-jnascimento "View jnascimento's Profile")**
- [![jnascimento's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/17752-jnascimento "View jnascimento's Profile") Topic Author
- [ Offline](/forum/user/17752-jnascimento)

Less More

- Posts: 12
- Thank you received: 0
-
-

12 years 3 weeks ago [\#174472](#174472) by [jnascimento](/forum/user/17752-jnascimento "View jnascimento's Profile")  Replied by *[jnascimento](/forum/user/17752-jnascimento "View jnascimento's Profile")* on topic *[Create Related Products column in Administrator](/forum/31-development/872087-create-related-products-column-in-administrator#174472 "Hello,  I'm trying to change the Administrator products listing to show the related products link in the list. (image in attachment  So far i was able to add the Title by adding the  on the right place.  My difficulty now is that i cannot get the related products title in the fields. I enter this code in the product/listing.php file:   manage){ ?&gt;   product&#95;name; ?&gt; manage){ ?&gt;     But what i get is only the same product name... Can you please tell me what can i do to make this possible?")*

Thanks for the reply.

I'm sorry i'm still "very young" on PHP coding.

I'm trying to apply this to the code but i'm not having results with it.

Im doing this:
Code:

&lt;td&gt; &lt;?php $query = 'SELECT a.*,b.* FROM '.hikashop_table('product_related').' AS a LEFT JOIN '.hikashop_table('product').' AS b ON a.product_related_id=b.product_id WHERE a.product_related_type=\'related\' AND a.product_id = '.$row-&gt;product_id; $database-&gt;setQuery($query); $related_products = $database-&gt;loadObjectList(); ?&gt; &lt;?php echo $row-&gt;product_name; ?&gt; &lt;/td&gt;

I'm calling the product_name after requesting the query but it's not working.

Can you help with this little bit of code?

Thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3MjA4Ny1jcmVhdGUtcmVsYXRlZC1wcm9kdWN0cy1jb2x1bW4taW4tYWRtaW5pc3RyYXRvcj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

12 years 3 weeks ago -  12 years 3 weeks ago [\#174511](#174511) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Create Related Products column in Administrator](/forum/31-development/872087-create-related-products-column-in-administrator#174511 "Hello,  I'm trying to change the Administrator products listing to show the related products link in the list. (image in attachment  So far i was able to add the Title by adding the  on the right place.  My difficulty now is that i cannot get the related products title in the fields. I enter this code in the product/listing.php file:   manage){ ?&gt;   product&#95;name; ?&gt; manage){ ?&gt;     But what i get is only the same product name... Can you please tell me what can i do to make this possible?")*

Hello,
The code that Jerome gave you will just allow you to **load** the related products details on the "$related_products" object, now you'll just have to check what you have on that object and display the link of your related products.
Using that kind of code will probably do the job : Code:

$database = JFactory::getDBO(); $query = 'SELECT a.*,b.* FROM '.hikashop_table('product_related').' AS a LEFT JOIN '.hikashop_table('product').' AS b ON a.product_related_id=b.product_id WHERE a.product_related_type=\'related\' AND a.product_id = '.$row-&gt;product_id; $database-&gt;setQuery($query); $related_products = $database-&gt;loadObjectList(); foreach($related_products as $key =&gt; $related_product){ if(!empty($related_product)){ ?&gt; &lt;a href="&lt;?php echo hikashop_completeLink('product&amp;task=edit&amp;cid[]='.$related_product-&gt;product_id); ?&gt;"&gt; &lt;?php echo $related_product-&gt;product_name.'&lt;/br&gt;'; ?&gt; &lt;/a&gt;&lt;?php } }

Last edit: 12 years 3 weeks ago by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3MjA4Ny1jcmVhdGUtcmVsYXRlZC1wcm9kdWN0cy1jb2x1bW4taW4tYWRtaW5pc3RyYXRvcj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jnascimento](/forum/user/17752-jnascimento "View jnascimento's Profile")**
- [![jnascimento's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/17752-jnascimento "View jnascimento's Profile") Topic Author
- [ Offline](/forum/user/17752-jnascimento)

Less More

- Posts: 12
- Thank you received: 0
-
-

12 years 3 weeks ago [\#174566](#174566) by [jnascimento](/forum/user/17752-jnascimento "View jnascimento's Profile")  Replied by *[jnascimento](/forum/user/17752-jnascimento "View jnascimento's Profile")* on topic *[Create Related Products column in Administrator](/forum/31-development/872087-create-related-products-column-in-administrator#174566 "Hello,  I'm trying to change the Administrator products listing to show the related products link in the list. (image in attachment  So far i was able to add the Title by adding the  on the right place.  My difficulty now is that i cannot get the related products title in the fields. I enter this code in the product/listing.php file:   manage){ ?&gt;   product&#95;name; ?&gt; manage){ ?&gt;     But what i get is only the same product name... Can you please tell me what can i do to make this possible?")*

Thanks for the reply... i try it under the &lt;td&gt;&lt;/td&gt; and it didn't work... i'm getting a blank page...

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3MjA4Ny1jcmVhdGUtcmVsYXRlZC1wcm9kdWN0cy1jb2x1bW4taW4tYWRtaW5pc3RyYXRvcj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jnascimento](/forum/user/17752-jnascimento "View jnascimento's Profile")**
- [![jnascimento's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/17752-jnascimento "View jnascimento's Profile") Topic Author
- [ Offline](/forum/user/17752-jnascimento)

Less More

- Posts: 12
- Thank you received: 0
-
-

12 years 3 weeks ago [\#174623](#174623) by [jnascimento](/forum/user/17752-jnascimento "View jnascimento's Profile")  Replied by *[jnascimento](/forum/user/17752-jnascimento "View jnascimento's Profile")* on topic *[Create Related Products column in Administrator](/forum/31-development/872087-create-related-products-column-in-administrator#174623 "Hello,  I'm trying to change the Administrator products listing to show the related products link in the list. (image in attachment  So far i was able to add the Title by adding the  on the right place.  My difficulty now is that i cannot get the related products title in the fields. I enter this code in the product/listing.php file:   manage){ ?&gt;   product&#95;name; ?&gt; manage){ ?&gt;     But what i get is only the same product name... Can you please tell me what can i do to make this possible?")*

IT's working now...

This is what i have done:
Code:

&lt;td&gt; &lt;?php $database = JFactory::getDBO(); $query = 'SELECT a.*,b.* FROM '.hikashop_table('product_related').' AS a LEFT JOIN '.hikashop_table('product').' AS b ON a.product_related_id=b.product_id WHERE a.product_related_type=\'related\' AND a.product_id = '.$row-&gt;product_id; $database-&gt;setQuery($query); $related_products = $database-&gt;loadObjectList(); foreach($related_products as $key =&gt; $related_product){ if(!empty($related_product)){ ?&gt; &lt;a href="&lt;?php echo hikashop_completeLink('product&amp;task=edit&amp;cid[]='.$related_product-&gt;product_id); ?&gt;"&gt; &lt;?php echo $related_product-&gt;product_name.'&lt;/br&gt;'; ?&gt; &lt;/a&gt; &lt;?php } } ?&gt; &lt;/td&gt;

Many thanks for your support!

Best Regards,

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3MjA4Ny1jcmVhdGUtcmVsYXRlZC1wcm9kdWN0cy1jb2x1bW4taW4tYWRtaW5pc3RyYXRvcj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

12 years 3 weeks ago [\#174639](#174639) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Create Related Products column in Administrator](/forum/31-development/872087-create-related-products-column-in-administrator#174639 "Hello,  I'm trying to change the Administrator products listing to show the related products link in the list. (image in attachment  So far i was able to add the Title by adding the  on the right place.  My difficulty now is that i cannot get the related products title in the fields. I enter this code in the product/listing.php file:   manage){ ?&gt;   product&#95;name; ?&gt; manage){ ?&gt;     But what i get is only the same product name... Can you please tell me what can i do to make this possible?")*

Hi,

Good to know that it is working now.

When you got full blank page, do not hesitate to check your PHP error log or to activate the Joomla debug mode (in the joomla global configuration).
You can also change the "error reporting" to "maxium" in the Joomla global configuration (server).

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3MjA4Ny1jcmVhdGUtcmVsYXRlZC1wcm9kdWN0cy1jb2x1bW4taW4tYWRtaW5pc3RyYXRvcj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.112 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
