Category in product display with custom <hr>
- condorazul
-
Topic Author
- Offline
what my client wants is that in the web wich has 8 categories, each one has a color code
this color is displayed underlining the category with a <hr> wich has different colors depending on the category.
and this one should be displayed in product description. The second part is solved and i have the category in product description it´s just the underline changing depending on category what i need.
Thank you
Please Log in or Create an account to join the conversation.
If the hr must be in the description, why not directly add it in the description and add to it a style attribute in order to define the color ?
Please Log in or Create an account to join the conversation.
- condorazul
-
Topic Author
- Offline
in top part all the width of the page is covered with the category name wich the product belongs to.
under it there is a custom <hr> with an image.
what i want is that the image changes when category changes.
Please Log in or Create an account to join the conversation.
Could you tell us what code you're using for that ?
Please Log in or Create an account to join the conversation.
- condorazul
-
Topic Author
- Offline
what i dont know how to do is that this hr changes depending on the category.
Please Log in or Create an account to join the conversation.
if($category->category_name="My category"){
echo '<hr class="line" style="color:red;">';
}elseif($category->category_name="My second category"){
echo '<hr class="line" style="color:blue;">';
}else{
echo '<hr class="line" style="color:black;">';
}
Please Log in or Create an account to join the conversation.
- condorazul
-
Topic Author
- Offline
second the color of the hr is a custom image so it should be something like hr class="line1" and the line2 depending on the category.
Thank you very much
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- condorazul
-
Topic Author
- Offline
Please Log in or Create an account to join the conversation.
- condorazul
-
Topic Author
- Offline
<div id="hikashop_product_top_part" class="hikashop_product_top_part">
<h2>
<span>
<?php
foreach($this->categories as $category) echo $category->category_name;
?>
</span><br/>
</h2>
<?php if($category->category_name="Linea Esencial"){
echo '<hr class="linea">';
}elseif($category->category_name="Linea Equilibrante"){
echo '<hr class="linea2">';
}elseif($category->category_name="Linea Multivitaminas"){
echo '<hr class="linea3">';
}elseif($category->category_name="Linea Multiefectos"){
echo '<hr class="linea4">';
}elseif($category->category_name="Linea de Barros"){
echo '<hr class="linea5">';
}elseif($category->category_name="Linea Spa Corporal"){
echo '<hr class="linea6">';
}elseif($category->category_name="Manicura & Pedicura"){
echo '<hr class="linea7">';
}elseif($category->category_name="Linea Spa Capilar"){
echo '<hr class="linea8">';
}?>
</div>
only first i showing in all categories
Please Log in or Create an account to join the conversation.
You want to have something like that:
<div id="hikashop_product_top_part" class="hikashop_product_top_part">
<?php
foreach($this->categories as $category){
?>
<h2>
<span><?php echo $category->category_name; ?>
</span></h2><br/>
<?php if($category->category_name=="Linea Esencial"){
echo '<hr class="linea">';
}elseif($category->category_name=="Linea Equilibrante"){
echo '<hr class="linea2">';
}elseif($category->category_name=="Linea Multivitaminas"){
echo '<hr class="linea3">';
}elseif($category->category_name=="Linea Multiefectos"){
echo '<hr class="linea4">';
}elseif($category->category_name="Linea de Barros"){
echo '<hr class="linea5">';
}elseif($category->category_name=="Linea Spa Corporal"){
echo '<hr class="linea6">';
}elseif($category->category_name="Manicura & Pedicura"){
echo '<hr class="linea7">';
}elseif($category->category_name=="Linea Spa Capilar"){
echo '<hr class="linea8">';
}?>
</div>
Please Log in or Create an account to join the conversation.
- condorazul
-
Topic Author
- Offline
Please Log in or Create an account to join the conversation.
- condorazul
-
Topic Author
- Offline
Please Log in or Create an account to join the conversation.
In the product listing view, you do not have the $category variable like in the product show view.
But you can retrieve it.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
- condorazul
-
Topic Author
- Offline
miraur.pingraf.es
in main page you have categories
if you click on any of those
the title of the category is displayed i product listing without doing anything.
what do i have to cahnge there?
Please Log in or Create an account to join the conversation.
It is displayed because it's not a simple product listing.
It come from a category listing from your menu #102 (with id 102).
Exactly like our demo website.
If you go one the home page, you would see a menu at the bottom left.
You can click on the item "Peripherals" in the "Computing" section.
It points to : demo.hikashop.com/index.php?option=com_h...ls&Itemid=78&lang=en
As you can see in the URL, it is a category listing, it display products in this category and at the top of the listing, there is the name of the category.
That is the "category listing".
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
- condorazul
-
Topic Author
- Offline
Please Log in or Create an account to join the conversation.
You have to edit the "category / listing" view.
At the beginning of the view, you would find the code which display the name of the category.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
- condorazul
-
Topic Author
- Offline
<?php if($category->category_name=="LINEA ESENCIAL MIRAUR Dermocosmetics"){
echo '<hr class="linea">';
}elseif($category->category_name=="LINEA EQUILIBRANTE MIRAUR Dermocosmetics"){
echo '<hr class="linea2">';
}elseif($category->category_name=="LINEA MULTIVITAMINAS MIRAUR Dermocosmetics"){
echo '<hr class="linea3">';
}elseif($category->category_name=="LINEA MULTIEFECTOS MIRAUR Dermocosmetics"){
echo '<hr class="linea4">';
}elseif($category->category_name="LINEA DE BARROS MIRAUR Dermocosmetics"){
echo '<hr class="linea5">';
}elseif($category->category_name=="LINEA SPA CORPORAL MIRAUR Dermocosmetics"){
echo '<hr class="linea6">';
}elseif($category->category_name="MANICURA & PEDICURA MIRAUR Dermocosmetics"){
echo '<hr class="linea7">';
}elseif($category->category_name=="LINEA SPA CAPILAR MIRAUR Dermocosmetics"){
echo '<hr class="linea8">';
}?>
i added it here
f($this->params->get($title) && JRequest::getVar('hikashop_front_end_main',0)){
?>
<<?php echo $titleType; ?>>
<?php echo $this->params->get('page_title'); ?>
</<?php echo $titleType; ?>>
<?php if($category->category_name=="LINEA ESENCIAL MIRAUR Dermocosmetics"){
echo '<hr class="linea">';
}elseif($category->category_name=="LINEA EQUILIBRANTE MIRAUR Dermocosmetics"){
echo '<hr class="linea2">';
}elseif($category->category_name=="LINEA MULTIVITAMINAS MIRAUR Dermocosmetics"){
echo '<hr class="linea3">';
}elseif($category->category_name=="LINEA MULTIEFECTOS MIRAUR Dermocosmetics"){
echo '<hr class="linea4">';
}elseif($category->category_name="LINEA DE BARROS MIRAUR Dermocosmetics"){
echo '<hr class="linea5">';
}elseif($category->category_name=="LINEA SPA CORPORAL MIRAUR Dermocosmetics"){
echo '<hr class="linea6">';
}elseif($category->category_name="MANICURA & PEDICURA MIRAUR Dermocosmetics"){
echo '<hr class="linea7">';
}elseif($category->category_name=="LINEA SPA CAPILAR MIRAUR Dermocosmetics"){
echo '<hr class="linea8">';
}?>
<?php
but it always choose line 5 by default and does not display waht i want
Please Log in or Create an account to join the conversation.
Try with "$this->element->category_name" instead of "$category->category_name"
Please Log in or Create an account to join the conversation.