VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: guybr on June 07, 2015, 08:44:16 AM

Title: User price offers
Post by: guybr on June 07, 2015, 08:44:16 AM
Hi, I'm using VM 2.6.6 and want to do something fairly simple: I want to mark certain products as ones where I'm open to receiving a "make an offer" from visitors.

I want to use the custom field function to display a contact us button (labelled "Make an Offer"), which would link to a form with relevant "make an offer" text (either a replication of the existing "ask a question" form with altered subject line, or access to a custom-form extension).

How can I do that??
Title: Re: User price offers
Post by: AH on June 07, 2015, 11:07:03 AM
Quotefairly simple

QuoteHow can I do that??

Looks like your first comment was made without any understanding of the potential complexity!  Hence you second comment.

http://www.open-tools.net/virtuemart/name-the-price.html (http://www.open-tools.net/virtuemart/name-the-price.html)

Maybe this developer could help further.

Title: Re: User price offers
Post by: guybr on June 07, 2015, 11:50:53 AM
Thanks for the link - I'll check it out.

But for my understanding, what is complex about my request? If I mark certain items as being open for an offer, all I need is a conditional php code to display a link to a contact us form -?

...is there a way to associate more extensions (eg a contact form) via the custom field "plugin" selection?
Title: Re: User price offers
Post by: GJC Web Design on June 08, 2015, 00:32:48 AM
by detecting the custom field and showing the form....
Title: Re: User price offers
Post by: AH on June 08, 2015, 10:03:33 AM
sounds very straightforward then...
Title: Re: User price offers
Post by: guybr on June 09, 2015, 14:32:49 PM
I've been able to get the special contact-us options to display conditionally - but I can't get the URLs to render correctly:

I used the original "ask a question" URL (from productdetails/view.html.php):

   $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);

   $this->assignRef('askquestion_url', $askquestion_url);


and assigned a variation of it to the customized contact option I want to display just below in that file:

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

   $this->assignRef('makeoffer_url', $makeoffer_url);


But when the product details page displays, the URL for the "make offer" button does not include the &task= part nor the &tmpl= part, and so it pulls up the site homepage.

I also tried using the URL format of the "recommend" email, and there I can get the 2 missing portions to display... but then the itemid and language elements go missing and the URL still doesn't work.

This is how I'm getting the button displayed (identical style code to the "ask question" except that the URL isn't correct...):

<?php
// Make an Offer contact us option, if set for this item. The customfield should be admin only and hidden.
if (!empty($this->product->customfieldsSorted['offer'])) {
    ?>
          <div class="make-an-offer">
            <a class="make-an-offer" href="<?php echo $this->makeoffer_url ?>" rel="nofollow" ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_MAKE_OFFER_LBL') ?></a>
              <!--<a class="ask-a-question modal" rel="{handler: 'iframe', size: {x: 700, y: 550}}" href="<?php echo $this->makeoffer_url ?>"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_MAKE_OFFER_LBL') ?></a>-->
          </div>
      <?php }
      ?>



any ideas what I'm doing wrong? What does the "FALSE" in the URL do?

(I have, of course, duplicated the "askquestion" view, renamed it to "makeoffer" and made all the string-label and css adjustments [ref: vmsite-ltr.css] to reflect that this is a separate email)