Skip to main content

Personalized product page in show.php

More
10 years 10 months ago - 10 years 10 months ago #220713 by co88agency
-- HikaShop version -- : 2.6.0 Business
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.5.29

Hello everyone,
I would like to display an image at the bottom of product page only in a specific category product.
I put this code in show.php:
Code:
<?php $category_name = JRequest::getInt('category_name'); if ($category_name == 'Partecipazioni') : ?><h3 style="text-align:center; margin-bottom:30px;">Alcuni esempi di colore e font</h3><img src="/ayro/media/com_hikashop/images/colori-font.jpg" /><?php endif; ?>

The fact is that it does not work and I do not understand why ... the image is displayed in every product, even in those who do not belong to the category "Partecipazioni".
Can anyone help me out?
Thank you and best regards,
Loredana
Last edit: 10 years 10 months ago by co88agency.

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

More
10 years 10 months ago #220715 by Mohamed Thelji
Hello Loredana,
Using that kind of code through the "Show" file of the "Product" view of your front-end template via "Hikashop->Display->Views" will probably do the job :
Code:
if(isset($this->element->product_category_id) && $this->element->product_category_id == YOUR_CATEGORY_ID){?> <h3 style = "text-align: center; margin-bottom: 30px;"> Some examples of color and font </ h3> <img src = "/ Ayro / media / com_hikashop / images / Color-font.jpg "/> <?php }
Don't forget to replace YOUR_CATEGORY_ID by your category ID that you can find via "Hikashop->Products->Categories".

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

More
10 years 10 months ago #220784 by co88agency
Thank you very very much!
Unfortunately it returns me an error... Complete code is:
Code:
<div class="row-fluid" style="margin-top:70px;"> <div class="span8" style="display:inline-block"> <h3 style="text-align:center; line-height:25px; margin-bottom:30px;">Compila il form come indicato<br /><span style="font-size:18px;">inserisci i dati del tuo evento</span></h3> <?php } $this->setLayout('show_block_custom_item'); echo $this->loadTemplate(); if($this->params->get('show_price')){ ?> </div> <div class="span4" style="display:inline-block"> <?php if(isset($this->element->product_category_id) && $this->element->product_category_id == 40){?> <h3 style = "text-align: center; margin-bottom: 30px;">Qualche esempio di font e colori</ h3> <img src = "/ayro/media/com_hikashop/images/colori-font.jpg "/> <?php } </div> </div>

What is wrong?

Thanks and best regards,
Loredana

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

More
10 years 10 months ago #220787 by Xavier
Hi,

Please give us more details about the returned error.
This is maybe due to the "}" present before: $this->setLayout('show_block_custom_item');

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

More
10 years 10 months ago #220922 by co88agency
The error is reported to the line where there is the penultimate </div>, but it doesn't say what is error.

Thanks and best regards,
Loredana

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

More
10 years 10 months ago #220928 by Mohamed Thelji
Hello Loredana,
Your issue is coming from your last 3 lines, you should replace these lines :
Code:
<?php } </div> </div>
By :
Code:
<?php }?> </div> </div>

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

More
10 years 10 months ago - 10 years 10 months ago #221137 by co88agency
Thank you very much Mohamed!
The error is changed...
It's on lline 923...
Code:
<?php content of the view removed by a moderator ; please do not paste entire view code.

Thank you very very much for your support...
Last edit: 10 years 10 months ago by Jerome. Reason: remove view content

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

More
10 years 10 months ago #221143 by Xavier
Hi,

You have to add another "}" right after the latest one in your code.

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

More
10 years 10 months ago #221252 by co88agency
Thank you very much. The error is ok now but I don't see image I want in category id 40...

Best regards,
Loredana

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

More
10 years 10 months ago #221286 by Mohamed Thelji
Hello Loredana,
Then a solution can be to just check what you have on the $this->element->product_category_id variable to see if the category which have the ID number 40 is correctly called.
Using that php code will display the value of that variable for example :
echo 'Category ID : ' . $this->element->product_category_id;

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

More
10 years 10 months ago #221395 by co88agency
Finally!!! That's ok!!!!
Thank you very very very much... thank you thank you thank you...

Best regards,
Loredana

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

More
10 years 10 months ago #221954 by co88agency
I'm sorry, I'm still here...
Category number change costantly... why? How can I do?

Best regards,
Loredana

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

More
10 years 10 months ago #221962 by Jerome
Hi,

What is a category number ?
What does "category number change constantly" mean ?

Regards,

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

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

More
10 years 10 months ago #222065 by co88agency
I used <php echo 'Category ID : ' . $this->element->product_category_id; ?> to find id category but every few time that id number changes...

Regards,
Loredana

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

More
10 years 10 months ago #222071 by nicolas
You should use instead $this->element->category_id
The following user(s) said Thank You: co88agency

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

More
10 years 10 months ago - 10 years 10 months ago #222169 by co88agency
Perfect! Now it works!
Thank you and best regards,
Loredana
Last edit: 10 years 10 months ago by co88agency.

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

Time to create page: 0.344 seconds
Powered by Kunena Forum