VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: jorgepracticum on November 18, 2015, 11:44:59 AM

Title: Ask for price error
Post by: jorgepracticum on November 18, 2015, 11:44:59 AM
Hi
I don't know if now you have solved this problem
When I enable the "ask for price" function and I disable the "Ask a question" function, I couldn't send any email asking for the price
I was checking the code and I realized that in one line of the code (I don't remember where it is), both "ask for price" and "ask a question" function check if the "ask a question" function is enable
I think that if I want to let the users ask for the price I don't want the appear the "ask a question" button in the item details
Regards
Title: Re: Ask for price error
Post by: Milbo on November 19, 2015, 00:13:39 AM
hmm, sounds valid bug, file and line?
Title: Re: Ask for price error
Post by: jorgepracticum on November 19, 2015, 09:48:43 AM
The file is: components/com_virtuemart/controllers/productdetails.php
And the line is 69
Title: Re: Ask for price error
Post by: AH on November 19, 2015, 10:25:09 AM
Agreed, the sublayout for prices uses the function mailAskquestion but the  controller only considers if the config for "ask_question" is set
QuoteModified above for clarity

Quote
if ($product->prices['salesPrice']<=0 and VmConfig::get ('askprice', 1) and isset($product->images[0]) and !$product->images[0]->file_is_downloadable) {
      $askquestion_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', FALSE);
      ?>
      <a class="ask-a-question bold" href="<?php echo $askquestion_url ?>" rel="nofollow" ><?php echo vmText::_ ('COM_VIRTUEMART_PRODUCT_ASKPRICE') ?></a>
      <?php
   } else {



ask question url from controller


public function mailAskquestion () {

JSession::checkToken () or jexit ('Invalid Token');

$app = JFactory::getApplication ();
if(!VmConfig::get('ask_question',false)){
$app->redirect (JRoute::_ ('index.php?option=com_virtuemart&tmpl=component&view=productdetails&task=askquestion&virtuemart_product_id=' . vRequest::getInt ('virtuemart_product_id', 0)), 'Function disabled');
}
Title: Re: Ask for price error
Post by: jorgepracticum on November 19, 2015, 10:31:08 AM
I don't understand your point...
Is this an error or not?
If u are saying that is not an error I don't understand it... Why do you want to check if ask_question function is enable if you only want to ask for price?
Regards
Title: Re: Ask for price error
Post by: AH on November 19, 2015, 10:55:13 AM
QuoteI don't understand your point...

I was agreeing with you -

"Show call for price, when the price is empty" setting - is not considered separately when using the function mailAskquestion



Title: Re: Ask for price error
Post by: jorgepracticum on November 19, 2015, 11:00:54 AM
Oh
Sorry, I'm spanish and my english is not very good  :'(
Title: Re: Ask for price error
Post by: AH on November 19, 2015, 11:39:23 AM
No problem - you English will be better than my Spanish  ;)

My first response was not very clear - so I have modified it, just in case someone else reads it
Title: Re: Ask for price error
Post by: Milbo on November 20, 2015, 00:30:28 AM
just use in line 69 if(!VmConfig::get('ask_question',false) and !VmConfig::get ('askprice', 1)){
Title: Re: Ask for price error
Post by: jorgepracticum on November 20, 2015, 12:36:42 PM
ok
Thanks