- Posts: 39
- Thank you received: 0
Create - Random Products Module for Joomla
15 years 5 months ago - 15 years 5 months ago #15536
by Storm15
Create - Random Products Module for Joomla was created by Storm15
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 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:
<html>
<head>
<title>JSProd</title>
<style type="text/css">
<!--
.table_jsprod {-moz-border-radius: 10px; margin: 20px;}
.table_td_jsprod {border: 1px solid grey;}
-->
</style>
<script language="javascript" >
<!--
// here will be the script
-->
</script>
</head>
<body>
<table width="300" height="390" border="1" class="table_jsprod">
<tr>
<td class="table_td_jsprod"> RANDOM IMAGE /></td>
<td class="table_td_jsprod">RANDOM IMAGE</td>
<td class="table_td_jsprod">RANDOM IMAGE</td>
</tr>
<tr>
<td class="table_td_jsprod"> RANDOM IMAGE </td>
<td class="table_td_jsprod"> RANDOM IMAGE </td>
<td class="table_td_jsprod"> RANDOM IMAGE </td>
</tr>
<tr>
<td class="table_td_jsprod"> RANDOM IMAGE </td>
<td class="table_td_jsprod"> RANDOM IMAGE </td>
<td class="table_td_jsprod"> RANDOM IMAGE </td>
</tr>
</table>
</body>
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 5 months ago by Storm15.
Please Log in or Create an account to join the conversation.
15 years 5 months ago #15543
by nicolas
Replied by nicolas on topic Re: Create - Random Products Module for Joomla
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 or Create an account to join the conversation.
15 years 5 months ago #15546
by Storm15
Replied by Storm15 on topic Re: Create - Random Products Module for Joomla
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)
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
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)
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 or Create an account to join the conversation.
15 years 5 months ago #15547
by nicolas
Replied by nicolas on topic Re: Create - Random Products Module for Joomla
You should go in the menu Display->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';
}
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 or Create an account to join the conversation.
15 years 5 months ago #15551
by Storm15
Replied by Storm15 on topic Re: Create - Random Products Module for Joomla
In which line do I have to put the code?
Please Log in or Create an account to join the conversation.
15 years 5 months ago #15562
by nicolas
Replied by nicolas on topic Re: Create - Random Products Module for Joomla
It depends what you want to do...
You need to make sure that the code is inside php tags: <?php code ?>
You need to make sure that the code is inside php tags: <?php code ?>
Please Log in or Create an account to join the conversation.
Time to create page: 0.182 seconds