Forums / Managing Customers and Orders / Hide some category/product prices from gen public for until loggin

Hide some category/product prices from gen public for until loggin

Views: 1,982

Results 1 to 8 of 8
11 Jul 2017, 8:04 AM
#1
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Hide some category/product prices from gen public for until loggin

Hi

Client' only one of their supplier wants to hide their product line prices from general public by way of either category or individual product selection until they are logged in as a registered users. So rest of the products and categories should be all visable to anyone.

How can it be done? I have already tried Dual Pricing - Wholesale Pricing module and does not do what client want.

Any ideas please?

Downunder QLD

11 Jul 2017, 10:04 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Hide some category/product prices from gen public for until loggin

Maybe try out the M.A.P. (Minimum Advertised Price) plugin, using it as inspiration for your unique need ... instead of only showing price when added to cart, show it only if logged in?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

11 Jul 2017, 11:07 PM
#3
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Hide some category/product prices from gen public for until loggin

Hi

Do you think 'Call for Price' can be used like my suggestion below instead of installing a whole new plugin?
I don't mind some code modification (with your help) :-)

This what I need for some (not all) products or category:
If price is 0.00 - No Price Display or "Call for Price" ... and may be I can later change the text to 'Login For Price' or something like that.

If price is .01 or higher - Display Price

If Logged in price is .01 - Display Price

Downunder QLD

15 Jul 2017, 1:45 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Hide some category/product prices from gen public for until loggin

If you're not using "Call For Price" for its usual purpose, you could adapt it to make that the trigger to show a "Login for Price" prompt.
I'm guessing this would do it:

/includes/functions/functions_prices.php, around line 281:

    // If Call for Price, Show it
[B]//[/B]    if ($product_check->fields['product_is_call']) {
[B]//[/B]      if (PRODUCTS_PRICE_IS_CALL_IMAGE_ON=='0') {
[B]//[/B]        $call_tag = '<br />' . PRODUCTS_PRICE_IS_CALL_FOR_PRICE_TEXT;
[B]//[/B]      } else {
[B]//[/B]        $call_tag = '<br />' . zen_image(DIR_WS_TEMPLATE_IMAGES . OTHER_IMAGE_CALL_FOR_PRICE, PRODUCTS_PRICE_IS_CALL_FOR_PRICE_TEXT);
[B]//[/B]      }
[B]//[/B]    }
    
[B]    if ($product_check->fields['product_is_call'] && empty($_SESSION['customer_id'])) {[/B]
[B]        return TEXT_LOGIN_FOR_PRICE_PRICE;[/B]
[B]    }[/B]


    return $final_display_price . $free_tag . $call_tag;
  }

And functions_general.php, lines 1144-1146:```
[B]//[/B] case ($button_check->fields['product_is_call'] == '1'):
[B]//[/B] $return_button = '<a href="' . zen_href_link(FILENAME_CONTACT_US, '', 'SSL') . '">' . TEXT_CALL_FOR_PRICE . '</a>';
[B]//[/B] break;

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

15 Jul 2017, 3:50 AM
#5
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: Hide some category/product prices from gen public for until loggin

oavs:

Hi

Client' only one of their supplier wants to hide their product line prices from general public by way of either category or individual product selection until they are logged in as a registered users. So rest of the products and categories should be all visable to anyone.

How can it be done? I have already tried Dual Pricing - Wholesale Pricing module and does not do what client want.

Any ideas please?

This one will do the trick: https://www.zen-cart.com/downloads.php?do=file&id=1234

Have this running on a 1.5.5e site.

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

15 Jul 2017, 4:39 AM
#6
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Hide some category/product prices from gen public for until loggin

Thank you Dr. This is elegant and simple enough. I will try. (I was hoping you would come back with a solution). Thank you for great support :-)

Downunder QLD

15 Jul 2017, 4:41 AM
#7
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Hide some category/product prices from gen public for until loggin

Thank you. I will try Dr's solution first.

Downunder QLD

15 Jul 2017, 5:05 AM
#8
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Hide some category/product prices from gen public for until loggin

DrByte:

If you're not using "Call For Price" for its usual purpose, you could adapt it to make that the trigger to show a "Login for Price" prompt.
I'm guessing this would do it:

/includes/functions/functions_prices.php, around line 281:

// If Call for Price, Show it

[B]//[/B] if ($product_check->fields['product_is_call']) {
[B]//[/B] if (PRODUCTS_PRICE_IS_CALL_IMAGE_ON=='0') {
[B]//[/B] $call_tag = '<br />' . PRODUCTS_PRICE_IS_CALL_FOR_PRICE_TEXT;
[B]//[/B] } else {
[B]//[/B] $call_tag = '<br />' . zen_image(DIR_WS_TEMPLATE_IMAGES . OTHER_IMAGE_CALL_FOR_PRICE, PRODUCTS_PRICE_IS_CALL_FOR_PRICE_TEXT);
[B]//[/B] }
[B]//[/B] }

[B] if ($product_check->fields['product_is_call'] && empty($_SESSION['customer_id'])) {[/B]
[B] return TEXT_LOGIN_FOR_PRICE_PRICE;[/B]
[B] }[/B]

return $final_display_price . $free_tag . $call_tag;

}

> 
> And functions_general.php, lines 1144-1146:```
[B]//[/B]    case ($button_check->fields['product_is_call'] == '1'):
[B]//[/B]      $return_button = '<a href="' . zen_href_link(FILENAME_CONTACT_US, '', 'SSL') . '">' . TEXT_CALL_FOR_PRICE . '</a>';
[B]//[/B]      break;

It works like a dream :-)

Downunder QLD