15 replies [Last post]
surbir's picture
Offline
Joined: 08/08/2007
Juice: 113
Was this information Helpful?

I have 2 websites Retail and wholesale one is working perfect but the wholesale website I want to hide price and add to cart button as well but on the place of add to cart button there will be written Log in to view prices

I have searched everywhere but didnt found proper code or module to help me and all other members who are looking for this feature in Ubercart.

There are lods of discussion about this feature but not proper solution here is some discussions

http://www.ubercart.org/forum/development/848/hide_price_unless_logged
http://www.ubercart.org/forum/support/2713/hide_sell_price_catalog_view
http://www.ubercart.org/forum/ideas_and_suggestions/2989/hide_price_fiel...
http://www.ubercart.org/forum/support/2922/access_control_catalog

Thanks in advance

www.taggedcheap.co.uk The cheapest price shop

surbir's picture
Offline
Joined: 08/08/2007
Juice: 113
Re: Add to cart button

No one is here to help me??

www.taggedcheap.co.uk The cheapest price shop

zmove's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Internationalizationizer
Joined: 08/13/2007
Juice: 1192
Hi, to do that, I think the

Hi,

to do that, I think the best way to proceed is to redeclare the theme_uc_product_display_price in your template.php file and make a condition with the user role to show the price only for certain authentificated users.

To test if the user is logged, you can make the conditions on the $user->uid

<?php
global $user;
if (
$user->uid) {
// Show price
} else {
// hide price
}
?>
surbir's picture
Offline
Joined: 08/08/2007
Juice: 113
hi I dont know any

hi

I dont know any programing is there any easy way to do please help me!!

www.taggedcheap.co.uk The cheapest price shop

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: hi

surbir, that probably is the easiest way to do it. Sticking out tongue For custom modifications, the best suggestion I have if you can't do it yourself is to post up a bounty and see if anyone is willing to do the work for you.

zmove's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Internationalizationizer
Joined: 08/13/2007
Juice: 1192
Hi, My father always said to

Hi,

My father always said to me : "When you don't know, you learn".

The way I give you is very simple, even without programming skills. You just have to create a template.php file in your theme folder and copy and paste the theme_uc_product_display_price() in it and replace "theme_" by "phptemplate_".

More infos about how override themes function here.

You are lucky, Drupal possess a very good API system and a complete handbook, that is not the case of all CMS...

So, to resume, in your template.php file, just put that :

<?php
function phptemplate_uc_product_display_price($price){
  global
$user;
  if (
$user->uid) {
   
$output = '<div class="display_price">';
   
$output .= uc_currency_format($price);
   
$output .= '</div>';
   
  } else {
   
$output = t('Sorry, you have to be registered to see products prices');
  }
  return
$output;
}
?>

But try to understand the way to override theme functions, because this is the main way to customize drupal.

Good luck

zmove

surbir's picture
Offline
Joined: 08/08/2007
Juice: 113
Re: Hi, My father always said to

Hi thanks zmove all done here is my website

http://wholesale.taggedcheap.co.uk

www.taggedcheap.co.uk The cheapest price shop

doomed@drupal.org's picture
Offline
Bug Finder
Joined: 04/05/2008
Juice: 334
Re: Hi,

zmove

Good information there.

Thanks.

surbir's picture
Offline
Joined: 08/08/2007
Juice: 113
Re: Add to cart button

I have used this function to hide price that was good but stil add to cart button was active to hide add to cart button I have used this

<?php

function uc_product_forms(){
 
$products = db_query("SELECT DISTINCT nid FROM {uc_products}");

 
  global

$user;
 
  if (
$user->uid) {
              while (
$product = db_fetch_object($products)){
               
$forms['uc_product_add_to_cart_form_'. $product->nid] = array('callback' => 'uc_product_add_to_cart_form');
               
$forms['uc_catalog_buy_it_now_form_'. $product->nid] = array('callback' => 'uc_catalog_buy_it_now_form');
              }    
  }

  return

$forms;
}
?>

after doing this I am getting this error in logs

<?php
call_user_func_array
() [<a href='function.call-user-func-array'>function.call-user-func-array</a>]: First argumented is expected to be a valid callback, 'uc_product_add_to_cart_form_168' was given in /home/designsd/public_html/wholesale/includes/form.inc on line 218.
?>

As I have 10 products on front page so I will get 10 times error with differnt form id
Can anyone helps me

Thanks in advance

www.taggedcheap.co.uk The cheapest price shop

end user's picture
Offline
Joined: 01/11/2008
Juice: 1198
Re: Add to cart button

I've had one reply to my bounty from webmasterkai but he hasn't replied my reply yet, so still waiting.

He said he could write a plug in to control what can be removed with check boxes and what roles can see the cart parts.

ubernewbie's picture
Offline
Joined: 05/03/2008
Juice: 43
Role Based Price Hiding

Hi,

Does anyone know if it's possible to hide the price based on the role/group a user is the member of?

Thanks.

end user's picture
Offline
Joined: 01/11/2008
Juice: 1198
Re: Role Based Price Hiding

This is being worked on for me. It'll be released once its finished hopefully sometime later this week.

webmasterkai's picture
Offline
Uber DonorBug Finder
Joined: 08/09/2007
Juice: 299
Re: Re: Role Based Price Hiding

The module end user sponsored can be found http://www.ubercart.org/contrib/4790

Biodiesel * (ubercart + drupal) = Sundays Energy

srinikasturi's picture
Offline
Joined: 11/14/2008
Juice: 7
Category level control

Thanks for this. How can I modify this to ensure category level visibility of the 'Add to cart' button? Here's the attempt:

1. The catalog category is split into 2 heirarchies at the highest level.

2. One category and its sub-categories display items for sale, and have a sale price etc., so the add to cart capability is required.

3. The other category and its sub-categories are for 3rd party affiliate links, so while the items are shown with prices, I'd like to remove the 'add to cart' button as the product description will have an eternal link.

Thanks
S

studioridge's picture
Offline
Joined: 07/16/2008
Juice: 8
"add to cart" button, not directing to shopping cart

For some reason, the "add to cart" buttons don't want to redirect to the shopping cart page but rather just reload the same page. This was not always the case and I am not sure what settings have changed. The settings on "Configurations > Cart Settings > Add to Cart Redirect" is just "cart" and this is the same as when it was working.

The product is added to the cart and a new text line is added to the top of the page with the product name and then "...added to your shopping cart." witht he last part as a link to your shopping cart.

AttachmentSize
whw-screenshot.jpg 53.18 KB
studioridge's picture
Offline
Joined: 07/16/2008
Juice: 8
Fixed

I had the "wish list" module installed as well and that was treating the product differently so as not to go to checkout but to keep shopping.