Author Topic: Duplicate and Customize askquestion form?  (Read 995 times)

idor

  • Jr. Member
  • **
  • Posts: 95
Duplicate and Customize askquestion form?
« on: July 05, 2019, 13:59:04 pm »
Hello,

JOOMLA 3.9.8, VM 3.4.2

I need to create a form in the product page with a button of lowest price.
When the user clicks on the button I want to open a form similar to the askquestion form, with some additional fields.
I tried to copy the folder "askquestion" folder, renamed it "lowprice" in the templates/MYTEMPLATE/layouts/default/html/com_virtuemart
I copied all the files of the original folder form.php mail_confirmed.php, mail_html_question.php, mail_raw_question.php, metadata.xml, view.html.php

Also in the default product´s page I created this:
$lowprice_url               = JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=lowprice&virtuemart_product_id=' . $this->product->virtuemart_product_id .
                                           '&virtuemart_category_id=' . $this->product->virtuemart_category_id . '&tmpl=component', false);


and the button
<button type="button" class="btn btn-nobg hover-invert" data-iframe="modal" data-modaltitle="<?php echo vmText::_('Lowest Price') ?>" title="<?php echo vmText::_('Lowest Price') ?>" data-url="<?php echo $lowprice_url ?>">
                   <span><?php echo vmText::_('Have you found a lower price?') ?></span>
                </button>

It opens the modal pop up but inside appears the category page. No form appears.
The generated url is
/categoryname/productname-detail/lowprice.html?tmpl=component"

I am something missing.

Is there any extension to make a customized contact form for VM tu pass the product´s details?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4632
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Duplicate and Customize askquestion form?
« Reply #1 on: July 05, 2019, 15:50:08 pm »
because task "lowprice" do not exist(in the controller and in the router, Virtuemart search for category
In any case you have to hack the core to add a new task or use a customfield plugin. Or another plugin and use com_ajax to add the modal content(raw or Json)