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

#   Create - Random Products Module for Joomla

##

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

Less More

- Posts: 39
- Thank you received: 0
-
-

15 years 6 months ago -  15 years 6 months ago [\#15536](#15536) by [Storm15](/forum/user/1649-storm15 "View Storm15's Profile")  *[Create - Random Products Module for Joomla](/forum/4-how-to/15536-create-random-products-module-for-joomla#15536 "Hello,  I want to create a module showing up 9 random product images in a table. 3 trs and 3 tds.  I've tried to solve it with javascript included into a mod.php file:  Now I have to write a script which shows random product images in each td. When you click on the image, you should be linked to the belonging product page of the product image. How can I realize this? And which source can I use?  Regards,  Storm")* was created by *[Storm15](/forum/user/1649-storm15 "View Storm15's Profile")*

Hello,

I want to create a module showing up 9 random product images in a table.
3 trs and 3 tds.

I've tried to solve it with javascript included into a mod.php file:
Code:

&lt;html&gt; &lt;head&gt; &lt;title&gt;JSProd&lt;/title&gt; &lt;style type="text/css"&gt; &lt;!-- .table_jsprod {-moz-border-radius: 10px; margin: 20px;} .table_td_jsprod {border: 1px solid grey;} --&gt; &lt;/style&gt; &lt;script language="javascript" &gt; &lt;!-- // here will be the script --&gt; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;table width="300" height="390" border="1" class="table_jsprod"&gt; &lt;tr&gt; &lt;td class="table_td_jsprod"&gt; RANDOM IMAGE /&gt;&lt;/td&gt; &lt;td class="table_td_jsprod"&gt;RANDOM IMAGE&lt;/td&gt; &lt;td class="table_td_jsprod"&gt;RANDOM IMAGE&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="table_td_jsprod"&gt; RANDOM IMAGE &lt;/td&gt; &lt;td class="table_td_jsprod"&gt; RANDOM IMAGE &lt;/td&gt; &lt;td class="table_td_jsprod"&gt; RANDOM IMAGE &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="table_td_jsprod"&gt; RANDOM IMAGE &lt;/td&gt; &lt;td class="table_td_jsprod"&gt; RANDOM IMAGE &lt;/td&gt; &lt;td class="table_td_jsprod"&gt; RANDOM IMAGE &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt;

Now I have to write a script which shows random product images in each td. When you click on the image, you should be linked to the belonging product page of the product image.
How can I realize this? And which source can I use?

Regards,

Storm

Last edit: 15 years 6 months ago by [Storm15](/forum/user/1649-storm15 "View Storm15's Profile").

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14279
-
-

15 years 6 months ago [\#15543](#15543) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Create - Random Products Module for Joomla](/forum/4-how-to/15536-create-random-products-module-for-joomla#15543 "Hello,  I want to create a module showing up 9 random product images in a table. 3 trs and 3 tds.  I've tried to solve it with javascript included into a mod.php file:  Now I have to write a script which shows random product images in each td. When you click on the image, you should be linked to the belonging product page of the product image. How can I realize this? And which source can I use?  Regards,  Storm")*

You can look ad the code of the function listing of the file components/com_hikashop/views/product/view.html.php where there is some code to load randomly a defined number of products with their information, including their main image. But why not just use the content module we provide in HikaShop which can already list products randomly ?

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

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

Less More

- Posts: 39
- Thank you received: 0
-
-

15 years 6 months ago [\#15546](#15546) by [Storm15](/forum/user/1649-storm15 "View Storm15's Profile")  Replied by *[Storm15](/forum/user/1649-storm15 "View Storm15's Profile")* on topic *[Re: Create - Random Products Module for Joomla](/forum/4-how-to/15536-create-random-products-module-for-joomla#15546 "Hello,  I want to create a module showing up 9 random product images in a table. 3 trs and 3 tds.  I've tried to solve it with javascript included into a mod.php file:  Now I have to write a script which shows random product images in each td. When you click on the image, you should be linked to the belonging product page of the product image. How can I realize this? And which source can I use?  Regards,  Storm")*

I want to give it a special style. The module's classes are the same like the hikashop product listing.
When I change hikashop_container, the style of the product listing will be changed, too.
Another reason is that I wanted to struggle with javascript (learning by doing) ![:)](/media/kunena/emoticons/3.png ":)")
If there's a way to seperate the style of the content module and the style of the product listing, I'd prefer the content modul anyway.
(I hope you can understand my english)

Regards,

Storm

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14279
-
-

15 years 6 months ago [\#15547](#15547) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Create - Random Products Module for Joomla](/forum/4-how-to/15536-create-random-products-module-for-joomla#15547 "Hello,  I want to create a module showing up 9 random product images in a table. 3 trs and 3 tds.  I've tried to solve it with javascript included into a mod.php file:  Now I have to write a script which shows random product images in each td. When you click on the image, you should be linked to the belonging product page of the product image. How can I realize this? And which source can I use?  Regards,  Storm")*

You should go in the menu Display-&gt;Views and edit the file listing_div of the view product in order to edit the code of the products listing.
There, you can easily set apart the module display and the component display with that code:

if(JRequest::getVar('hikashop_front_end_main',0)){
echo 'in module';
}else{
echo 'in component';
}

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

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

Less More

- Posts: 39
- Thank you received: 0
-
-

15 years 6 months ago [\#15551](#15551) by [Storm15](/forum/user/1649-storm15 "View Storm15's Profile")  Replied by *[Storm15](/forum/user/1649-storm15 "View Storm15's Profile")* on topic *[Re: Create - Random Products Module for Joomla](/forum/4-how-to/15536-create-random-products-module-for-joomla#15551 "Hello,  I want to create a module showing up 9 random product images in a table. 3 trs and 3 tds.  I've tried to solve it with javascript included into a mod.php file:  Now I have to write a script which shows random product images in each td. When you click on the image, you should be linked to the belonging product page of the product image. How can I realize this? And which source can I use?  Regards,  Storm")*

In which line do I have to put the code?

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14279
-
-

15 years 6 months ago [\#15562](#15562) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Create - Random Products Module for Joomla](/forum/4-how-to/15536-create-random-products-module-for-joomla#15562 "Hello,  I want to create a module showing up 9 random product images in a table. 3 trs and 3 tds.  I've tried to solve it with javascript included into a mod.php file:  Now I have to write a script which shows random product images in each td. When you click on the image, you should be linked to the belonging product page of the product image. How can I realize this? And which source can I use?  Regards,  Storm")*

It depends what you want to do...
You need to make sure that the code is inside php tags: &lt;?php code ?&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzE1NTM2LWNyZWF0ZS1yYW5kb20tcHJvZHVjdHMtbW9kdWxlLWZvci1qb29tbGE/dG1wbD1tYXJrZG93bg==) 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.070 seconds

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

[](#top)
