Author Topic: "Call for price" Button  (Read 503 times)

hnoproductions

  • Beginner
  • *
  • Posts: 5
  • A beginner
"Call for price" Button
« on: April 11, 2018, 22:20:46 pm »
Hello everyone,

I am a little stuck with my issue and need some guidance on how to resolve it.

Joomla Version is 3.8.6
VirtueMart Version is 3.2.14
Template is JSN Force 2
Website is http://rentforyourevent.com

When I go to the Product Page (http://rentforyourevent.com/index.php/audio/speakers/15-powered-speaker-detail) and I click on the "Call for price" button, I get a popup window, which is exactly what I want.

When I do that from Category Page (http://rentforyourevent.com/index.php/audio/speakers) and I click on the "Call for price" button, I get routed to another a webpage with the same information as the popup window.

How I can get the Category Page to get the same popup as the Product Page when clicking on the "Call for price" button?

Thanks in advance for all your help!

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3330
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: "Call for price" Button
« Reply #1 on: April 12, 2018, 22:28:26 pm »
ask-a-question button need javascript to display the modal. See your productdetails view file and copy the script to your category view

hnoproductions

  • Beginner
  • *
  • Posts: 5
  • A beginner
Re: "Call for price" Button
« Reply #2 on: April 13, 2018, 16:27:43 pm »
Thank you for your quick reply Studio 42.  I am assuming you are talking about copying the script from file "/components/com_virtuemart/views/productdetails/view.html.php" to "/components/com_virtuemart/views/category/view.html.php".  What specific script or line of code should I be copying?  I apologize for my lack of knowledge. 

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3330
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: "Call for price" Button
« Reply #3 on: April 13, 2018, 17:20:53 pm »
Search for "ask-question" in /components/com_virtuemart/views/productdetails/tmpl/default.php or check your template if you have some overrides

hnoproductions

  • Beginner
  • *
  • Posts: 5
  • A beginner
Re: "Call for price" Button
« Reply #4 on: April 13, 2018, 17:28:29 pm »
It seems I have this...

      // Ask a question about this product
      if (VmConfig::get('ask_question', 0) == 1) {
         $askquestion_url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id=' . $this->product->virtuemart_product_id . '&virtuemart_category_id=' . $this->product->virtuemart_category_id . '&tmpl=component', FALSE);
         ?>
         <div class="ask-a-question">
            <a class="ask-a-question" href="<?php echo $askquestion_url ?>" rel="nofollow" ><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a>
         </div>
      <?php
      }
      ?>

      <?php

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3330
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: "Call for price" Button
« Reply #5 on: April 13, 2018, 20:53:43 pm »
I spoke about the javascript, not the HTML code.

hnoproductions

  • Beginner
  • *
  • Posts: 5
  • A beginner
Re: "Call for price" Button
« Reply #6 on: April 13, 2018, 21:55:21 pm »
Studio 42, I found this in the source code of the webpage for Product Details...

<script id="popups_js" type="text/javascript">//<![CDATA[
jQuery(document).ready(function($) {
      
      $('a.ask-a-question, a.printModal, a.recommened-to-friend, a.manuModal').click(function(event){
        event.preventDefault();
        $.fancybox({
         href: $(this).attr('href'),
         type: 'iframe',
         height: 550
         });
        });
      
   }); //]]>
</script>

I did find the PHP file that loads the script according to the notes...

"/components/com_virtuemart/sublayouts/askrecomjs.php"

I just don't know what to do or where to add the code in the backend in order for it to reflect in the webpage on the Category page.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3330
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: "Call for price" Button
« Reply #7 on: April 13, 2018, 22:38:28 pm »
Copy and paste ti in your category/tmpl/default.php file.
You can remove
, a.printModal, a.recommened-to-friend, a.manuModal

hnoproductions

  • Beginner
  • *
  • Posts: 5
  • A beginner
Re: "Call for price" Button
« Reply #8 on: April 13, 2018, 23:03:22 pm »
That didn't work, but I figured out how to fix it.

I went to the following file, which is very similar to what you asked me to do:

/templates/jsn_force2_pro/html/com_virtuemart/category/default.php

I added the following code to point to the askrecomjs.php file.

echo shopFunctionsF::renderVmSubLayout('askrecomjs',array('product'=>$this->product));

I would like to thank you for all your help and not giving up on me.  If you wouldn't have made all the recommendations you did, I would have never figured it out.  Thank you!

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3330
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: "Call for price" Button
« Reply #9 on: April 14, 2018, 11:32:11 am »
or check your template if you have some overrides
/templates/jsn_force2_pro/html/com_virtuemart/category/default.php is the override in your template.
But using this code is not optimal, you should simply include the javascript