News:

Support the VirtueMart project and become a member

Main Menu

replace link to productdetails by link to ask-a-question

Started by krakoukass, March 15, 2012, 16:52:29 PM

Previous topic - Next topic

krakoukass

Bonjour, lors de l'affichage de la liste des produits, je souhaite que le lien de chaque item n'ouvre pas la page productdetails mais fasse comme le bouton ask-a-question.

J'ai repéré le code dans chaque php mais comment mettre cela ensemble ?

Merci d'avance

Hi ! in the list of products from 1 category, I don't wish a link near productdetails but like the button ask-a-question : click on the product name open the form.

Is it possible ?

Thank you

PRO

url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id);


Rayjak

I wish to do the same thing but don't understand your reply.

How does your reply fit into or replace this code:

               <?php // Product Details Button
               echo JHTML::link($product->link, JText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name,'class' => 'product-details'));               
               ?>

Thank you.

babouz

Quote from: PRO on March 15, 2012, 20:05:13 PM
url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id);

Hi,
I try to do the same things but it seems to doesn't work...

I put your code and all the code at the top of productdetails/default.php to the top of category/default.php :

$url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id . '&tmpl=component');


$document = JFactory::getDocument();

$document->addScriptDeclaration("

jQuery(document).ready(function($) {

$('a.ask-a-question').click( function(){

$.facebox({

iframe: '" . $url . "',

rev: 'iframe|550|550'

});

return false ;

});

/* $('.additional-images a').mouseover(function() {

var himg = this.href ;

var extension=himg.substring(himg.lastIndexOf('.')+1);

if (extension =='png' || extension =='jpg' || extension =='gif') {

$('.main-image img').attr('src',himg );

}

console.log(extension)

});*/

});

");


Now I got the popup when I clic on "Ask question" but form is not display...


Can you help me please ?
Where is mum? She is in the bathroom. Where is dad? He is not at home. Why? I don't know.

babouz

Where is mum? She is in the bathroom. Where is dad? He is not at home. Why? I don't know.

babouz

Quote from: krakoukass on March 15, 2012, 16:52:29 PM
Bonjour, lors de l'affichage de la liste des produits, je souhaite que le lien de chaque item n'ouvre pas la page productdetails mais fasse comme le bouton ask-a-question.

J'ai repéré le code dans chaque php mais comment mettre cela ensemble ?

Merci d'avance

Hi ! in the list of products from 1 category, I don't wish a link near productdetails but like the button ask-a-question : click on the product name open the form.

Is it possible ?

Thank you

Bonjour Krakoukass, je souhaite faire exactement la même chose !
Avez-vous trouvé une solution depuis le mois de mars ?
Moi j'arrive à afficher le pop up du formulaire mais sans le formulaire...   :(

Merci d'avance pour votre réponse
Where is mum? She is in the bathroom. Where is dad? He is not at home. Why? I don't know.

PRO

Quote from: babouz on August 10, 2012, 11:41:39 AM
Quote from: PRO on March 15, 2012, 20:05:13 PM
url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id);

Hi,
I try to do the same things but it seems to doesn't work...

I put your code and all the code at the top of productdetails/default.php to the top of category/default.php :

$url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id . '&tmpl=component');


$document = JFactory::getDocument();

$document->addScriptDeclaration("

jQuery(document).ready(function($) {

$('a.ask-a-question').click( function(){

$.facebox({

iframe: '" . $url . "',

rev: 'iframe|550|550'

});

return false ;

});

/* $('.additional-images a').mouseover(function() {

var himg = this.href ;

var extension=himg.substring(himg.lastIndexOf('.')+1);

if (extension =='png' || extension =='jpg' || extension =='gif') {

$('.main-image img').attr('src',himg );

}

console.log(extension)

});*/

});

");


Now I got the popup when I clic on "Ask question" but form is not display...


Can you help me please ?


You could try a javascript popup

<a class="quote" href="<?php echo $url ?>" onclick="window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes, width=600, height=800');return false;" ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a>

OR: MAKE sure the

$url=

IS INSIDE the foreach ($products as $product){


}

babouz

Hi,
First of all thank you for your answer  :)

You were right, I've moved $url inside "foreach ( $this->products as $product ) { }" and replaced the link by a basic javascript pop up and now it's works !
So I've moved the lightbox code under the $url and now I have the lighbox popup with the form !  ;D

BUT ! It's always the last one product of the list which is displayed.....  :(

Have you an idea ?
Where is mum? She is in the bathroom. Where is dad? He is not at home. Why? I don't know.

babouz

Quote from: PRO on August 13, 2012, 15:32:50 PM
You could try a javascript popup

<a class="quote" href="<?php echo $url ?>" onclick="window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes, width=600, height=800');return false;" ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a>

OR: MAKE sure the

$url=

IS INSIDE the foreach ($products as $product){


}


In fact, it seems to have a problem with facebox code...

all works fine when I remove this code :


$document->addScriptDeclaration("

jQuery(document).ready(function($) {

$('a.ask-a-question').click( function(){

$.facebox({

iframe: '" . $url . "',

rev: 'iframe|550|550'

});

return false ;

});

});

");


I see the product's form but without the facebox popup style...
Do you know what's wrong in this code ? I'm not really good in jquery...

Thx for your help !
Where is mum? She is in the bathroom. Where is dad? He is not at home. Why? I don't know.

PRO

babouz, I cannot test this, because I dont use the lightbox. I use a regular popup

ivus

Hi babouz,

What page did you want to display this ASK-A-QUESTION pop up?

Is it the category page? if so you cannot use that particular $document->addScripDeclaration() on that page as it hard codes a single URL to the pop-up action

You'll need to combine PRO's original code with the following:



   <?php $url JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id=' $product->virtuemart_product_id '&virtuemart_category_id=' $product->virtuemart_category_id); ?>
   <a class="modal" rel="{handler: 'iframe', size: {x: 700, y: 550}}" href="<?php echo $url ?>"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL'?></a>



Remember it has to go inside that foreach loop...

Give that a go. :D

babouz

Hi ivus,
Yes I would like to have "ask a question" on category page. And now because of you it works !!! Yeeeesss !

In fact I've deleted all I had made before and just put your last one code instead of mine.

But It had displayed a lighbox popup with a frame of my website which displayed the good form  :o
So I just added to your code "&tmpl=component" and now it works great (I don't really know why... if someone can explain).

Now my code :

<?php $url JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id=' $product->virtuemart_product_id '&virtuemart_category_id=' $product->virtuemart_category_id '&tmpl=component'); ?>
   <a class="modal ask-a-question" rel="{handler: 'iframe', size: {x: 550, y: 550}}" href="<?php echo $url ?>"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL'?></a>
Where is mum? She is in the bathroom. Where is dad? He is not at home. Why? I don't know.

ivus

Hi babouz,

That's wonderful. Good stuff.

&tmpl=component is a template override switch. Basically it will display only the COMPONENT part of the page and bypass the rendering of any other elements (headers, modules etc).

babouz

Ok, thank you ivus for your explanation and for your help ;)
Where is mum? She is in the bathroom. Where is dad? He is not at home. Why? I don't know.