VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: hnoproductions on April 11, 2018, 22:20:46 PM

Title: "Call for price" Button
Post by: hnoproductions 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!
Title: Re: "Call for price" Button
Post by: Studio 42 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
Title: Re: "Call for price" Button
Post by: hnoproductions 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. 
Title: Re: "Call for price" Button
Post by: Studio 42 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
Title: Re: "Call for price" Button
Post by: hnoproductions 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
Title: Re: "Call for price" Button
Post by: Studio 42 on April 13, 2018, 20:53:43 PM
I spoke about the javascript, not the HTML code.
Title: Re: "Call for price" Button
Post by: hnoproductions 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.
Title: Re: "Call for price" Button
Post by: Studio 42 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
Title: Re: "Call for price" Button
Post by: hnoproductions 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!
Title: Re: "Call for price" Button
Post by: Studio 42 on April 14, 2018, 11:32:11 AM
Quote from: Studio 42 on April 13, 2018, 17:20:53 PM
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