Ask a Question in a Tab

  • Posts: 158
  • Thank you received: 5
7 years 11 months ago #271635

-- url of the page with the problem -- : test.leconcepts.com
-- HikaShop version -- : 3.1.1
-- Joomla version -- : 3.7.2
-- PHP version -- : 5.6.26
-- Browser(s) name and version -- : all
-- Error-message(debug-mod must be tuned on) -- : n/a

Hello, I'm trying to move the "ask a question" feature which is on the product page into a separate tab. I have almost got it all working except for a couple of things;

1. How do I pick up the product name dynamically?
2. How do I get rid of the main menu / footer etc...

here it is in action.

Here is my code ...

<li id="hikashop_show_tabular_question_li" onclick="window.open('http://test.leconcepts.com/products/uhd-4k-tvs/product/contact/cid-1664',
'',' scrollbars=no,menubar=no,width=500, resizable=no,toolbar=no,location=no,status=no');"><?php echo JText::_('GOT A QUESTION?');?></li>

Thanks

Last edit: 7 years 11 months ago by serbofleconcepts. Reason: updated content

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

  • Posts: 83800
  • Thank you received: 13571
  • MODERATOR
7 years 11 months ago #271640

Hi,

1. The product name ? don't you mean how to generate the contact URL dynamically ?
If you need to generate the contact URL dynamically, you can do like that:
<?php echo hikashop_completeLink('product&task=contact&cid=' . (int)$this->element->product_id . $this->url_itemid); ?>
That's the code you can find for the standard contact button in the show_tabular/show_default view files.

2. You can add the parameter ?tmpl=component to the URL if you don't want the stuff around the main area:
test.leconcepts.com/products/uhd-4k-tvs/...-1664?tmpl=component

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

  • Posts: 158
  • Thank you received: 5
7 years 11 months ago #271710

Brilliant, thanks for this. I have removed the headers and footers OK, but am still left with the issue of how to open the popup window that relates to the product the user wants to ask a question on? At the moment I have hard-coded a link to a product, but I think I just need to link to the ask a question form and the form will generate the product URL automatically?

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

  • Posts: 83800
  • Thank you received: 13571
  • MODERATOR
7 years 11 months ago #271716

Hi,

I already answered you about that:

If you need to generate the contact URL dynamically, you can do like that:
<?php echo hikashop_completeLink('product&task=contact&cid=' . (int)$this->element->product_id . $this->url_itemid); ?>
That's the code you can find for the standard contact button in the show_tabular/show_default view files.

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

  • Posts: 158
  • Thank you received: 5
7 years 11 months ago #272158

Hi nicolas, I can see the code that activates the popup, but it does it from std text on the product page rather than a tab on the product page.

This is my onclick code - I need to replace the hard-coded product link below with something that opens the ask a question form. Does that make more sense now?

<li id="hikashop_show_tabular_question_li" onclick="window.open('http://test.leconcepts.com/products/uhd-4k-tvs/product/contact/cid-1664?tmpl=component', '',' scrollbars=no,menubar=no,width=500, resizable=no,toolbar=no,location=no,status=no');"><?php echo JText::_('GOT A QUESTION?');?></li>

Last edit: 7 years 11 months ago by serbofleconcepts.

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

  • Posts: 26233
  • Thank you received: 4036
  • MODERATOR
7 years 11 months ago #272164

Hello,

I'm afraid that Nicolas gave you the solution twice.
But here again the code to have the dynamic URL :

<?php echo hikashop_completeLink('product&task=contact&cid=' . (int)$this->element->product_id . $this->url_itemid); ?>
And you can use the extra parameters to force the "popup" and have JS compatible content:
[code]
<?php echo hikashop_completeLink('product&task=contact&cid=' . (int)$this->element->product_id . $this->url_itemid, true, true); ?>

If you still don't get it ; please contact someone who will have some PHP and Joomla knowledge.

Thank you for your understanding.
Jerome


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

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 86
  • Thank you received: 11
7 years 10 months ago #272332

How would I insert the contact form WITHIN the tab itself? No popup or outside link?

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

  • Posts: 83800
  • Thank you received: 13571
  • MODERATOR
7 years 10 months ago #272342

Hi,

That's not easy.
You need to get the code from the file "contact" of the view "product" to add it in your tab, and before that, you also need to call $this->contact(); in order to initialize the variables used in the product/contact view file code. Also, contact() function will use the cid parameter to load the product data, so you'll have to set it manually in $_REQUEST before calling it.
So it's a lot more involved than just a popup link.

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

Time to create page: 0.145 seconds
Powered by Kunena Forum