I need UC support a "Call us" for product price. Let me know that this already supported by UC (and how to enable this feature).
Regards.

Comments

rszrama’s picture

Assigned: drupalnesia » Unassigned
Status: Active » Fixed

You might be able to use http://drupal.org/project/uc_free_order. Please remember that Ubercart support is limited to the support forums.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

selwynpolit’s picture

Version: 6.x-2.0-beta4 » 6.x-2.0-beta6
Category: feature » support

I want to make ubercart show "Call for price" if an item is priced $0. How can I make this appear in the taxonomy type listings that come with ubercart?

I found the function theme_uc_product_price($price, $class, $no_label = 0) in uc_product.module which I could hack to fix this, but I know that is not the best way to go. Can someone please advise me how to override this function?

thanks
Selwyn

selwynpolit’s picture

Status: Closed (fixed) » Active

ok, so I got this working partially. This function allows me to show "call for pricing" when the node is displayed. This is what I did. I created a module named martin.module, enabled it. Here is the main function

/**
* Implementation of hook_nodeapi()
*/
function martin_nodeapi(&$node, $op, $a3 = NULL, $a3 = NULL, $a4 = NULL){
  if ($op == 'view' ){
    if ($node->type == 'product' ){
      //drupal_set_message("martin_hook_node here..","status") 
      if (intval($node->sell_price)==0) {
        $node->content['sell_price']['#value'] = "<div class=\"call-for-pricing\">Call for pricing</div>";
        $node->content['display_price']['#value'] = "<div class=\"call-for-pricing2\">Call for pricing</div>"  ;
        unset($node->content['add_to_cart']) ;   // remove add to cart button
      }
    }
  }
}

This allows me to set the price to zero for an item and when someone views it as a node, it shows "call for pricing" in both places where a price would normally appear. It also removes the add to cart button so people can't inadvertently try to add the item to their cart. It also adds classes that allow you to style those messages as needed.

I also added a function to the template.php in my sites/all/themes/acquia_marina_martin theme folder. It looks like this:

Note, it is a copy of the theme_uc_product_price() function from ubercart, with some mods...


/**
* This function overrides ubercart's theme_uc_product_price
* 
* It checks to see if the price is $0.000
*   then it shows "Call for pricing" instead of $0.000
* 
* Selwyn Polit 4-28-09
* 
*/
function phptemplate_uc_product_price($price, $class, $no_label = 0) {
 
    //drupal_set_message("Selwyn here", "status");
    //print_r($price);
 
  $output = '<div class="'. $class .'">';
  if ($no_label) {
      if ($price=="0.000")
        $output .= t("Call for price");
      else
        $output .= uc_currency_format($price);
  }
  else {
    switch ($class) {
      case 'list-price':
        $output .= t('List Price: !price', array('!price' => uc_currency_format($price)));
      break;
      case 'cost':
        $output .= t('Cost: !price', array('!price' => uc_currency_format($price)));
      break;
      case 'sell-price':
      if ($price=="0.000")
        $output .= t('Call for price');
      else
        $output .= t('Price: !price', array('!price' => uc_currency_format($price)));
      
      break;
      default:
        $output .= uc_currency_format($price);
      break;
    }
  }

  $output .= '</div>';
  return $output;
} 

I hope this benefits someone. I sweated a little blood and got some help from someone on this. Now - does anyone have any suggestions how to remove the add to cart from these lists?

thanks
Selwyn

selwynpolit’s picture

oops - Ubercart rc3 just came out and my fix broke...

rszrama’s picture

Status: Active » Closed (won't fix)
rszrama’s picture

Status: Closed (won't fix) » Closed (fixed)

Sorry, meant to move this back to closed. Something like this should be accomplished through a custom module. We won't be changing this behavior in core right now.

iantresman’s picture

Module "UC Price Visibility" seem to do this.