News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

"Call for price" Button

Started by hnoproductions, April 11, 2018, 22:20:46 PM

Previous topic - Next topic

hnoproductions

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

ask-a-question button need javascript to display the modal. See your productdetails view file and copy the script to your category view

hnoproductions

#2
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

Search for "ask-question" in /components/com_virtuemart/views/productdetails/tmpl/default.php or check your template if you have some overrides

hnoproductions

#4
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

I spoke about the javascript, not the HTML code.

hnoproductions

#6
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

Copy and paste ti in your category/tmpl/default.php file.
You can remove
, a.printModal, a.recommened-to-friend, a.manuModal

hnoproductions

#8
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

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