Community Documentation

Ubercart Make an Offer

Last updated April 20, 2012. Created by compujohnny on April 20, 2012.
Log in to edit this page.

This page refers to the module Ubercart Make an Offer It describes how to remove the occurrence of the zero price at all.

You can add the following code to your theme to replace the $0.00 sell and list price with a Call for price using the following code (using the marinelli theme as an example)

function marinelli_uc_price($value, $context, $options) {
  // Fixup class names.
  if (!is_array($context['class'])) {
    $context['class'] = array();
  }
  foreach ($context['class'] as $key => $class) {
    $context['class'][$key] = 'uc-price-'. $class;
  }
  $context['class'][] = 'uc-price';
  // Class the element.
  $output = '<span class="'. implode(' ', $context['class']) .'">';
  // Prefix(es).
  if ($options['label'] && isset($options['prefixes'])) {
    $output .= '<span class="price-prefixes">'. implode('', $options['prefixes']) .'</span>';
  }
  // Value.
  $output .= $value;
  // Suffix(es).
  if ($options['label'] && isset($options['suffixes'])) {
    $output .= '<span class="price-suffixes">'. implode('', $options['suffixes']) .'</span>';
  }
  $output .= '</span>';

  if($value == t('$0.00')){
  $output = '<span class="'. implode(' ', $context['class']) .'">'.t('Call for price').'</span>';
  }

  return $output;
}

function marinelli_uc_product_price($price, $context, $options = array()) {
  if ($price !=0) {
    $output = '<div class="product-info '. implode(' ', (array)$context['class']) .'">';
    $output .= uc_price($price, $context, $options);
    $output .= '</div>';
  }
  return $output;
}

Comments

Thanks for this chunk of

Thanks for this chunk of code! It worked for me, but it also conflicted with the UberPOS module. My receipts started coming up as call for price! hahah.

Page status

No known problems

Log in to edit this page

About this page

Drupal version
Drupal 6.x
Audience
Programmers
Level
Intermediate
Keywords
Make an Offer, ubercart

Reference

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here